/* global React, Icon, Button, LEARNER, US_STATES */
// LPE Learning Center — shell (utility bar, topbar, sidebar) + login gate.

const { useState, useEffect: useEffectShell, useRef: useRefShell } = React;

// click-outside helper
function useClickOutside(onClose) {
  const ref = useRefShell(null);
  useEffectShell(() => {
    function onDoc(e) { if (ref.current && !ref.current.contains(e.target)) onClose(); }
    document.addEventListener("mousedown", onDoc);
    return () => document.removeEventListener("mousedown", onDoc);
  }, [onClose]);
  return ref;
}

function UtilityBar() {
  return (
    <div className="utility-bar">
      <div className="util-left">
        <span>Members-only learning center · Continuing legal education</span>
      </div>
      <div className="util-right">
        <a>The marketplace</a>
        <span className="util-divider" />
        <a>Help</a>
      </div>
    </div>
  );
}

function NotificationsMenu({ notifications, onNotif, markAllRead, onClose, goPrefs }) {
  const ref = useClickOutside(onClose);
  return (
    <div className="notif-menu" ref={ref}>
      <div className="notif-head">
        <span>Notifications</span>
        <button onClick={() => { markAllRead(); }}>Mark all as read</button>
      </div>
      <div className="notif-body">
        {notifications.map((n) => (
          <button key={n.id} className={"notif-row" + (n.unread ? " unread" : "")} onClick={() => { onNotif(n); onClose(); }}>
            <span className="ni"><Icon name={n.icon} size={15} /></span>
            <span className="nt">
              <span className="ntt">{n.title}</span>
              <span className="ntb">{n.body}</span>
              <span className="ntm">{n.time}</span>
            </span>
            {n.unread ? <span className="ndot" /> : null}
          </button>
        ))}
      </div>
      <button className="notif-foot" onClick={() => { goPrefs(); onClose(); }}>Notification preferences</button>
    </div>
  );
}

function AvatarMenu({ learner, onAvatarNav, onSignOut, onClose }) {
  const ref = useClickOutside(onClose);
  return (
    <div className="avatar-dropdown" ref={ref}>
      <div className="avatar-dropdown-header">
        <span className="avatar-dropdown-name">{learner.name}</span>
        <span className="small" style={{ fontSize: 11.5 }}>{learner.role} · {learner.firm}</span>
      </div>
      <button className="avatar-dropdown-item" onClick={() => { onAvatarNav("learning"); onClose(); }}><Icon name="user" size={15} /> My Learning</button>
      {!(window.APP_TWEAKS && window.APP_TWEAKS.hideCle) ? (
        <button className="avatar-dropdown-item" onClick={() => { onAvatarNav("cle"); onClose(); }}><Icon name="award" size={15} /> CLE record</button>
      ) : null}
      <button className="avatar-dropdown-item" onClick={() => { onAvatarNav("settings"); onClose(); }}><Icon name="settings" size={15} /> Settings</button>
      <button className="avatar-dropdown-item" onClick={() => { window.dispatchEvent(new CustomEvent("start-tour")); onClose(); }}><Icon name="info" size={15} /> Platform Tour</button>
      <button className="avatar-dropdown-item avatar-dropdown-logout" onClick={() => { onSignOut(); onClose(); }}><Icon name="logout" size={15} /> Sign out</button>
    </div>
  );
}

function Topbar({ query, setQuery, onAvatarNav, onSignOut, onLogo, learner, notifications, unreadCount, onNotif, markAllRead, hideCle, onToggleCle }) {
  const [menu, setMenu] = useState(null); // 'notif' | 'avatar' | null
  const isAdmin = learner && (learner.isAdmin || learner.role === "Administrator");
  return (
    <div className="topbar">
      <img src="lms/lpe-logo.svg" alt="The Law Practice Exchange" className="logo" onClick={onLogo} style={{ cursor: "pointer" }} />
      <span style={{
        fontFamily: "var(--font-script)", fontStyle: "italic", color: "var(--orange)",
        fontSize: 21, lineHeight: 1, marginLeft: -2, marginRight: 10, transform: "translateY(1px)",
        whiteSpace: "nowrap", flexShrink: 0,
      }}>Learning Center</span>
      <div className="search">
        <Icon name="search" size={16} />
        <input
          placeholder="Search webinars, tutorials, topics…"
          value={query}
          onChange={(e) => setQuery(e.target.value)}
        />
        <kbd>⌘ K</kbd>
      </div>
      <div className="spacer" />
      <div className="topbar-actions">
        {isAdmin && onToggleCle ? (
          <button
            className="btn btn-secondary btn-sm"
            onClick={onToggleCle}
            title={hideCle ? "Enable CLE features across the LMS" : "Hide CLE features across the LMS"}
            style={{
              display: "inline-flex",
              alignItems: "center",
              gap: 6,
              fontSize: 12,
              fontWeight: 600,
              padding: "6px 12px",
              borderRadius: 6,
              border: "1px solid var(--grey-300)",
              background: hideCle ? "var(--orange)" : "var(--white)",
              color: hideCle ? "#fff" : "var(--navy)",
              marginRight: 6,
              cursor: "pointer"
            }}
          >
            <Icon name="award" size={14} />
            {hideCle ? "CLE Hidden (Show)" : "Hide CLE"}
          </button>
        ) : null}
        <button className="icon-btn" title="Saved" onClick={() => onAvatarNav("saved")}>
          <Icon name="bookmark" size={16} />
        </button>
        <div style={{ position: "relative" }}>
          <button className="icon-btn" title="Notifications" onClick={() => setMenu(menu === "notif" ? null : "notif")}>
            <Icon name="bell" size={16} />
            {unreadCount > 0 ? <span className="badge">{unreadCount}</span> : null}
          </button>
          {menu === "notif" ? (
            <NotificationsMenu notifications={notifications} onNotif={onNotif} markAllRead={markAllRead} goPrefs={() => onAvatarNav("settings")} onClose={() => setMenu(null)} />
          ) : null}
        </div>
        <div style={{ position: "relative" }}>
          <button className="avatar" onClick={() => setMenu(menu === "avatar" ? null : "avatar")} style={{ background: "var(--teal)" }} title={learner.name}>
            {learner.initials}
          </button>
          {menu === "avatar" ? (
            <AvatarMenu learner={learner} onAvatarNav={onAvatarNav} onSignOut={onSignOut} onClose={() => setMenu(null)} />
          ) : null}
        </div>
      </div>
    </div>
  );
}

const NAV_GROUPS = [
  {
    label: "Learn",
    items: [
      { id: "library", icon: "video", label: "Library" },
      { id: "upcoming", icon: "calendar", label: "Upcoming live" },
      { id: "saved", icon: "bookmark", label: "Saved" },
      { id: "learning", icon: "user", label: "My Learning" },
    ],
  },
  {
    label: "Credit & Resources",
    items: [
      { id: "cle", icon: "award", label: "CLE Center" },
      { id: "collateral", icon: "folder", label: "Collateral" },
    ],
  },
];

function Sidebar({ active, onNavigate, inProgress = 0, savedCount = 0, cleCredits = 0, upcomingCount = 0, showCta = true, isAdmin = false, pendingCleCount = 0, hideCle = false }) {
  const counts = {
    library: undefined,
    upcoming: upcomingCount || undefined,
    saved: savedCount || undefined,
    learning: inProgress || undefined,
    cle: cleCredits ? cleCredits.toFixed(1) : undefined,
    collateral: undefined,
  };
  return (
    <aside className="sidebar">
      {isAdmin ? (
        <div className="nav-group admin-group" style={{ marginBottom: 20 }}>
          <div className="nav-group-label" style={{ color: "var(--orange)", fontWeight: 700 }}>Administrative Portal</div>
          {[
            { id: "admin-dashboard", icon: "chart", label: "Dashboard" },
            { id: "admin-cle", icon: "award", label: "CLE Approvals", count: pendingCleCount || undefined },
            { id: "admin-courses", icon: "video", label: "Manage Library" },
            { id: "admin-learners", icon: "user", label: "Learners Directory" },
            { id: "admin-events", icon: "calendar", label: "Live Registrations" },
          ].filter(item => !(item.id === "admin-cle" && hideCle)).map((item) => (
            <button
              key={item.id}
              className={"nav-item " + (active === item.id ? "active" : "")}
              onClick={() => onNavigate(item.id)}
              style={active === item.id ? { borderLeft: "2px solid var(--orange)", color: "var(--orange)", background: "rgba(228, 116, 37, 0.05)" } : {}}
            >
              <Icon name={item.icon} size={18} style={active === item.id ? { color: "var(--orange)" } : {}} />
              {item.label}
              {item.count != null ? (
                <span 
                  className="nav-count" 
                  style={{ 
                    background: "var(--orange)", 
                    color: "white",
                    padding: "1px 7px",
                    borderRadius: "10px",
                    fontSize: "11px",
                    fontWeight: "700",
                    minWidth: "18px",
                    height: "18px",
                    display: "inline-flex",
                    alignItems: "center",
                    justifyContent: "center",
                    lineHeight: 1,
                    marginLeft: "auto"
                  }}
                >
                  {item.count}
                </span>
              ) : null}
            </button>
          ))}
        </div>
      ) : null}

      <div className="nav-group">
        <div className="nav-group-label">{isAdmin ? "Student View Preview" : "Learn"}</div>
        {NAV_GROUPS[0].items.map((item) => (
          <button
            key={item.id}
            className={"nav-item " + (active === item.id ? "active" : "")}
            onClick={() => onNavigate(item.id)}
          >
            <Icon name={item.icon} size={18} />
            {item.label}
            {counts[item.id] != null ? <span className="nav-count">{counts[item.id]}</span> : null}
          </button>
        ))}
      </div>

      <div className="nav-group">
        <div className="nav-group-label">Credit & Resources</div>
        {NAV_GROUPS[1].items.filter(item => !(item.id === "cle" && hideCle)).map((item) => (
          <button
            key={item.id}
            className={"nav-item " + (active === item.id ? "active" : "")}
            onClick={() => onNavigate(item.id)}
          >
            <Icon name={item.icon} size={18} />
            {item.label}
            {counts[item.id] != null ? <span className="nav-count">{counts[item.id]}</span> : null}
          </button>
        ))}
      </div>

      <div style={{ marginTop: "auto", paddingTop: 14, borderTop: "1px solid var(--grey-200)", marginBottom: 14 }}>
        <div
          onClick={() => window.dispatchEvent(new CustomEvent("start-tour"))}
          style={{
            display: "flex",
            alignItems: "center",
            gap: 10,
            padding: "10px 12px",
            borderRadius: "10px",
            background: "linear-gradient(135deg, rgba(228, 116, 37, 0.08) 0%, rgba(27, 127, 124, 0.08) 100%)",
            border: "1px solid rgba(228, 116, 37, 0.2)",
            cursor: "pointer",
            transition: "all 0.2s ease"
          }}
        >
          <div
            style={{
              width: 30,
              height: 30,
              borderRadius: "8px",
              background: "var(--orange)",
              color: "#ffffff",
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              flexShrink: 0,
              boxShadow: "0 2px 6px rgba(228, 116, 37, 0.25)"
            }}
          >
            <Icon name="info" size={16} />
          </div>
          <div style={{ flex: 1, minWidth: 0 }}>
            <div style={{ fontSize: 12.5, fontWeight: 700, color: "var(--navy)", lineHeight: 1.2 }}>Platform Tour</div>
            <div style={{ fontSize: 10.5, color: "var(--grey-600)", marginTop: 2, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>
              Quick 1-min guide
            </div>
          </div>
          <Icon name="arrowRight" size={12} style={{ color: "var(--orange)", flexShrink: 0 }} />
        </div>
      </div>

      {showCta ? (
        <div className="sidebar-cta">
          <div className="label">Earn it.</div>
          <h4>CLE credit, on your schedule.</h4>
          <p>Attend live or watch the recording — log your hours and download a certificate for retroactive credit.</p>
          <button className="btn btn-primary btn-sm" style={{ width: "100%" }} onClick={() => onNavigate("cle")}>
            Open CLE center
          </button>
        </div>
      ) : null}
    </aside>
  );
}

function AppShell({ active, onNavigate, query, setQuery, onAvatarNav, onSignOut, onLogo, learner, notifications, unreadCount, onNotif, markAllRead, sidebarStats, hideCle, onToggleCle, children }) {
  const isAdmin = learner && (learner.isAdmin || learner.role === "Administrator");
  return (
    <div className="lpe-scope app">
      <UtilityBar />
      <Topbar query={query} setQuery={setQuery} onAvatarNav={onAvatarNav} onSignOut={onSignOut} onLogo={onLogo} learner={learner}
        notifications={notifications} unreadCount={unreadCount} onNotif={onNotif} markAllRead={markAllRead} hideCle={hideCle} onToggleCle={onToggleCle} />
      <div className="shell">
        <Sidebar active={active} onNavigate={onNavigate} {...sidebarStats} isAdmin={isAdmin} />
        <main className="main">{children}</main>
      </div>
    </div>
  );
}

// ---------- Login gate ----------
function Login({ onLogin }) {
  const [email, setEmail] = useState("");
  const [pw, setPw] = useState("");
  const [show, setShow] = useState(false);
  const [mode, setMode] = useState("signin"); // signin | apply | admin
  const [error, setError] = useState("");
  const [success, setSuccess] = useState("");
  const [loading, setLoading] = useState(false);
  const [name, setName] = useState("");
  const [firm, setFirm] = useState("");
  const [role, setRole] = useState("Buyer member");
  const [barState, setBarState] = useState("Ohio");
  const [barNo, setBarNo] = useState("");

  async function submit(e) {
    e.preventDefault();
    if (!email || !pw) {
      setError("Email and password are required.");
      return;
    }
    setError("");
    setSuccess("");
    setLoading(true);
    const res = await onLogin({
      fresh: mode === "apply",
      email,
      pw,
      name,
      firm,
      role,
      barState,
      barNo
    });
    setLoading(false);
    if (res) {
      if (res.success) {
        if (res.pending) {
          setSuccess(res.message || "Application submitted successfully! Your account is pending administrator approval.");
          setEmail("");
          setPw("");
          setMode("signin");
        }
      } else {
        setError(res.error || "Authentication failed. Please verify your credentials.");
      }
    }
  }

  return (
    <div className="lpe-login">
      <div className="lpe-scope">
        <UtilityBar />
        <div className="topbar">
          <img src="lms/lpe-logo.svg" alt="The Law Practice Exchange" className="logo" />
          <span style={{
            fontFamily: "var(--font-script)", fontStyle: "italic", color: "var(--orange)",
            fontSize: 21, lineHeight: 1, marginLeft: -2, marginRight: 10, transform: "translateY(1px)",
            whiteSpace: "nowrap", flexShrink: 0,
          }}>Learning Center</span>
        </div>
      </div>
      <div className="top-banner">
        <span className="pip" />
        <span><b>Members-only.</b> The Learning Center is open to verified LPE buyers and sellers.</span>
      </div>
      <div className="login-shell">
        <div className="left">
          <div className="editorial" style={{ marginTop: 24 }}>
            <div className="eyebrow"><span className="pip" />The LPE Learning Center</div>
            <h1>Know the deal<br /><span className="script" style={{ marginRight: 16 }}>before</span>you make it.</h1>
            <p className="lede">{window.APP_TWEAKS && window.APP_TWEAKS.hideCle ? "Webinars and tutorials on valuing, buying, and selling a law practice — taught by the people who run the exchange. Expand your expertise while you learn." : "Webinars and tutorials on valuing, buying, and selling a law practice — taught by the people who run the exchange. Earn CLE credit while you learn."}</p>
          </div>

          <div className="featured">
            <div className="feat-eyebrow"><span className="live" />Featured webinar</div>
            <div className="feat-title">Valuing a personal injury practice</div>
            <div className="feat-meta">{window.APP_TWEAKS && window.APP_TWEAKS.hideCle ? "LPE-W18 · 1h 02m · 1.0 credit hours" : "LPE-W18 · 1h 02m · 1.0 CLE general"}</div>
            <div className="feat-figs">
              <div className="fig"><div className="v">62</div><div className="l">Sessions</div></div>
              <div className="fig"><div className="v">14.5</div><div className="l">{window.APP_TWEAKS && window.APP_TWEAKS.hideCle ? "Credit hours" : "CLE hours"}</div></div>
              <div className="fig"><div className="v">7</div><div className="l">Topics</div></div>
            </div>
          </div>

          <div className="trust-row">
            <div className="stat"><div className="v">1,200+</div><div className="l">Verified members</div></div>
            <div className="div" />
            <div className="stat"><div className="v">38</div><div className="l">States represented</div></div>
            <div className="div" />
            <div className="stat"><div className="v">4.8</div><div className="l">Avg. rating</div></div>
          </div>
        </div>

        <div className="right">
          <div className="topnav">
            {mode === "admin" ? "Back to members?" : "New to LPE?"}
            <button className="topnav-link" type="button" disabled={loading} onClick={() => {
              setError("");
              setSuccess("");
              if (mode === "admin") {
                setMode("signin");
                setEmail("nainika@sharma-acq.com");
                setPw("");
              } else {
                setMode(mode === "apply" ? "signin" : "apply");
              }
            }}>
              {mode === "admin" ? "Sign in as Member" : mode === "apply" ? "Sign in" : "Apply for membership"}
            </button>
          </div>

          <form className="form-wrap" onSubmit={submit}>
            <div className="form-eyebrow">{mode === "apply" ? "Request access" : mode === "admin" ? "Admin portal" : "Member sign in"}</div>
            <h2>{mode === "apply" ? "Apply for membership" : mode === "admin" ? "LPE Administrator Sign In" : "Continue to the Learning Center"}</h2>
            <p className="sub">{mode === "apply"
              ? "Tell us how you work with law practices. We verify every member before granting access."
              : mode === "admin" ? "Sign in with your administrative credentials to manage sessions, CLE requests, and members."
              : "Sign in with your LPE marketplace credentials. Your learning history follows your account."}</p>

            {mode === "apply" ? (
              <div className="register-intro">
                <p><b>Verification keeps the room quiet.</b> We confirm bar standing and intent before approving access. Most requests are reviewed within two business days.</p>
              </div>
            ) : null}

            {error ? (
              <div className="login-error-alert" style={{
                background: "rgba(228, 116, 37, 0.1)",
                borderLeft: "4px solid var(--orange)",
                padding: "10px 14px",
                borderRadius: 4,
                color: "var(--navy)",
                fontSize: 13,
                marginBottom: 16,
                lineHeight: 1.4
              }}>
                {error}
              </div>
            ) : null}

            {success ? (
              <div className="login-success-alert" style={{
                background: "rgba(46, 117, 89, 0.1)",
                borderLeft: "4px solid #2E7559",
                padding: "10px 14px",
                borderRadius: 4,
                color: "var(--navy)",
                fontSize: 13,
                marginBottom: 16,
                lineHeight: 1.4
              }}>
                {success}
              </div>
            ) : null}

            <div className="field">
              <label htmlFor="lg-email">Email</label>
              <div className="input-shell">
                <span className="icon"><Icon name="mail" size={16} /></span>
                <input id="lg-email" type="email" disabled={loading} value={email} onChange={(e) => setEmail(e.target.value)} placeholder="you@firm.com" />
              </div>
            </div>

            {mode === "apply" && (
              <div style={{ display: "contents" }}>
                <div className="field">
                  <label htmlFor="lg-name">Full Name</label>
                  <div className="input-shell">
                    <span className="icon"><Icon name="user" size={16} /></span>
                    <input id="lg-name" type="text" disabled={loading} value={name} onChange={(e) => setName(e.target.value)} placeholder="Jane Doe" />
                  </div>
                </div>

                <div className="field">
                  <label htmlFor="lg-firm">Firm Name</label>
                  <div className="input-shell">
                    <span className="icon"><Icon name="user" size={16} /></span>
                    <input id="lg-firm" type="text" disabled={loading} value={firm} onChange={(e) => setFirm(e.target.value)} placeholder="Doe & Partners" />
                  </div>
                </div>

                <div className="field">
                  <label htmlFor="lg-role">Member Role</label>
                  <div className="input-shell">
                    <span className="icon"><Icon name="sparkle" size={16} /></span>
                    <select id="lg-role" disabled={loading} value={role} onChange={(e) => setRole(e.target.value)} style={{ width: "100%", height: 38, border: 0, paddingLeft: 36, background: "transparent", fontSize: 13, outline: "none", color: "var(--navy)" }}>
                      <option value="Buyer member">Buyer Member</option>
                      <option value="Seller member">Seller Member</option>
                      <option value="Broker">Broker / Intermediary</option>
                    </select>
                  </div>
                </div>

                <div className="field">
                  <label htmlFor="lg-state">Bar Jurisdiction</label>
                  <div className="input-shell">
                    <span className="icon"><Icon name="globe" size={16} /></span>
                    <select id="lg-state" disabled={loading} value={barState} onChange={(e) => setBarState(e.target.value)} style={{ width: "100%", height: 38, border: 0, paddingLeft: 36, background: "transparent", fontSize: 13, outline: "none", color: "var(--navy)" }}>
                      {(window.US_STATES || []).map((st) => (
                        <option key={st} value={st}>{st}</option>
                      ))}
                    </select>
                  </div>
                </div>

                <div className="field">
                  <label htmlFor="lg-barno">Bar Number</label>
                  <div className="input-shell">
                    <span className="icon"><Icon name="check" size={16} /></span>
                    <input id="lg-barno" type="text" disabled={loading} value={barNo} onChange={(e) => setBarNo(e.target.value)} placeholder="e.g. OH-123456" />
                  </div>
                </div>
              </div>
            )}

            <div className="field">
              <label htmlFor="lg-pw">
                Password
                {mode === "signin" ? <span className="helper">Forgot?</span> : null}
              </label>
              <div className="input-shell">
                <span className="icon"><Icon name="lock" size={16} /></span>
                <input id="lg-pw" type={show ? "text" : "password"} disabled={loading} value={pw} onChange={(e) => setPw(e.target.value)} placeholder="••••••••" />
                <button type="button" className="show-toggle" onClick={() => setShow((s) => !s)}>{show ? "Hide" : "Show"}</button>
              </div>
            </div>

            {mode === "signin" ? (
              <div className="field-row">
                <label className="check"><input type="checkbox" defaultChecked disabled={loading} /> Keep me signed in</label>
              </div>
            ) : <div style={{ height: 14 }} />}

            <button type="submit" className="btn-primary" disabled={loading}>
              {loading ? "Please wait..." : mode === "apply" ? "Submit application" : mode === "admin" ? "Sign in as Admin" : "Sign in"}
              {!loading && <Icon name="arrowRight" size={15} />}
            </button>

            {mode !== "admin" ? (
              <div style={{ display: "flex", justifyContent: "center", marginTop: 24, borderTop: "1px solid var(--grey-100)", paddingTop: 16 }}>
                <button 
                  type="button" 
                  className="btn-secondary" 
                  style={{ 
                    fontSize: "12.5px", 
                    fontWeight: 600, 
                    padding: "10px 16px", 
                    width: "100%", 
                    display: "flex", 
                    justifyContent: "center", 
                    alignItems: "center", 
                    gap: "6px",
                    border: "1.5px solid var(--grey-200)", 
                    borderRadius: "4px", 
                    background: "transparent", 
                    color: "var(--navy)",
                    cursor: "pointer",
                    transition: "all 0.2s ease"
                  }} 
                  onClick={() => { setError(""); setSuccess(""); setMode("admin"); setEmail("admin@thelawpracticeexchange.com"); setPw(""); }}
                >
                  <Icon name="sliders" size={13} /> Access Administrative Portal
                </button>
              </div>
            ) : (
              <div style={{ display: "flex", justifyContent: "center", marginTop: 24, borderTop: "1px solid var(--grey-100)", paddingTop: 16 }}>
                <button 
                  type="button" 
                  className="btn-secondary" 
                  style={{ 
                    fontSize: "12.5px", 
                    fontWeight: 600, 
                    padding: "10px 16px", 
                    width: "100%", 
                    display: "flex", 
                    justifyContent: "center", 
                    alignItems: "center", 
                    gap: "6px",
                    border: "1.5px solid var(--grey-200)", 
                    borderRadius: "4px", 
                    background: "transparent", 
                    color: "var(--navy)",
                    cursor: "pointer",
                    transition: "all 0.2s ease"
                  }} 
                  onClick={() => { setError(""); setSuccess(""); setMode("signin"); setEmail("nainika@sharma-acq.com"); setPw(""); }}
                >
                  <Icon name="user" size={13} /> Back to Member Sign In
                </button>
              </div>
            )}

            <div className="right-foot">
              <div className="badges">
                <span className="badge"><Icon name="lock" size={12} /> Encrypted</span>
                <span className="badge"><Icon name="check" size={12} /> NDA-gated</span>
              </div>
              <div className="legal">
                <a>Terms</a><a>Privacy</a>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  );
}

Object.assign(window, { UtilityBar, Topbar, Sidebar, AppShell, NAV_GROUPS, Login, NotificationsMenu, AvatarMenu, useClickOutside });
