diff --git a/docs/mobile-quality-prd.md b/docs/mobile-quality-prd.md new file mode 100644 index 0000000..1ddc5d6 --- /dev/null +++ b/docs/mobile-quality-prd.md @@ -0,0 +1,113 @@ +# Spec: Mobile layout quality for the BearDrive web app + +Authoritative spec for the mobile-polish goal loop. The bar is met by +independent review: a `beardrive-designer` subagent audits the running app +and returns scores; the implementing agent never scores its own work. + +## Harness + +Seeded hub: `BDRIVE_E2E_SERVE=1 go test -count=1 -timeout 8h -run +TestE2EServe ./internal/webapp` → http://localhost:8993 (state resets per +start). Accounts (password `e2e-pass-1` for all): `e2e@example.com` +(admin — insights, admin bar, org Manage), `member@example.com` (member), +`solo@example.com` (no org — onboarding empty state). + +## Viewports (all must pass) + +| Name | Size | +|---|---| +| phone-small | 360×800 | +| phone | 390×844 | +| phone-landscape | 844×390 | +| tablet | 768×1024 | + +## Surfaces to audit (per viewport) + +1. Login page (`/auth/login`) — server-rendered, still in scope. +2. Project home: connect guide (tabs, code blocks + copy buttons) and, as + admin, the embedded Insights below (treemap/scatter/hot-path/matrix + SVGs must not overflow or become unreadably small). +3. Folder listing (`//notes`): rows, heat dots, Recent changes feed. +4. Markdown file view (`//index.md`): content, breadcrumbs, meta + line, topbar actions (Share/History/Upload/Download vs the ⋯ menu — + targets must stay tappable, header must not wrap or overflow). +5. History (`//history`): entry rows, expandable notes. +6. Dedicated Insights (`//insights`). +7. Org admin panel (Manage) and hub settings (Admin) — lists, selects, + buttons, toggles. +8. Off-canvas sidebar: hamburger open/close, backdrop, tree interaction, + auto-close after selecting a file. +9. ⌘K palette (on tablet; on phones verify the Search button opens it and + it is usable). +10. Modals (new-project prompt, share dialog, confirms) and toasts. +11. Onboarding empty state (as `solo@`). + +## Scoring rubric (designer subagent returns 0–10 per category) + +- **layout** — nothing overflows the viewport; no horizontal page scroll; + wide content (code blocks, tables, SVGs, URLs) scrolls in its own box. +- **readability** — type sizes/line lengths sane; nothing truncated + without recourse; contrast preserved. +- **tap-targets** — interactive elements ≥ ~44px effective target; no + overlapping/cramped controls. +- **navigation** — sidebar, breadcrumbs, back/forward, deep links all + usable one-handed; nothing reachable only by hover. +- **polish** — spacing, alignment, safe-area behavior, orientation change. + +Findings carry severity (high/medium/low), the viewport+surface, and a +concrete CSS/markup fix suggestion. + +## Exit bar + +Two CONSECUTIVE designer rounds with every category ≥ 8/10 and zero +high-severity mobile findings across all viewports. Desktop (1360×900) +spot-checked each round — no regressions introduced by mobile fixes. + +## Rules + +- Fix in `internal/webapp/frontend` (prefer `src/style.css`; markup only + when CSS can't). Rebuild committed static (`npm run build`) after every + change; `npm run e2e` (42 specs) must stay green each iteration. +- No new runtime dependencies; no desktop redesign — mobile fixes only. +- Never commit `internal/webapp/manual_serve_test.go`. +- Branch `feat/mobile-polish`, commit per iteration + (`feat(webapp): [mobile] ...`), PR at the end; never merge or deploy. +- Disputed/won't-fix findings: record below with reasoning, count them + out of the exit bar only if justified here. + +## Scorecard (append one row per designer round) + +| Round | layout | readability | tap-targets | navigation | polish | high-sev findings | +|---|---|---|---|---|---|---| +| 1 (before fixes) | 5 | 7 | 6 | 8 | 7 | 1 (topbar overflow at 768/844 — breakpoint gap) | +| 2 (after round-1 fixes) | 9 | 8 | 8 | 9 | 8 | 0 (5 low cosmetics, fixed before round 3) | +| 3 (after low-fixes) | 6 | 6 | 7 | 9 | 6 | 1 (REGRESSION: URL rows collapsed by the wrap fix — streak reset, fixed for round 4) | +| 4 (after round-3 fixes) | 9 | 9 | 8 | 9 | 8 | 0 (4 lows: chips/tabs/modal-input heights + share row at 360, fixed before round 5) | +| 5 (confirmation) | 9 | 9 | 9 | 9 | 8 | 0 — EXIT BAR MET (rounds 4+5 consecutive passes) | + +## Won't-fix / disputed + +- **Palette footer shows keyboard hints ("↑↓ · ↵ · esc") on touch** (round-5 + low #1, second half): cosmetic copy noise; tap interaction fully works. + Changing the hint per-viewport adds conditional copy for no functional + gain. (The ⌘K badge half of the finding was a real bug — the React port + dropped `id="search-btn"`, so the existing hide rule never matched; fixed + post-exit, e2e green.) +- **Share dialog's Done sits alone on its last row at ≤430** (round-5 low + #2): reviewer marked it "intended destructive-isolation behavior… + subjective/taste — no action needed". +- **Server auth pages use 44px controls via their own inline CSS** + (`authlocal.go`), the one fix outside `frontend/` — the login page is a + spec surface but is server-rendered, unreachable from the frontend + stylesheet. + +## Status + +GOAL COMPLETE (2026-07-14): rounds 4 and 5 both scored every category ≥8 +with zero high-severity findings. Five designer rounds total; round 3 +caught and reset on a regression the loop itself introduced — the +independent-scoring design worked as intended. + +## Status / blockers + +(record and stop rather than deviate) diff --git a/internal/webapp/authlocal.go b/internal/webapp/authlocal.go index 9241e3a..bd44544 100644 --- a/internal/webapp/authlocal.go +++ b/internal/webapp/authlocal.go @@ -597,6 +597,7 @@ button:focus-visible{outline:2px solid #ffcf85;outline-offset:2px} .alt{margin-top:16px;font-size:12.5px;color:#868b93} .alt a{color:#ffcf85;text-decoration:none} .alt a:hover{text-decoration:underline} +@media (max-width:900px){input{height:44px}button{height:44px}} code{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.08);padding:2px 6px;border-radius:5px; font-family:ui-monospace,Menlo,monospace}

%s

%s
`, diff --git a/internal/webapp/frontend/src/apps/Browser.tsx b/internal/webapp/frontend/src/apps/Browser.tsx index b4d41cb..6b4af4c 100644 --- a/internal/webapp/frontend/src/apps/Browser.tsx +++ b/internal/webapp/frontend/src/apps/Browser.tsx @@ -349,7 +349,7 @@ export default function Browser(props: { meta={uploadStatus || meta} actions={ <> - {canShare && ( diff --git a/internal/webapp/frontend/src/components/ShareDialog.tsx b/internal/webapp/frontend/src/components/ShareDialog.tsx index da1682b..d44ebc7 100644 --- a/internal/webapp/frontend/src/components/ShareDialog.tsx +++ b/internal/webapp/frontend/src/components/ShareDialog.tsx @@ -1,3 +1,4 @@ +import { useEffect } from "react"; import { api } from "../api/http"; import { copyText } from "../util"; import { toast } from "../toast"; @@ -14,6 +15,13 @@ export function ShareDialog({ onClose: () => void; }) { const token = url.split("/s/")[1]; + useEffect(() => { + const onKey = (e: KeyboardEvent) => { + if (e.key === "Escape") onClose(); + }; + document.addEventListener("keydown", onKey); + return () => document.removeEventListener("keydown", onKey); + }, [onClose]); return (
e.target === e.currentTarget && onClose()}>
diff --git a/internal/webapp/frontend/src/style.css b/internal/webapp/frontend/src/style.css index d6c15bd..eedabe0 100644 --- a/internal/webapp/frontend/src/style.css +++ b/internal/webapp/frontend/src/style.css @@ -294,7 +294,7 @@ button, input, a.btn { font-family: inherit; } .gd-desc { margin: 2px 0 8px 32px; color: var(--text-faint); font-size: 13px; line-height: 1.5; } .gd-extra { font-size: 12.5px; margin-top: 6px; } .gd-code { position: relative; margin: 6px 0 6px 32px; padding: 10px 72px 10px 12px; background: var(--bg-raise); border: 1px solid var(--border); border-radius: var(--r-card); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; color: var(--text); overflow-x: auto; white-space: pre; } -.gd-copy { position: absolute; top: 7px; right: 7px; font: inherit; font-family: inherit; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-faint); cursor: pointer; } +.gd-copy { position: absolute; top: 7px; right: 7px; font: inherit; font-family: inherit; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--bg-raise); color: var(--text-faint); cursor: pointer; box-shadow: -14px 0 12px -6px var(--bg-raise); } .gd-copy:hover { color: var(--accent-bright); border-color: var(--accent-dim); } .gd-done { margin: 22px 0 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-side); color: var(--text-faint); font-size: 13px; line-height: 1.5; } .home-insights { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--border); } @@ -359,9 +359,9 @@ button, input, a.btn { font-family: inherit; } .hpath { font-weight: 500; cursor: pointer; color: var(--text); font-size: 13px; } .hpath:hover { color: var(--accent-bright); } .htime { margin-left: auto; color: var(--text-faint); font-size: 12px; font-variant-numeric: tabular-nums; } -.hmeta { display: flex; gap: 14px; margin-top: 4px; padding-left: 23px; font-size: 12px; color: var(--text-dim); } +.hmeta { display: flex; align-items: center; gap: 14px; margin-top: 4px; padding-left: 23px; font-size: 12px; color: var(--text-dim); } .hdev, .hsize { color: var(--text-faint); } -.hsize { font-variant-numeric: tabular-nums; } +.hsize { font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; } .hnote { margin-top: 4px; padding-left: 23px; font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; } .hnote:hover { color: var(--text); } .hnote.open { white-space: normal; overflow-wrap: anywhere; } @@ -410,8 +410,12 @@ button, input, a.btn { font-family: inherit; } #sb-backdrop { display: none; } -/* ---- responsive ---- */ -@media (max-width: 760px) { +/* ---- responsive ---- + 900px covers tablet portrait (768) and phone landscape (844): with the + fixed 264px sidebar plus the full topbar those widths overflow the page + (measured 849px needed at 768) — they need the off-canvas/collapsed + chrome just like phones. */ +@media (max-width: 900px) { #sidebar { position: fixed; z-index: 60; top: 0; left: 0; height: 100%; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.6); } body.sb-open #sidebar { transform: translateX(0); } body.sb-open #sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; } @@ -423,20 +427,64 @@ button, input, a.btn { font-family: inherit; } #topbar .btn .ico { width: 18px; height: 18px; } #more-btn:not([hidden]) { display: inline-flex; } #history-btn, #upload-btn, #download { display: none !important; } + /* Desktop right-aligns the actions via #meta's flex:1 — with meta + hidden here, the crumb becomes the spacer so Search/Share/⋯ pin to + the top-right corner. */ #meta { display: none; } + #crumb { flex: 1; } #vault { padding: 0 8px 0 12px; } .icon-btn2, #signout, .adminbar { min-width: 44px; min-height: 44px; } #tree li > .row, #projects .row { height: 44px; } - #invite-btn { min-height: 40px; padding: 0 14px; } + #invite-btn { min-height: 44px; padding: 0 14px; } #org-name { min-height: 44px; } .nav-add { min-width: 44px; min-height: 44px; } .markdown, .admin, .onboard, .history, .dirlist { max-width: 100%; } .markdown table, pre.plain { display: block; overflow-x: auto; max-width: 100%; } .ob-row { flex-direction: column; } + .ob-row input { flex: none; min-height: 44px; } + /* Admin rows: 27-28px selects/buttons are too small to tap; let rows + wrap so the controls keep room next to long names/URLs. */ + .admin-item { flex-wrap: wrap; row-gap: 8px; padding: 12px 14px; } + .admin-item select { height: 44px; } + .ai-btn, .ai-del { height: auto; min-height: 44px; padding: 0 12px; } + /* No hover on touch: a truncated email/URL would be unreadable — wrap + it. The name/URL takes the whole row (tag + buttons drop below): + without full-row basis, a long flex:none .ai-tag starves the URL down + to one character per line. break-word prefers natural break points + (@, .) and still splits long unbroken URLs when it must. */ + .admin-item .ai-main { flex: 1 1 100%; white-space: normal; overflow-wrap: break-word; } + /* The code-block Copy button needs a real touch target; give one-line + blocks the height to hold it. */ + .gd-code { min-height: 62px; padding-top: 12px; padding-bottom: 12px; } + .gd-copy { min-height: 44px; padding: 0 14px; } + .gd-tab { min-height: 44px; } + .in-lens-btn { min-height: 44px; padding: 0 14px; } + .modal-input { height: 44px; } + .modal-actions button { height: auto; min-height: 44px; } + .pbtn { height: auto; min-height: 44px; } + #palette-results li { height: auto; min-height: 44px; } + .more-item { min-height: 44px; } +} + +/* The destructive Revoke must not sit flush against the safe Done on a + touch row — push it to the far side (share dialog only; prompts and + confirms have no .ai-del). */ +.modal-actions .ai-del { margin-right: auto; } + +@media (max-width: 430px) { + /* The name wins the row: drop the verbose meta (the heat dot still + conveys activity) instead of truncating "readme.md" to "readme...." */ + .dl-meta { display: none; } + .ai-tag { font-size: 11px; } + .htime { white-space: nowrap; font-size: 12px; } + .hline { flex-wrap: wrap; } + /* Four share-dialog buttons don't fit one row at 360 — the destructive + Revoke takes its own line rather than sitting 9px from Done. */ + .modal-actions .ai-del { flex: 0 0 100%; } } /* ---- markdown reading view ---- */ -.markdown { max-width: 704px; margin: 0 auto; } +.markdown { max-width: 704px; width: 100%; margin: 0 auto; } .markdown h1, .markdown h2, .markdown h3, .markdown h4 { color: #f4f6f9; line-height: 1.25; letter-spacing: -.018em; margin: 1.5em 0 .5em; text-wrap: balance; } .markdown h1:first-child { margin-top: 0; } .markdown h1 { font-size: 1.85em; font-weight: 660; letter-spacing: -.024em; } diff --git a/internal/webapp/static/assets/index-CemqdDtO.css b/internal/webapp/static/assets/index-D_DgiVAj.css similarity index 55% rename from internal/webapp/static/assets/index-CemqdDtO.css rename to internal/webapp/static/assets/index-D_DgiVAj.css index 970ae9d..cf7ee2d 100644 --- a/internal/webapp/static/assets/index-CemqdDtO.css +++ b/internal/webapp/static/assets/index-D_DgiVAj.css @@ -1 +1 @@ -:root{--bg: #0a0b0d;--bg-side: #0c0e10;--bg-raise: #15171b;--surface: rgba(255,255,255,.03);--hover: rgba(255,255,255,.06);--border: rgba(255,255,255,.07);--border-2: rgba(255,255,255,.11);--code-bg: #0d0f12;--text: #eef0f3;--text-dim: #9aa0a9;--text-faint: #868b93;--text-ghost: #666b74;--accent: #f5a623;--accent-bright: #ffcf85;--accent-dim: #d3861a;--accent-press: #e0951a;--glow: rgba(245,166,35,.13);--add: #4cc38a;--del: #f26d6d;--mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;--ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;--r-ctl: 7px;--r-card: 10px;--r-over: 14px}*{box-sizing:border-box}[hidden]{display:none!important}html,body{height:100%;margin:0}#root{display:contents}body{display:flex;background:var(--bg);color:var(--text);font:13px/1.5 var(--ui);letter-spacing:-.006em;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}::selection{background:var(--glow);color:var(--accent-bright)}:focus-visible{outline:2px solid var(--accent);outline-offset:1px;border-radius:5px}.sprite{position:absolute}.ico{width:16px;height:16px;flex:none;stroke:currentColor;stroke-width:1.6;fill:none;stroke-linecap:round;stroke-linejoin:round}button,input,a.btn{font-family:inherit}#sidebar{width:264px;min-width:210px;background:var(--bg-side);border-right:1px solid var(--border);display:flex;flex-direction:column;overflow:hidden}#vault{display:flex;align-items:center;gap:9px;height:52px;padding:0 12px 0 14px;border-bottom:1px solid var(--border)}#vault-badge{width:22px;height:22px;border-radius:6px;flex:none;display:grid;place-items:center;font-size:13px;line-height:1;background:linear-gradient(160deg,#ffcf85,#f5a623 55%,#d3861a);box-shadow:0 1px #ffffff59 inset,0 2px 6px -1px #f5a62366}#vault-name{font-weight:600;font-size:13px;letter-spacing:-.01em;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vault-actions{display:flex;align-items:center;gap:4px}#signout,.icon-btn2{width:28px;height:28px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;color:var(--text-ghost);background:transparent;border:none;cursor:pointer;text-decoration:none}#signout:hover,.icon-btn2:hover{color:var(--text);background:var(--hover)}#signout .ico,.icon-btn2 .ico{width:16px;height:16px}.adminbar{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 9px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--accent-bright);font-size:11.5px;font-weight:600;cursor:pointer}.adminbar:hover{background:var(--glow);border-color:transparent}#projects{flex:none;max-height:32%;overflow-y:auto;padding:10px 8px 8px;border-bottom:1px solid var(--border)}.nav-head{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.07em;color:var(--text-ghost)}.nav-add{display:grid;place-items:center;width:18px;height:18px;border:none;background:transparent;color:var(--text-ghost);cursor:pointer;border-radius:5px}.nav-add .ico{width:14px;height:14px}.nav-add:hover{color:var(--text);background:var(--hover)}#projects ul{list-style:none;margin:0;padding:0}#projects .row{display:flex;align-items:center;gap:9px;height:31px;padding:0 8px;border-radius:7px;color:var(--text-dim);cursor:pointer;position:relative;white-space:nowrap;overflow:hidden}.proj-mark{width:17px;height:17px;border-radius:5px;flex:none;display:grid;place-items:center;font-size:10px;font-weight:700;color:#0a0b0d;letter-spacing:-.02em;text-transform:uppercase}#projects .row .label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}#projects .row:hover{background:var(--hover);color:var(--text)}#projects .row.active{background:var(--glow);color:var(--accent-bright)}#projects .row.active:before{content:"";position:absolute;left:0;top:6px;bottom:6px;width:2px;border-radius:2px;background:var(--accent)}#tree{flex:1;overflow-y:auto;padding:8px 8px 24px}#tree ul{list-style:none;margin:0;padding-left:13px;position:relative}#tree>ul{padding-left:0}#tree ul ul:before{content:"";position:absolute;left:5px;top:0;bottom:0;width:1px;background:var(--border)}#tree li>.row{display:flex;align-items:center;gap:6px;height:28px;padding:0 8px;border-radius:7px;color:var(--text-dim);cursor:pointer;position:relative;white-space:nowrap;overflow:hidden}#tree li>.row:hover{background:var(--hover);color:var(--text)}#tree li>.row.active{background:var(--glow);color:var(--accent-bright)}#tree li>.row.active:before{content:"";position:absolute;left:0;top:5px;bottom:5px;width:2px;border-radius:2px;background:var(--accent)}#tree .chev{width:14px;height:14px;flex:none;color:var(--text-ghost);transition:transform .12s;display:flex;align-items:center;justify-content:center}#tree .chev .ico{width:13px;height:13px}#tree .ticon{flex:none;display:flex;color:var(--text-ghost)}#tree .ticon .ico{width:15px;height:15px}#tree li>.row:hover .ticon,#tree li>.row:hover .chev{color:var(--text-faint)}#tree li>.row.active .ticon,#tree li>.row.active .chev{color:var(--accent)}#tree .label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}#tree .file .label{font-size:12.5px}#tree .file .chev{visibility:hidden}#tree li.collapsed>ul{display:none}#tree li.collapsed>.row .chev{transform:rotate(-90deg)}#orgbar{display:flex;align-items:center;gap:9px;padding:9px 12px 9px 14px;border-top:1px solid var(--border)}#org-name{flex:1;min-width:0;display:inline-flex;align-items:center;gap:8px;color:var(--text-dim);font-size:12.5px;font-weight:500;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#org-name:before{content:"";width:15px;height:15px;flex:none;border-radius:4px;background:linear-gradient(160deg,#ffcf85,#d3861a);opacity:.85}#org-name:hover{color:var(--text)}#invite-btn{flex:none;height:27px;padding:0 11px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text-dim);font-size:12px;font-weight:500;cursor:pointer}#invite-btn:hover{background:var(--hover);color:var(--text);border-color:var(--border-2)}#main{flex:1;display:flex;flex-direction:column;min-width:0}#topbar{position:relative;display:flex;align-items:center;gap:9px;height:52px;padding:0 16px;border-bottom:1px solid var(--border)}.icon-btn{display:none;width:34px;height:34px;border:none;background:transparent;color:var(--text-dim);cursor:pointer;border-radius:7px;align-items:center;justify-content:center}.icon-btn:hover{color:var(--text);background:var(--hover)}#crumb{font-size:12.5px;color:var(--text);font-weight:500;letter-spacing:-.01em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#crumb .crumb-seg{color:var(--text-dim);cursor:pointer}#crumb .crumb-seg:hover{color:var(--accent-bright)}#crumb .crumb-sep{color:var(--text-ghost);margin:0 5px}#meta{flex:1;min-width:0;font-size:12px;color:var(--text-faint);text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.btn{display:inline-flex;align-items:center;gap:6px;flex:none;height:30px;padding:0 11px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text-dim);font-size:12.5px;font-weight:500;cursor:pointer;text-decoration:none}.btn:hover{background:var(--hover);color:var(--text);border-color:var(--border-2)}.btn .ico{width:15px;height:15px}.btn.ghost{color:var(--text-dim)}#search-btn kbd{font:11px var(--ui);color:var(--text-faint);background:var(--hover);border:1px solid var(--border-2);border-radius:5px;padding:1px 5px;margin-left:2px}#more-menu{position:absolute;right:12px;top:calc(100% - 4px);z-index:80;background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-card);box-shadow:0 18px 44px -14px #000000bf;padding:6px;min-width:168px}.more-item{display:block;width:100%;text-align:left;min-height:40px;padding:0 12px;background:transparent;border:none;cursor:pointer;color:var(--text);font:inherit;font-size:13.5px;border-radius:var(--r-ctl)}.more-item:hover{background:var(--hover)}#content{flex:1;overflow-y:auto;padding:44px 40px 110px;scroll-behavior:smooth}.empty{color:var(--text-faint);text-align:center;margin-top:22vh}.empty-hint{display:block;margin-top:6px;font-size:12px;color:var(--text-ghost)}.onboard{max-width:560px;margin:8vh auto 0}.onboard h1{font-size:25px;font-weight:640;letter-spacing:-.02em;margin:0 0 8px;color:#f4f6f9}.onboard>p{color:var(--text-dim);margin:0 0 28px;font-size:14px}.ob-card{background:var(--bg-side);border:1px solid var(--border);border-radius:var(--r-card);padding:20px 22px;margin-bottom:14px}.ob-card h3{margin:0 0 6px;font-size:14.5px;font-weight:600}.ob-card p{margin:0 0 14px;font-size:13px;color:var(--text-dim)}.ob-row{display:flex;gap:9px}.ob-row input{flex:1;height:34px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:13px;outline:none}.ob-row input:focus{border-color:var(--accent);background:var(--hover)}.pbtn{display:inline-flex;align-items:center;gap:6px;flex:none;height:32px;padding:0 14px;border-radius:var(--r-ctl);border:none;background:var(--accent);color:#241704;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap}.pbtn:hover{background:var(--accent-bright)}.pbtn .ico{width:15px;height:15px}.danger-btn{display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:var(--r-ctl);border:none;background:#b3382e;color:#fff;font-size:13px;font-weight:600;cursor:pointer}.danger-btn:hover{background:#c94336}.admin{max-width:760px}.admin h1{font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 6px;color:#f4f6f9}.admin h3{font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--text-ghost);font-weight:600;margin:30px 0 10px}.admin-sub{color:var(--text-dim);font-size:13.5px;margin:0 0 6px;line-height:1.55}.admin-h{display:flex;align-items:center;justify-content:space-between;margin:30px 0 10px}.admin-h h3{margin:0}.admin-row{display:flex;gap:9px;margin-bottom:8px}.admin-row input{flex:1;height:34px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:13px;outline:none}.admin-row input:focus{border-color:var(--accent);background:var(--hover)}.admin-list{border:1px solid var(--border);border-radius:var(--r-card);overflow:hidden;background:var(--bg-side)}.admin-item{display:flex;align-items:center;gap:11px;padding:11px 14px;border-bottom:1px solid var(--border);font-size:13.5px}.admin-item:last-child{border-bottom:none}.admin-item:hover{background:#ffffff04}.ai-main{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}.ai-main.mono{font:12px var(--mono);color:var(--text-dim);cursor:pointer}.ai-tag{font-size:11.5px;color:var(--text-faint);flex:none}.admin-item select{height:28px;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:0 8px;font:inherit;font-size:12.5px;cursor:pointer}.admin-item select:hover{border-color:var(--border-2)}.ai-btn,.ai-del{flex:none;height:27px;padding:0 11px;border-radius:6px;border:1px solid var(--border);background:var(--surface);color:var(--text-dim);font:inherit;font-size:12px;font-weight:500;cursor:pointer}.ai-btn:hover{background:var(--hover);color:var(--text);border-color:var(--border-2)}.ai-del{color:var(--del);border-color:transparent;background:transparent}.ai-del:hover{background:#f26d6d1f;color:#ff8b8b}.admin-empty{padding:14px;color:var(--text-faint);font-size:13px}.admin-item.toggle{cursor:pointer;align-items:flex-start}.admin-item.toggle .ai-main{white-space:normal}.tg-label{font-size:13.5px;font-weight:550;color:var(--text)}.tg-desc{font-size:12px;color:var(--text-faint);margin-top:3px;line-height:1.5}.admin-item.toggle input{width:16px;height:16px;margin-top:2px;accent-color:var(--accent);flex:none}.dirlist{max-width:704px;margin:0 auto}.dl-title{display:flex;align-items:center;gap:10px;font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 4px;color:#f4f6f9}.dl-title-icon{display:flex;color:var(--accent)}.dl-title-icon .ico{width:20px;height:20px}.dl-sub{color:var(--text-faint);font-size:12.5px;margin:0 0 18px}.dl-items{border:1px solid var(--border);border-radius:var(--r-card);overflow:hidden;background:var(--bg-side)}.dl-row{display:flex;align-items:center;gap:11px;padding:10px 14px;border-bottom:1px solid var(--border);cursor:pointer}.dl-row:last-child{border-bottom:none}.dl-row:hover{background:var(--hover)}.dl-row .ticon{flex:none;display:flex;color:var(--text-ghost)}.dl-row .ticon .ico{width:16px;height:16px}.dl-row:hover .ticon{color:var(--text-faint)}.dl-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13.5px;color:var(--text)}.dl-meta{flex:none;font-size:12px;color:var(--text-faint);font-variant-numeric:tabular-nums}.heatdot{flex:none;width:7px;height:7px;border-radius:50%;background:var(--accent)}.heatdot.lvl1{opacity:.3}.heatdot.lvl2{opacity:.55}.heatdot.lvl3{opacity:.8}.heatdot.lvl4{opacity:1;box-shadow:0 0 6px #f5a6238c}.dl-empty{padding:24px 14px;color:var(--text-faint);font-size:13px;border:1px dashed var(--border);border-radius:var(--r-card);text-align:center}.dl-h3{margin:28px 0 8px;font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--text-ghost);font-weight:600}.dl-hlist{border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);overflow:hidden;max-width:none}.dl-hlist .hentry:last-child{border-bottom:none}.hentry.clickable{cursor:pointer}.hentry.clickable:hover{background:var(--hover)}.dl-more{margin-top:10px}#vault-name.vault-link{cursor:pointer}#vault-name.vault-link:hover{color:var(--accent-bright)}.guide{max-width:760px;margin:0 auto}.gd-tabs{display:flex;gap:2px;margin:20px 0 16px;border-bottom:1px solid var(--border);overflow-x:auto}.gd-tab{font:inherit;font-size:13px;font-weight:600;padding:7px 12px 9px;background:none;border:none;border-bottom:2px solid transparent;margin-bottom:-1px;color:var(--text-faint);cursor:pointer;white-space:nowrap}.gd-tab:hover{color:var(--text)}.gd-tab.active{color:var(--accent-bright);border-bottom-color:var(--accent)}.gd-step{margin:0 0 18px}.gd-step-head{display:flex;align-items:center;gap:10px;margin-bottom:3px}.gd-num{flex:none;width:22px;height:22px;border-radius:50%;background:var(--glow);color:var(--accent-bright);font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center}.gd-step-title{font-weight:600;font-size:14px;color:var(--text)}.gd-desc{margin:2px 0 8px 32px;color:var(--text-faint);font-size:13px;line-height:1.5}.gd-extra{font-size:12.5px;margin-top:6px}.gd-code{position:relative;margin:6px 0 6px 32px;padding:10px 72px 10px 12px;background:var(--bg-raise);border:1px solid var(--border);border-radius:var(--r-card);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;line-height:1.6;color:var(--text);overflow-x:auto;white-space:pre}.gd-copy{position:absolute;top:7px;right:7px;font:inherit;font-family:inherit;font-size:11px;font-weight:600;padding:3px 9px;border-radius:6px;border:1px solid var(--border-2);background:var(--surface);color:var(--text-faint);cursor:pointer}.gd-copy:hover{color:var(--accent-bright);border-color:var(--accent-dim)}.gd-done{margin:22px 0 8px;padding:12px 14px;border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);color:var(--text-faint);font-size:13px;line-height:1.5}.home-insights{margin-top:30px;padding-top:22px;border-top:1px solid var(--border)}.insights{max-width:760px;margin:0 auto}.in-title{font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 4px;color:#f4f6f9}.in-lens{display:flex;gap:6px;margin:0 0 14px}.in-lens-btn{font:inherit;font-size:12px;padding:5px 12px;border-radius:999px;border:1px solid var(--border);background:none;color:var(--text-faint);cursor:pointer}.in-lens-btn:hover{color:var(--text)}.in-lens-btn.active{color:var(--accent);border-color:var(--accent)}.in-chart{width:100%;height:auto;border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);margin-bottom:6px}.in-axis{stroke:var(--border);stroke-width:1}.in-threshold{stroke:var(--border);stroke-width:1;stroke-dasharray:4 4}.in-danger-zone{fill:#f26d6d0d}.in-label{fill:var(--text-ghost);font-size:11px}.in-quad{fill:var(--text-ghost);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em}.in-quad-danger{fill:#e07070}.in-pt{fill:var(--accent);opacity:.5;cursor:pointer}.in-pt:hover{opacity:1}.in-pt.cold{fill:var(--text-ghost);opacity:.25}.in-pt.danger{fill:#e05d5d;opacity:.6}.in-treemap{background:#0c0d10}.in-tm-group{fill:none;stroke:var(--border);stroke-width:1;cursor:pointer;pointer-events:all}.in-tm-glabel{fill:var(--text-faint);font-size:10px;text-transform:uppercase;letter-spacing:.05em;cursor:pointer}.in-tm-cell{cursor:pointer}.in-tm-cell:hover{stroke:#fff;stroke-width:1}.in-tm-label{fill:#0c0d10;font-size:10.5px;font-weight:620;cursor:pointer;pointer-events:none}.in-hotpath{border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);overflow:hidden}.in-hp-row{display:flex;align-items:center;gap:10px;padding:6px 12px;border-bottom:1px solid var(--border);cursor:pointer}.in-hp-row:last-child{border-bottom:none}.in-hp-row:hover{background:var(--hover)}.in-hp-name{flex:0 0 300px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--text)}.in-hp-name.danger{color:var(--accent)}.in-hp-bar{flex:1;display:flex;height:10px;border-radius:3px;overflow:hidden}.in-hp-agent{background:var(--accent)}.in-hp-human{background:#5b8def}.in-hp-count{flex:none;width:40px;text-align:right;font-size:11.5px;color:var(--text-faint);font-variant-numeric:tabular-nums}.in-legend{margin:8px 2px 0;font-size:11.5px;color:var(--text-faint)}.in-sw{display:inline-block;width:10px;height:10px;border-radius:2px;vertical-align:-1px}.in-sw.agent{background:var(--accent)}.in-sw.human{background:#5b8def}.in-matrix rect{transition:opacity .1s}.in-matrix rect:hover{opacity:.85}.history{max-width:860px}.hentry{padding:11px 12px;border-bottom:1px solid var(--border)}.hentry:hover{background:#ffffff04}.hline{display:flex;gap:10px;align-items:center}.hkind{display:inline-flex;color:var(--add)}.hkind .ico{width:13px;height:13px}.hentry.edit .hkind{color:var(--accent)}.hentry.delete .hkind{color:var(--del)}.htag{flex:none;font-size:10px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:1px 6px;border-radius:4px}.hentry.add .htag{color:var(--add);background:#4cc38a1f}.hentry.edit .htag{color:var(--accent-bright);background:var(--glow)}.hentry.delete .htag{color:#ff8b8b;background:#f26d6d1f}.hpath{font-weight:500;cursor:pointer;color:var(--text);font-size:13px}.hpath:hover{color:var(--accent-bright)}.htime{margin-left:auto;color:var(--text-faint);font-size:12px;font-variant-numeric:tabular-nums}.hmeta{display:flex;gap:14px;margin-top:4px;padding-left:23px;font-size:12px;color:var(--text-dim)}.hdev,.hsize{color:var(--text-faint)}.hsize{font-variant-numeric:tabular-nums}.hnote{margin-top:4px;padding-left:23px;font-size:12px;color:var(--text-faint);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}.hnote:hover{color:var(--text)}.hnote.open{white-space:normal;overflow-wrap:anywhere}.hnote:before{content:"› ";color:var(--text-ghost)}.hnote a{color:var(--accent-bright);text-decoration:none}.hnote a:hover{text-decoration:underline}#palette-overlay{position:fixed;inset:0;background:#0607099e;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:flex;justify-content:center;align-items:flex-start;padding-top:12vh;z-index:100}#palette{width:min(560px,92vw);background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-over);box-shadow:0 24px 70px -18px #000c;overflow:hidden}#palette-inputwrap{display:flex;align-items:center;gap:11px;padding:14px 16px;border-bottom:1px solid var(--border)}#palette-inputwrap .ico{width:17px;height:17px;color:var(--text-faint)}#palette-input{flex:1;width:100%;border:none;background:transparent;color:var(--text);font:inherit;font-size:15px;letter-spacing:-.01em;outline:none;padding:0}#palette-input::placeholder{color:var(--text-ghost)}#palette-results{list-style:none;margin:0;padding:8px;max-height:46vh;overflow-y:auto}#palette-results li{display:flex;align-items:center;gap:11px;height:38px;padding:0 10px;border-radius:9px;cursor:pointer;color:var(--text-dim);font-size:13.5px}#palette-results li.selected{background:var(--glow)}#palette-results li.selected .picon{color:var(--accent)}#palette-results li.selected .plabel,#palette-results li.selected .plabel b{color:var(--accent-bright)}#palette-results li .picon{width:18px;flex:none;display:flex;justify-content:center;color:var(--text-faint)}#palette-results li .picon .ico{width:15px;height:15px}#palette-results li .plabel{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text)}#palette-results li .plabel b{color:var(--accent-bright);font-weight:600}#palette-results li .pkind{flex:none;font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--text-ghost)}#palette-results .pempty{color:var(--text-faint);cursor:default;justify-content:center;height:auto;padding:14px}#palette-hint{padding:9px 16px;border-top:1px solid var(--border);font-size:11px;color:var(--text-ghost)}.modal-back{position:fixed;inset:0;background:#06070999;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:flex;align-items:center;justify-content:center;z-index:150;padding:20px}.modal{background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-over);padding:22px 24px;width:min(460px,100%);box-shadow:0 24px 70px -18px #000c}.modal h3{margin:0 0 10px;font-size:16px;font-weight:620;letter-spacing:-.01em}.modal p{margin:0 0 16px;font-size:13.5px;color:var(--text-dim);line-height:1.55}.modal p b{color:var(--text)}.modal-url{font:12px var(--mono);background:var(--surface);border:1px solid var(--border);border-radius:var(--r-ctl);padding:9px 11px;color:var(--text-dim);word-break:break-all;margin-bottom:16px}.modal-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.modal-label{display:block;font-size:12.5px;color:var(--text-dim);margin:0 0 6px}.modal-msg{margin:0 0 16px;font-size:13.5px;color:var(--text-dim);line-height:1.55}.modal-input{width:100%;height:36px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:14px;margin-bottom:16px;outline:none}.modal-input:focus{border-color:var(--accent);background:var(--hover)}#toast{position:fixed;bottom:24px;left:50%;transform:translate(-50%) translateY(20px);background:var(--bg-raise);color:var(--text);border:1px solid var(--border-2);border-radius:10px;padding:11px 18px;font-size:13.5px;box-shadow:0 18px 44px -12px #000000b3;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:200}#toast.show{opacity:1;transform:translate(-50%) translateY(0)}#toast.err{border-color:#f26d6d80;color:#ffb0aa}#sb-backdrop{display:none}@media(max-width:760px){#sidebar{position:fixed;z-index:60;top:0;left:0;height:100%;transform:translate(-100%);transition:transform .2s ease;box-shadow:0 0 40px #0009}body.sb-open #sidebar{transform:translate(0)}body.sb-open #sb-backdrop{display:block;position:fixed;inset:0;background:#0000008c;z-index:50}.icon-btn{display:inline-flex;width:44px;height:44px}#content{padding:24px 18px 70px}#topbar{padding:0 8px;gap:4px}#search-btn kbd,.btn .lbl{display:none}#topbar .btn{min-width:44px;min-height:44px;padding:0;justify-content:center;gap:0}#topbar .btn .ico{width:18px;height:18px}#more-btn:not([hidden]){display:inline-flex}#history-btn,#upload-btn,#download{display:none!important}#meta{display:none}#vault{padding:0 8px 0 12px}.icon-btn2,#signout,.adminbar{min-width:44px;min-height:44px}#tree li>.row,#projects .row{height:44px}#invite-btn{min-height:40px;padding:0 14px}#org-name{min-height:44px}.nav-add{min-width:44px;min-height:44px}.markdown,.admin,.onboard,.history,.dirlist{max-width:100%}.markdown table,pre.plain{display:block;overflow-x:auto;max-width:100%}.ob-row{flex-direction:column}}.markdown{max-width:704px;margin:0 auto}.markdown h1,.markdown h2,.markdown h3,.markdown h4{color:#f4f6f9;line-height:1.25;letter-spacing:-.018em;margin:1.5em 0 .5em;text-wrap:balance}.markdown h1:first-child{margin-top:0}.markdown h1{font-size:1.85em;font-weight:660;letter-spacing:-.024em}.markdown h2{font-size:1.32em;font-weight:620;margin-top:1.7em}.markdown h3{font-size:1.08em;font-weight:620}.markdown p,.markdown li{color:#c6cbd3;font-size:14.5px;line-height:1.72}.markdown p{margin:0 0 1em}.markdown strong{color:var(--text);font-weight:620}.markdown a{color:var(--accent-bright);text-decoration:none;border-bottom:1px solid rgba(245,166,35,.28)}.markdown a:hover{border-bottom-color:var(--accent)}.markdown ul,.markdown ol{margin:0 0 1em;padding-left:1.4em}.markdown li{margin-bottom:.4em}.markdown li::marker{color:var(--text-ghost)}.markdown code{background:var(--hover);border:1px solid var(--border);padding:.1em .4em;border-radius:5px;font:12.5px/1.5 var(--mono);color:#e4d9c4}.markdown pre{background:var(--code-bg);border:1px solid var(--border);border-radius:var(--r-card);padding:14px 16px;overflow-x:auto;margin:1.3em 0}.markdown pre code{background:none;border:none;padding:0;color:#c6cbd3}.markdown blockquote{margin:1.3em 0;padding:.3em 1em;border-left:2px solid var(--accent);background:linear-gradient(90deg,var(--glow),transparent);border-radius:0 8px 8px 0;color:#d8cdb6}.markdown blockquote p{margin:.3em 0;color:#d8cdb6}.markdown table{border-collapse:collapse;margin:1.3em 0;font-size:13.5px}.markdown th,.markdown td{border-bottom:1px solid var(--border);padding:9px 13px;text-align:left}.markdown th{color:var(--text-faint);font-size:11px;text-transform:uppercase;letter-spacing:.05em;font-weight:600;border-bottom-color:var(--border-2)}.markdown tr:hover td{background:#ffffff05}.markdown img{max-width:100%;border-radius:8px;border:1px solid var(--border)}.markdown hr{border:none;border-top:1px solid var(--border);margin:2.2em 0}.markdown input[type=checkbox]{accent-color:var(--accent)}pre.plain{background:var(--code-bg);border:1px solid var(--border);border-radius:var(--r-card);padding:14px 16px;overflow-x:auto;font:12.5px/1.6 var(--mono);color:#c6cbd3;white-space:pre-wrap;overflow-wrap:anywhere;max-width:900px}#content.markdown{min-width:0}.filecard{margin-top:15vh;text-align:center;color:var(--text-dim)}.filecard .name{font-size:1.2em;color:var(--text);margin-bottom:.3em}.filecard .btn{margin-top:14px} +:root{--bg: #0a0b0d;--bg-side: #0c0e10;--bg-raise: #15171b;--surface: rgba(255,255,255,.03);--hover: rgba(255,255,255,.06);--border: rgba(255,255,255,.07);--border-2: rgba(255,255,255,.11);--code-bg: #0d0f12;--text: #eef0f3;--text-dim: #9aa0a9;--text-faint: #868b93;--text-ghost: #666b74;--accent: #f5a623;--accent-bright: #ffcf85;--accent-dim: #d3861a;--accent-press: #e0951a;--glow: rgba(245,166,35,.13);--add: #4cc38a;--del: #f26d6d;--mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;--ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;--r-ctl: 7px;--r-card: 10px;--r-over: 14px}*{box-sizing:border-box}[hidden]{display:none!important}html,body{height:100%;margin:0}#root{display:contents}body{display:flex;background:var(--bg);color:var(--text);font:13px/1.5 var(--ui);letter-spacing:-.006em;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}::selection{background:var(--glow);color:var(--accent-bright)}:focus-visible{outline:2px solid var(--accent);outline-offset:1px;border-radius:5px}.sprite{position:absolute}.ico{width:16px;height:16px;flex:none;stroke:currentColor;stroke-width:1.6;fill:none;stroke-linecap:round;stroke-linejoin:round}button,input,a.btn{font-family:inherit}#sidebar{width:264px;min-width:210px;background:var(--bg-side);border-right:1px solid var(--border);display:flex;flex-direction:column;overflow:hidden}#vault{display:flex;align-items:center;gap:9px;height:52px;padding:0 12px 0 14px;border-bottom:1px solid var(--border)}#vault-badge{width:22px;height:22px;border-radius:6px;flex:none;display:grid;place-items:center;font-size:13px;line-height:1;background:linear-gradient(160deg,#ffcf85,#f5a623 55%,#d3861a);box-shadow:0 1px #ffffff59 inset,0 2px 6px -1px #f5a62366}#vault-name{font-weight:600;font-size:13px;letter-spacing:-.01em;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vault-actions{display:flex;align-items:center;gap:4px}#signout,.icon-btn2{width:28px;height:28px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;color:var(--text-ghost);background:transparent;border:none;cursor:pointer;text-decoration:none}#signout:hover,.icon-btn2:hover{color:var(--text);background:var(--hover)}#signout .ico,.icon-btn2 .ico{width:16px;height:16px}.adminbar{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 9px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--accent-bright);font-size:11.5px;font-weight:600;cursor:pointer}.adminbar:hover{background:var(--glow);border-color:transparent}#projects{flex:none;max-height:32%;overflow-y:auto;padding:10px 8px 8px;border-bottom:1px solid var(--border)}.nav-head{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.07em;color:var(--text-ghost)}.nav-add{display:grid;place-items:center;width:18px;height:18px;border:none;background:transparent;color:var(--text-ghost);cursor:pointer;border-radius:5px}.nav-add .ico{width:14px;height:14px}.nav-add:hover{color:var(--text);background:var(--hover)}#projects ul{list-style:none;margin:0;padding:0}#projects .row{display:flex;align-items:center;gap:9px;height:31px;padding:0 8px;border-radius:7px;color:var(--text-dim);cursor:pointer;position:relative;white-space:nowrap;overflow:hidden}.proj-mark{width:17px;height:17px;border-radius:5px;flex:none;display:grid;place-items:center;font-size:10px;font-weight:700;color:#0a0b0d;letter-spacing:-.02em;text-transform:uppercase}#projects .row .label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}#projects .row:hover{background:var(--hover);color:var(--text)}#projects .row.active{background:var(--glow);color:var(--accent-bright)}#projects .row.active:before{content:"";position:absolute;left:0;top:6px;bottom:6px;width:2px;border-radius:2px;background:var(--accent)}#tree{flex:1;overflow-y:auto;padding:8px 8px 24px}#tree ul{list-style:none;margin:0;padding-left:13px;position:relative}#tree>ul{padding-left:0}#tree ul ul:before{content:"";position:absolute;left:5px;top:0;bottom:0;width:1px;background:var(--border)}#tree li>.row{display:flex;align-items:center;gap:6px;height:28px;padding:0 8px;border-radius:7px;color:var(--text-dim);cursor:pointer;position:relative;white-space:nowrap;overflow:hidden}#tree li>.row:hover{background:var(--hover);color:var(--text)}#tree li>.row.active{background:var(--glow);color:var(--accent-bright)}#tree li>.row.active:before{content:"";position:absolute;left:0;top:5px;bottom:5px;width:2px;border-radius:2px;background:var(--accent)}#tree .chev{width:14px;height:14px;flex:none;color:var(--text-ghost);transition:transform .12s;display:flex;align-items:center;justify-content:center}#tree .chev .ico{width:13px;height:13px}#tree .ticon{flex:none;display:flex;color:var(--text-ghost)}#tree .ticon .ico{width:15px;height:15px}#tree li>.row:hover .ticon,#tree li>.row:hover .chev{color:var(--text-faint)}#tree li>.row.active .ticon,#tree li>.row.active .chev{color:var(--accent)}#tree .label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}#tree .file .label{font-size:12.5px}#tree .file .chev{visibility:hidden}#tree li.collapsed>ul{display:none}#tree li.collapsed>.row .chev{transform:rotate(-90deg)}#orgbar{display:flex;align-items:center;gap:9px;padding:9px 12px 9px 14px;border-top:1px solid var(--border)}#org-name{flex:1;min-width:0;display:inline-flex;align-items:center;gap:8px;color:var(--text-dim);font-size:12.5px;font-weight:500;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#org-name:before{content:"";width:15px;height:15px;flex:none;border-radius:4px;background:linear-gradient(160deg,#ffcf85,#d3861a);opacity:.85}#org-name:hover{color:var(--text)}#invite-btn{flex:none;height:27px;padding:0 11px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text-dim);font-size:12px;font-weight:500;cursor:pointer}#invite-btn:hover{background:var(--hover);color:var(--text);border-color:var(--border-2)}#main{flex:1;display:flex;flex-direction:column;min-width:0}#topbar{position:relative;display:flex;align-items:center;gap:9px;height:52px;padding:0 16px;border-bottom:1px solid var(--border)}.icon-btn{display:none;width:34px;height:34px;border:none;background:transparent;color:var(--text-dim);cursor:pointer;border-radius:7px;align-items:center;justify-content:center}.icon-btn:hover{color:var(--text);background:var(--hover)}#crumb{font-size:12.5px;color:var(--text);font-weight:500;letter-spacing:-.01em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#crumb .crumb-seg{color:var(--text-dim);cursor:pointer}#crumb .crumb-seg:hover{color:var(--accent-bright)}#crumb .crumb-sep{color:var(--text-ghost);margin:0 5px}#meta{flex:1;min-width:0;font-size:12px;color:var(--text-faint);text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.btn{display:inline-flex;align-items:center;gap:6px;flex:none;height:30px;padding:0 11px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text-dim);font-size:12.5px;font-weight:500;cursor:pointer;text-decoration:none}.btn:hover{background:var(--hover);color:var(--text);border-color:var(--border-2)}.btn .ico{width:15px;height:15px}.btn.ghost{color:var(--text-dim)}#search-btn kbd{font:11px var(--ui);color:var(--text-faint);background:var(--hover);border:1px solid var(--border-2);border-radius:5px;padding:1px 5px;margin-left:2px}#more-menu{position:absolute;right:12px;top:calc(100% - 4px);z-index:80;background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-card);box-shadow:0 18px 44px -14px #000000bf;padding:6px;min-width:168px}.more-item{display:block;width:100%;text-align:left;min-height:40px;padding:0 12px;background:transparent;border:none;cursor:pointer;color:var(--text);font:inherit;font-size:13.5px;border-radius:var(--r-ctl)}.more-item:hover{background:var(--hover)}#content{flex:1;overflow-y:auto;padding:44px 40px 110px;scroll-behavior:smooth}.empty{color:var(--text-faint);text-align:center;margin-top:22vh}.empty-hint{display:block;margin-top:6px;font-size:12px;color:var(--text-ghost)}.onboard{max-width:560px;margin:8vh auto 0}.onboard h1{font-size:25px;font-weight:640;letter-spacing:-.02em;margin:0 0 8px;color:#f4f6f9}.onboard>p{color:var(--text-dim);margin:0 0 28px;font-size:14px}.ob-card{background:var(--bg-side);border:1px solid var(--border);border-radius:var(--r-card);padding:20px 22px;margin-bottom:14px}.ob-card h3{margin:0 0 6px;font-size:14.5px;font-weight:600}.ob-card p{margin:0 0 14px;font-size:13px;color:var(--text-dim)}.ob-row{display:flex;gap:9px}.ob-row input{flex:1;height:34px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:13px;outline:none}.ob-row input:focus{border-color:var(--accent);background:var(--hover)}.pbtn{display:inline-flex;align-items:center;gap:6px;flex:none;height:32px;padding:0 14px;border-radius:var(--r-ctl);border:none;background:var(--accent);color:#241704;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap}.pbtn:hover{background:var(--accent-bright)}.pbtn .ico{width:15px;height:15px}.danger-btn{display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:var(--r-ctl);border:none;background:#b3382e;color:#fff;font-size:13px;font-weight:600;cursor:pointer}.danger-btn:hover{background:#c94336}.admin{max-width:760px}.admin h1{font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 6px;color:#f4f6f9}.admin h3{font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--text-ghost);font-weight:600;margin:30px 0 10px}.admin-sub{color:var(--text-dim);font-size:13.5px;margin:0 0 6px;line-height:1.55}.admin-h{display:flex;align-items:center;justify-content:space-between;margin:30px 0 10px}.admin-h h3{margin:0}.admin-row{display:flex;gap:9px;margin-bottom:8px}.admin-row input{flex:1;height:34px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:13px;outline:none}.admin-row input:focus{border-color:var(--accent);background:var(--hover)}.admin-list{border:1px solid var(--border);border-radius:var(--r-card);overflow:hidden;background:var(--bg-side)}.admin-item{display:flex;align-items:center;gap:11px;padding:11px 14px;border-bottom:1px solid var(--border);font-size:13.5px}.admin-item:last-child{border-bottom:none}.admin-item:hover{background:#ffffff04}.ai-main{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}.ai-main.mono{font:12px var(--mono);color:var(--text-dim);cursor:pointer}.ai-tag{font-size:11.5px;color:var(--text-faint);flex:none}.admin-item select{height:28px;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:0 8px;font:inherit;font-size:12.5px;cursor:pointer}.admin-item select:hover{border-color:var(--border-2)}.ai-btn,.ai-del{flex:none;height:27px;padding:0 11px;border-radius:6px;border:1px solid var(--border);background:var(--surface);color:var(--text-dim);font:inherit;font-size:12px;font-weight:500;cursor:pointer}.ai-btn:hover{background:var(--hover);color:var(--text);border-color:var(--border-2)}.ai-del{color:var(--del);border-color:transparent;background:transparent}.ai-del:hover{background:#f26d6d1f;color:#ff8b8b}.admin-empty{padding:14px;color:var(--text-faint);font-size:13px}.admin-item.toggle{cursor:pointer;align-items:flex-start}.admin-item.toggle .ai-main{white-space:normal}.tg-label{font-size:13.5px;font-weight:550;color:var(--text)}.tg-desc{font-size:12px;color:var(--text-faint);margin-top:3px;line-height:1.5}.admin-item.toggle input{width:16px;height:16px;margin-top:2px;accent-color:var(--accent);flex:none}.dirlist{max-width:704px;margin:0 auto}.dl-title{display:flex;align-items:center;gap:10px;font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 4px;color:#f4f6f9}.dl-title-icon{display:flex;color:var(--accent)}.dl-title-icon .ico{width:20px;height:20px}.dl-sub{color:var(--text-faint);font-size:12.5px;margin:0 0 18px}.dl-items{border:1px solid var(--border);border-radius:var(--r-card);overflow:hidden;background:var(--bg-side)}.dl-row{display:flex;align-items:center;gap:11px;padding:10px 14px;border-bottom:1px solid var(--border);cursor:pointer}.dl-row:last-child{border-bottom:none}.dl-row:hover{background:var(--hover)}.dl-row .ticon{flex:none;display:flex;color:var(--text-ghost)}.dl-row .ticon .ico{width:16px;height:16px}.dl-row:hover .ticon{color:var(--text-faint)}.dl-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13.5px;color:var(--text)}.dl-meta{flex:none;font-size:12px;color:var(--text-faint);font-variant-numeric:tabular-nums}.heatdot{flex:none;width:7px;height:7px;border-radius:50%;background:var(--accent)}.heatdot.lvl1{opacity:.3}.heatdot.lvl2{opacity:.55}.heatdot.lvl3{opacity:.8}.heatdot.lvl4{opacity:1;box-shadow:0 0 6px #f5a6238c}.dl-empty{padding:24px 14px;color:var(--text-faint);font-size:13px;border:1px dashed var(--border);border-radius:var(--r-card);text-align:center}.dl-h3{margin:28px 0 8px;font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--text-ghost);font-weight:600}.dl-hlist{border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);overflow:hidden;max-width:none}.dl-hlist .hentry:last-child{border-bottom:none}.hentry.clickable{cursor:pointer}.hentry.clickable:hover{background:var(--hover)}.dl-more{margin-top:10px}#vault-name.vault-link{cursor:pointer}#vault-name.vault-link:hover{color:var(--accent-bright)}.guide{max-width:760px;margin:0 auto}.gd-tabs{display:flex;gap:2px;margin:20px 0 16px;border-bottom:1px solid var(--border);overflow-x:auto}.gd-tab{font:inherit;font-size:13px;font-weight:600;padding:7px 12px 9px;background:none;border:none;border-bottom:2px solid transparent;margin-bottom:-1px;color:var(--text-faint);cursor:pointer;white-space:nowrap}.gd-tab:hover{color:var(--text)}.gd-tab.active{color:var(--accent-bright);border-bottom-color:var(--accent)}.gd-step{margin:0 0 18px}.gd-step-head{display:flex;align-items:center;gap:10px;margin-bottom:3px}.gd-num{flex:none;width:22px;height:22px;border-radius:50%;background:var(--glow);color:var(--accent-bright);font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center}.gd-step-title{font-weight:600;font-size:14px;color:var(--text)}.gd-desc{margin:2px 0 8px 32px;color:var(--text-faint);font-size:13px;line-height:1.5}.gd-extra{font-size:12.5px;margin-top:6px}.gd-code{position:relative;margin:6px 0 6px 32px;padding:10px 72px 10px 12px;background:var(--bg-raise);border:1px solid var(--border);border-radius:var(--r-card);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;line-height:1.6;color:var(--text);overflow-x:auto;white-space:pre}.gd-copy{position:absolute;top:7px;right:7px;font:inherit;font-family:inherit;font-size:11px;font-weight:600;padding:3px 9px;border-radius:6px;border:1px solid var(--border-2);background:var(--bg-raise);color:var(--text-faint);cursor:pointer;box-shadow:-14px 0 12px -6px var(--bg-raise)}.gd-copy:hover{color:var(--accent-bright);border-color:var(--accent-dim)}.gd-done{margin:22px 0 8px;padding:12px 14px;border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);color:var(--text-faint);font-size:13px;line-height:1.5}.home-insights{margin-top:30px;padding-top:22px;border-top:1px solid var(--border)}.insights{max-width:760px;margin:0 auto}.in-title{font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 4px;color:#f4f6f9}.in-lens{display:flex;gap:6px;margin:0 0 14px}.in-lens-btn{font:inherit;font-size:12px;padding:5px 12px;border-radius:999px;border:1px solid var(--border);background:none;color:var(--text-faint);cursor:pointer}.in-lens-btn:hover{color:var(--text)}.in-lens-btn.active{color:var(--accent);border-color:var(--accent)}.in-chart{width:100%;height:auto;border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);margin-bottom:6px}.in-axis{stroke:var(--border);stroke-width:1}.in-threshold{stroke:var(--border);stroke-width:1;stroke-dasharray:4 4}.in-danger-zone{fill:#f26d6d0d}.in-label{fill:var(--text-ghost);font-size:11px}.in-quad{fill:var(--text-ghost);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em}.in-quad-danger{fill:#e07070}.in-pt{fill:var(--accent);opacity:.5;cursor:pointer}.in-pt:hover{opacity:1}.in-pt.cold{fill:var(--text-ghost);opacity:.25}.in-pt.danger{fill:#e05d5d;opacity:.6}.in-treemap{background:#0c0d10}.in-tm-group{fill:none;stroke:var(--border);stroke-width:1;cursor:pointer;pointer-events:all}.in-tm-glabel{fill:var(--text-faint);font-size:10px;text-transform:uppercase;letter-spacing:.05em;cursor:pointer}.in-tm-cell{cursor:pointer}.in-tm-cell:hover{stroke:#fff;stroke-width:1}.in-tm-label{fill:#0c0d10;font-size:10.5px;font-weight:620;cursor:pointer;pointer-events:none}.in-hotpath{border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);overflow:hidden}.in-hp-row{display:flex;align-items:center;gap:10px;padding:6px 12px;border-bottom:1px solid var(--border);cursor:pointer}.in-hp-row:last-child{border-bottom:none}.in-hp-row:hover{background:var(--hover)}.in-hp-name{flex:0 0 300px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--text)}.in-hp-name.danger{color:var(--accent)}.in-hp-bar{flex:1;display:flex;height:10px;border-radius:3px;overflow:hidden}.in-hp-agent{background:var(--accent)}.in-hp-human{background:#5b8def}.in-hp-count{flex:none;width:40px;text-align:right;font-size:11.5px;color:var(--text-faint);font-variant-numeric:tabular-nums}.in-legend{margin:8px 2px 0;font-size:11.5px;color:var(--text-faint)}.in-sw{display:inline-block;width:10px;height:10px;border-radius:2px;vertical-align:-1px}.in-sw.agent{background:var(--accent)}.in-sw.human{background:#5b8def}.in-matrix rect{transition:opacity .1s}.in-matrix rect:hover{opacity:.85}.history{max-width:860px}.hentry{padding:11px 12px;border-bottom:1px solid var(--border)}.hentry:hover{background:#ffffff04}.hline{display:flex;gap:10px;align-items:center}.hkind{display:inline-flex;color:var(--add)}.hkind .ico{width:13px;height:13px}.hentry.edit .hkind{color:var(--accent)}.hentry.delete .hkind{color:var(--del)}.htag{flex:none;font-size:10px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:1px 6px;border-radius:4px}.hentry.add .htag{color:var(--add);background:#4cc38a1f}.hentry.edit .htag{color:var(--accent-bright);background:var(--glow)}.hentry.delete .htag{color:#ff8b8b;background:#f26d6d1f}.hpath{font-weight:500;cursor:pointer;color:var(--text);font-size:13px}.hpath:hover{color:var(--accent-bright)}.htime{margin-left:auto;color:var(--text-faint);font-size:12px;font-variant-numeric:tabular-nums}.hmeta{display:flex;align-items:center;gap:14px;margin-top:4px;padding-left:23px;font-size:12px;color:var(--text-dim)}.hdev,.hsize{color:var(--text-faint)}.hsize{font-variant-numeric:tabular-nums;white-space:nowrap;flex:none}.hnote{margin-top:4px;padding-left:23px;font-size:12px;color:var(--text-faint);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}.hnote:hover{color:var(--text)}.hnote.open{white-space:normal;overflow-wrap:anywhere}.hnote:before{content:"› ";color:var(--text-ghost)}.hnote a{color:var(--accent-bright);text-decoration:none}.hnote a:hover{text-decoration:underline}#palette-overlay{position:fixed;inset:0;background:#0607099e;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:flex;justify-content:center;align-items:flex-start;padding-top:12vh;z-index:100}#palette{width:min(560px,92vw);background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-over);box-shadow:0 24px 70px -18px #000c;overflow:hidden}#palette-inputwrap{display:flex;align-items:center;gap:11px;padding:14px 16px;border-bottom:1px solid var(--border)}#palette-inputwrap .ico{width:17px;height:17px;color:var(--text-faint)}#palette-input{flex:1;width:100%;border:none;background:transparent;color:var(--text);font:inherit;font-size:15px;letter-spacing:-.01em;outline:none;padding:0}#palette-input::placeholder{color:var(--text-ghost)}#palette-results{list-style:none;margin:0;padding:8px;max-height:46vh;overflow-y:auto}#palette-results li{display:flex;align-items:center;gap:11px;height:38px;padding:0 10px;border-radius:9px;cursor:pointer;color:var(--text-dim);font-size:13.5px}#palette-results li.selected{background:var(--glow)}#palette-results li.selected .picon{color:var(--accent)}#palette-results li.selected .plabel,#palette-results li.selected .plabel b{color:var(--accent-bright)}#palette-results li .picon{width:18px;flex:none;display:flex;justify-content:center;color:var(--text-faint)}#palette-results li .picon .ico{width:15px;height:15px}#palette-results li .plabel{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text)}#palette-results li .plabel b{color:var(--accent-bright);font-weight:600}#palette-results li .pkind{flex:none;font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--text-ghost)}#palette-results .pempty{color:var(--text-faint);cursor:default;justify-content:center;height:auto;padding:14px}#palette-hint{padding:9px 16px;border-top:1px solid var(--border);font-size:11px;color:var(--text-ghost)}.modal-back{position:fixed;inset:0;background:#06070999;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:flex;align-items:center;justify-content:center;z-index:150;padding:20px}.modal{background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-over);padding:22px 24px;width:min(460px,100%);box-shadow:0 24px 70px -18px #000c}.modal h3{margin:0 0 10px;font-size:16px;font-weight:620;letter-spacing:-.01em}.modal p{margin:0 0 16px;font-size:13.5px;color:var(--text-dim);line-height:1.55}.modal p b{color:var(--text)}.modal-url{font:12px var(--mono);background:var(--surface);border:1px solid var(--border);border-radius:var(--r-ctl);padding:9px 11px;color:var(--text-dim);word-break:break-all;margin-bottom:16px}.modal-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.modal-label{display:block;font-size:12.5px;color:var(--text-dim);margin:0 0 6px}.modal-msg{margin:0 0 16px;font-size:13.5px;color:var(--text-dim);line-height:1.55}.modal-input{width:100%;height:36px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:14px;margin-bottom:16px;outline:none}.modal-input:focus{border-color:var(--accent);background:var(--hover)}#toast{position:fixed;bottom:24px;left:50%;transform:translate(-50%) translateY(20px);background:var(--bg-raise);color:var(--text);border:1px solid var(--border-2);border-radius:10px;padding:11px 18px;font-size:13.5px;box-shadow:0 18px 44px -12px #000000b3;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:200}#toast.show{opacity:1;transform:translate(-50%) translateY(0)}#toast.err{border-color:#f26d6d80;color:#ffb0aa}#sb-backdrop{display:none}@media(max-width:900px){#sidebar{position:fixed;z-index:60;top:0;left:0;height:100%;transform:translate(-100%);transition:transform .2s ease;box-shadow:0 0 40px #0009}body.sb-open #sidebar{transform:translate(0)}body.sb-open #sb-backdrop{display:block;position:fixed;inset:0;background:#0000008c;z-index:50}.icon-btn{display:inline-flex;width:44px;height:44px}#content{padding:24px 18px 70px}#topbar{padding:0 8px;gap:4px}#search-btn kbd,.btn .lbl{display:none}#topbar .btn{min-width:44px;min-height:44px;padding:0;justify-content:center;gap:0}#topbar .btn .ico{width:18px;height:18px}#more-btn:not([hidden]){display:inline-flex}#history-btn,#upload-btn,#download{display:none!important}#meta{display:none}#crumb{flex:1}#vault{padding:0 8px 0 12px}.icon-btn2,#signout,.adminbar{min-width:44px;min-height:44px}#tree li>.row,#projects .row{height:44px}#invite-btn{min-height:44px;padding:0 14px}#org-name{min-height:44px}.nav-add{min-width:44px;min-height:44px}.markdown,.admin,.onboard,.history,.dirlist{max-width:100%}.markdown table,pre.plain{display:block;overflow-x:auto;max-width:100%}.ob-row{flex-direction:column}.ob-row input{flex:none;min-height:44px}.admin-item{flex-wrap:wrap;row-gap:8px;padding:12px 14px}.admin-item select{height:44px}.ai-btn,.ai-del{height:auto;min-height:44px;padding:0 12px}.admin-item .ai-main{flex:1 1 100%;white-space:normal;overflow-wrap:break-word}.gd-code{min-height:62px;padding-top:12px;padding-bottom:12px}.gd-copy{min-height:44px;padding:0 14px}.gd-tab{min-height:44px}.in-lens-btn{min-height:44px;padding:0 14px}.modal-input{height:44px}.modal-actions button,.pbtn,#palette-results li{height:auto;min-height:44px}.more-item{min-height:44px}}.modal-actions .ai-del{margin-right:auto}@media(max-width:430px){.dl-meta{display:none}.ai-tag{font-size:11px}.htime{white-space:nowrap;font-size:12px}.hline{flex-wrap:wrap}.modal-actions .ai-del{flex:0 0 100%}}.markdown{max-width:704px;width:100%;margin:0 auto}.markdown h1,.markdown h2,.markdown h3,.markdown h4{color:#f4f6f9;line-height:1.25;letter-spacing:-.018em;margin:1.5em 0 .5em;text-wrap:balance}.markdown h1:first-child{margin-top:0}.markdown h1{font-size:1.85em;font-weight:660;letter-spacing:-.024em}.markdown h2{font-size:1.32em;font-weight:620;margin-top:1.7em}.markdown h3{font-size:1.08em;font-weight:620}.markdown p,.markdown li{color:#c6cbd3;font-size:14.5px;line-height:1.72}.markdown p{margin:0 0 1em}.markdown strong{color:var(--text);font-weight:620}.markdown a{color:var(--accent-bright);text-decoration:none;border-bottom:1px solid rgba(245,166,35,.28)}.markdown a:hover{border-bottom-color:var(--accent)}.markdown ul,.markdown ol{margin:0 0 1em;padding-left:1.4em}.markdown li{margin-bottom:.4em}.markdown li::marker{color:var(--text-ghost)}.markdown code{background:var(--hover);border:1px solid var(--border);padding:.1em .4em;border-radius:5px;font:12.5px/1.5 var(--mono);color:#e4d9c4}.markdown pre{background:var(--code-bg);border:1px solid var(--border);border-radius:var(--r-card);padding:14px 16px;overflow-x:auto;margin:1.3em 0}.markdown pre code{background:none;border:none;padding:0;color:#c6cbd3}.markdown blockquote{margin:1.3em 0;padding:.3em 1em;border-left:2px solid var(--accent);background:linear-gradient(90deg,var(--glow),transparent);border-radius:0 8px 8px 0;color:#d8cdb6}.markdown blockquote p{margin:.3em 0;color:#d8cdb6}.markdown table{border-collapse:collapse;margin:1.3em 0;font-size:13.5px}.markdown th,.markdown td{border-bottom:1px solid var(--border);padding:9px 13px;text-align:left}.markdown th{color:var(--text-faint);font-size:11px;text-transform:uppercase;letter-spacing:.05em;font-weight:600;border-bottom-color:var(--border-2)}.markdown tr:hover td{background:#ffffff05}.markdown img{max-width:100%;border-radius:8px;border:1px solid var(--border)}.markdown hr{border:none;border-top:1px solid var(--border);margin:2.2em 0}.markdown input[type=checkbox]{accent-color:var(--accent)}pre.plain{background:var(--code-bg);border:1px solid var(--border);border-radius:var(--r-card);padding:14px 16px;overflow-x:auto;font:12.5px/1.6 var(--mono);color:#c6cbd3;white-space:pre-wrap;overflow-wrap:anywhere;max-width:900px}#content.markdown{min-width:0}.filecard{margin-top:15vh;text-align:center;color:var(--text-dim)}.filecard .name{font-size:1.2em;color:var(--text);margin-bottom:.3em}.filecard .btn{margin-top:14px} diff --git a/internal/webapp/static/assets/index-BmKSe0_Y.js b/internal/webapp/static/assets/index-ISEZlu5u.js similarity index 89% rename from internal/webapp/static/assets/index-BmKSe0_Y.js rename to internal/webapp/static/assets/index-ISEZlu5u.js index a848712..e2eba2c 100644 --- a/internal/webapp/static/assets/index-BmKSe0_Y.js +++ b/internal/webapp/static/assets/index-ISEZlu5u.js @@ -1,11 +1,11 @@ -(function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))r(d);new MutationObserver(d=>{for(const y of d)if(y.type==="childList")for(const S of y.addedNodes)S.tagName==="LINK"&&S.rel==="modulepreload"&&r(S)}).observe(document,{childList:!0,subtree:!0});function f(d){const y={};return d.integrity&&(y.integrity=d.integrity),d.referrerPolicy&&(y.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?y.credentials="include":d.crossOrigin==="anonymous"?y.credentials="omit":y.credentials="same-origin",y}function r(d){if(d.ep)return;d.ep=!0;const y=f(d);fetch(d.href,y)}})();var Ks={exports:{}},Zn={};var mh;function Rv(){if(mh)return Zn;mh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function f(r,d,y){var S=null;if(y!==void 0&&(S=""+y),d.key!==void 0&&(S=""+d.key),"key"in d){y={};for(var A in d)A!=="key"&&(y[A]=d[A])}else y=d;return d=y.ref,{$$typeof:i,type:r,key:S,ref:d!==void 0?d:null,props:y}}return Zn.Fragment=c,Zn.jsx=f,Zn.jsxs=f,Zn}var yh;function Uv(){return yh||(yh=1,Ks.exports=Rv()),Ks.exports}var o=Uv(),Zs={exports:{}},I={};var vh;function Hv(){if(vh)return I;vh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),S=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),E=Symbol.iterator;function q(b){return b===null||typeof b!="object"?null:(b=E&&b[E]||b["@@iterator"],typeof b=="function"?b:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,B={};function L(b,H,G){this.props=b,this.context=H,this.refs=B,this.updater=G||C}L.prototype.isReactComponent={},L.prototype.setState=function(b,H){if(typeof b!="object"&&typeof b!="function"&&b!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,b,H,"setState")},L.prototype.forceUpdate=function(b){this.updater.enqueueForceUpdate(this,b,"forceUpdate")};function dt(){}dt.prototype=L.prototype;function nt(b,H,G){this.props=b,this.context=H,this.refs=B,this.updater=G||C}var Ot=nt.prototype=new dt;Ot.constructor=nt,w(Ot,L.prototype),Ot.isPureReactComponent=!0;var Nt=Array.isArray;function tt(){}var F={H:null,A:null,T:null,S:null},ht=Object.prototype.hasOwnProperty;function Lt(b,H,G){var X=G.ref;return{$$typeof:i,type:b,key:H,ref:X!==void 0?X:null,props:G}}function ne(b,H){return Lt(b.type,H,b.props)}function Vt(b){return typeof b=="object"&&b!==null&&b.$$typeof===i}function Ht(b){var H={"=":"=0",":":"=2"};return"$"+b.replace(/[=:]/g,function(G){return H[G]})}var zt=/\/+/g;function ee(b,H){return typeof b=="object"&&b!==null&&b.key!=null?Ht(""+b.key):H.toString(36)}function me(b){switch(b.status){case"fulfilled":return b.value;case"rejected":throw b.reason;default:switch(typeof b.status=="string"?b.then(tt,tt):(b.status="pending",b.then(function(H){b.status==="pending"&&(b.status="fulfilled",b.value=H)},function(H){b.status==="pending"&&(b.status="rejected",b.reason=H)})),b.status){case"fulfilled":return b.value;case"rejected":throw b.reason}}throw b}function _(b,H,G,X,W){var et=typeof b;(et==="undefined"||et==="boolean")&&(b=null);var at=!1;if(b===null)at=!0;else switch(et){case"bigint":case"string":case"number":at=!0;break;case"object":switch(b.$$typeof){case i:case c:at=!0;break;case N:return at=b._init,_(at(b._payload),H,G,X,W)}}if(at)return W=W(b),at=X===""?"."+ee(b,0):X,Nt(W)?(G="",at!=null&&(G=at.replace(zt,"$&/")+"/"),_(W,H,G,"",function(Le){return Le})):W!=null&&(Vt(W)&&(W=ne(W,G+(W.key==null||b&&b.key===W.key?"":(""+W.key).replace(zt,"$&/")+"/")+at)),H.push(W)),1;at=0;var Jt=X===""?".":X+":";if(Nt(b))for(var Dt=0;Dt>>1,gt=_[mt];if(0>>1;mtd(G,J))Xd(W,G)?(_[mt]=W,_[X]=J,mt=X):(_[mt]=G,_[H]=J,mt=H);else if(Xd(W,J))_[mt]=W,_[X]=J,mt=X;else break t}}return Y}function d(_,Y){var J=_.sortIndex-Y.sortIndex;return J!==0?J:_.id-Y.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var y=performance;i.unstable_now=function(){return y.now()}}else{var S=Date,A=S.now();i.unstable_now=function(){return S.now()-A}}var v=[],m=[],N=1,j=null,E=3,q=!1,C=!1,w=!1,B=!1,L=typeof setTimeout=="function"?setTimeout:null,dt=typeof clearTimeout=="function"?clearTimeout:null,nt=typeof setImmediate<"u"?setImmediate:null;function Ot(_){for(var Y=f(m);Y!==null;){if(Y.callback===null)r(m);else if(Y.startTime<=_)r(m),Y.sortIndex=Y.expirationTime,c(v,Y);else break;Y=f(m)}}function Nt(_){if(w=!1,Ot(_),!C)if(f(v)!==null)C=!0,tt||(tt=!0,Ht());else{var Y=f(m);Y!==null&&me(Nt,Y.startTime-_)}}var tt=!1,F=-1,ht=5,Lt=-1;function ne(){return B?!0:!(i.unstable_now()-Lt_&&ne());){var mt=j.callback;if(typeof mt=="function"){j.callback=null,E=j.priorityLevel;var gt=mt(j.expirationTime<=_);if(_=i.unstable_now(),typeof gt=="function"){j.callback=gt,Ot(_),Y=!0;break e}j===f(v)&&r(v),Ot(_)}else r(v);j=f(v)}if(j!==null)Y=!0;else{var b=f(m);b!==null&&me(Nt,b.startTime-_),Y=!1}}break t}finally{j=null,E=J,q=!1}Y=void 0}}finally{Y?Ht():tt=!1}}}var Ht;if(typeof nt=="function")Ht=function(){nt(Vt)};else if(typeof MessageChannel<"u"){var zt=new MessageChannel,ee=zt.port2;zt.port1.onmessage=Vt,Ht=function(){ee.postMessage(null)}}else Ht=function(){L(Vt,0)};function me(_,Y){F=L(function(){_(i.unstable_now())},Y)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(_){_.callback=null},i.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ht=0<_?Math.floor(1e3/_):5},i.unstable_getCurrentPriorityLevel=function(){return E},i.unstable_next=function(_){switch(E){case 1:case 2:case 3:var Y=3;break;default:Y=E}var J=E;E=Y;try{return _()}finally{E=J}},i.unstable_requestPaint=function(){B=!0},i.unstable_runWithPriority=function(_,Y){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var J=E;E=_;try{return Y()}finally{E=J}},i.unstable_scheduleCallback=function(_,Y,J){var mt=i.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0mt?(_.sortIndex=J,c(m,_),f(v)===null&&_===f(m)&&(w?(dt(F),F=-1):w=!0,me(Nt,J-mt))):(_.sortIndex=gt,c(v,_),C||q||(C=!0,tt||(tt=!0,Ht()))),_},i.unstable_shouldYield=ne,i.unstable_wrapCallback=function(_){var Y=E;return function(){var J=E;E=Y;try{return _.apply(this,arguments)}finally{E=J}}}})(ks)),ks}var bh;function wv(){return bh||(bh=1,Js.exports=qv()),Js.exports}var Fs={exports:{}},le={};var Sh;function Qv(){if(Sh)return le;Sh=1;var i=cf();function c(v){var m="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),Fs.exports=Qv(),Fs.exports}var jh;function Yv(){if(jh)return Vn;jh=1;var i=wv(),c=cf(),f=Bv();function r(t){var e="https://react.dev/errors/"+t;if(1gt||(t.current=mt[gt],mt[gt]=null,gt--)}function G(t,e){gt++,mt[gt]=t.current,t.current=e}var X=b(null),W=b(null),et=b(null),at=b(null);function Jt(t,e){switch(G(et,e),G(W,t),G(X,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?wd(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=wd(e),t=Qd(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}H(X),G(X,t)}function Dt(){H(X),H(W),H(et)}function Le(t){t.memoizedState!==null&&G(at,t);var e=X.current,l=Qd(e,t.type);e!==l&&(G(W,t),G(X,l))}function Kl(t){W.current===t&&(H(X),H(W)),at.current===t&&(H(at),Gn._currentValue=J)}var Wa,ai;function we(t){if(Wa===void 0)try{throw Error()}catch(l){var e=l.stack.trim().match(/\n( *(at )?)/);Wa=e&&e[1]||"",ai=-1{for(const m of d)if(m.type==="childList")for(const S of m.addedNodes)S.tagName==="LINK"&&S.rel==="modulepreload"&&r(S)}).observe(document,{childList:!0,subtree:!0});function f(d){const m={};return d.integrity&&(m.integrity=d.integrity),d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?m.credentials="include":d.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function r(d){if(d.ep)return;d.ep=!0;const m=f(d);fetch(d.href,m)}})();var Ks={exports:{}},Zn={};var mh;function Rv(){if(mh)return Zn;mh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function f(r,d,m){var S=null;if(m!==void 0&&(S=""+m),d.key!==void 0&&(S=""+d.key),"key"in d){m={};for(var A in d)A!=="key"&&(m[A]=d[A])}else m=d;return d=m.ref,{$$typeof:i,type:r,key:S,ref:d!==void 0?d:null,props:m}}return Zn.Fragment=c,Zn.jsx=f,Zn.jsxs=f,Zn}var yh;function Uv(){return yh||(yh=1,Ks.exports=Rv()),Ks.exports}var o=Uv(),Zs={exports:{}},I={};var vh;function Hv(){if(vh)return I;vh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),S=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),E=Symbol.iterator;function q(b){return b===null||typeof b!="object"?null:(b=E&&b[E]||b["@@iterator"],typeof b=="function"?b:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,B={};function L(b,H,G){this.props=b,this.context=H,this.refs=B,this.updater=G||C}L.prototype.isReactComponent={},L.prototype.setState=function(b,H){if(typeof b!="object"&&typeof b!="function"&&b!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,b,H,"setState")},L.prototype.forceUpdate=function(b){this.updater.enqueueForceUpdate(this,b,"forceUpdate")};function dt(){}dt.prototype=L.prototype;function nt(b,H,G){this.props=b,this.context=H,this.refs=B,this.updater=G||C}var Ot=nt.prototype=new dt;Ot.constructor=nt,w(Ot,L.prototype),Ot.isPureReactComponent=!0;var Nt=Array.isArray;function tt(){}var F={H:null,A:null,T:null,S:null},ht=Object.prototype.hasOwnProperty;function Lt(b,H,G){var X=G.ref;return{$$typeof:i,type:b,key:H,ref:X!==void 0?X:null,props:G}}function ne(b,H){return Lt(b.type,H,b.props)}function Vt(b){return typeof b=="object"&&b!==null&&b.$$typeof===i}function Ht(b){var H={"=":"=0",":":"=2"};return"$"+b.replace(/[=:]/g,function(G){return H[G]})}var zt=/\/+/g;function ee(b,H){return typeof b=="object"&&b!==null&&b.key!=null?Ht(""+b.key):H.toString(36)}function me(b){switch(b.status){case"fulfilled":return b.value;case"rejected":throw b.reason;default:switch(typeof b.status=="string"?b.then(tt,tt):(b.status="pending",b.then(function(H){b.status==="pending"&&(b.status="fulfilled",b.value=H)},function(H){b.status==="pending"&&(b.status="rejected",b.reason=H)})),b.status){case"fulfilled":return b.value;case"rejected":throw b.reason}}throw b}function _(b,H,G,X,W){var et=typeof b;(et==="undefined"||et==="boolean")&&(b=null);var at=!1;if(b===null)at=!0;else switch(et){case"bigint":case"string":case"number":at=!0;break;case"object":switch(b.$$typeof){case i:case c:at=!0;break;case N:return at=b._init,_(at(b._payload),H,G,X,W)}}if(at)return W=W(b),at=X===""?"."+ee(b,0):X,Nt(W)?(G="",at!=null&&(G=at.replace(zt,"$&/")+"/"),_(W,H,G,"",function(Le){return Le})):W!=null&&(Vt(W)&&(W=ne(W,G+(W.key==null||b&&b.key===W.key?"":(""+W.key).replace(zt,"$&/")+"/")+at)),H.push(W)),1;at=0;var Jt=X===""?".":X+":";if(Nt(b))for(var Dt=0;Dt>>1,gt=_[mt];if(0>>1;mtd(G,J))Xd(W,G)?(_[mt]=W,_[X]=J,mt=X):(_[mt]=G,_[H]=J,mt=H);else if(Xd(W,J))_[mt]=W,_[X]=J,mt=X;else break t}}return Y}function d(_,Y){var J=_.sortIndex-Y.sortIndex;return J!==0?J:_.id-Y.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;i.unstable_now=function(){return m.now()}}else{var S=Date,A=S.now();i.unstable_now=function(){return S.now()-A}}var v=[],y=[],N=1,j=null,E=3,q=!1,C=!1,w=!1,B=!1,L=typeof setTimeout=="function"?setTimeout:null,dt=typeof clearTimeout=="function"?clearTimeout:null,nt=typeof setImmediate<"u"?setImmediate:null;function Ot(_){for(var Y=f(y);Y!==null;){if(Y.callback===null)r(y);else if(Y.startTime<=_)r(y),Y.sortIndex=Y.expirationTime,c(v,Y);else break;Y=f(y)}}function Nt(_){if(w=!1,Ot(_),!C)if(f(v)!==null)C=!0,tt||(tt=!0,Ht());else{var Y=f(y);Y!==null&&me(Nt,Y.startTime-_)}}var tt=!1,F=-1,ht=5,Lt=-1;function ne(){return B?!0:!(i.unstable_now()-Lt_&&ne());){var mt=j.callback;if(typeof mt=="function"){j.callback=null,E=j.priorityLevel;var gt=mt(j.expirationTime<=_);if(_=i.unstable_now(),typeof gt=="function"){j.callback=gt,Ot(_),Y=!0;break e}j===f(v)&&r(v),Ot(_)}else r(v);j=f(v)}if(j!==null)Y=!0;else{var b=f(y);b!==null&&me(Nt,b.startTime-_),Y=!1}}break t}finally{j=null,E=J,q=!1}Y=void 0}}finally{Y?Ht():tt=!1}}}var Ht;if(typeof nt=="function")Ht=function(){nt(Vt)};else if(typeof MessageChannel<"u"){var zt=new MessageChannel,ee=zt.port2;zt.port1.onmessage=Vt,Ht=function(){ee.postMessage(null)}}else Ht=function(){L(Vt,0)};function me(_,Y){F=L(function(){_(i.unstable_now())},Y)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(_){_.callback=null},i.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ht=0<_?Math.floor(1e3/_):5},i.unstable_getCurrentPriorityLevel=function(){return E},i.unstable_next=function(_){switch(E){case 1:case 2:case 3:var Y=3;break;default:Y=E}var J=E;E=Y;try{return _()}finally{E=J}},i.unstable_requestPaint=function(){B=!0},i.unstable_runWithPriority=function(_,Y){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var J=E;E=_;try{return Y()}finally{E=J}},i.unstable_scheduleCallback=function(_,Y,J){var mt=i.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0mt?(_.sortIndex=J,c(y,_),f(v)===null&&_===f(y)&&(w?(dt(F),F=-1):w=!0,me(Nt,J-mt))):(_.sortIndex=gt,c(v,_),C||q||(C=!0,tt||(tt=!0,Ht()))),_},i.unstable_shouldYield=ne,i.unstable_wrapCallback=function(_){var Y=E;return function(){var J=E;E=Y;try{return _.apply(this,arguments)}finally{E=J}}}})(ks)),ks}var bh;function wv(){return bh||(bh=1,Js.exports=qv()),Js.exports}var Fs={exports:{}},le={};var Sh;function Qv(){if(Sh)return le;Sh=1;var i=cf();function c(v){var y="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),Fs.exports=Qv(),Fs.exports}var jh;function Yv(){if(jh)return Vn;jh=1;var i=wv(),c=cf(),f=Bv();function r(t){var e="https://react.dev/errors/"+t;if(1gt||(t.current=mt[gt],mt[gt]=null,gt--)}function G(t,e){gt++,mt[gt]=t.current,t.current=e}var X=b(null),W=b(null),et=b(null),at=b(null);function Jt(t,e){switch(G(et,e),G(W,t),G(X,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?wd(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=wd(e),t=Qd(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}H(X),G(X,t)}function Dt(){H(X),H(W),H(et)}function Le(t){t.memoizedState!==null&&G(at,t);var e=X.current,l=Qd(e,t.type);e!==l&&(G(W,t),G(X,l))}function Kl(t){W.current===t&&(H(X),H(W)),at.current===t&&(H(at),Gn._currentValue=J)}var Wa,ai;function we(t){if(Wa===void 0)try{throw Error()}catch(l){var e=l.stack.trim().match(/\n( *(at )?)/);Wa=e&&e[1]||"",ai=-1)":-1n||p[a]!==O[n]){var D=` `+p[a].replace(" at new "," at ");return t.displayName&&D.includes("")&&(D=D.replace("",t.displayName)),D}while(1<=a&&0<=n);break}}}finally{hl=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?we(l):""}function zu(t,e){switch(t.tag){case 26:case 27:case 5:return we(t.type);case 16:return we("Lazy");case 13:return t.child!==e&&e!==null?we("Suspense Fallback"):we("Suspense");case 19:return we("SuspenseList");case 0:case 15:return ml(t.type,!1);case 11:return ml(t.type.render,!1);case 1:return ml(t.type,!0);case 31:return we("Activity");default:return""}}function ni(t){try{var e="",l=null;do e+=zu(t,l),l=t,t=t.return;while(t);return e}catch(a){return` Error generating stack: `+a.message+` -`+a.stack}}var yl=Object.prototype.hasOwnProperty,Xe=i.unstable_scheduleCallback,ye=i.unstable_cancelCallback,Mu=i.unstable_shouldYield,Cu=i.unstable_requestPaint,k=i.unstable_now,it=i.unstable_getCurrentPriorityLevel,bt=i.unstable_ImmediatePriority,Qe=i.unstable_UserBlockingPriority,vl=i.unstable_NormalPriority,Du=i.unstable_LowPriority,vf=i.unstable_IdlePriority,ym=i.log,vm=i.unstable_setDisableYieldValue,Ia=null,ve=null;function pl(t){if(typeof ym=="function"&&vm(t),ve&&typeof ve.setStrictMode=="function")try{ve.setStrictMode(Ia,t)}catch{}}var pe=Math.clz32?Math.clz32:bm,pm=Math.log,gm=Math.LN2;function bm(t){return t>>>=0,t===0?32:31-(pm(t)/gm|0)|0}var ii=256,ui=262144,ci=4194304;function Zl(t){var e=t&42;if(e!==0)return e;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function si(t,e,l){var a=t.pendingLanes;if(a===0)return 0;var n=0,u=t.suspendedLanes,s=t.pingedLanes;t=t.warmLanes;var h=a&134217727;return h!==0?(a=h&~u,a!==0?n=Zl(a):(s&=h,s!==0?n=Zl(s):l||(l=h&~t,l!==0&&(n=Zl(l))))):(h=a&~u,h!==0?n=Zl(h):s!==0?n=Zl(s):l||(l=a&~t,l!==0&&(n=Zl(l)))),n===0?0:e!==0&&e!==n&&(e&u)===0&&(u=n&-n,l=e&-e,u>=l||u===32&&(l&4194048)!==0)?e:n}function Pa(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function Sm(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pf(){var t=ci;return ci<<=1,(ci&62914560)===0&&(ci=4194304),t}function _u(t){for(var e=[],l=0;31>l;l++)e.push(t);return e}function tn(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function xm(t,e,l,a,n,u){var s=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var h=t.entanglements,p=t.expirationTimes,O=t.hiddenUpdates;for(l=s&~l;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Nm=/[\n"\\]/g;function ze(t){return t.replace(Nm,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Qu(t,e,l,a,n,u,s,h){t.name="",s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?t.type=s:t.removeAttribute("type"),e!=null?s==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+Ne(e)):t.value!==""+Ne(e)&&(t.value=""+Ne(e)):s!=="submit"&&s!=="reset"||t.removeAttribute("value"),e!=null?Bu(t,s,Ne(e)):l!=null?Bu(t,s,Ne(l)):a!=null&&t.removeAttribute("value"),n==null&&u!=null&&(t.defaultChecked=!!u),n!=null&&(t.checked=n&&typeof n!="function"&&typeof n!="symbol"),h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?t.name=""+Ne(h):t.removeAttribute("name")}function Cf(t,e,l,a,n,u,s,h){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),e!=null||l!=null){if(!(u!=="submit"&&u!=="reset"||e!=null)){wu(t);return}l=l!=null?""+Ne(l):"",e=e!=null?""+Ne(e):l,h||e===t.value||(t.value=e),t.defaultValue=e}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=h?t.checked:!!a,t.defaultChecked=!!a,s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(t.name=s),wu(t)}function Bu(t,e,l){e==="number"&&oi(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function va(t,e,l,a){if(t=t.options,e){e={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=!1;if(We)try{var nn={};Object.defineProperty(nn,"passive",{get:function(){Ku=!0}}),window.addEventListener("test",nn,nn),window.removeEventListener("test",nn,nn)}catch{Ku=!1}var bl=null,Zu=null,hi=null;function wf(){if(hi)return hi;var t,e=Zu,l=e.length,a,n="value"in bl?bl.value:bl.textContent,u=n.length;for(t=0;t=sn),Xf=" ",Kf=!1;function Zf(t,e){switch(t){case"keyup":return ey.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Sa=!1;function ay(t,e){switch(t){case"compositionend":return Vf(e);case"keypress":return e.which!==32?null:(Kf=!0,Xf);case"textInput":return t=e.data,t===Xf&&Kf?null:t;default:return null}}function ny(t,e){if(Sa)return t==="compositionend"||!$u&&Zf(t,e)?(t=wf(),hi=Zu=bl=null,Sa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:l,offset:e-t};t=a}t:{for(;l;){if(l.nextSibling){l=l.nextSibling;break t}l=l.parentNode}l=void 0}l=tr(l)}}function lr(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?lr(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function ar(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=oi(t.document);e instanceof t.HTMLIFrameElement;){try{var l=typeof e.contentWindow.location.href=="string"}catch{l=!1}if(l)t=e.contentWindow;else break;e=oi(t.document)}return e}function Pu(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var dy=We&&"documentMode"in document&&11>=document.documentMode,xa=null,tc=null,dn=null,ec=!1;function nr(t,e,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ec||xa==null||xa!==oi(a)||(a=xa,"selectionStart"in a&&Pu(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),dn&&on(dn,a)||(dn=a,a=uu(tc,"onSelect"),0>=s,n-=s,Ke=1<<32-pe(e)+n|l<lt?(ft=Z,Z=null):ft=Z.sibling;var vt=z(x,Z,T[lt],R);if(vt===null){Z===null&&(Z=ft);break}t&&Z&&vt.alternate===null&&e(x,Z),g=u(vt,g,lt),yt===null?V=vt:yt.sibling=vt,yt=vt,Z=ft}if(lt===T.length)return l(x,Z),rt&&Pe(x,lt),V;if(Z===null){for(;ltlt?(ft=Z,Z=null):ft=Z.sibling;var Gl=z(x,Z,vt.value,R);if(Gl===null){Z===null&&(Z=ft);break}t&&Z&&Gl.alternate===null&&e(x,Z),g=u(Gl,g,lt),yt===null?V=Gl:yt.sibling=Gl,yt=Gl,Z=ft}if(vt.done)return l(x,Z),rt&&Pe(x,lt),V;if(Z===null){for(;!vt.done;lt++,vt=T.next())vt=U(x,vt.value,R),vt!==null&&(g=u(vt,g,lt),yt===null?V=vt:yt.sibling=vt,yt=vt);return rt&&Pe(x,lt),V}for(Z=a(Z);!vt.done;lt++,vt=T.next())vt=M(Z,x,lt,vt.value,R),vt!==null&&(t&&vt.alternate!==null&&Z.delete(vt.key===null?lt:vt.key),g=u(vt,g,lt),yt===null?V=vt:yt.sibling=vt,yt=vt);return t&&Z.forEach(function(_v){return e(x,_v)}),rt&&Pe(x,lt),V}function Tt(x,g,T,R){if(typeof T=="object"&&T!==null&&T.type===w&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case q:t:{for(var V=T.key;g!==null;){if(g.key===V){if(V=T.type,V===w){if(g.tag===7){l(x,g.sibling),R=n(g,T.props.children),R.return=x,x=R;break t}}else if(g.elementType===V||typeof V=="object"&&V!==null&&V.$$typeof===ht&&la(V)===g.type){l(x,g.sibling),R=n(g,T.props),gn(R,T),R.return=x,x=R;break t}l(x,g);break}else e(x,g);g=g.sibling}T.type===w?(R=Wl(T.props.children,x.mode,R,T.key),R.return=x,x=R):(R=Ei(T.type,T.key,T.props,null,x.mode,R),gn(R,T),R.return=x,x=R)}return s(x);case C:t:{for(V=T.key;g!==null;){if(g.key===V)if(g.tag===4&&g.stateNode.containerInfo===T.containerInfo&&g.stateNode.implementation===T.implementation){l(x,g.sibling),R=n(g,T.children||[]),R.return=x,x=R;break t}else{l(x,g);break}else e(x,g);g=g.sibling}R=sc(T,x.mode,R),R.return=x,x=R}return s(x);case ht:return T=la(T),Tt(x,g,T,R)}if(me(T))return K(x,g,T,R);if(Ht(T)){if(V=Ht(T),typeof V!="function")throw Error(r(150));return T=V.call(T),$(x,g,T,R)}if(typeof T.then=="function")return Tt(x,g,Ci(T),R);if(T.$$typeof===nt)return Tt(x,g,Ai(x,T),R);Di(x,T)}return typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint"?(T=""+T,g!==null&&g.tag===6?(l(x,g.sibling),R=n(g,T),R.return=x,x=R):(l(x,g),R=cc(T,x.mode,R),R.return=x,x=R),s(x)):l(x,g)}return function(x,g,T,R){try{pn=0;var V=Tt(x,g,T,R);return _a=null,V}catch(Z){if(Z===Da||Z===zi)throw Z;var yt=be(29,Z,null,x.mode);return yt.lanes=R,yt.return=x,yt}}}var na=Nr(!0),zr=Nr(!1),Tl=!1;function Sc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xc(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ol(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Al(t,e,l){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(pt&2)!==0){var n=a.pending;return n===null?e.next=e:(e.next=n.next,n.next=e),a.pending=e,e=ji(t),or(t,null,l),e}return xi(t,a,e,l),ji(t)}function bn(t,e,l){if(e=e.updateQueue,e!==null&&(e=e.shared,(l&4194048)!==0)){var a=e.lanes;a&=t.pendingLanes,l|=a,e.lanes=l,bf(t,l)}}function jc(t,e){var l=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,l===a)){var n=null,u=null;if(l=l.firstBaseUpdate,l!==null){do{var s={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};u===null?n=u=s:u=u.next=s,l=l.next}while(l!==null);u===null?n=u=e:u=u.next=e}else n=u=e;l={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=e:t.next=e,l.lastBaseUpdate=e}var Ec=!1;function Sn(){if(Ec){var t=Ca;if(t!==null)throw t}}function xn(t,e,l,a){Ec=!1;var n=t.updateQueue;Tl=!1;var u=n.firstBaseUpdate,s=n.lastBaseUpdate,h=n.shared.pending;if(h!==null){n.shared.pending=null;var p=h,O=p.next;p.next=null,s===null?u=O:s.next=O,s=p;var D=t.alternate;D!==null&&(D=D.updateQueue,h=D.lastBaseUpdate,h!==s&&(h===null?D.firstBaseUpdate=O:h.next=O,D.lastBaseUpdate=p))}if(u!==null){var U=n.baseState;s=0,D=O=p=null,h=u;do{var z=h.lane&-536870913,M=z!==h.lane;if(M?(st&z)===z:(a&z)===z){z!==0&&z===Ma&&(Ec=!0),D!==null&&(D=D.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});t:{var K=t,$=h;z=e;var Tt=l;switch($.tag){case 1:if(K=$.payload,typeof K=="function"){U=K.call(Tt,U,z);break t}U=K;break t;case 3:K.flags=K.flags&-65537|128;case 0:if(K=$.payload,z=typeof K=="function"?K.call(Tt,U,z):K,z==null)break t;U=j({},U,z);break t;case 2:Tl=!0}}z=h.callback,z!==null&&(t.flags|=64,M&&(t.flags|=8192),M=n.callbacks,M===null?n.callbacks=[z]:M.push(z))}else M={lane:z,tag:h.tag,payload:h.payload,callback:h.callback,next:null},D===null?(O=D=M,p=U):D=D.next=M,s|=z;if(h=h.next,h===null){if(h=n.shared.pending,h===null)break;M=h,h=M.next,M.next=null,n.lastBaseUpdate=M,n.shared.pending=null}}while(!0);D===null&&(p=U),n.baseState=p,n.firstBaseUpdate=O,n.lastBaseUpdate=D,u===null&&(n.shared.lanes=0),Dl|=s,t.lanes=s,t.memoizedState=U}}function Mr(t,e){if(typeof t!="function")throw Error(r(191,t));t.call(e)}function Cr(t,e){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;tu?u:8;var s=_.T,h={};_.T=h,Lc(t,!1,e,l);try{var p=n(),O=_.S;if(O!==null&&O(h,p),p!==null&&typeof p=="object"&&typeof p.then=="function"){var D=xy(p,a);Tn(t,e,D,Te(t))}else Tn(t,e,a,Te(t))}catch(U){Tn(t,e,{then:function(){},status:"rejected",reason:U},Te())}finally{Y.p=u,s!==null&&h.types!==null&&(s.types=h.types),_.T=s}}function Ny(){}function Yc(t,e,l,a){if(t.tag!==5)throw Error(r(476));var n=so(t).queue;co(t,n,e,J,l===null?Ny:function(){return fo(t),l(a)})}function so(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:J},next:null};var l={};return e.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:l},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function fo(t){var e=so(t);e.next===null&&(e=t.alternate.memoizedState),Tn(t,e.next.queue,{},Te())}function Gc(){return $t(Gn)}function ro(){return wt().memoizedState}function oo(){return wt().memoizedState}function zy(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var l=Te();t=Ol(l);var a=Al(e,t,l);a!==null&&(oe(a,e,l),bn(a,e,l)),e={cache:vc()},t.payload=e;return}e=e.return}}function My(t,e,l){var a=Te();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Gi(t)?mo(e,l):(l=ic(t,e,l,a),l!==null&&(oe(l,t,a),yo(l,e,a)))}function ho(t,e,l){var a=Te();Tn(t,e,l,a)}function Tn(t,e,l,a){var n={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Gi(t))mo(e,n);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=e.lastRenderedReducer,u!==null))try{var s=e.lastRenderedState,h=u(s,l);if(n.hasEagerState=!0,n.eagerState=h,ge(h,s))return xi(t,e,n,0),At===null&&Si(),!1}catch{}if(l=ic(t,e,n,a),l!==null)return oe(l,t,a),yo(l,e,a),!0}return!1}function Lc(t,e,l,a){if(a={lane:2,revertLane:Ss(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Gi(t)){if(e)throw Error(r(479))}else e=ic(t,l,a,2),e!==null&&oe(e,t,2)}function Gi(t){var e=t.alternate;return t===P||e!==null&&e===P}function mo(t,e){Ua=Ui=!0;var l=t.pending;l===null?e.next=e:(e.next=l.next,l.next=e),t.pending=e}function yo(t,e,l){if((l&4194048)!==0){var a=e.lanes;a&=t.pendingLanes,l|=a,e.lanes=l,bf(t,l)}}var On={readContext:$t,use:wi,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useInsertionEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useSyncExternalStore:Rt,useId:Rt,useHostTransitionStatus:Rt,useFormState:Rt,useActionState:Rt,useOptimistic:Rt,useMemoCache:Rt,useCacheRefresh:Rt};On.useEffectEvent=Rt;var vo={readContext:$t,use:wi,useCallback:function(t,e){return ae().memoizedState=[t,e===void 0?null:e],t},useContext:$t,useEffect:Ir,useImperativeHandle:function(t,e,l){l=l!=null?l.concat([t]):null,Bi(4194308,4,lo.bind(null,e,t),l)},useLayoutEffect:function(t,e){return Bi(4194308,4,t,e)},useInsertionEffect:function(t,e){Bi(4,2,t,e)},useMemo:function(t,e){var l=ae();e=e===void 0?null:e;var a=t();if(ia){pl(!0);try{t()}finally{pl(!1)}}return l.memoizedState=[a,e],a},useReducer:function(t,e,l){var a=ae();if(l!==void 0){var n=l(e);if(ia){pl(!0);try{l(e)}finally{pl(!1)}}}else n=e;return a.memoizedState=a.baseState=n,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=My.bind(null,P,t),[a.memoizedState,t]},useRef:function(t){var e=ae();return t={current:t},e.memoizedState=t},useState:function(t){t=Hc(t);var e=t.queue,l=ho.bind(null,P,e);return e.dispatch=l,[t.memoizedState,l]},useDebugValue:Qc,useDeferredValue:function(t,e){var l=ae();return Bc(l,t,e)},useTransition:function(){var t=Hc(!1);return t=co.bind(null,P,t.queue,!0,!1),ae().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,l){var a=P,n=ae();if(rt){if(l===void 0)throw Error(r(407));l=l()}else{if(l=e(),At===null)throw Error(r(349));(st&127)!==0||qr(a,e,l)}n.memoizedState=l;var u={value:l,getSnapshot:e};return n.queue=u,Ir(Qr.bind(null,a,u,t),[t]),a.flags|=2048,qa(9,{destroy:void 0},wr.bind(null,a,u,l,e),null),l},useId:function(){var t=ae(),e=At.identifierPrefix;if(rt){var l=Ze,a=Ke;l=(a&~(1<<32-pe(a)-1)).toString(32)+l,e="_"+e+"R_"+l,l=Hi++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?s.createElement("select",{is:a.is}):s.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?s.createElement(n,{is:a.is}):s.createElement(n)}}u[kt]=e,u[ie]=a;t:for(s=e.child;s!==null;){if(s.tag===5||s.tag===6)u.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break t;for(;s.sibling===null;){if(s.return===null||s.return===e)break t;s=s.return}s.sibling.return=s.return,s=s.sibling}e.stateNode=u;t:switch(It(u,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break t;case"img":a=!0;break t;default:a=!1}a&&il(e)}}return Ct(e),ls(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,l),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==a&&il(e);else{if(typeof a!="string"&&e.stateNode===null)throw Error(r(166));if(t=et.current,Na(e)){if(t=e.stateNode,l=e.memoizedProps,a=null,n=Ft,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}t[kt]=e,t=!!(t.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||Hd(t.nodeValue,l)),t||jl(e,!0)}else t=cu(t).createTextNode(a),t[kt]=e,e.stateNode=t}return Ct(e),null;case 31:if(l=e.memoizedState,t===null||t.memoizedState!==null){if(a=Na(e),l!==null){if(t===null){if(!a)throw Error(r(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[kt]=e}else Il(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ct(e),t=!1}else l=dc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return e.flags&256?(xe(e),e):(xe(e),null);if((e.flags&128)!==0)throw Error(r(558))}return Ct(e),null;case 13:if(a=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(n=Na(e),a!==null&&a.dehydrated!==null){if(t===null){if(!n)throw Error(r(318));if(n=e.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));n[kt]=e}else Il(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ct(e),n=!1}else n=dc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),n=!0;if(!n)return e.flags&256?(xe(e),e):(xe(e),null)}return xe(e),(e.flags&128)!==0?(e.lanes=l,e):(l=a!==null,t=t!==null&&t.memoizedState!==null,l&&(a=e.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==n&&(a.flags|=2048)),l!==t&&l&&(e.child.flags|=8192),Vi(e,e.updateQueue),Ct(e),null);case 4:return Dt(),t===null&&Ts(e.stateNode.containerInfo),Ct(e),null;case 10:return el(e.type),Ct(e),null;case 19:if(H(qt),a=e.memoizedState,a===null)return Ct(e),null;if(n=(e.flags&128)!==0,u=a.rendering,u===null)if(n)Nn(a,!1);else{if(Ut!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(u=Ri(t),u!==null){for(e.flags|=128,Nn(a,!1),t=u.updateQueue,e.updateQueue=t,Vi(e,t),e.subtreeFlags=0,t=l,l=e.child;l!==null;)dr(l,t),l=l.sibling;return G(qt,qt.current&1|2),rt&&Pe(e,a.treeForkCount),e.child}t=t.sibling}a.tail!==null&&k()>Wi&&(e.flags|=128,n=!0,Nn(a,!1),e.lanes=4194304)}else{if(!n)if(t=Ri(u),t!==null){if(e.flags|=128,n=!0,t=t.updateQueue,e.updateQueue=t,Vi(e,t),Nn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!rt)return Ct(e),null}else 2*k()-a.renderingStartTime>Wi&&l!==536870912&&(e.flags|=128,n=!0,Nn(a,!1),e.lanes=4194304);a.isBackwards?(u.sibling=e.child,e.child=u):(t=a.last,t!==null?t.sibling=u:e.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=k(),t.sibling=null,l=qt.current,G(qt,n?l&1|2:l&1),rt&&Pe(e,a.treeForkCount),t):(Ct(e),null);case 22:case 23:return xe(e),Oc(),a=e.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(e.flags|=8192):a&&(e.flags|=8192),a?(l&536870912)!==0&&(e.flags&128)===0&&(Ct(e),e.subtreeFlags&6&&(e.flags|=8192)):Ct(e),l=e.updateQueue,l!==null&&Vi(e,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),a=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),a!==l&&(e.flags|=2048),t!==null&&H(ea),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),e.memoizedState.cache!==l&&(e.flags|=2048),el(Qt),Ct(e),null;case 25:return null;case 30:return null}throw Error(r(156,e.tag))}function Uy(t,e){switch(rc(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return el(Qt),Dt(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return Kl(e),null;case 31:if(e.memoizedState!==null){if(xe(e),e.alternate===null)throw Error(r(340));Il()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(xe(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(r(340));Il()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return H(qt),null;case 4:return Dt(),null;case 10:return el(e.type),null;case 22:case 23:return xe(e),Oc(),t!==null&&H(ea),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return el(Qt),null;case 25:return null;default:return null}}function Yo(t,e){switch(rc(e),e.tag){case 3:el(Qt),Dt();break;case 26:case 27:case 5:Kl(e);break;case 4:Dt();break;case 31:e.memoizedState!==null&&xe(e);break;case 13:xe(e);break;case 19:H(qt);break;case 10:el(e.type);break;case 22:case 23:xe(e),Oc(),t!==null&&H(ea);break;case 24:el(Qt)}}function zn(t,e){try{var l=e.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var n=a.next;l=n;do{if((l.tag&t)===t){a=void 0;var u=l.create,s=l.inst;a=u(),s.destroy=a}l=l.next}while(l!==n)}}catch(h){xt(e,e.return,h)}}function Ml(t,e,l){try{var a=e.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var u=n.next;a=u;do{if((a.tag&t)===t){var s=a.inst,h=s.destroy;if(h!==void 0){s.destroy=void 0,n=e;var p=l,O=h;try{O()}catch(D){xt(n,p,D)}}}a=a.next}while(a!==u)}}catch(D){xt(e,e.return,D)}}function Go(t){var e=t.updateQueue;if(e!==null){var l=t.stateNode;try{Cr(e,l)}catch(a){xt(t,t.return,a)}}}function Lo(t,e,l){l.props=ua(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(a){xt(t,e,a)}}function Mn(t,e){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof l=="function"?t.refCleanup=l(a):l.current=a}}catch(n){xt(t,e,n)}}function Ve(t,e){var l=t.ref,a=t.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(n){xt(t,e,n)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(n){xt(t,e,n)}else l.current=null}function Xo(t){var e=t.type,l=t.memoizedProps,a=t.stateNode;try{t:switch(e){case"button":case"input":case"select":case"textarea":l.autoFocus&&a.focus();break t;case"img":l.src?a.src=l.src:l.srcSet&&(a.srcset=l.srcSet)}}catch(n){xt(t,t.return,n)}}function as(t,e,l){try{var a=t.stateNode;lv(a,t.type,l,e),a[ie]=e}catch(n){xt(t,t.return,n)}}function Ko(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ql(t.type)||t.tag===4}function ns(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||Ko(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ql(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function is(t,e,l){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,e):(e=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,e.appendChild(t),l=l._reactRootContainer,l!=null||e.onclick!==null||(e.onclick=$e));else if(a!==4&&(a===27&&ql(t.type)&&(l=t.stateNode,e=null),t=t.child,t!==null))for(is(t,e,l),t=t.sibling;t!==null;)is(t,e,l),t=t.sibling}function Ji(t,e,l){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?l.insertBefore(t,e):l.appendChild(t);else if(a!==4&&(a===27&&ql(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(Ji(t,e,l),t=t.sibling;t!==null;)Ji(t,e,l),t=t.sibling}function Zo(t){var e=t.stateNode,l=t.memoizedProps;try{for(var a=t.type,n=e.attributes;n.length;)e.removeAttributeNode(n[0]);It(e,a,l),e[kt]=t,e[ie]=l}catch(u){xt(t,t.return,u)}}var ul=!1,Gt=!1,us=!1,Vo=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function Hy(t,e){if(t=t.containerInfo,Ns=mu,t=ar(t),Pu(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else t:{l=(l=t.ownerDocument)&&l.defaultView||window;var a=l.getSelection&&l.getSelection();if(a&&a.rangeCount!==0){l=a.anchorNode;var n=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{l.nodeType,u.nodeType}catch{l=null;break t}var s=0,h=-1,p=-1,O=0,D=0,U=t,z=null;e:for(;;){for(var M;U!==l||n!==0&&U.nodeType!==3||(h=s+n),U!==u||a!==0&&U.nodeType!==3||(p=s+a),U.nodeType===3&&(s+=U.nodeValue.length),(M=U.firstChild)!==null;)z=U,U=M;for(;;){if(U===t)break e;if(z===l&&++O===n&&(h=s),z===u&&++D===a&&(p=s),(M=U.nextSibling)!==null)break;U=z,z=U.parentNode}U=M}l=h===-1||p===-1?null:{start:h,end:p}}else l=null}l=l||{start:0,end:0}}else l=null;for(zs={focusedElem:t,selectionRange:l},mu=!1,Zt=e;Zt!==null;)if(e=Zt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Zt=t;else for(;Zt!==null;){switch(e=Zt,u=e.alternate,t=e.flags,e.tag){case 0:if((t&4)!==0&&(t=e.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l title"))),It(u,a,l),u[kt]=t,Kt(u),a=u;break t;case"link":var s=Id("link","href",n).get(a+(l.href||""));if(s){for(var h=0;hTt&&(s=Tt,Tt=$,$=s);var x=er(h,$),g=er(h,Tt);if(x&&g&&(M.rangeCount!==1||M.anchorNode!==x.node||M.anchorOffset!==x.offset||M.focusNode!==g.node||M.focusOffset!==g.offset)){var T=U.createRange();T.setStart(x.node,x.offset),M.removeAllRanges(),$>Tt?(M.addRange(T),M.extend(g.node,g.offset)):(T.setEnd(g.node,g.offset),M.addRange(T))}}}}for(U=[],M=h;M=M.parentNode;)M.nodeType===1&&U.push({element:M,left:M.scrollLeft,top:M.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;hl?32:l,_.T=null,l=hs,hs=null;var u=Rl,s=ol;if(Xt=0,Ga=Rl=null,ol=0,(pt&6)!==0)throw Error(r(331));var h=pt;if(pt|=4,ad(u.current),td(u,u.current,s,l),pt=h,Hn(0,!1),ve&&typeof ve.onPostCommitFiberRoot=="function")try{ve.onPostCommitFiberRoot(Ia,u)}catch{}return!0}finally{Y.p=n,_.T=a,xd(t,e)}}function Ed(t,e,l){e=Ce(l,e),e=Vc(t.stateNode,e,2),t=Al(t,e,2),t!==null&&(tn(t,2),Je(t))}function xt(t,e,l){if(t.tag===3)Ed(t,t,l);else for(;e!==null;){if(e.tag===3){Ed(e,t,l);break}else if(e.tag===1){var a=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(_l===null||!_l.has(a))){t=Ce(l,t),l=To(2),a=Al(e,l,2),a!==null&&(Oo(l,a,e,t),tn(a,2),Je(a));break}}e=e.return}}function ps(t,e,l){var a=t.pingCache;if(a===null){a=t.pingCache=new Qy;var n=new Set;a.set(e,n)}else n=a.get(e),n===void 0&&(n=new Set,a.set(e,n));n.has(l)||(fs=!0,n.add(l),t=Xy.bind(null,t,e,l),e.then(t,t))}function Xy(t,e,l){var a=t.pingCache;a!==null&&a.delete(e),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,At===t&&(st&l)===l&&(Ut===4||Ut===3&&(st&62914560)===st&&300>k()-$i?(pt&2)===0&&La(t,0):rs|=l,Ya===st&&(Ya=0)),Je(t)}function Td(t,e){e===0&&(e=pf()),t=$l(t,e),t!==null&&(tn(t,e),Je(t))}function Ky(t){var e=t.memoizedState,l=0;e!==null&&(l=e.retryLane),Td(t,l)}function Zy(t,e){var l=0;switch(t.tag){case 31:case 13:var a=t.stateNode,n=t.memoizedState;n!==null&&(l=n.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(r(314))}a!==null&&a.delete(e),Td(t,l)}function Vy(t,e){return Xe(t,e)}var au=null,Ka=null,gs=!1,nu=!1,bs=!1,Hl=0;function Je(t){t!==Ka&&t.next===null&&(Ka===null?au=Ka=t:Ka=Ka.next=t),nu=!0,gs||(gs=!0,ky())}function Hn(t,e){if(!bs&&nu){bs=!0;do for(var l=!1,a=au;a!==null;){if(t!==0){var n=a.pendingLanes;if(n===0)var u=0;else{var s=a.suspendedLanes,h=a.pingedLanes;u=(1<<31-pe(42|t)+1)-1,u&=n&~(s&~h),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,zd(a,u))}else u=st,u=si(a,a===At?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Pa(a,u)||(l=!0,zd(a,u));a=a.next}while(l);bs=!1}}function Jy(){Od()}function Od(){nu=gs=!1;var t=0;Hl!==0&&nv()&&(t=Hl);for(var e=k(),l=null,a=au;a!==null;){var n=a.next,u=Ad(a,e);u===0?(a.next=null,l===null?au=n:l.next=n,n===null&&(Ka=l)):(l=a,(t!==0||(u&3)!==0)&&(nu=!0)),a=n}Xt!==0&&Xt!==5||Hn(t),Hl!==0&&(Hl=0)}function Ad(t,e){for(var l=t.suspendedLanes,a=t.pingedLanes,n=t.expirationTimes,u=t.pendingLanes&-62914561;0h)break;var D=p.transferSize,U=p.initiatorType;D&&qd(U)&&(p=p.responseEnd,s+=D*(p"u"?null:document;function kd(t,e,l){var a=Za;if(a&&typeof e=="string"&&e){var n=ze(e);n='link[rel="'+t+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),Jd.has(n)||(Jd.add(n),t={rel:t,crossOrigin:l,href:e},a.querySelector(n)===null&&(e=a.createElement("link"),It(e,"link",t),Kt(e),a.head.appendChild(e)))}}function hv(t){dl.D(t),kd("dns-prefetch",t,null)}function mv(t,e){dl.C(t,e),kd("preconnect",t,e)}function yv(t,e,l){dl.L(t,e,l);var a=Za;if(a&&t&&e){var n='link[rel="preload"][as="'+ze(e)+'"]';e==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+ze(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+ze(l.imageSizes)+'"]')):n+='[href="'+ze(t)+'"]';var u=n;switch(e){case"style":u=Va(t);break;case"script":u=Ja(t)}qe.has(u)||(t=j({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),qe.set(u,t),a.querySelector(n)!==null||e==="style"&&a.querySelector(Bn(u))||e==="script"&&a.querySelector(Yn(u))||(e=a.createElement("link"),It(e,"link",t),Kt(e),a.head.appendChild(e)))}}function vv(t,e){dl.m(t,e);var l=Za;if(l&&t){var a=e&&typeof e.as=="string"?e.as:"script",n='link[rel="modulepreload"][as="'+ze(a)+'"][href="'+ze(t)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ja(t)}if(!qe.has(u)&&(t=j({rel:"modulepreload",href:t},e),qe.set(u,t),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Yn(u)))return}a=l.createElement("link"),It(a,"link",t),Kt(a),l.head.appendChild(a)}}}function pv(t,e,l){dl.S(t,e,l);var a=Za;if(a&&t){var n=ma(a).hoistableStyles,u=Va(t);e=e||"default";var s=n.get(u);if(!s){var h={loading:0,preload:null};if(s=a.querySelector(Bn(u)))h.loading=5;else{t=j({rel:"stylesheet",href:t,"data-precedence":e},l),(l=qe.get(u))&&Hs(t,l);var p=s=a.createElement("link");Kt(p),It(p,"link",t),p._p=new Promise(function(O,D){p.onload=O,p.onerror=D}),p.addEventListener("load",function(){h.loading|=1}),p.addEventListener("error",function(){h.loading|=2}),h.loading|=4,fu(s,e,a)}s={type:"stylesheet",instance:s,count:1,state:h},n.set(u,s)}}}function gv(t,e){dl.X(t,e);var l=Za;if(l&&t){var a=ma(l).hoistableScripts,n=Ja(t),u=a.get(n);u||(u=l.querySelector(Yn(n)),u||(t=j({src:t,async:!0},e),(e=qe.get(n))&&qs(t,e),u=l.createElement("script"),Kt(u),It(u,"link",t),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function bv(t,e){dl.M(t,e);var l=Za;if(l&&t){var a=ma(l).hoistableScripts,n=Ja(t),u=a.get(n);u||(u=l.querySelector(Yn(n)),u||(t=j({src:t,async:!0,type:"module"},e),(e=qe.get(n))&&qs(t,e),u=l.createElement("script"),Kt(u),It(u,"link",t),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function Fd(t,e,l,a){var n=(n=et.current)?su(n):null;if(!n)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(e=Va(l.href),l=ma(n).hoistableStyles,a=l.get(e),a||(a={type:"style",instance:null,count:0,state:null},l.set(e,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=Va(l.href);var u=ma(n).hoistableStyles,s=u.get(t);if(s||(n=n.ownerDocument||n,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,s),(u=n.querySelector(Bn(t)))&&!u._p&&(s.instance=u,s.state.loading=5),qe.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},qe.set(t,l),u||Sv(n,t,l,s.state))),e&&a===null)throw Error(r(528,""));return s}if(e&&a!==null)throw Error(r(529,""));return null;case"script":return e=l.async,l=l.src,typeof l=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Ja(l),l=ma(n).hoistableScripts,a=l.get(e),a||(a={type:"script",instance:null,count:0,state:null},l.set(e,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function Va(t){return'href="'+ze(t)+'"'}function Bn(t){return'link[rel="stylesheet"]['+t+"]"}function $d(t){return j({},t,{"data-precedence":t.precedence,precedence:null})}function Sv(t,e,l,a){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?a.loading=1:(e=t.createElement("link"),a.preload=e,e.addEventListener("load",function(){return a.loading|=1}),e.addEventListener("error",function(){return a.loading|=2}),It(e,"link",l),Kt(e),t.head.appendChild(e))}function Ja(t){return'[src="'+ze(t)+'"]'}function Yn(t){return"script[async]"+t}function Wd(t,e,l){if(e.count++,e.instance===null)switch(e.type){case"style":var a=t.querySelector('style[data-href~="'+ze(l.href)+'"]');if(a)return e.instance=a,Kt(a),a;var n=j({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),Kt(a),It(a,"style",n),fu(a,l.precedence,t),e.instance=a;case"stylesheet":n=Va(l.href);var u=t.querySelector(Bn(n));if(u)return e.state.loading|=4,e.instance=u,Kt(u),u;a=$d(l),(n=qe.get(n))&&Hs(a,n),u=(t.ownerDocument||t).createElement("link"),Kt(u);var s=u;return s._p=new Promise(function(h,p){s.onload=h,s.onerror=p}),It(u,"link",a),e.state.loading|=4,fu(u,l.precedence,t),e.instance=u;case"script":return u=Ja(l.src),(n=t.querySelector(Yn(u)))?(e.instance=n,Kt(n),n):(a=l,(n=qe.get(u))&&(a=j({},l),qs(a,n)),t=t.ownerDocument||t,n=t.createElement("script"),Kt(n),It(n,"link",a),t.head.appendChild(n),e.instance=n);case"void":return null;default:throw Error(r(443,e.type))}else e.type==="stylesheet"&&(e.state.loading&4)===0&&(a=e.instance,e.state.loading|=4,fu(a,l.precedence,t));return e.instance}function fu(t,e,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,u=n,s=0;s title"):null)}function xv(t,e,l){if(l===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;return e.rel==="stylesheet"?(t=e.disabled,typeof e.precedence=="string"&&t==null):!0;case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function th(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function jv(t,e,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var n=Va(a.href),u=e.querySelector(Bn(n));if(u){e=u._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=ou.bind(t),e.then(t,t)),l.state.loading|=4,l.instance=u,Kt(u);return}u=e.ownerDocument||e,a=$d(a),(n=qe.get(n))&&Hs(a,n),u=u.createElement("link"),Kt(u);var s=u;s._p=new Promise(function(h,p){s.onload=h,s.onerror=p}),It(u,"link",a),l.instance=u}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,e),(e=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=ou.bind(t),e.addEventListener("load",l),e.addEventListener("error",l))}}var ws=0;function Ev(t,e){return t.stylesheets&&t.count===0&&hu(t,t.stylesheets),0ws?50:800)+e);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function ou(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)hu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var du=null;function hu(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,du=new Map,e.forEach(Tv,t),du=null,ou.call(t))}function Tv(t,e){if(!(e.state.loading&4)){var l=du.get(t);if(l)var a=l.get(null);else{l=new Map,du.set(t,l);for(var n=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),Vs.exports=Yv(),Vs.exports}var Lv=Gv(),ei=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(i){return this.listeners.add(i),this.onSubscribe(),()=>{this.listeners.delete(i),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Xv=class extends ei{#t;#e;#l;constructor(){super(),this.#l=i=>{if(typeof window<"u"&&window.addEventListener){const c=()=>i();return window.addEventListener("visibilitychange",c,!1),()=>{window.removeEventListener("visibilitychange",c)}}}}onSubscribe(){this.#e||this.setEventListener(this.#l)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(i){this.#l=i,this.#e?.(),this.#e=i(c=>{typeof c=="boolean"?this.setFocused(c):this.onFocus()})}setFocused(i){this.#t!==i&&(this.#t=i,this.onFocus())}onFocus(){const i=this.isFocused();this.listeners.forEach(c=>{c(i)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},sf=new Xv,Kv={setTimeout:(i,c)=>setTimeout(i,c),clearTimeout:i=>clearTimeout(i),setInterval:(i,c)=>setInterval(i,c),clearInterval:i=>clearInterval(i)},Zv=class{#t=Kv;#e=!1;setTimeoutProvider(i){this.#t=i}setTimeout(i,c){return this.#t.setTimeout(i,c)}clearTimeout(i){this.#t.clearTimeout(i)}setInterval(i,c){return this.#t.setInterval(i,c)}clearInterval(i){this.#t.clearInterval(i)}},fa=new Zv;function Vv(i){setTimeout(i,0)}var Jv=typeof window>"u"||"Deno"in globalThis;function de(){}function kv(i,c){return typeof i=="function"?i(c):i}function Is(i){return typeof i=="number"&&i>=0&&i!==1/0}function Zh(i,c){return Math.max(i+(c||0)-Date.now(),0)}function Xl(i,c){return typeof i=="function"?i(c):i}function Oe(i,c){return typeof i=="function"?i(c):i}function Th(i,c){const{type:f="all",exact:r,fetchStatus:d,predicate:y,queryKey:S,stale:A}=i;if(S){if(r){if(c.queryHash!==ff(S,c.options))return!1}else if(!Fn(c.queryKey,S))return!1}if(f!=="all"){const v=c.isActive();if(f==="active"&&!v||f==="inactive"&&v)return!1}return!(typeof A=="boolean"&&c.isStale()!==A||d&&d!==c.state.fetchStatus||y&&!y(c))}function Oh(i,c){const{exact:f,status:r,predicate:d,mutationKey:y}=i;if(y){if(!c.options.mutationKey)return!1;if(f){if(kn(c.options.mutationKey)!==kn(y))return!1}else if(!Fn(c.options.mutationKey,y))return!1}return!(r&&c.state.status!==r||d&&!d(c))}function ff(i,c){return(c?.queryKeyHashFn||kn)(i)}function kn(i){return JSON.stringify(i,(c,f)=>tf(f)?Object.keys(f).sort().reduce((r,d)=>(r[d]=f[d],r),{}):f)}function Fn(i,c){return i===c?!0:typeof i!=typeof c?!1:i&&c&&typeof i=="object"&&typeof c=="object"?Object.keys(c).every(f=>Fn(i[f],c[f])):!1}var Fv=Object.prototype.hasOwnProperty;function Vh(i,c,f=0){if(i===c)return i;if(f>500)return c;const r=Ah(i)&&Ah(c);if(!r&&!(tf(i)&&tf(c)))return c;const y=(r?i:Object.keys(i)).length,S=r?c:Object.keys(c),A=S.length,v=r?new Array(A):{};let m=0;for(let N=0;N{fa.setTimeout(c,i)})}function ef(i,c,f){return typeof f.structuralSharing=="function"?f.structuralSharing(i,c):f.structuralSharing!==!1?Vh(i,c):c}function Wv(i,c,f=0){const r=[...i,c];return f&&r.length>f?r.slice(1):r}function Iv(i,c,f=0){const r=[c,...i];return f&&r.length>f?r.slice(0,-1):r}var rf=Symbol();function Jh(i,c){return!i.queryFn&&c?.initialPromise?()=>c.initialPromise:!i.queryFn||i.queryFn===rf?()=>Promise.reject(new Error(`Missing queryFn: '${i.queryHash}'`)):i.queryFn}function kh(i,c){return typeof i=="function"?i(...c):!!i}function Pv(i,c,f){let r=!1,d;return Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(d??=c(),r||(r=!0,d.aborted?f():d.addEventListener("abort",f,{once:!0})),d)}),i}var $n=(()=>{let i=()=>Jv;return{isServer(){return i()},setIsServer(c){i=c}}})();function lf(){let i,c;const f=new Promise((d,y)=>{i=d,c=y});f.status="pending",f.catch(()=>{});function r(d){Object.assign(f,d),delete f.resolve,delete f.reject}return f.resolve=d=>{r({status:"fulfilled",value:d}),i(d)},f.reject=d=>{r({status:"rejected",reason:d}),c(d)},f}var t0=Vv;function e0(){let i=[],c=0,f=A=>{A()},r=A=>{A()},d=t0;const y=A=>{c?i.push(A):d(()=>{f(A)})},S=()=>{const A=i;i=[],A.length&&d(()=>{r(()=>{A.forEach(v=>{f(v)})})})};return{batch:A=>{let v;c++;try{v=A()}finally{c--,c||S()}return v},batchCalls:A=>(...v)=>{y(()=>{A(...v)})},schedule:y,setNotifyFunction:A=>{f=A},setBatchNotifyFunction:A=>{r=A},setScheduler:A=>{d=A}}}var Pt=e0(),l0=class extends ei{#t=!0;#e;#l;constructor(){super(),this.#l=i=>{if(typeof window<"u"&&window.addEventListener){const c=()=>i(!0),f=()=>i(!1);return window.addEventListener("online",c,!1),window.addEventListener("offline",f,!1),()=>{window.removeEventListener("online",c),window.removeEventListener("offline",f)}}}}onSubscribe(){this.#e||this.setEventListener(this.#l)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(i){this.#l=i,this.#e?.(),this.#e=i(this.setOnline.bind(this))}setOnline(i){this.#t!==i&&(this.#t=i,this.listeners.forEach(f=>{f(i)}))}isOnline(){return this.#t}},Au=new l0;function a0(i){return Math.min(1e3*2**i,3e4)}function Fh(i){return(i??"online")==="online"?Au.isOnline():!0}var af=class extends Error{constructor(i){super("CancelledError"),this.revert=i?.revert,this.silent=i?.silent}};function $h(i){let c=!1,f=0,r;const d=lf(),y=()=>d.status!=="pending",S=w=>{if(!y()){const B=new af(w);E(B),i.onCancel?.(B)}},A=()=>{c=!0},v=()=>{c=!1},m=()=>sf.isFocused()&&(i.networkMode==="always"||Au.isOnline())&&i.canRun(),N=()=>Fh(i.networkMode)&&i.canRun(),j=w=>{y()||(r?.(),d.resolve(w))},E=w=>{y()||(r?.(),d.reject(w))},q=()=>new Promise(w=>{r=B=>{(y()||m())&&w(B)},i.onPause?.()}).then(()=>{r=void 0,y()||i.onContinue?.()}),C=()=>{if(y())return;let w;const B=f===0?i.initialPromise:void 0;try{w=B??i.fn()}catch(L){w=Promise.reject(L)}Promise.resolve(w).then(j).catch(L=>{if(y())return;const dt=i.retry??($n.isServer()?0:3),nt=i.retryDelay??a0,Ot=typeof nt=="function"?nt(f,L):nt,Nt=dt===!0||typeof dt=="number"&&fm()?void 0:q()).then(()=>{c?E(L):C()})})};return{promise:d,status:()=>d.status,cancel:S,continue:()=>(r?.(),d),cancelRetry:A,continueRetry:v,canStart:N,start:()=>(N()?C():q().then(C),d)}}var Wh=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Is(this.gcTime)&&(this.#t=fa.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(i){this.gcTime=Math.max(this.gcTime||0,i??($n.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#t!==void 0&&(fa.clearTimeout(this.#t),this.#t=void 0)}};function n0(i){return{onFetch:(c,f)=>{const r=c.options,d=c.fetchOptions?.meta?.fetchMore?.direction,y=c.state.data?.pages||[],S=c.state.data?.pageParams||[];let A={pages:[],pageParams:[]},v=0;const m=async()=>{let N=!1;const j=C=>{Pv(C,()=>c.signal,()=>N=!0)},E=Jh(c.options,c.fetchOptions),q=async(C,w,B)=>{if(N)return Promise.reject(c.signal.reason);if(w==null&&C.pages.length)return Promise.resolve(C);const dt=(()=>{const tt={client:c.client,queryKey:c.queryKey,pageParam:w,direction:B?"backward":"forward",meta:c.options.meta};return j(tt),tt})(),nt=await E(dt),{maxPages:Ot}=c.options,Nt=B?Iv:Wv;return{pages:Nt(C.pages,nt,Ot),pageParams:Nt(C.pageParams,w,Ot)}};if(d&&y.length){const C=d==="backward",w=C?i0:zh,B={pages:y,pageParams:S},L=w(r,B);A=await q(B,L,C)}else{const C=i??y.length;do{const w=v===0?S[0]??r.initialPageParam:zh(r,A);if(v>0&&w==null)break;A=await q(A,w),v++}while(vc.options.persister?.(m,{client:c.client,queryKey:c.queryKey,meta:c.options.meta,signal:c.signal},f):c.fetchFn=m}}}function zh(i,{pages:c,pageParams:f}){const r=c.length-1;return c.length>0?i.getNextPageParam(c[r],c,f[r],f):void 0}function i0(i,{pages:c,pageParams:f}){return c.length>0?i.getPreviousPageParam?.(c[0],c,f[0],f):void 0}var u0=class extends Wh{#t;#e;#l;#a;#i;#n;#c;#u;constructor(i){super(),this.#u=!1,this.#c=i.defaultOptions,this.setOptions(i.options),this.observers=[],this.#i=i.client,this.#a=this.#i.getQueryCache(),this.queryKey=i.queryKey,this.queryHash=i.queryHash,this.#e=Ch(this.options),this.state=i.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#t}get promise(){return this.#n?.promise}setOptions(i){if(this.options={...this.#c,...i},i?._type&&(this.#t=i._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const c=Ch(this.options);c.data!==void 0&&(this.setState(Mh(c.data,c.dataUpdatedAt)),this.#e=c)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(i,c){const f=ef(this.state.data,i,this.options);return this.#s({data:f,type:"success",dataUpdatedAt:c?.updatedAt,manual:c?.manual}),f}setState(i){this.#s({type:"setState",state:i})}cancel(i){const c=this.#n?.promise;return this.#n?.cancel(i),c?c.then(de).catch(de):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(i=>Oe(i.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rf||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(i=>Xl(i.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(i=>i.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(i=0){return this.state.data===void 0?!0:i==="static"?!1:this.state.isInvalidated?!0:!Zh(this.state.dataUpdatedAt,i)}onFocus(){this.observers.find(c=>c.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(c=>c.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(i){this.observers.includes(i)||(this.observers.push(i),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:i}))}removeObserver(i){this.observers.includes(i)&&(this.observers=this.observers.filter(c=>c!==i),this.observers.length||(this.#n&&(this.#u||this.#r()?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#a.notify({type:"observerRemoved",query:this,observer:i}))}getObserversCount(){return this.observers.length}#r(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(i,c){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&c?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(i&&this.setOptions(i),!this.options.queryFn){const v=this.observers.find(m=>m.options.queryFn);v&&this.setOptions(v.options)}const f=new AbortController,r=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(this.#u=!0,f.signal)})},d=()=>{const v=Jh(this.options,c),N=(()=>{const j={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(j),j})();return this.#u=!1,this.options.persister?this.options.persister(v,N,this):v(N)},S=(()=>{const v={fetchOptions:c,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:d};return r(v),v})();(this.#t==="infinite"?n0(this.options.pages):this.options.behavior)?.onFetch(S,this),this.#l=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==S.fetchOptions?.meta)&&this.#s({type:"fetch",meta:S.fetchOptions?.meta}),this.#n=$h({initialPromise:c?.initialPromise,fn:S.fetchFn,onCancel:v=>{v instanceof af&&v.revert&&this.setState({...this.#l,fetchStatus:"idle"}),f.abort()},onFail:(v,m)=>{this.#s({type:"failed",failureCount:v,error:m})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:S.options.retry,retryDelay:S.options.retryDelay,networkMode:S.options.networkMode,canRun:()=>!0});try{const v=await this.#n.start();if(v===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(v),this.#a.config.onSuccess?.(v,this),this.#a.config.onSettled?.(v,this.state.error,this),v}catch(v){if(v instanceof af){if(v.silent)return this.#n.promise;if(v.revert){if(this.state.data===void 0)throw v;return this.state.data}}throw this.#s({type:"error",error:v}),this.#a.config.onError?.(v,this),this.#a.config.onSettled?.(this.state.data,v,this),v}finally{this.scheduleGc()}}#s(i){const c=f=>{switch(i.type){case"failed":return{...f,fetchFailureCount:i.failureCount,fetchFailureReason:i.error};case"pause":return{...f,fetchStatus:"paused"};case"continue":return{...f,fetchStatus:"fetching"};case"fetch":return{...f,...Ih(f.data,this.options),fetchMeta:i.meta??null};case"success":const r={...f,...Mh(i.data,i.dataUpdatedAt),dataUpdateCount:f.dataUpdateCount+1,...!i.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=i.manual?r:void 0,r;case"error":const d=i.error;return{...f,error:d,errorUpdateCount:f.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:f.fetchFailureCount+1,fetchFailureReason:d,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...f,isInvalidated:!0};case"setState":return{...f,...i.state}}};this.state=c(this.state),Pt.batch(()=>{this.observers.forEach(f=>{f.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:i})})}};function Ih(i,c){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Fh(c.networkMode)?"fetching":"paused",...i===void 0&&{error:null,status:"pending"}}}function Mh(i,c){return{data:i,dataUpdatedAt:c??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ch(i){const c=typeof i.initialData=="function"?i.initialData():i.initialData,f=c!==void 0,r=f?typeof i.initialDataUpdatedAt=="function"?i.initialDataUpdatedAt():i.initialDataUpdatedAt:0;return{data:c,dataUpdateCount:0,dataUpdatedAt:f?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:f?"success":"pending",fetchStatus:"idle"}}var c0=class extends ei{constructor(i,c){super(),this.options=c,this.#t=i,this.#u=null,this.#c=lf(),this.bindMethods(),this.setOptions(c)}#t;#e=void 0;#l=void 0;#a=void 0;#i;#n;#c;#u;#r;#s;#m;#o;#d;#f;#y=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Dh(this.#e,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return nf(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return nf(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#S(),this.#x(),this.#e.removeObserver(this)}setOptions(i){const c=this.options,f=this.#e;if(this.options=this.#t.defaultQueryOptions(i),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Oe(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#e.setOptions(this.options),c._defaulted&&!Ps(this.options,c)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&_h(this.#e,f,this.options,c)&&this.#h(),this.updateResult(),r&&(this.#e!==f||Oe(this.options.enabled,this.#e)!==Oe(c.enabled,this.#e)||Xl(this.options.staleTime,this.#e)!==Xl(c.staleTime,this.#e))&&this.#v();const d=this.#p();r&&(this.#e!==f||Oe(this.options.enabled,this.#e)!==Oe(c.enabled,this.#e)||d!==this.#f)&&this.#g(d)}getOptimisticResult(i){const c=this.#t.getQueryCache().build(this.#t,i),f=this.createResult(c,i);return f0(this,f)&&(this.#a=f,this.#n=this.options,this.#i=this.#e.state),f}getCurrentResult(){return this.#a}trackResult(i,c){return new Proxy(i,{get:(f,r)=>(this.trackProp(r),c?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#c.status==="pending"&&this.#c.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(f,r))})}trackProp(i){this.#y.add(i)}getCurrentQuery(){return this.#e}refetch({...i}={}){return this.fetch({...i})}fetchOptimistic(i){const c=this.#t.defaultQueryOptions(i),f=this.#t.getQueryCache().build(this.#t,c);return f.fetch().then(()=>this.createResult(f,c))}fetch(i){return this.#h({...i,cancelRefetch:i.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#h(i){this.#j();let c=this.#e.fetch(this.options,i);return i?.throwOnError||(c=c.catch(de)),c}#v(){this.#S();const i=Xl(this.options.staleTime,this.#e);if($n.isServer()||this.#a.isStale||!Is(i))return;const f=Zh(this.#a.dataUpdatedAt,i)+1;this.#o=fa.setTimeout(()=>{this.#a.isStale||this.updateResult()},f)}#p(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#g(i){this.#x(),this.#f=i,!($n.isServer()||Oe(this.options.enabled,this.#e)===!1||!Is(this.#f)||this.#f===0)&&(this.#d=fa.setInterval(()=>{(this.options.refetchIntervalInBackground||sf.isFocused())&&this.#h()},this.#f))}#b(){this.#v(),this.#g(this.#p())}#S(){this.#o!==void 0&&(fa.clearTimeout(this.#o),this.#o=void 0)}#x(){this.#d!==void 0&&(fa.clearInterval(this.#d),this.#d=void 0)}createResult(i,c){const f=this.#e,r=this.options,d=this.#a,y=this.#i,S=this.#n,v=i!==f?i.state:this.#l,{state:m}=i;let N={...m},j=!1,E;if(c._optimisticResults){const ht=this.hasListeners(),Lt=!ht&&Dh(i,c),ne=ht&&_h(i,f,c,r);(Lt||ne)&&(N={...N,...Ih(m.data,i.options)}),c._optimisticResults==="isRestoring"&&(N.fetchStatus="idle")}let{error:q,errorUpdatedAt:C,status:w}=N;E=N.data;let B=!1;if(c.placeholderData!==void 0&&E===void 0&&w==="pending"){let ht;d?.isPlaceholderData&&c.placeholderData===S?.placeholderData?(ht=d.data,B=!0):ht=typeof c.placeholderData=="function"?c.placeholderData(this.#m?.state.data,this.#m):c.placeholderData,ht!==void 0&&(w="success",E=ef(d?.data,ht,c),j=!0)}if(c.select&&E!==void 0&&!B)if(d&&E===y?.data&&c.select===this.#r)E=this.#s;else try{this.#r=c.select,E=c.select(E),E=ef(d?.data,E,c),this.#s=E,this.#u=null}catch(ht){this.#u=ht}this.#u&&(q=this.#u,E=this.#s,C=Date.now(),w="error");const L=N.fetchStatus==="fetching",dt=w==="pending",nt=w==="error",Ot=dt&&L,Nt=E!==void 0,F={status:w,fetchStatus:N.fetchStatus,isPending:dt,isSuccess:w==="success",isError:nt,isInitialLoading:Ot,isLoading:Ot,data:E,dataUpdatedAt:N.dataUpdatedAt,error:q,errorUpdatedAt:C,failureCount:N.fetchFailureCount,failureReason:N.fetchFailureReason,errorUpdateCount:N.errorUpdateCount,isFetched:i.isFetched(),isFetchedAfterMount:N.dataUpdateCount>v.dataUpdateCount||N.errorUpdateCount>v.errorUpdateCount,isFetching:L,isRefetching:L&&!dt,isLoadingError:nt&&!Nt,isPaused:N.fetchStatus==="paused",isPlaceholderData:j,isRefetchError:nt&&Nt,isStale:of(i,c),refetch:this.refetch,promise:this.#c,isEnabled:Oe(c.enabled,i)!==!1};if(this.options.experimental_prefetchInRender){const ht=F.data!==void 0,Lt=F.status==="error"&&!ht,ne=zt=>{Lt?zt.reject(F.error):ht&&zt.resolve(F.data)},Vt=()=>{const zt=this.#c=F.promise=lf();ne(zt)},Ht=this.#c;switch(Ht.status){case"pending":i.queryHash===f.queryHash&&ne(Ht);break;case"fulfilled":(Lt||F.data!==Ht.value)&&Vt();break;case"rejected":(!Lt||F.error!==Ht.reason)&&Vt();break}}return F}updateResult(){const i=this.#a,c=this.createResult(this.#e,this.options);if(this.#i=this.#e.state,this.#n=this.options,this.#i.data!==void 0&&(this.#m=this.#e),Ps(c,i))return;this.#a=c;const f=()=>{if(!i)return!0;const{notifyOnChangeProps:r}=this.options,d=typeof r=="function"?r():r;if(d==="all"||!d&&!this.#y.size)return!0;const y=new Set(d??this.#y);return this.options.throwOnError&&y.add("error"),Object.keys(this.#a).some(S=>{const A=S;return this.#a[A]!==i[A]&&y.has(A)})};this.#E({listeners:f()})}#j(){const i=this.#t.getQueryCache().build(this.#t,this.options);if(i===this.#e)return;const c=this.#e;this.#e=i,this.#l=i.state,this.hasListeners()&&(c?.removeObserver(this),i.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#E(i){Pt.batch(()=>{i.listeners&&this.listeners.forEach(c=>{c(this.#a)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function s0(i,c){return Oe(c.enabled,i)!==!1&&i.state.data===void 0&&!(i.state.status==="error"&&Oe(c.retryOnMount,i)===!1)}function Dh(i,c){return s0(i,c)||i.state.data!==void 0&&nf(i,c,c.refetchOnMount)}function nf(i,c,f){if(Oe(c.enabled,i)!==!1&&Xl(c.staleTime,i)!=="static"){const r=typeof f=="function"?f(i):f;return r==="always"||r!==!1&&of(i,c)}return!1}function _h(i,c,f,r){return(i!==c||Oe(r.enabled,i)===!1)&&(!f.suspense||i.state.status!=="error")&&of(i,f)}function of(i,c){return Oe(c.enabled,i)!==!1&&i.isStaleByTime(Xl(c.staleTime,i))}function f0(i,c){return!Ps(i.getCurrentResult(),c)}var r0=class extends Wh{#t;#e;#l;#a;constructor(i){super(),this.#t=i.client,this.mutationId=i.mutationId,this.#l=i.mutationCache,this.#e=[],this.state=i.state||o0(),this.setOptions(i.options),this.scheduleGc()}setOptions(i){this.options=i,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(i){this.#e.includes(i)||(this.#e.push(i),this.clearGcTimeout(),this.#l.notify({type:"observerAdded",mutation:this,observer:i}))}removeObserver(i){this.#e=this.#e.filter(c=>c!==i),this.scheduleGc(),this.#l.notify({type:"observerRemoved",mutation:this,observer:i})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#l.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(i){const c=()=>{this.#i({type:"continue"})},f={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=$h({fn:()=>this.options.mutationFn?this.options.mutationFn(i,f):Promise.reject(new Error("No mutationFn found")),onFail:(y,S)=>{this.#i({type:"failed",failureCount:y,error:S})},onPause:()=>{this.#i({type:"pause"})},onContinue:c,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#l.canRun(this)});const r=this.state.status==="pending",d=!this.#a.canStart();try{if(r)c();else{this.#i({type:"pending",variables:i,isPaused:d}),this.#l.config.onMutate&&await this.#l.config.onMutate(i,this,f);const S=await this.options.onMutate?.(i,f);S!==this.state.context&&this.#i({type:"pending",context:S,variables:i,isPaused:d})}const y=await this.#a.start();return await this.#l.config.onSuccess?.(y,i,this.state.context,this,f),await this.options.onSuccess?.(y,i,this.state.context,f),await this.#l.config.onSettled?.(y,null,this.state.variables,this.state.context,this,f),await this.options.onSettled?.(y,null,i,this.state.context,f),this.#i({type:"success",data:y}),y}catch(y){try{await this.#l.config.onError?.(y,i,this.state.context,this,f)}catch(S){Promise.reject(S)}try{await this.options.onError?.(y,i,this.state.context,f)}catch(S){Promise.reject(S)}try{await this.#l.config.onSettled?.(void 0,y,this.state.variables,this.state.context,this,f)}catch(S){Promise.reject(S)}try{await this.options.onSettled?.(void 0,y,i,this.state.context,f)}catch(S){Promise.reject(S)}throw this.#i({type:"error",error:y}),y}finally{this.#l.runNext(this)}}#i(i){const c=f=>{switch(i.type){case"failed":return{...f,failureCount:i.failureCount,failureReason:i.error};case"pause":return{...f,isPaused:!0};case"continue":return{...f,isPaused:!1};case"pending":return{...f,context:i.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:i.isPaused,status:"pending",variables:i.variables,submittedAt:Date.now()};case"success":return{...f,data:i.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...f,data:void 0,error:i.error,failureCount:f.failureCount+1,failureReason:i.error,isPaused:!1,status:"error"}}};this.state=c(this.state),Pt.batch(()=>{this.#e.forEach(f=>{f.onMutationUpdate(i)}),this.#l.notify({mutation:this,type:"updated",action:i})})}};function o0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var d0=class extends ei{constructor(i={}){super(),this.config=i,this.#t=new Set,this.#e=new Map,this.#l=0}#t;#e;#l;build(i,c,f){const r=new r0({client:i,mutationCache:this,mutationId:++this.#l,options:i.defaultMutationOptions(c),state:f});return this.add(r),r}add(i){this.#t.add(i);const c=xu(i);if(typeof c=="string"){const f=this.#e.get(c);f?f.push(i):this.#e.set(c,[i])}this.notify({type:"added",mutation:i})}remove(i){if(this.#t.delete(i)){const c=xu(i);if(typeof c=="string"){const f=this.#e.get(c);if(f)if(f.length>1){const r=f.indexOf(i);r!==-1&&f.splice(r,1)}else f[0]===i&&this.#e.delete(c)}}this.notify({type:"removed",mutation:i})}canRun(i){const c=xu(i);if(typeof c=="string"){const r=this.#e.get(c)?.find(d=>d.state.status==="pending");return!r||r===i}else return!0}runNext(i){const c=xu(i);return typeof c=="string"?this.#e.get(c)?.find(r=>r!==i&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Pt.batch(()=>{this.#t.forEach(i=>{this.notify({type:"removed",mutation:i})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(i){const c={exact:!0,...i};return this.getAll().find(f=>Oh(c,f))}findAll(i={}){return this.getAll().filter(c=>Oh(i,c))}notify(i){Pt.batch(()=>{this.listeners.forEach(c=>{c(i)})})}resumePausedMutations(){const i=this.getAll().filter(c=>c.state.isPaused);return Pt.batch(()=>Promise.all(i.map(c=>c.continue().catch(de))))}};function xu(i){return i.options.scope?.id}var h0=class extends ei{constructor(i={}){super(),this.config=i,this.#t=new Map}#t;build(i,c,f){const r=c.queryKey,d=c.queryHash??ff(r,c);let y=this.get(d);return y||(y=new u0({client:i,queryKey:r,queryHash:d,options:i.defaultQueryOptions(c),state:f,defaultOptions:i.getQueryDefaults(r)}),this.add(y)),y}add(i){this.#t.has(i.queryHash)||(this.#t.set(i.queryHash,i),this.notify({type:"added",query:i}))}remove(i){const c=this.#t.get(i.queryHash);c&&(i.destroy(),c===i&&this.#t.delete(i.queryHash),this.notify({type:"removed",query:i}))}clear(){Pt.batch(()=>{this.getAll().forEach(i=>{this.remove(i)})})}get(i){return this.#t.get(i)}getAll(){return[...this.#t.values()]}find(i){const c={exact:!0,...i};return this.getAll().find(f=>Th(c,f))}findAll(i={}){const c=this.getAll();return Object.keys(i).length>0?c.filter(f=>Th(i,f)):c}notify(i){Pt.batch(()=>{this.listeners.forEach(c=>{c(i)})})}onFocus(){Pt.batch(()=>{this.getAll().forEach(i=>{i.onFocus()})})}onOnline(){Pt.batch(()=>{this.getAll().forEach(i=>{i.onOnline()})})}},m0=class{#t;#e;#l;#a;#i;#n;#c;#u;constructor(i={}){this.#t=i.queryCache||new h0,this.#e=i.mutationCache||new d0,this.#l=i.defaultOptions||{},this.#a=new Map,this.#i=new Map,this.#n=0}mount(){this.#n++,this.#n===1&&(this.#c=sf.subscribe(async i=>{i&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#u=Au.subscribe(async i=>{i&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#n--,this.#n===0&&(this.#c?.(),this.#c=void 0,this.#u?.(),this.#u=void 0)}isFetching(i){return this.#t.findAll({...i,fetchStatus:"fetching"}).length}isMutating(i){return this.#e.findAll({...i,status:"pending"}).length}getQueryData(i){const c=this.defaultQueryOptions({queryKey:i});return this.#t.get(c.queryHash)?.state.data}ensureQueryData(i){const c=this.defaultQueryOptions(i),f=this.#t.build(this,c),r=f.state.data;return r===void 0?this.fetchQuery(i):(i.revalidateIfStale&&f.isStaleByTime(Xl(c.staleTime,f))&&this.prefetchQuery(c),Promise.resolve(r))}getQueriesData(i){return this.#t.findAll(i).map(({queryKey:c,state:f})=>{const r=f.data;return[c,r]})}setQueryData(i,c,f){const r=this.defaultQueryOptions({queryKey:i}),y=this.#t.get(r.queryHash)?.state.data,S=kv(c,y);if(S!==void 0)return this.#t.build(this,r).setData(S,{...f,manual:!0})}setQueriesData(i,c,f){return Pt.batch(()=>this.#t.findAll(i).map(({queryKey:r})=>[r,this.setQueryData(r,c,f)]))}getQueryState(i){const c=this.defaultQueryOptions({queryKey:i});return this.#t.get(c.queryHash)?.state}removeQueries(i){const c=this.#t;Pt.batch(()=>{c.findAll(i).forEach(f=>{c.remove(f)})})}resetQueries(i,c){const f=this.#t;return Pt.batch(()=>(f.findAll(i).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...i},c)))}cancelQueries(i,c={}){const f={revert:!0,...c},r=Pt.batch(()=>this.#t.findAll(i).map(d=>d.cancel(f)));return Promise.all(r).then(de).catch(de)}invalidateQueries(i,c={}){return Pt.batch(()=>(this.#t.findAll(i).forEach(f=>{f.invalidate()}),i?.refetchType==="none"?Promise.resolve():this.refetchQueries({...i,type:i?.refetchType??i?.type??"active"},c)))}refetchQueries(i,c={}){const f={...c,cancelRefetch:c.cancelRefetch??!0},r=Pt.batch(()=>this.#t.findAll(i).filter(d=>!d.isDisabled()&&!d.isStatic()).map(d=>{let y=d.fetch(void 0,f);return f.throwOnError||(y=y.catch(de)),d.state.fetchStatus==="paused"?Promise.resolve():y}));return Promise.all(r).then(de)}fetchQuery(i){const c=this.defaultQueryOptions(i);c.retry===void 0&&(c.retry=!1);const f=this.#t.build(this,c);return f.isStaleByTime(Xl(c.staleTime,f))?f.fetch(c):Promise.resolve(f.state.data)}prefetchQuery(i){return this.fetchQuery(i).then(de).catch(de)}fetchInfiniteQuery(i){return i._type="infinite",this.fetchQuery(i)}prefetchInfiniteQuery(i){return this.fetchInfiniteQuery(i).then(de).catch(de)}ensureInfiniteQueryData(i){return i._type="infinite",this.ensureQueryData(i)}resumePausedMutations(){return Au.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#l}setDefaultOptions(i){this.#l=i}setQueryDefaults(i,c){this.#a.set(kn(i),{queryKey:i,defaultOptions:c})}getQueryDefaults(i){const c=[...this.#a.values()],f={};return c.forEach(r=>{Fn(i,r.queryKey)&&Object.assign(f,r.defaultOptions)}),f}setMutationDefaults(i,c){this.#i.set(kn(i),{mutationKey:i,defaultOptions:c})}getMutationDefaults(i){const c=[...this.#i.values()],f={};return c.forEach(r=>{Fn(i,r.mutationKey)&&Object.assign(f,r.defaultOptions)}),f}defaultQueryOptions(i){if(i._defaulted)return i;const c={...this.#l.queries,...this.getQueryDefaults(i.queryKey),...i,_defaulted:!0};return c.queryHash||(c.queryHash=ff(c.queryKey,c)),c.refetchOnReconnect===void 0&&(c.refetchOnReconnect=c.networkMode!=="always"),c.throwOnError===void 0&&(c.throwOnError=!!c.suspense),!c.networkMode&&c.persister&&(c.networkMode="offlineFirst"),c.queryFn===rf&&(c.enabled=!1),c}defaultMutationOptions(i){return i?._defaulted?i:{...this.#l.mutations,...i?.mutationKey&&this.getMutationDefaults(i.mutationKey),...i,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Ph=Q.createContext(void 0),li=i=>{const c=Q.useContext(Ph);if(!c)throw new Error("No QueryClient set, use QueryClientProvider to set one");return c},y0=({client:i,children:c})=>(Q.useEffect(()=>(i.mount(),()=>{i.unmount()}),[i]),o.jsx(Ph.Provider,{value:i,children:c})),tm=Q.createContext(!1),v0=()=>Q.useContext(tm);tm.Provider;function p0(){let i=!1;return{clearReset:()=>{i=!1},reset:()=>{i=!0},isReset:()=>i}}var g0=Q.createContext(p0()),b0=()=>Q.useContext(g0),S0=(i,c,f)=>{const r=f?.state.error&&typeof i.throwOnError=="function"?kh(i.throwOnError,[f.state.error,f]):i.throwOnError;(i.suspense||i.experimental_prefetchInRender||r)&&(c.isReset()||(i.retryOnMount=!1))},x0=i=>{Q.useEffect(()=>{i.clearReset()},[i])},j0=({result:i,errorResetBoundary:c,throwOnError:f,query:r,suspense:d})=>i.isError&&!c.isReset()&&!i.isFetching&&r&&(d&&i.data===void 0||kh(f,[i.error,r])),E0=i=>{if(i.suspense){const f=d=>d==="static"?d:Math.max(d??1e3,1e3),r=i.staleTime;i.staleTime=typeof r=="function"?(...d)=>f(r(...d)):f(r),typeof i.gcTime=="number"&&(i.gcTime=Math.max(i.gcTime,1e3))}},T0=(i,c)=>i.isLoading&&i.isFetching&&!c,O0=(i,c)=>i?.suspense&&c.isPending,Rh=(i,c,f)=>c.fetchOptimistic(i).catch(()=>{f.clearReset()});function A0(i,c,f){const r=v0(),d=b0(),y=li(),S=y.defaultQueryOptions(i);y.getDefaultOptions().queries?._experimental_beforeQuery?.(S);const A=y.getQueryCache().get(S.queryHash),v=i.subscribed!==!1;S._optimisticResults=r?"isRestoring":v?"optimistic":void 0,E0(S),S0(S,d,A),x0(d);const m=!y.getQueryCache().get(S.queryHash),[N]=Q.useState(()=>new c(y,S)),j=N.getOptimisticResult(S),E=!r&&v;if(Q.useSyncExternalStore(Q.useCallback(q=>{const C=E?N.subscribe(Pt.batchCalls(q)):de;return N.updateResult(),C},[N,E]),()=>N.getCurrentResult(),()=>N.getCurrentResult()),Q.useEffect(()=>{N.setOptions(S)},[S,N]),O0(S,j))throw Rh(S,N,d);if(j0({result:j,errorResetBoundary:d,throwOnError:S.throwOnError,query:A,suspense:S.suspense}))throw j.error;return y.getDefaultOptions().queries?._experimental_afterQuery?.(S,j),S.experimental_prefetchInRender&&!$n.isServer()&&T0(j,r)&&(m?Rh(S,N,d):A?.promise)?.catch(de).finally(()=>{N.updateResult()}),S.notifyOnChangeProps?j:N.trackResult(j)}function he(i,c){return A0(i,c0)}function em(){throw location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),new Error("signing in…")}async function Ae(i){const c=await fetch(i);if(c.status===401&&em(),!c.ok)throw new Error(await c.text());return c.json()}async function Ll(i,c,f){const r={method:i};f!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(f));const d=await fetch(c,r);if(!d.ok)throw new Error(await d.text());return d.status===204?{}:d.json()}async function $a(i,c){const f=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c||{})});if(f.status===401&&em(),!f.ok)throw new Error(await f.text());return f.json()}function N0(){return he({queryKey:["config"],queryFn:async()=>{const i=await Ae("/api/config");return i.auth.enabled&&!i.me&&(location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),await new Promise(()=>{})),i},staleTime:1/0})}function z0(){document.body.classList.toggle("sb-open")}function ra(){document.body.classList.remove("sb-open")}function te({name:i}){return o.jsx("svg",{className:"ico","aria-hidden":"true",children:o.jsx("use",{href:`#i-${i}`})})}function Wn(i){return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:"sb-backdrop",onClick:ra}),o.jsxs("aside",{id:"sidebar",children:[i.vault,i.projectsNav,i.tree??o.jsx("nav",{id:"tree","aria-label":"Files"}),i.orgBar]}),o.jsxs("main",{id:"main",children:[i.topbar,o.jsx("article",{id:"content",className:i.contentClass??"markdown",ref:i.contentRef,onScroll:i.onContentScroll,children:i.children})]})]})}function Nu(i){const{name:c,onHome:f,showSignout:r,admin:d,gear:y}=i;return o.jsxs("header",{id:"vault",children:[o.jsx("span",{id:"vault-badge","aria-hidden":"true",children:"🐻"}),o.jsx("span",{id:"vault-name",className:f?"vault-link":void 0,onClick:f,role:f?"button":void 0,tabIndex:f?0:void 0,onKeyDown:S=>{f&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),f())},children:c}),o.jsxs("div",{className:"vault-actions",children:[d&&o.jsxs("button",{id:"adminbar",className:"adminbar",title:"Hub administration — signup policy"+(d.pending?" and pending approvals":""),onClick:d.onClick,children:[o.jsx(te,{name:"shield"}),o.jsxs("span",{children:["Admin",d.pending?" · "+d.pending:""]})]}),y&&o.jsx("button",{id:"settings-btn",className:"icon-btn2",title:"Manage organization","aria-label":"Manage organization",onClick:y.onClick,children:o.jsx(te,{name:"users"})}),r&&o.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:o.jsx(te,{name:"power"})})]})]})}function In(i){return o.jsxs("header",{id:"topbar",children:[o.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu",onClick:z0,children:o.jsx(te,{name:"menu"})}),o.jsx("span",{id:"crumb",children:i.crumb}),o.jsx("span",{id:"meta",children:i.meta}),i.actions]})}let df={msg:"",err:!1,shown:!1},Eu=[],Uh;function Hh(i){df=i,Eu.forEach(c=>c())}function ot(i,c=!1){Hh({msg:i,err:c,shown:!0}),clearTimeout(Uh),Uh=setTimeout(()=>Hh({...df,shown:!1}),3200)}function M0(){const i=Q.useSyncExternalStore(c=>(Eu.push(c),()=>{Eu=Eu.filter(f=>f!==c)}),()=>df);return o.jsx("div",{id:"toast",className:i.shown?"show"+(i.err?" err":""):"",children:i.msg})}let lm=null,Tu=[];function hf(i){lm=i,Tu.forEach(c=>c())}function am(i,c,f="",r="OK"){return new Promise(d=>hf({kind:"prompt",title:i,label:c,value:f,okLabel:r,resolve:d}))}function ju(i,c,f="Confirm",r=!1){return new Promise(d=>hf({kind:"confirm",title:i,message:c,confirmLabel:f,danger:r,resolve:d}))}function C0(){const i=Q.useSyncExternalStore(c=>(Tu.push(c),()=>{Tu=Tu.filter(f=>f!==c)}),()=>lm);return i?i.kind==="prompt"?o.jsx(D0,{m:i}):o.jsx(_0,{m:i}):null}function nm(){hf(null)}function D0({m:i}){const c=Q.useRef(null),f=d=>{nm(),i.resolve(d)},r=()=>f(c.current.value.trim()||null);return Q.useEffect(()=>{c.current.focus(),c.current.select();const d=y=>{y.key==="Escape"&&f(null),y.key==="Enter"&&r()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]),o.jsx("div",{className:"modal-back",onClick:d=>d.target===d.currentTarget&&f(null),children:o.jsxs("div",{className:"modal",children:[o.jsx("h3",{children:i.title}),o.jsx("label",{className:"modal-label",children:i.label}),o.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",defaultValue:i.value,ref:c}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"ai-btn",onClick:()=>f(null),children:"Cancel"}),o.jsx("button",{className:"pbtn",onClick:r,children:i.okLabel})]})]})})}function _0({m:i}){const c=Q.useRef(null),f=r=>{nm(),i.resolve(r)};return Q.useEffect(()=>{c.current.focus();const r=d=>{d.key==="Escape"&&f(!1),d.key==="Enter"&&f(!0)};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),o.jsx("div",{className:"modal-back",onClick:r=>r.target===r.currentTarget&&f(!1),children:o.jsxs("div",{className:"modal",children:[o.jsx("h3",{children:i.title}),o.jsx("p",{className:"modal-msg",children:i.message}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"ai-btn",onClick:()=>f(!1),children:"Cancel"}),o.jsx("button",{className:i.danger?"danger-btn":"pbtn",onClick:()=>f(!0),ref:c,children:i.confirmLabel})]})]})})}function R0(i){return he({queryKey:["projects"],queryFn:()=>Ae("/api/projects"),enabled:i,refetchInterval:3e4,select:c=>c.projects||[]})}function U0(i){return he({queryKey:["orgs"],queryFn:()=>Ae("/api/orgs"),enabled:i,select:c=>c.orgs||[]})}function im(i){return he({queryKey:["admin","pending"],queryFn:()=>Ae("/api/admin/pending"),enabled:i,select:c=>c.pending||[]})}function um(){const i=li();return()=>Promise.all([i.invalidateQueries({queryKey:["projects"]}),i.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function cm(i){return i.split("/").map(encodeURIComponent).join("/")}function qh(i){return i.split("/").map(decodeURIComponent).join("/")}const H0=new Set(["insights","history"]);function sm(i,c){const f=i.replace(/^\/+/,"");if(c!=="hub")return{path:f?qh(f):""};const r=f.indexOf("/");if(r===-1)return{project:f,path:""};const d={project:f.slice(0,r),path:qh(f.slice(r+1))},y=d.path.indexOf("/"),S=y===-1?d.path:d.path.slice(0,y);return H0.has(S)&&(d.view=S,d.viewTarget=y===-1?"":d.path.slice(y+1).replace(/\/+$/,""),d.path=""),d}function q0(i,c){const f=cm(i);return c?"/"+c+(f?"/"+f:""):"/"+f}function wh(i,c,f){let r=(c?"/"+c:"")+"/"+i;return i==="history"&&f&&(r+="/"+cm(f.replace(/\/+$/,""))),r}let mf="POP";const uf=new Set;function fm(){for(const i of uf)i()}window.addEventListener("popstate",()=>{mf="POP",fm()});function ke(i,c){const f=location.pathname+location.search;!c?.replace&&f===i||(history[c?.replace?"replaceState":"pushState"](null,"",i),mf=c?.replace?"REPLACE":"PUSH",fm())}function yf(){return Q.useSyncExternalStore(i=>(uf.add(i),()=>{uf.delete(i)}),()=>location.pathname)}function w0(){return mf}function Q0({to:i}){return Q.useEffect(()=>{ke(i,{replace:!0})},[i]),null}const B0=/\.(md|markdown)$/i,Y0=/\.(png|jpe?g|gif|svg|webp|ico|bmp|avif)$/i,G0=/\.(txt|log|json|ya?ml|toml|csv|go|py|js|ts|jsx|tsx|sh|bash|zsh|rb|rs|c|h|cpp|java|kt|swift|sql|html|css|xml|ini|conf|env|mod|sum|jsonl)$/i;function rm(i){if(i<1024)return i+" B";const c=["KB","MB","GB","TB"];let f=-1;do i/=1024,f++;while(i>=1024&&fd.invalidateQueries({queryKey:["orgs"]}),m=()=>d.invalidateQueries({queryKey:["invites",i.id]}),N=()=>d.invalidateQueries({queryKey:["orgShares",i.id]}),{data:j}=he({queryKey:["invites",i.id],queryFn:()=>Ae(`/api/orgs/${i.id}/invites`),enabled:y,select:C=>C.invites||[]}),{data:E}=he({queryKey:["orgShares",i.id],queryFn:()=>Ae(`/api/orgs/${i.id}/shares`),enabled:y,select:C=>C.shares||[]}),q=c.filter(C=>C.org===i.id);return o.jsxs("div",{className:"admin",children:[o.jsx("h1",{id:"org-title",children:i.name+(y?"":" · member")}),y&&o.jsxs("div",{className:"admin-row",children:[o.jsx("input",{id:"org-rename",type:"text",value:S,onChange:C=>A(C.target.value)}),o.jsx("button",{className:"pbtn",id:"org-rename-btn",onClick:async()=>{try{await Ll("PATCH","/api/orgs/"+i.id,{name:S.trim()}),ot("Renamed."),v()}catch(C){ot(C.message,!0)}},children:"Rename org"})]}),o.jsx("h3",{children:"Members"}),o.jsx("div",{className:"admin-list",children:i.members.map(C=>{const w=!!f&&C.email.toLowerCase()===f.toLowerCase();return o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:C.email+(w?" (you)":"")}),y&&!w?o.jsxs(o.Fragment,{children:[o.jsxs("select",{value:C.role,onChange:async B=>{try{await Ll("PATCH",`/api/orgs/${i.id}/members/${encodeURIComponent(C.email)}`,{role:B.target.value}),ot("Role updated.")}catch(L){ot(L.message,!0)}v()},children:[o.jsx("option",{value:"owner",children:"owner"}),o.jsx("option",{value:"member",children:"member"})]}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await ju("Remove member",`Remove ${C.email} from ${i.name}?`,"Remove",!0))try{await Ll("DELETE",`/api/orgs/${i.id}/members/${encodeURIComponent(C.email)}`),ot("Removed."),v()}catch(B){ot(B.message,!0)}},children:"Remove"})]}):o.jsx("span",{className:"ai-tag",children:C.role})]},C.email)})}),y&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{children:"Projects"}),o.jsxs("div",{className:"admin-list",children:[q.length===0&&o.jsx("div",{className:"admin-empty",children:"No projects yet."}),q.map(C=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:C.name}),o.jsx("button",{className:"ai-btn",onClick:async()=>{const w=await am("Rename project","New name",C.name,"Rename");if(!(!w||w===C.name))try{await Ll("PATCH","/api/projects/"+C.id,{name:w}),ot("Renamed."),await r()}catch(B){ot(B.message,!0)}},children:"Rename"}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await ju("Delete project",`Delete “${C.name}”? Its files stay in storage, but it's removed from the hub.`,"Delete",!0))try{await Ll("DELETE","/api/projects/"+C.id),ot(`Deleted “${C.name}”.`),await r()}catch(w){ot(w.message,!0)}},children:"Delete"})]},C.id))]}),o.jsxs("div",{className:"admin-h",children:[o.jsx("h3",{children:"Invite links"}),o.jsx("button",{className:"pbtn",onClick:async()=>{try{const C=await $a(`/api/orgs/${i.id}/invites`),w=await Pn(C.url);ot(w?"Invite link copied to clipboard.":"Invite created — copy it from the list below."),m()}catch(C){ot(C.message,!0)}},children:"New invite"})]}),o.jsxs("div",{className:"admin-list",children:[j&&j.length===0&&o.jsx("div",{className:"admin-empty",children:"No active invite links."}),(j||[]).map(C=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main mono",style:{cursor:"pointer"},title:"Copy",onClick:()=>Pn(C.url).then(w=>ot(w?"Copied.":"Select and copy the link.")),children:C.url}),o.jsx("span",{className:"ai-tag",children:(C.creator?"by "+C.creator+" · ":"")+(C.uses?C.uses+" joined · ":"unused · ")+"expires "+new Date(C.expires).toLocaleDateString()}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await ju("Revoke invite","Revoke this invite link? Anyone still holding it won't be able to join.","Revoke",!0))try{await Ll("DELETE",`/api/orgs/${i.id}/invites/${C.token}`),ot("Revoked."),m()}catch(w){ot(w.message,!0)}},children:"Revoke"})]},C.token))]}),o.jsx("h3",{children:"Public share links"}),o.jsxs("div",{className:"admin-list",children:[E&&E.length===0&&o.jsx("div",{className:"admin-empty",children:"No public shares."}),(E||[]).map(C=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main mono",style:{cursor:"pointer"},title:C.url,onClick:()=>window.open(C.url,"_blank"),children:C.path}),o.jsx("span",{className:"ai-tag",children:(C.project_name||"")+(C.creator?" · by "+C.creator:"")+(C.created?" · "+new Date(C.created).toLocaleDateString():"")}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await ju("Revoke share link",`Revoke the public link to “${C.path}”? Anyone with the URL will lose access.`,"Revoke",!0))try{await Ll("DELETE","/api/shares/"+C.token),ot("Share revoked."),N()}catch(w){ot(w.message,!0)}},children:"Revoke"})]},C.token))]})]})]})}function X0(){const i=li(),{data:c,error:f}=he({queryKey:["admin","policy"],queryFn:()=>Ae("/api/admin/policy")}),{data:r}=im(!0),[d,y]=Q.useState(!1),[S,A]=Q.useState(!1);if(Q.useEffect(()=>{c&&(y(c.require_verification&&c.mailer),A(c.require_approval))},[c]),Q.useEffect(()=>{f&&ot(f.message,!0)},[f]),!c)return null;const v=async(m,N,j)=>{try{await $a(`/api/admin/pending/${m}/${N}`),ot((N==="approve"?"Approved ":"Denied ")+j),i.invalidateQueries({queryKey:["admin","pending"]})}catch(E){ot(E.message,!0)}};return o.jsxs("div",{className:"admin",children:[o.jsx("h1",{children:"Signup & access"}),o.jsx("p",{className:"admin-sub",children:"Who can create an account on this hub, and how new accounts are vetted."}),o.jsx("h3",{children:"New-account vetting"}),o.jsxs("div",{className:"admin-list",children:[o.jsx(Qh,{label:"Require email verification",desc:c.mailer?"New accounts must click an emailed link before they can sign in — proves they control the address.":"Configure SMTP on the server (auth.smtp) to enable email verification.",checked:d,disabled:!c.mailer,onChange:y}),o.jsx(Qh,{label:"Require admin approval",desc:"New accounts wait for a hub admin to approve them before they gain access.",checked:S,onChange:A})]}),o.jsx("button",{className:"pbtn",style:{marginTop:14},onClick:async()=>{try{await $a("/api/admin/policy",{require_verification:d,require_approval:S}),ot("Signup policy saved."),i.invalidateQueries({queryKey:["admin","policy"]})}catch(m){ot(m.message,!0)}},children:"Save policy"}),o.jsx("h3",{children:"Who can sign up"}),o.jsxs("div",{className:"admin-list",children:[o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:"Allowed email domains"}),o.jsx("span",{className:"ai-tag",children:c.allowed_domains&&c.allowed_domains.length?c.allowed_domains.map(m=>"@"+m).join(", "):"any"})]}),o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:"Self-signup"}),o.jsx("span",{className:"ai-tag",children:c.allow_signup?"open":"invite-only"})]}),o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:"Hub admins"}),o.jsx("span",{className:"ai-tag",children:c.admins&&c.admins.length?c.admins.join(", "):"none"})]})]}),o.jsx("p",{className:"admin-sub",children:"Domains and admins are set in the server config file (they can't be widened from the browser)."}),o.jsx("h3",{children:"Pending signups"}),o.jsxs("div",{className:"admin-list",children:[(!r||r.length===0)&&o.jsx("div",{className:"admin-empty",children:"No one is waiting for approval."}),(r||[]).map(m=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:(m.name?m.name+" · ":"")+m.email}),o.jsx("button",{className:"pbtn",onClick:()=>v(m.id,"approve",m.email),children:"Approve"}),o.jsx("button",{className:"ai-del",onClick:()=>v(m.id,"deny",m.email),children:"Deny"})]},m.id))]})]})}function Qh({label:i,desc:c,checked:f,disabled:r,onChange:d}){return o.jsxs("label",{className:"admin-item toggle",style:r?{opacity:.55}:void 0,children:[o.jsxs("span",{className:"ai-main",children:[o.jsx("div",{className:"tg-label",children:i}),o.jsx("div",{className:"tg-desc",children:c})]}),o.jsx("input",{type:"checkbox",checked:f,disabled:r,onChange:y=>d(y.target.checked)})]})}const Bh=["#5b8def","#f5a623","#4cc38a","#e0679b","#8b7bf0","#3ec8c8","#e6934a"];function K0(i){let c=0;for(const f of i)c=c*31+f.charCodeAt(0)>>>0;return Bh[c%Bh.length]}function Yh({projects:i,currentId:c}){const f=um(),r=async()=>{const d=await am("New project","Project name","","Create");if(d)try{const y=await $a("/api/projects",{name:d});await f(),ke("/"+y.project.id),ot(`Created “${y.project.name}”.`)}catch(y){ot("Could not create the project: "+y.message,!0)}};return o.jsxs("nav",{id:"projects","aria-label":"Projects",children:[o.jsxs("div",{className:"nav-head",children:[o.jsx("span",{children:"Projects"}),o.jsx("button",{className:"nav-add",title:"New project",onClick:r,children:"+"})]}),o.jsx("ul",{children:i.map(d=>o.jsx("li",{children:o.jsxs("div",{className:"row"+(c===d.id?" active":""),title:d.name,tabIndex:0,role:"button",onClick:()=>{ke("/"+d.id),ra()},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.currentTarget.click())},children:[o.jsx("span",{className:"proj-mark",style:{background:K0(d.name)},children:d.name.trim()[0]||"?"}),o.jsx("span",{className:"label",children:d.name})]})},d.id))})]})}function Z0({org:i,onManage:c}){return i?o.jsxs("footer",{id:"orgbar",children:[o.jsx("span",{id:"org-name",title:"Manage organization",role:"button",tabIndex:0,onClick:()=>c(i),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),c(i))},children:i.name}),i.role==="owner"&&o.jsx("button",{id:"invite-btn",title:"Manage this organization",onClick:()=>c(i),children:"Manage"})]}):null}function V0({authEnabled:i,onCreate:c}){const f=Q.useRef(null),r=Q.useRef(null),d=()=>{const y=f.current.value.trim(),S=y.match(/join\/([0-9a-f]+)/)||y.match(/^([0-9a-f]{8,})$/);if(!S){ot("That doesn't look like an invite link.",!0);return}location.href="/join/"+S[1]};return o.jsxs("div",{className:"onboard",children:[o.jsx("h1",{children:"Welcome to BearDrive"}),o.jsx("p",{children:"You're signed in, but you're not part of any project yet."}),i&&o.jsxs("div",{className:"ob-card",children:[o.jsx("h3",{children:"Have an invite link?"}),o.jsx("p",{children:"A teammate can send you a join link. Paste it here:"}),o.jsxs("div",{className:"ob-row",children:[o.jsx("input",{id:"ob-invite",type:"text",placeholder:"https://…/join/…",autoComplete:"off",ref:f}),o.jsx("button",{id:"ob-join",className:"pbtn",onClick:d,children:"Join"})]})]}),o.jsxs("div",{className:"ob-card",children:[o.jsx("h3",{children:"Or start a new project"}),o.jsx("p",{children:"Create a shared space for your team's files."}),o.jsxs("div",{className:"ob-row",children:[o.jsx("input",{id:"ob-name",type:"text",placeholder:"Project name, e.g. wiki",autoComplete:"off",ref:r}),o.jsx("button",{id:"ob-create",className:"pbtn",onClick:()=>c(r.current.value.trim()),children:"Create"})]})]})]})}function J0(i,c=!0){const f=he({queryKey:["tree",i],queryFn:()=>Ae(i+"tree"),enabled:c,refetchInterval:15e3}),r=Q.useMemo(()=>{const d=[],y=new Map,S=A=>{for(const v of A.children||[])v.dir?(y.set(v.path,v),S(v)):d.push(v)};return f.data&&S(f.data),{flatFiles:d,dirIndex:y}},[f.data]);return{tree:f.data,...r,loaded:!!f.data}}function k0(i,c){return he({queryKey:["heat",i],queryFn:()=>Ae(i+"heat?days=30"),enabled:c,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function F0(i,c,f){return he({queryKey:["history",i,"prefix",c,20],queryFn:()=>Ae(i+"history?prefix="+encodeURIComponent(c)+"&n=20"),enabled:f,staleTime:15e3}).data?.entries??null}function Gh(i,c,f){if(!i)return null;if(!f)return i[c]||null;const r={human:0,agent:0,share:0};for(const[d,y]of Object.entries(i))d.startsWith(c+"/")&&(r.human+=y.human||0,r.agent+=y.agent||0,r.share+=y.share||0);return r.human||r.agent||r.share?r:null}function ti(i){return(i.human||0)+(i.agent||0)+(i.share||0)}function Ou(i){const c=ti(i);if(!c)return"";let f=c+(c===1?" read":" reads");return i.agent&&(f+=" ("+i.agent+" agent)"),f}function $0(i){const c=ti(i);return c?c<3?1:c<10?2:c<30?3:4:0}async function W0(i,c,f){const r=await f.arrayBuffer(),d=await I0(r),y=async(v,m)=>{const N=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)});if(!N.ok)throw new Error(await N.text());return N.json()},S={path:c,sha256:d,size:f.size},A=await y(i+"upload/init",S);if(A.mode==="direct"){if(!A.exists){const v=await fetch(A.url,{method:A.method||"PUT",headers:A.headers||{},body:r});if(!v.ok)throw new Error("storage upload failed: "+v.status)}await y(i+"upload/commit",S)}else{const v=await fetch(i+"upload/content?path="+encodeURIComponent(c),{method:"PUT",body:r});if(!v.ok)throw new Error(await v.text())}}async function I0(i){if(crypto.subtle){const c=await crypto.subtle.digest("SHA-256",i);return[...new Uint8Array(c)].map(f=>f.toString(16).padStart(2,"0")).join("")}return P0(new Uint8Array(i))}function P0(i){const c=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),f=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),r=(v,m)=>v>>>m|v<<32-m,d=i.length,y=new Uint8Array((d+8>>6)+1<<6);y.set(i),y[d]=128;const S=new DataView(y.buffer);S.setUint32(y.length-8,Math.floor(d*8/4294967296)),S.setUint32(y.length-4,d*8>>>0);const A=new Uint32Array(64);for(let v=0;v>>3,nt=r(A[L-2],17)^r(A[L-2],19)^A[L-2]>>>10;A[L]=A[L-16]+dt+A[L-7]+nt>>>0}let[m,N,j,E,q,C,w,B]=f;for(let L=0;L<64;L++){const dt=r(q,6)^r(q,11)^r(q,25),nt=B+dt+(q&C^~q&w)+c[L]+A[L]>>>0,Nt=(r(m,2)^r(m,13)^r(m,22))+(m&N^m&j^N&j)>>>0;B=w,w=C,C=q,q=E+nt>>>0,E=j,j=N,N=m,m=nt+Nt>>>0}f[0]+=m,f[1]+=N,f[2]+=j,f[3]+=E,f[4]+=q,f[5]+=C,f[6]+=w,f[7]+=B}return[...f].map(v=>(v>>>0).toString(16).padStart(8,"0")).join("")}function tp(i){return o.jsx("nav",{id:"tree","aria-label":"Files",children:i.root&&o.jsx(dm,{nodes:i.root.children||[],...i})})}function dm({nodes:i,...c}){return o.jsx("ul",{children:i.map(f=>o.jsx(ep,{node:f,...c},f.path))})}function ep({node:i,...c}){const{expanded:f,onToggle:r,currentPath:d,listingShowing:y,onOpen:S}=c,A=i.dir?f.has(i.path):!1,v=()=>{if(i.dir&&d===i.path&&y){r(i.path);return}S(i.path),i.dir||ra()};return o.jsxs("li",{className:(i.dir?"dir":"file")+(i.dir&&!A?" collapsed":""),children:[o.jsxs("div",{className:"row"+(d===i.path?" active":""),"data-path":i.path,tabIndex:0,role:"button",title:i.name,"aria-expanded":i.dir?A:void 0,onClick:v,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),v())},children:[o.jsx("span",{className:"chev",onClick:m=>{i.dir&&(m.stopPropagation(),r(i.path))},children:o.jsx(te,{name:"chevd"})}),o.jsx("span",{className:"ticon",children:o.jsx(te,{name:i.dir?"folder":"doc"})}),o.jsx("span",{className:"label",children:i.name})]}),i.dir&&o.jsx(dm,{nodes:i.children||[],...c})]})}function lp(i){const c=i.split("/"),f=[];let r="";for(let d=0;d{r=r?r+"/"+d:d;const S=r,A=y===f.length-1;return o.jsxs("span",{children:[y>0&&o.jsx("span",{className:"crumb-sep",children:"/"}),A?o.jsx("span",{children:d}):o.jsx("span",{className:"crumb-seg",title:S,onClick:()=>c(S),children:d})]},S)})})}const np={add:"plus",edit:"edit",delete:"x"},ip={add:"added",edit:"edited",delete:"deleted"};function hm({entry:i,onOpen:c}){const[f,r]=Q.useState(!1),d=i.kind==="put"?"edit":i.kind,y=i.user_name?`${i.user_name} <${i.user}>`:i.user||i.author||"unknown",S=[i.device.name||i.device.id,i.device.os,i.device.ip].filter(Boolean).join(" · "),A=d!=="delete",v=m=>{m.target.tagName!=="A"&&A&&c(i.path)};return o.jsxs("div",{className:"hentry "+d+(A?" clickable":""),tabIndex:A?0:void 0,role:A?"button":void 0,onClick:v,onKeyDown:m=>{A&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c(i.path))},children:[o.jsxs("div",{className:"hline",children:[o.jsx("span",{className:"hkind",children:o.jsx(te,{name:np[d]||"dot"})}),o.jsx("span",{className:"hpath",children:i.path}),o.jsx("span",{className:"htag",children:ip[d]||d}),o.jsx("span",{className:"htime",children:new Date(i.time).toLocaleString()})]}),o.jsxs("div",{className:"hmeta",children:[o.jsx("span",{className:"hwho",children:y}),o.jsx("span",{className:"hdev",children:S}),o.jsx("span",{className:"hsize",children:i.size?rm(i.size):""})]}),i.note&&o.jsx("div",{className:"hnote"+(f?" open":""),tabIndex:0,role:"button",title:f?"Collapse note":"Show full note","aria-expanded":f,onClick:m=>{m.stopPropagation(),m.target.tagName!=="A"&&r(!f)},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),m.stopPropagation(),r(!f))},children:i.note.split(/(https?:\/\/\S+)/).map((m,N)=>/^https?:\/\//.test(m)?o.jsx("a",{href:m,target:"_blank",rel:"noopener",children:m},N):m)})]})}function up(i){const{node:c,heatMap:f,onOpen:r}=i,d=(c.children||[]).slice().sort((m,N)=>Number(N.dir||!1)-Number(m.dir||!1)||m.name.localeCompare(N.name)),y=d.filter(m=>m.dir).length,S=d.length-y,A=[];y&&A.push(y+(y===1?" folder":" folders")),S&&A.push(S+(S===1?" file":" files"));const v=Gh(f,c.path,!0);return v&&A.push(Ou(v)+" in 30 days"),o.jsxs("div",{className:"dirlist",children:[o.jsxs("h1",{className:"dl-title",children:[o.jsx("span",{className:"dl-title-icon",children:o.jsx(te,{name:"folder"})}),o.jsx("span",{children:c.name})]}),o.jsx("p",{className:"dl-sub",children:A.join(" · ")||"Empty folder"}),d.length===0?o.jsx("div",{className:"dl-empty",children:"Nothing in this folder yet."}):o.jsx("div",{className:"dl-items",children:d.map(m=>{let N="";if(m.dir){const E=(m.children||[]).length;N=E+(E===1?" item":" items")}else N=[m.size?rm(m.size):"",m.time?new Date(m.time).toLocaleDateString():""].filter(Boolean).join(" · ");const j=Gh(f,m.path,!!m.dir);return j&&(N=Ou(j)+(N?" · "+N:"")),o.jsxs("div",{className:"dl-row",tabIndex:0,role:"button",title:m.path,onClick:()=>r(m.path),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),r(m.path))},children:[o.jsx("span",{className:"ticon",children:o.jsx(te,{name:m.dir?"folder":"doc"})}),o.jsx("span",{className:"dl-name",children:m.name}),j&&o.jsx("span",{className:"heatdot lvl"+$0(j),title:Ou(j)+" in 30 days"}),o.jsx("span",{className:"dl-meta",children:N})]},m.path)})}),i.hub&&o.jsx(cp,{apiBase:i.apiBase,prefix:c.path+"/",onOpen:r,onFullHistory:()=>i.onFullHistory(c.path+"/"),onRendered:i.onRendered})]})}function cp(i){const c=F0(i.apiBase,i.prefix,!0),{onRendered:f}=i;return Q.useEffect(()=>{c&&c.length&&f&&f()},[c,f]),!c||c.length===0?null:o.jsxs("div",{className:"dl-history",children:[o.jsx("h3",{className:"dl-h3",children:"Recent changes"}),o.jsx("div",{className:"history dl-hlist",children:c.map((r,d)=>o.jsx(hm,{entry:r,onOpen:i.onOpen},d))}),o.jsx("button",{className:"ai-btn dl-more",onClick:i.onFullHistory,children:"Full history"})]})}function sp(i){const{apiBase:c,path:f,onMeta:r}=i,d=c+"file?path="+encodeURIComponent(f);return Q.useEffect(()=>()=>r(""),[f,r]),B0.test(f)?o.jsx(fp,{...i}):Y0.test(f)?o.jsx(dp,{src:d,alt:f,onRendered:i.onRendered}):G0.test(f)?o.jsx(hp,{...i,fileURL:d}):o.jsxs("div",{className:"filecard",children:[o.jsx("div",{className:"name",children:f.split("/").pop()}),o.jsx("p",{children:"No preview for this file type."}),o.jsx("a",{className:"btn",download:!0,href:c+"download?path="+encodeURIComponent(f),children:"Download"})]})}function fp(i){const{apiBase:c,path:f,heatMap:r,flatFiles:d,onOpenFile:y,onMeta:S,onRendered:A}=i,{data:v,error:m}=he({queryKey:["render",c,f],queryFn:()=>Ae(c+"render?path="+encodeURIComponent(f))}),N=Q.useMemo(()=>v?op(v.html,f,c):"",[v,f,c]);return Q.useEffect(()=>{if(!v)return;const j=[];v.author&&j.push(v.author+(v.device?" on "+v.device:"")),v.time&&j.push(new Date(v.time).toLocaleString());const E=r&&r[v.path];E&&ti(E)&&j.push(Ou(E)+" / 30d"),S(j.join(" · ")),A?.()},[v,r,S,A]),m?o.jsxs("div",{className:"empty",children:["Could not load file: ",m.message]}):v?o.jsx("div",{dangerouslySetInnerHTML:{__html:N},onClick:j=>rp(j,f,d,y)}):null}function rp(i,c,f,r){const d=i.target.closest("a");if(!d||!i.currentTarget.contains(d))return;const y=d.getAttribute("href")||"",S=c.includes("/")?c.slice(0,c.lastIndexOf("/")):"";y.startsWith("wiki:")?(i.preventDefault(),mp(decodeURIComponent(y.slice(5)),f,r)):/^([a-z]+:|\/|#)/i.test(y)||(i.preventDefault(),r(om(S,decodeURIComponent(y))))}function op(i,c,f){const r=c.includes("/")?c.slice(0,c.lastIndexOf("/")):"",d=S=>f+"file?path="+encodeURIComponent(S),y=new DOMParser().parseFromString(i,"text/html");for(const S of y.querySelectorAll("img")){const A=S.getAttribute("src")||"";/^([a-z]+:|\/)/i.test(A)||S.setAttribute("src",d(om(r,A)))}for(const S of y.querySelectorAll("a")){const A=S.getAttribute("href")||"";/^https?:/i.test(A)&&(S.setAttribute("target","_blank"),S.setAttribute("rel","noopener"))}return y.body.innerHTML}function dp({src:i,alt:c,onRendered:f}){return o.jsx("img",{src:i,alt:c,onLoad:f})}function hp(i){const{path:c,fileURL:f,onRendered:r}=i,{data:d,error:y}=he({queryKey:["text",f],queryFn:async()=>{const S=await fetch(f);if(!S.ok)throw new Error(await S.text());return S.text()}});return Q.useEffect(()=>{d!=null&&r?.()},[d,r]),y?o.jsxs("div",{className:"empty",children:["Could not load file: ",y.message]}):d==null?null:o.jsx("pre",{className:"plain",children:d},c)}function mp(i,c,f){const r=i.toLowerCase(),d=c.find(y=>y.path.toLowerCase()===r||y.path.toLowerCase()===r+".md")||c.find(y=>{const S=y.name.toLowerCase();return S===r||S===r+".md"});d&&f(d.path)}function yp({url:i,copied:c,onClose:f}){const r=i.split("/s/")[1];return o.jsx("div",{className:"modal-back",onClick:d=>d.target===d.currentTarget&&f(),children:o.jsxs("div",{className:"modal",children:[o.jsx("h3",{children:"Public link created"}),o.jsxs("p",{children:[o.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until you revoke it."]}),o.jsx("div",{className:"modal-url",children:i}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"pbtn",onClick:()=>Pn(i).then(d=>ot(d?"Copied.":"Select and copy the link above.")),children:c?"Copied ✓":"Copy link"}),o.jsx("button",{className:"ai-btn",onClick:()=>window.open(i,"_blank"),children:"Open"}),o.jsx("button",{className:"ai-del",onClick:async()=>{try{await Ll("DELETE","/api/shares/"+r),ot("Link revoked — it no longer works."),f()}catch(d){ot(d.message,!0)}},children:"Revoke"}),o.jsx("button",{className:"ai-btn",onClick:f,children:"Done"})]})]})})}function Lh(i,c){if(!i)return{score:0,hits:[]};const f=i.toLowerCase(),r=c.toLowerCase();let d=0,y=0,S=0;const A=[];for(let v=0;v3&&r.endsWith("ies")?d=r.slice(0,-3)+"y":r.length>3&&r.endsWith("es")?d=r.slice(0,-2):r.length>2&&r.endsWith("s")&&(d=r.slice(0,-1)),d?Lh(d,c):null}function pp({text:i,hits:c}){const f=[];let r=0;return c.forEach((d,y)=>{d>r&&f.push(i.slice(r,d)),f.push(o.jsx("b",{children:i[d]},y)),r=d+1}),f.push(i.slice(r)),o.jsx("span",{className:"plabel",children:f})}function gp({open:i,onClose:c,candidates:f}){const[r,d]=Q.useState(""),[y,S]=Q.useState(0),A=Q.useRef(null),v=Q.useRef(null),m=Q.useMemo(()=>{if(!i)return[];const j=[];for(const E of f()){const q=vp(r,E.label);q&&j.push({...E,score:q.score,hits:q.hits})}return j.sort((E,q)=>q.score-E.score),j.slice(0,40)},[i,r,f]);Q.useEffect(()=>{i&&(d(""),S(0),A.current?.focus())},[i]),Q.useEffect(()=>S(0),[r]),Q.useEffect(()=>{v.current?.children[y]?.scrollIntoView({block:"nearest"})},[y,m]);const N=j=>{c(),j.run()};return Q.useEffect(()=>{if(!i)return;const j=E=>{if(E.key==="Escape")E.preventDefault(),c();else if(E.key==="ArrowDown"||E.key==="ArrowUp"){E.preventDefault();const q=m.length;q&&S(C=>(C+(E.key==="ArrowDown"?1:q-1))%q)}else E.key==="Enter"&&(E.preventDefault(),m[y]&&N(m[y]))};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[i,m,y]),i?o.jsx("div",{id:"palette-overlay",onClick:j=>j.target===j.currentTarget&&c(),children:o.jsxs("div",{id:"palette",role:"dialog","aria-label":"Search and quick actions",children:[o.jsxs("div",{id:"palette-inputwrap",children:[o.jsx(te,{name:"search"}),o.jsx("input",{id:"palette-input",type:"text",placeholder:"Search file names, projects, actions…",autoComplete:"off",spellCheck:!1,ref:A,value:r,onChange:j=>d(j.target.value)})]}),o.jsx("ul",{id:"palette-results",ref:v,children:m.length===0?o.jsx("li",{className:"pempty",children:"No matches — search covers file names, projects, and actions"}):m.map((j,E)=>o.jsxs("li",{className:E===y?"selected":void 0,onClick:()=>N(j),onMouseMove:()=>y!==E&&S(E),children:[o.jsx("span",{className:"picon",children:o.jsx(te,{name:j.icon})}),o.jsx(pp,{text:j.label,hits:j.hits}),o.jsx("span",{className:"pkind",children:j.kind})]},j.kind+":"+j.label))}),o.jsx("footer",{id:"palette-hint",children:"↑↓ navigate · ⏎ select · esc close"})]})}):null}const $s=[{key:"claude",label:"Claude Code & Cowork"},{key:"hermes",label:"Hermes",hook:"hermes",note:"Registers BearDrive's hooks in Hermes's config: pull before every turn, push after edits with a session note, and report file reads to Insights."},{key:"codex",label:"Codex",hook:"codex",note:"Registers hooks in .codex/hooks.json.",extra:"Run /hooks inside Codex once to trust the project's .codex layer — after that every turn pulls, edits push automatically, and reads are reported to Insights."}];function bp(i,c){const f=window.location.origin,r=c.id;if(i.key==="claude")return[{title:"Add the BearDrive plugin",desc:"One time, in any Claude Code session. The plugin ships the beardrive skill, the /beardrive commands, and turn-boundary sync hooks — and Claude Cowork shares the same plugins, so installing it once covers both.",code:`/plugin marketplace add runbear-io/beardrive +`+a.stack}}var yl=Object.prototype.hasOwnProperty,Xe=i.unstable_scheduleCallback,ye=i.unstable_cancelCallback,Mu=i.unstable_shouldYield,Cu=i.unstable_requestPaint,k=i.unstable_now,it=i.unstable_getCurrentPriorityLevel,bt=i.unstable_ImmediatePriority,Qe=i.unstable_UserBlockingPriority,vl=i.unstable_NormalPriority,Du=i.unstable_LowPriority,vf=i.unstable_IdlePriority,ym=i.log,vm=i.unstable_setDisableYieldValue,Ia=null,ve=null;function pl(t){if(typeof ym=="function"&&vm(t),ve&&typeof ve.setStrictMode=="function")try{ve.setStrictMode(Ia,t)}catch{}}var pe=Math.clz32?Math.clz32:bm,pm=Math.log,gm=Math.LN2;function bm(t){return t>>>=0,t===0?32:31-(pm(t)/gm|0)|0}var ii=256,ui=262144,ci=4194304;function Zl(t){var e=t&42;if(e!==0)return e;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function si(t,e,l){var a=t.pendingLanes;if(a===0)return 0;var n=0,u=t.suspendedLanes,s=t.pingedLanes;t=t.warmLanes;var h=a&134217727;return h!==0?(a=h&~u,a!==0?n=Zl(a):(s&=h,s!==0?n=Zl(s):l||(l=h&~t,l!==0&&(n=Zl(l))))):(h=a&~u,h!==0?n=Zl(h):s!==0?n=Zl(s):l||(l=a&~t,l!==0&&(n=Zl(l)))),n===0?0:e!==0&&e!==n&&(e&u)===0&&(u=n&-n,l=e&-e,u>=l||u===32&&(l&4194048)!==0)?e:n}function Pa(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function Sm(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pf(){var t=ci;return ci<<=1,(ci&62914560)===0&&(ci=4194304),t}function _u(t){for(var e=[],l=0;31>l;l++)e.push(t);return e}function tn(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function xm(t,e,l,a,n,u){var s=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var h=t.entanglements,p=t.expirationTimes,O=t.hiddenUpdates;for(l=s&~l;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Nm=/[\n"\\]/g;function ze(t){return t.replace(Nm,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Qu(t,e,l,a,n,u,s,h){t.name="",s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?t.type=s:t.removeAttribute("type"),e!=null?s==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+Ne(e)):t.value!==""+Ne(e)&&(t.value=""+Ne(e)):s!=="submit"&&s!=="reset"||t.removeAttribute("value"),e!=null?Bu(t,s,Ne(e)):l!=null?Bu(t,s,Ne(l)):a!=null&&t.removeAttribute("value"),n==null&&u!=null&&(t.defaultChecked=!!u),n!=null&&(t.checked=n&&typeof n!="function"&&typeof n!="symbol"),h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?t.name=""+Ne(h):t.removeAttribute("name")}function Cf(t,e,l,a,n,u,s,h){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),e!=null||l!=null){if(!(u!=="submit"&&u!=="reset"||e!=null)){wu(t);return}l=l!=null?""+Ne(l):"",e=e!=null?""+Ne(e):l,h||e===t.value||(t.value=e),t.defaultValue=e}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=h?t.checked:!!a,t.defaultChecked=!!a,s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(t.name=s),wu(t)}function Bu(t,e,l){e==="number"&&oi(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function va(t,e,l,a){if(t=t.options,e){e={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=!1;if(We)try{var nn={};Object.defineProperty(nn,"passive",{get:function(){Ku=!0}}),window.addEventListener("test",nn,nn),window.removeEventListener("test",nn,nn)}catch{Ku=!1}var bl=null,Zu=null,hi=null;function wf(){if(hi)return hi;var t,e=Zu,l=e.length,a,n="value"in bl?bl.value:bl.textContent,u=n.length;for(t=0;t=sn),Xf=" ",Kf=!1;function Zf(t,e){switch(t){case"keyup":return ey.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Sa=!1;function ay(t,e){switch(t){case"compositionend":return Vf(e);case"keypress":return e.which!==32?null:(Kf=!0,Xf);case"textInput":return t=e.data,t===Xf&&Kf?null:t;default:return null}}function ny(t,e){if(Sa)return t==="compositionend"||!$u&&Zf(t,e)?(t=wf(),hi=Zu=bl=null,Sa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:l,offset:e-t};t=a}t:{for(;l;){if(l.nextSibling){l=l.nextSibling;break t}l=l.parentNode}l=void 0}l=tr(l)}}function lr(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?lr(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function ar(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=oi(t.document);e instanceof t.HTMLIFrameElement;){try{var l=typeof e.contentWindow.location.href=="string"}catch{l=!1}if(l)t=e.contentWindow;else break;e=oi(t.document)}return e}function Pu(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var dy=We&&"documentMode"in document&&11>=document.documentMode,xa=null,tc=null,dn=null,ec=!1;function nr(t,e,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ec||xa==null||xa!==oi(a)||(a=xa,"selectionStart"in a&&Pu(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),dn&&on(dn,a)||(dn=a,a=uu(tc,"onSelect"),0>=s,n-=s,Ke=1<<32-pe(e)+n|l<lt?(ft=Z,Z=null):ft=Z.sibling;var vt=z(x,Z,T[lt],R);if(vt===null){Z===null&&(Z=ft);break}t&&Z&&vt.alternate===null&&e(x,Z),g=u(vt,g,lt),yt===null?V=vt:yt.sibling=vt,yt=vt,Z=ft}if(lt===T.length)return l(x,Z),rt&&Pe(x,lt),V;if(Z===null){for(;ltlt?(ft=Z,Z=null):ft=Z.sibling;var Gl=z(x,Z,vt.value,R);if(Gl===null){Z===null&&(Z=ft);break}t&&Z&&Gl.alternate===null&&e(x,Z),g=u(Gl,g,lt),yt===null?V=Gl:yt.sibling=Gl,yt=Gl,Z=ft}if(vt.done)return l(x,Z),rt&&Pe(x,lt),V;if(Z===null){for(;!vt.done;lt++,vt=T.next())vt=U(x,vt.value,R),vt!==null&&(g=u(vt,g,lt),yt===null?V=vt:yt.sibling=vt,yt=vt);return rt&&Pe(x,lt),V}for(Z=a(Z);!vt.done;lt++,vt=T.next())vt=M(Z,x,lt,vt.value,R),vt!==null&&(t&&vt.alternate!==null&&Z.delete(vt.key===null?lt:vt.key),g=u(vt,g,lt),yt===null?V=vt:yt.sibling=vt,yt=vt);return t&&Z.forEach(function(_v){return e(x,_v)}),rt&&Pe(x,lt),V}function Tt(x,g,T,R){if(typeof T=="object"&&T!==null&&T.type===w&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case q:t:{for(var V=T.key;g!==null;){if(g.key===V){if(V=T.type,V===w){if(g.tag===7){l(x,g.sibling),R=n(g,T.props.children),R.return=x,x=R;break t}}else if(g.elementType===V||typeof V=="object"&&V!==null&&V.$$typeof===ht&&la(V)===g.type){l(x,g.sibling),R=n(g,T.props),gn(R,T),R.return=x,x=R;break t}l(x,g);break}else e(x,g);g=g.sibling}T.type===w?(R=Wl(T.props.children,x.mode,R,T.key),R.return=x,x=R):(R=Ei(T.type,T.key,T.props,null,x.mode,R),gn(R,T),R.return=x,x=R)}return s(x);case C:t:{for(V=T.key;g!==null;){if(g.key===V)if(g.tag===4&&g.stateNode.containerInfo===T.containerInfo&&g.stateNode.implementation===T.implementation){l(x,g.sibling),R=n(g,T.children||[]),R.return=x,x=R;break t}else{l(x,g);break}else e(x,g);g=g.sibling}R=sc(T,x.mode,R),R.return=x,x=R}return s(x);case ht:return T=la(T),Tt(x,g,T,R)}if(me(T))return K(x,g,T,R);if(Ht(T)){if(V=Ht(T),typeof V!="function")throw Error(r(150));return T=V.call(T),$(x,g,T,R)}if(typeof T.then=="function")return Tt(x,g,Ci(T),R);if(T.$$typeof===nt)return Tt(x,g,Ai(x,T),R);Di(x,T)}return typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint"?(T=""+T,g!==null&&g.tag===6?(l(x,g.sibling),R=n(g,T),R.return=x,x=R):(l(x,g),R=cc(T,x.mode,R),R.return=x,x=R),s(x)):l(x,g)}return function(x,g,T,R){try{pn=0;var V=Tt(x,g,T,R);return _a=null,V}catch(Z){if(Z===Da||Z===zi)throw Z;var yt=be(29,Z,null,x.mode);return yt.lanes=R,yt.return=x,yt}}}var na=Nr(!0),zr=Nr(!1),Tl=!1;function Sc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xc(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ol(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Al(t,e,l){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(pt&2)!==0){var n=a.pending;return n===null?e.next=e:(e.next=n.next,n.next=e),a.pending=e,e=ji(t),or(t,null,l),e}return xi(t,a,e,l),ji(t)}function bn(t,e,l){if(e=e.updateQueue,e!==null&&(e=e.shared,(l&4194048)!==0)){var a=e.lanes;a&=t.pendingLanes,l|=a,e.lanes=l,bf(t,l)}}function jc(t,e){var l=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,l===a)){var n=null,u=null;if(l=l.firstBaseUpdate,l!==null){do{var s={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};u===null?n=u=s:u=u.next=s,l=l.next}while(l!==null);u===null?n=u=e:u=u.next=e}else n=u=e;l={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=e:t.next=e,l.lastBaseUpdate=e}var Ec=!1;function Sn(){if(Ec){var t=Ca;if(t!==null)throw t}}function xn(t,e,l,a){Ec=!1;var n=t.updateQueue;Tl=!1;var u=n.firstBaseUpdate,s=n.lastBaseUpdate,h=n.shared.pending;if(h!==null){n.shared.pending=null;var p=h,O=p.next;p.next=null,s===null?u=O:s.next=O,s=p;var D=t.alternate;D!==null&&(D=D.updateQueue,h=D.lastBaseUpdate,h!==s&&(h===null?D.firstBaseUpdate=O:h.next=O,D.lastBaseUpdate=p))}if(u!==null){var U=n.baseState;s=0,D=O=p=null,h=u;do{var z=h.lane&-536870913,M=z!==h.lane;if(M?(st&z)===z:(a&z)===z){z!==0&&z===Ma&&(Ec=!0),D!==null&&(D=D.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});t:{var K=t,$=h;z=e;var Tt=l;switch($.tag){case 1:if(K=$.payload,typeof K=="function"){U=K.call(Tt,U,z);break t}U=K;break t;case 3:K.flags=K.flags&-65537|128;case 0:if(K=$.payload,z=typeof K=="function"?K.call(Tt,U,z):K,z==null)break t;U=j({},U,z);break t;case 2:Tl=!0}}z=h.callback,z!==null&&(t.flags|=64,M&&(t.flags|=8192),M=n.callbacks,M===null?n.callbacks=[z]:M.push(z))}else M={lane:z,tag:h.tag,payload:h.payload,callback:h.callback,next:null},D===null?(O=D=M,p=U):D=D.next=M,s|=z;if(h=h.next,h===null){if(h=n.shared.pending,h===null)break;M=h,h=M.next,M.next=null,n.lastBaseUpdate=M,n.shared.pending=null}}while(!0);D===null&&(p=U),n.baseState=p,n.firstBaseUpdate=O,n.lastBaseUpdate=D,u===null&&(n.shared.lanes=0),Dl|=s,t.lanes=s,t.memoizedState=U}}function Mr(t,e){if(typeof t!="function")throw Error(r(191,t));t.call(e)}function Cr(t,e){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;tu?u:8;var s=_.T,h={};_.T=h,Lc(t,!1,e,l);try{var p=n(),O=_.S;if(O!==null&&O(h,p),p!==null&&typeof p=="object"&&typeof p.then=="function"){var D=xy(p,a);Tn(t,e,D,Te(t))}else Tn(t,e,a,Te(t))}catch(U){Tn(t,e,{then:function(){},status:"rejected",reason:U},Te())}finally{Y.p=u,s!==null&&h.types!==null&&(s.types=h.types),_.T=s}}function Ny(){}function Yc(t,e,l,a){if(t.tag!==5)throw Error(r(476));var n=so(t).queue;co(t,n,e,J,l===null?Ny:function(){return fo(t),l(a)})}function so(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:J},next:null};var l={};return e.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:l},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function fo(t){var e=so(t);e.next===null&&(e=t.alternate.memoizedState),Tn(t,e.next.queue,{},Te())}function Gc(){return $t(Gn)}function ro(){return wt().memoizedState}function oo(){return wt().memoizedState}function zy(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var l=Te();t=Ol(l);var a=Al(e,t,l);a!==null&&(oe(a,e,l),bn(a,e,l)),e={cache:vc()},t.payload=e;return}e=e.return}}function My(t,e,l){var a=Te();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Gi(t)?mo(e,l):(l=ic(t,e,l,a),l!==null&&(oe(l,t,a),yo(l,e,a)))}function ho(t,e,l){var a=Te();Tn(t,e,l,a)}function Tn(t,e,l,a){var n={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Gi(t))mo(e,n);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=e.lastRenderedReducer,u!==null))try{var s=e.lastRenderedState,h=u(s,l);if(n.hasEagerState=!0,n.eagerState=h,ge(h,s))return xi(t,e,n,0),At===null&&Si(),!1}catch{}if(l=ic(t,e,n,a),l!==null)return oe(l,t,a),yo(l,e,a),!0}return!1}function Lc(t,e,l,a){if(a={lane:2,revertLane:Ss(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Gi(t)){if(e)throw Error(r(479))}else e=ic(t,l,a,2),e!==null&&oe(e,t,2)}function Gi(t){var e=t.alternate;return t===P||e!==null&&e===P}function mo(t,e){Ua=Ui=!0;var l=t.pending;l===null?e.next=e:(e.next=l.next,l.next=e),t.pending=e}function yo(t,e,l){if((l&4194048)!==0){var a=e.lanes;a&=t.pendingLanes,l|=a,e.lanes=l,bf(t,l)}}var On={readContext:$t,use:wi,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useInsertionEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useSyncExternalStore:Rt,useId:Rt,useHostTransitionStatus:Rt,useFormState:Rt,useActionState:Rt,useOptimistic:Rt,useMemoCache:Rt,useCacheRefresh:Rt};On.useEffectEvent=Rt;var vo={readContext:$t,use:wi,useCallback:function(t,e){return ae().memoizedState=[t,e===void 0?null:e],t},useContext:$t,useEffect:Ir,useImperativeHandle:function(t,e,l){l=l!=null?l.concat([t]):null,Bi(4194308,4,lo.bind(null,e,t),l)},useLayoutEffect:function(t,e){return Bi(4194308,4,t,e)},useInsertionEffect:function(t,e){Bi(4,2,t,e)},useMemo:function(t,e){var l=ae();e=e===void 0?null:e;var a=t();if(ia){pl(!0);try{t()}finally{pl(!1)}}return l.memoizedState=[a,e],a},useReducer:function(t,e,l){var a=ae();if(l!==void 0){var n=l(e);if(ia){pl(!0);try{l(e)}finally{pl(!1)}}}else n=e;return a.memoizedState=a.baseState=n,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=My.bind(null,P,t),[a.memoizedState,t]},useRef:function(t){var e=ae();return t={current:t},e.memoizedState=t},useState:function(t){t=Hc(t);var e=t.queue,l=ho.bind(null,P,e);return e.dispatch=l,[t.memoizedState,l]},useDebugValue:Qc,useDeferredValue:function(t,e){var l=ae();return Bc(l,t,e)},useTransition:function(){var t=Hc(!1);return t=co.bind(null,P,t.queue,!0,!1),ae().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,l){var a=P,n=ae();if(rt){if(l===void 0)throw Error(r(407));l=l()}else{if(l=e(),At===null)throw Error(r(349));(st&127)!==0||qr(a,e,l)}n.memoizedState=l;var u={value:l,getSnapshot:e};return n.queue=u,Ir(Qr.bind(null,a,u,t),[t]),a.flags|=2048,qa(9,{destroy:void 0},wr.bind(null,a,u,l,e),null),l},useId:function(){var t=ae(),e=At.identifierPrefix;if(rt){var l=Ze,a=Ke;l=(a&~(1<<32-pe(a)-1)).toString(32)+l,e="_"+e+"R_"+l,l=Hi++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?s.createElement("select",{is:a.is}):s.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?s.createElement(n,{is:a.is}):s.createElement(n)}}u[kt]=e,u[ie]=a;t:for(s=e.child;s!==null;){if(s.tag===5||s.tag===6)u.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break t;for(;s.sibling===null;){if(s.return===null||s.return===e)break t;s=s.return}s.sibling.return=s.return,s=s.sibling}e.stateNode=u;t:switch(It(u,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break t;case"img":a=!0;break t;default:a=!1}a&&il(e)}}return Ct(e),ls(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,l),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==a&&il(e);else{if(typeof a!="string"&&e.stateNode===null)throw Error(r(166));if(t=et.current,Na(e)){if(t=e.stateNode,l=e.memoizedProps,a=null,n=Ft,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}t[kt]=e,t=!!(t.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||Hd(t.nodeValue,l)),t||jl(e,!0)}else t=cu(t).createTextNode(a),t[kt]=e,e.stateNode=t}return Ct(e),null;case 31:if(l=e.memoizedState,t===null||t.memoizedState!==null){if(a=Na(e),l!==null){if(t===null){if(!a)throw Error(r(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[kt]=e}else Il(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ct(e),t=!1}else l=dc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return e.flags&256?(xe(e),e):(xe(e),null);if((e.flags&128)!==0)throw Error(r(558))}return Ct(e),null;case 13:if(a=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(n=Na(e),a!==null&&a.dehydrated!==null){if(t===null){if(!n)throw Error(r(318));if(n=e.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));n[kt]=e}else Il(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ct(e),n=!1}else n=dc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),n=!0;if(!n)return e.flags&256?(xe(e),e):(xe(e),null)}return xe(e),(e.flags&128)!==0?(e.lanes=l,e):(l=a!==null,t=t!==null&&t.memoizedState!==null,l&&(a=e.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==n&&(a.flags|=2048)),l!==t&&l&&(e.child.flags|=8192),Vi(e,e.updateQueue),Ct(e),null);case 4:return Dt(),t===null&&Ts(e.stateNode.containerInfo),Ct(e),null;case 10:return el(e.type),Ct(e),null;case 19:if(H(qt),a=e.memoizedState,a===null)return Ct(e),null;if(n=(e.flags&128)!==0,u=a.rendering,u===null)if(n)Nn(a,!1);else{if(Ut!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(u=Ri(t),u!==null){for(e.flags|=128,Nn(a,!1),t=u.updateQueue,e.updateQueue=t,Vi(e,t),e.subtreeFlags=0,t=l,l=e.child;l!==null;)dr(l,t),l=l.sibling;return G(qt,qt.current&1|2),rt&&Pe(e,a.treeForkCount),e.child}t=t.sibling}a.tail!==null&&k()>Wi&&(e.flags|=128,n=!0,Nn(a,!1),e.lanes=4194304)}else{if(!n)if(t=Ri(u),t!==null){if(e.flags|=128,n=!0,t=t.updateQueue,e.updateQueue=t,Vi(e,t),Nn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!rt)return Ct(e),null}else 2*k()-a.renderingStartTime>Wi&&l!==536870912&&(e.flags|=128,n=!0,Nn(a,!1),e.lanes=4194304);a.isBackwards?(u.sibling=e.child,e.child=u):(t=a.last,t!==null?t.sibling=u:e.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=k(),t.sibling=null,l=qt.current,G(qt,n?l&1|2:l&1),rt&&Pe(e,a.treeForkCount),t):(Ct(e),null);case 22:case 23:return xe(e),Oc(),a=e.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(e.flags|=8192):a&&(e.flags|=8192),a?(l&536870912)!==0&&(e.flags&128)===0&&(Ct(e),e.subtreeFlags&6&&(e.flags|=8192)):Ct(e),l=e.updateQueue,l!==null&&Vi(e,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),a=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),a!==l&&(e.flags|=2048),t!==null&&H(ea),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),e.memoizedState.cache!==l&&(e.flags|=2048),el(Qt),Ct(e),null;case 25:return null;case 30:return null}throw Error(r(156,e.tag))}function Uy(t,e){switch(rc(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return el(Qt),Dt(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return Kl(e),null;case 31:if(e.memoizedState!==null){if(xe(e),e.alternate===null)throw Error(r(340));Il()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(xe(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(r(340));Il()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return H(qt),null;case 4:return Dt(),null;case 10:return el(e.type),null;case 22:case 23:return xe(e),Oc(),t!==null&&H(ea),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return el(Qt),null;case 25:return null;default:return null}}function Yo(t,e){switch(rc(e),e.tag){case 3:el(Qt),Dt();break;case 26:case 27:case 5:Kl(e);break;case 4:Dt();break;case 31:e.memoizedState!==null&&xe(e);break;case 13:xe(e);break;case 19:H(qt);break;case 10:el(e.type);break;case 22:case 23:xe(e),Oc(),t!==null&&H(ea);break;case 24:el(Qt)}}function zn(t,e){try{var l=e.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var n=a.next;l=n;do{if((l.tag&t)===t){a=void 0;var u=l.create,s=l.inst;a=u(),s.destroy=a}l=l.next}while(l!==n)}}catch(h){xt(e,e.return,h)}}function Ml(t,e,l){try{var a=e.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var u=n.next;a=u;do{if((a.tag&t)===t){var s=a.inst,h=s.destroy;if(h!==void 0){s.destroy=void 0,n=e;var p=l,O=h;try{O()}catch(D){xt(n,p,D)}}}a=a.next}while(a!==u)}}catch(D){xt(e,e.return,D)}}function Go(t){var e=t.updateQueue;if(e!==null){var l=t.stateNode;try{Cr(e,l)}catch(a){xt(t,t.return,a)}}}function Lo(t,e,l){l.props=ua(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(a){xt(t,e,a)}}function Mn(t,e){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof l=="function"?t.refCleanup=l(a):l.current=a}}catch(n){xt(t,e,n)}}function Ve(t,e){var l=t.ref,a=t.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(n){xt(t,e,n)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(n){xt(t,e,n)}else l.current=null}function Xo(t){var e=t.type,l=t.memoizedProps,a=t.stateNode;try{t:switch(e){case"button":case"input":case"select":case"textarea":l.autoFocus&&a.focus();break t;case"img":l.src?a.src=l.src:l.srcSet&&(a.srcset=l.srcSet)}}catch(n){xt(t,t.return,n)}}function as(t,e,l){try{var a=t.stateNode;lv(a,t.type,l,e),a[ie]=e}catch(n){xt(t,t.return,n)}}function Ko(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ql(t.type)||t.tag===4}function ns(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||Ko(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ql(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function is(t,e,l){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,e):(e=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,e.appendChild(t),l=l._reactRootContainer,l!=null||e.onclick!==null||(e.onclick=$e));else if(a!==4&&(a===27&&ql(t.type)&&(l=t.stateNode,e=null),t=t.child,t!==null))for(is(t,e,l),t=t.sibling;t!==null;)is(t,e,l),t=t.sibling}function Ji(t,e,l){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?l.insertBefore(t,e):l.appendChild(t);else if(a!==4&&(a===27&&ql(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(Ji(t,e,l),t=t.sibling;t!==null;)Ji(t,e,l),t=t.sibling}function Zo(t){var e=t.stateNode,l=t.memoizedProps;try{for(var a=t.type,n=e.attributes;n.length;)e.removeAttributeNode(n[0]);It(e,a,l),e[kt]=t,e[ie]=l}catch(u){xt(t,t.return,u)}}var ul=!1,Gt=!1,us=!1,Vo=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function Hy(t,e){if(t=t.containerInfo,Ns=mu,t=ar(t),Pu(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else t:{l=(l=t.ownerDocument)&&l.defaultView||window;var a=l.getSelection&&l.getSelection();if(a&&a.rangeCount!==0){l=a.anchorNode;var n=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{l.nodeType,u.nodeType}catch{l=null;break t}var s=0,h=-1,p=-1,O=0,D=0,U=t,z=null;e:for(;;){for(var M;U!==l||n!==0&&U.nodeType!==3||(h=s+n),U!==u||a!==0&&U.nodeType!==3||(p=s+a),U.nodeType===3&&(s+=U.nodeValue.length),(M=U.firstChild)!==null;)z=U,U=M;for(;;){if(U===t)break e;if(z===l&&++O===n&&(h=s),z===u&&++D===a&&(p=s),(M=U.nextSibling)!==null)break;U=z,z=U.parentNode}U=M}l=h===-1||p===-1?null:{start:h,end:p}}else l=null}l=l||{start:0,end:0}}else l=null;for(zs={focusedElem:t,selectionRange:l},mu=!1,Zt=e;Zt!==null;)if(e=Zt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Zt=t;else for(;Zt!==null;){switch(e=Zt,u=e.alternate,t=e.flags,e.tag){case 0:if((t&4)!==0&&(t=e.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l title"))),It(u,a,l),u[kt]=t,Kt(u),a=u;break t;case"link":var s=Id("link","href",n).get(a+(l.href||""));if(s){for(var h=0;hTt&&(s=Tt,Tt=$,$=s);var x=er(h,$),g=er(h,Tt);if(x&&g&&(M.rangeCount!==1||M.anchorNode!==x.node||M.anchorOffset!==x.offset||M.focusNode!==g.node||M.focusOffset!==g.offset)){var T=U.createRange();T.setStart(x.node,x.offset),M.removeAllRanges(),$>Tt?(M.addRange(T),M.extend(g.node,g.offset)):(T.setEnd(g.node,g.offset),M.addRange(T))}}}}for(U=[],M=h;M=M.parentNode;)M.nodeType===1&&U.push({element:M,left:M.scrollLeft,top:M.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;hl?32:l,_.T=null,l=hs,hs=null;var u=Rl,s=ol;if(Xt=0,Ga=Rl=null,ol=0,(pt&6)!==0)throw Error(r(331));var h=pt;if(pt|=4,ad(u.current),td(u,u.current,s,l),pt=h,Hn(0,!1),ve&&typeof ve.onPostCommitFiberRoot=="function")try{ve.onPostCommitFiberRoot(Ia,u)}catch{}return!0}finally{Y.p=n,_.T=a,xd(t,e)}}function Ed(t,e,l){e=Ce(l,e),e=Vc(t.stateNode,e,2),t=Al(t,e,2),t!==null&&(tn(t,2),Je(t))}function xt(t,e,l){if(t.tag===3)Ed(t,t,l);else for(;e!==null;){if(e.tag===3){Ed(e,t,l);break}else if(e.tag===1){var a=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(_l===null||!_l.has(a))){t=Ce(l,t),l=To(2),a=Al(e,l,2),a!==null&&(Oo(l,a,e,t),tn(a,2),Je(a));break}}e=e.return}}function ps(t,e,l){var a=t.pingCache;if(a===null){a=t.pingCache=new Qy;var n=new Set;a.set(e,n)}else n=a.get(e),n===void 0&&(n=new Set,a.set(e,n));n.has(l)||(fs=!0,n.add(l),t=Xy.bind(null,t,e,l),e.then(t,t))}function Xy(t,e,l){var a=t.pingCache;a!==null&&a.delete(e),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,At===t&&(st&l)===l&&(Ut===4||Ut===3&&(st&62914560)===st&&300>k()-$i?(pt&2)===0&&La(t,0):rs|=l,Ya===st&&(Ya=0)),Je(t)}function Td(t,e){e===0&&(e=pf()),t=$l(t,e),t!==null&&(tn(t,e),Je(t))}function Ky(t){var e=t.memoizedState,l=0;e!==null&&(l=e.retryLane),Td(t,l)}function Zy(t,e){var l=0;switch(t.tag){case 31:case 13:var a=t.stateNode,n=t.memoizedState;n!==null&&(l=n.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(r(314))}a!==null&&a.delete(e),Td(t,l)}function Vy(t,e){return Xe(t,e)}var au=null,Ka=null,gs=!1,nu=!1,bs=!1,Hl=0;function Je(t){t!==Ka&&t.next===null&&(Ka===null?au=Ka=t:Ka=Ka.next=t),nu=!0,gs||(gs=!0,ky())}function Hn(t,e){if(!bs&&nu){bs=!0;do for(var l=!1,a=au;a!==null;){if(t!==0){var n=a.pendingLanes;if(n===0)var u=0;else{var s=a.suspendedLanes,h=a.pingedLanes;u=(1<<31-pe(42|t)+1)-1,u&=n&~(s&~h),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,zd(a,u))}else u=st,u=si(a,a===At?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Pa(a,u)||(l=!0,zd(a,u));a=a.next}while(l);bs=!1}}function Jy(){Od()}function Od(){nu=gs=!1;var t=0;Hl!==0&&nv()&&(t=Hl);for(var e=k(),l=null,a=au;a!==null;){var n=a.next,u=Ad(a,e);u===0?(a.next=null,l===null?au=n:l.next=n,n===null&&(Ka=l)):(l=a,(t!==0||(u&3)!==0)&&(nu=!0)),a=n}Xt!==0&&Xt!==5||Hn(t),Hl!==0&&(Hl=0)}function Ad(t,e){for(var l=t.suspendedLanes,a=t.pingedLanes,n=t.expirationTimes,u=t.pendingLanes&-62914561;0h)break;var D=p.transferSize,U=p.initiatorType;D&&qd(U)&&(p=p.responseEnd,s+=D*(p"u"?null:document;function kd(t,e,l){var a=Za;if(a&&typeof e=="string"&&e){var n=ze(e);n='link[rel="'+t+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),Jd.has(n)||(Jd.add(n),t={rel:t,crossOrigin:l,href:e},a.querySelector(n)===null&&(e=a.createElement("link"),It(e,"link",t),Kt(e),a.head.appendChild(e)))}}function hv(t){dl.D(t),kd("dns-prefetch",t,null)}function mv(t,e){dl.C(t,e),kd("preconnect",t,e)}function yv(t,e,l){dl.L(t,e,l);var a=Za;if(a&&t&&e){var n='link[rel="preload"][as="'+ze(e)+'"]';e==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+ze(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+ze(l.imageSizes)+'"]')):n+='[href="'+ze(t)+'"]';var u=n;switch(e){case"style":u=Va(t);break;case"script":u=Ja(t)}qe.has(u)||(t=j({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),qe.set(u,t),a.querySelector(n)!==null||e==="style"&&a.querySelector(Bn(u))||e==="script"&&a.querySelector(Yn(u))||(e=a.createElement("link"),It(e,"link",t),Kt(e),a.head.appendChild(e)))}}function vv(t,e){dl.m(t,e);var l=Za;if(l&&t){var a=e&&typeof e.as=="string"?e.as:"script",n='link[rel="modulepreload"][as="'+ze(a)+'"][href="'+ze(t)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ja(t)}if(!qe.has(u)&&(t=j({rel:"modulepreload",href:t},e),qe.set(u,t),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Yn(u)))return}a=l.createElement("link"),It(a,"link",t),Kt(a),l.head.appendChild(a)}}}function pv(t,e,l){dl.S(t,e,l);var a=Za;if(a&&t){var n=ma(a).hoistableStyles,u=Va(t);e=e||"default";var s=n.get(u);if(!s){var h={loading:0,preload:null};if(s=a.querySelector(Bn(u)))h.loading=5;else{t=j({rel:"stylesheet",href:t,"data-precedence":e},l),(l=qe.get(u))&&Hs(t,l);var p=s=a.createElement("link");Kt(p),It(p,"link",t),p._p=new Promise(function(O,D){p.onload=O,p.onerror=D}),p.addEventListener("load",function(){h.loading|=1}),p.addEventListener("error",function(){h.loading|=2}),h.loading|=4,fu(s,e,a)}s={type:"stylesheet",instance:s,count:1,state:h},n.set(u,s)}}}function gv(t,e){dl.X(t,e);var l=Za;if(l&&t){var a=ma(l).hoistableScripts,n=Ja(t),u=a.get(n);u||(u=l.querySelector(Yn(n)),u||(t=j({src:t,async:!0},e),(e=qe.get(n))&&qs(t,e),u=l.createElement("script"),Kt(u),It(u,"link",t),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function bv(t,e){dl.M(t,e);var l=Za;if(l&&t){var a=ma(l).hoistableScripts,n=Ja(t),u=a.get(n);u||(u=l.querySelector(Yn(n)),u||(t=j({src:t,async:!0,type:"module"},e),(e=qe.get(n))&&qs(t,e),u=l.createElement("script"),Kt(u),It(u,"link",t),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function Fd(t,e,l,a){var n=(n=et.current)?su(n):null;if(!n)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(e=Va(l.href),l=ma(n).hoistableStyles,a=l.get(e),a||(a={type:"style",instance:null,count:0,state:null},l.set(e,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=Va(l.href);var u=ma(n).hoistableStyles,s=u.get(t);if(s||(n=n.ownerDocument||n,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,s),(u=n.querySelector(Bn(t)))&&!u._p&&(s.instance=u,s.state.loading=5),qe.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},qe.set(t,l),u||Sv(n,t,l,s.state))),e&&a===null)throw Error(r(528,""));return s}if(e&&a!==null)throw Error(r(529,""));return null;case"script":return e=l.async,l=l.src,typeof l=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Ja(l),l=ma(n).hoistableScripts,a=l.get(e),a||(a={type:"script",instance:null,count:0,state:null},l.set(e,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function Va(t){return'href="'+ze(t)+'"'}function Bn(t){return'link[rel="stylesheet"]['+t+"]"}function $d(t){return j({},t,{"data-precedence":t.precedence,precedence:null})}function Sv(t,e,l,a){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?a.loading=1:(e=t.createElement("link"),a.preload=e,e.addEventListener("load",function(){return a.loading|=1}),e.addEventListener("error",function(){return a.loading|=2}),It(e,"link",l),Kt(e),t.head.appendChild(e))}function Ja(t){return'[src="'+ze(t)+'"]'}function Yn(t){return"script[async]"+t}function Wd(t,e,l){if(e.count++,e.instance===null)switch(e.type){case"style":var a=t.querySelector('style[data-href~="'+ze(l.href)+'"]');if(a)return e.instance=a,Kt(a),a;var n=j({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),Kt(a),It(a,"style",n),fu(a,l.precedence,t),e.instance=a;case"stylesheet":n=Va(l.href);var u=t.querySelector(Bn(n));if(u)return e.state.loading|=4,e.instance=u,Kt(u),u;a=$d(l),(n=qe.get(n))&&Hs(a,n),u=(t.ownerDocument||t).createElement("link"),Kt(u);var s=u;return s._p=new Promise(function(h,p){s.onload=h,s.onerror=p}),It(u,"link",a),e.state.loading|=4,fu(u,l.precedence,t),e.instance=u;case"script":return u=Ja(l.src),(n=t.querySelector(Yn(u)))?(e.instance=n,Kt(n),n):(a=l,(n=qe.get(u))&&(a=j({},l),qs(a,n)),t=t.ownerDocument||t,n=t.createElement("script"),Kt(n),It(n,"link",a),t.head.appendChild(n),e.instance=n);case"void":return null;default:throw Error(r(443,e.type))}else e.type==="stylesheet"&&(e.state.loading&4)===0&&(a=e.instance,e.state.loading|=4,fu(a,l.precedence,t));return e.instance}function fu(t,e,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,u=n,s=0;s title"):null)}function xv(t,e,l){if(l===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;return e.rel==="stylesheet"?(t=e.disabled,typeof e.precedence=="string"&&t==null):!0;case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function th(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function jv(t,e,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var n=Va(a.href),u=e.querySelector(Bn(n));if(u){e=u._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=ou.bind(t),e.then(t,t)),l.state.loading|=4,l.instance=u,Kt(u);return}u=e.ownerDocument||e,a=$d(a),(n=qe.get(n))&&Hs(a,n),u=u.createElement("link"),Kt(u);var s=u;s._p=new Promise(function(h,p){s.onload=h,s.onerror=p}),It(u,"link",a),l.instance=u}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,e),(e=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=ou.bind(t),e.addEventListener("load",l),e.addEventListener("error",l))}}var ws=0;function Ev(t,e){return t.stylesheets&&t.count===0&&hu(t,t.stylesheets),0ws?50:800)+e);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function ou(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)hu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var du=null;function hu(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,du=new Map,e.forEach(Tv,t),du=null,ou.call(t))}function Tv(t,e){if(!(e.state.loading&4)){var l=du.get(t);if(l)var a=l.get(null);else{l=new Map,du.set(t,l);for(var n=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),Vs.exports=Yv(),Vs.exports}var Lv=Gv(),ei=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(i){return this.listeners.add(i),this.onSubscribe(),()=>{this.listeners.delete(i),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Xv=class extends ei{#t;#e;#l;constructor(){super(),this.#l=i=>{if(typeof window<"u"&&window.addEventListener){const c=()=>i();return window.addEventListener("visibilitychange",c,!1),()=>{window.removeEventListener("visibilitychange",c)}}}}onSubscribe(){this.#e||this.setEventListener(this.#l)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(i){this.#l=i,this.#e?.(),this.#e=i(c=>{typeof c=="boolean"?this.setFocused(c):this.onFocus()})}setFocused(i){this.#t!==i&&(this.#t=i,this.onFocus())}onFocus(){const i=this.isFocused();this.listeners.forEach(c=>{c(i)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},sf=new Xv,Kv={setTimeout:(i,c)=>setTimeout(i,c),clearTimeout:i=>clearTimeout(i),setInterval:(i,c)=>setInterval(i,c),clearInterval:i=>clearInterval(i)},Zv=class{#t=Kv;#e=!1;setTimeoutProvider(i){this.#t=i}setTimeout(i,c){return this.#t.setTimeout(i,c)}clearTimeout(i){this.#t.clearTimeout(i)}setInterval(i,c){return this.#t.setInterval(i,c)}clearInterval(i){this.#t.clearInterval(i)}},fa=new Zv;function Vv(i){setTimeout(i,0)}var Jv=typeof window>"u"||"Deno"in globalThis;function de(){}function kv(i,c){return typeof i=="function"?i(c):i}function Is(i){return typeof i=="number"&&i>=0&&i!==1/0}function Zh(i,c){return Math.max(i+(c||0)-Date.now(),0)}function Xl(i,c){return typeof i=="function"?i(c):i}function Oe(i,c){return typeof i=="function"?i(c):i}function Th(i,c){const{type:f="all",exact:r,fetchStatus:d,predicate:m,queryKey:S,stale:A}=i;if(S){if(r){if(c.queryHash!==ff(S,c.options))return!1}else if(!Fn(c.queryKey,S))return!1}if(f!=="all"){const v=c.isActive();if(f==="active"&&!v||f==="inactive"&&v)return!1}return!(typeof A=="boolean"&&c.isStale()!==A||d&&d!==c.state.fetchStatus||m&&!m(c))}function Oh(i,c){const{exact:f,status:r,predicate:d,mutationKey:m}=i;if(m){if(!c.options.mutationKey)return!1;if(f){if(kn(c.options.mutationKey)!==kn(m))return!1}else if(!Fn(c.options.mutationKey,m))return!1}return!(r&&c.state.status!==r||d&&!d(c))}function ff(i,c){return(c?.queryKeyHashFn||kn)(i)}function kn(i){return JSON.stringify(i,(c,f)=>tf(f)?Object.keys(f).sort().reduce((r,d)=>(r[d]=f[d],r),{}):f)}function Fn(i,c){return i===c?!0:typeof i!=typeof c?!1:i&&c&&typeof i=="object"&&typeof c=="object"?Object.keys(c).every(f=>Fn(i[f],c[f])):!1}var Fv=Object.prototype.hasOwnProperty;function Vh(i,c,f=0){if(i===c)return i;if(f>500)return c;const r=Ah(i)&&Ah(c);if(!r&&!(tf(i)&&tf(c)))return c;const m=(r?i:Object.keys(i)).length,S=r?c:Object.keys(c),A=S.length,v=r?new Array(A):{};let y=0;for(let N=0;N{fa.setTimeout(c,i)})}function ef(i,c,f){return typeof f.structuralSharing=="function"?f.structuralSharing(i,c):f.structuralSharing!==!1?Vh(i,c):c}function Wv(i,c,f=0){const r=[...i,c];return f&&r.length>f?r.slice(1):r}function Iv(i,c,f=0){const r=[c,...i];return f&&r.length>f?r.slice(0,-1):r}var rf=Symbol();function Jh(i,c){return!i.queryFn&&c?.initialPromise?()=>c.initialPromise:!i.queryFn||i.queryFn===rf?()=>Promise.reject(new Error(`Missing queryFn: '${i.queryHash}'`)):i.queryFn}function kh(i,c){return typeof i=="function"?i(...c):!!i}function Pv(i,c,f){let r=!1,d;return Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(d??=c(),r||(r=!0,d.aborted?f():d.addEventListener("abort",f,{once:!0})),d)}),i}var $n=(()=>{let i=()=>Jv;return{isServer(){return i()},setIsServer(c){i=c}}})();function lf(){let i,c;const f=new Promise((d,m)=>{i=d,c=m});f.status="pending",f.catch(()=>{});function r(d){Object.assign(f,d),delete f.resolve,delete f.reject}return f.resolve=d=>{r({status:"fulfilled",value:d}),i(d)},f.reject=d=>{r({status:"rejected",reason:d}),c(d)},f}var t0=Vv;function e0(){let i=[],c=0,f=A=>{A()},r=A=>{A()},d=t0;const m=A=>{c?i.push(A):d(()=>{f(A)})},S=()=>{const A=i;i=[],A.length&&d(()=>{r(()=>{A.forEach(v=>{f(v)})})})};return{batch:A=>{let v;c++;try{v=A()}finally{c--,c||S()}return v},batchCalls:A=>(...v)=>{m(()=>{A(...v)})},schedule:m,setNotifyFunction:A=>{f=A},setBatchNotifyFunction:A=>{r=A},setScheduler:A=>{d=A}}}var Pt=e0(),l0=class extends ei{#t=!0;#e;#l;constructor(){super(),this.#l=i=>{if(typeof window<"u"&&window.addEventListener){const c=()=>i(!0),f=()=>i(!1);return window.addEventListener("online",c,!1),window.addEventListener("offline",f,!1),()=>{window.removeEventListener("online",c),window.removeEventListener("offline",f)}}}}onSubscribe(){this.#e||this.setEventListener(this.#l)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(i){this.#l=i,this.#e?.(),this.#e=i(this.setOnline.bind(this))}setOnline(i){this.#t!==i&&(this.#t=i,this.listeners.forEach(f=>{f(i)}))}isOnline(){return this.#t}},Au=new l0;function a0(i){return Math.min(1e3*2**i,3e4)}function Fh(i){return(i??"online")==="online"?Au.isOnline():!0}var af=class extends Error{constructor(i){super("CancelledError"),this.revert=i?.revert,this.silent=i?.silent}};function $h(i){let c=!1,f=0,r;const d=lf(),m=()=>d.status!=="pending",S=w=>{if(!m()){const B=new af(w);E(B),i.onCancel?.(B)}},A=()=>{c=!0},v=()=>{c=!1},y=()=>sf.isFocused()&&(i.networkMode==="always"||Au.isOnline())&&i.canRun(),N=()=>Fh(i.networkMode)&&i.canRun(),j=w=>{m()||(r?.(),d.resolve(w))},E=w=>{m()||(r?.(),d.reject(w))},q=()=>new Promise(w=>{r=B=>{(m()||y())&&w(B)},i.onPause?.()}).then(()=>{r=void 0,m()||i.onContinue?.()}),C=()=>{if(m())return;let w;const B=f===0?i.initialPromise:void 0;try{w=B??i.fn()}catch(L){w=Promise.reject(L)}Promise.resolve(w).then(j).catch(L=>{if(m())return;const dt=i.retry??($n.isServer()?0:3),nt=i.retryDelay??a0,Ot=typeof nt=="function"?nt(f,L):nt,Nt=dt===!0||typeof dt=="number"&&fy()?void 0:q()).then(()=>{c?E(L):C()})})};return{promise:d,status:()=>d.status,cancel:S,continue:()=>(r?.(),d),cancelRetry:A,continueRetry:v,canStart:N,start:()=>(N()?C():q().then(C),d)}}var Wh=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Is(this.gcTime)&&(this.#t=fa.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(i){this.gcTime=Math.max(this.gcTime||0,i??($n.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#t!==void 0&&(fa.clearTimeout(this.#t),this.#t=void 0)}};function n0(i){return{onFetch:(c,f)=>{const r=c.options,d=c.fetchOptions?.meta?.fetchMore?.direction,m=c.state.data?.pages||[],S=c.state.data?.pageParams||[];let A={pages:[],pageParams:[]},v=0;const y=async()=>{let N=!1;const j=C=>{Pv(C,()=>c.signal,()=>N=!0)},E=Jh(c.options,c.fetchOptions),q=async(C,w,B)=>{if(N)return Promise.reject(c.signal.reason);if(w==null&&C.pages.length)return Promise.resolve(C);const dt=(()=>{const tt={client:c.client,queryKey:c.queryKey,pageParam:w,direction:B?"backward":"forward",meta:c.options.meta};return j(tt),tt})(),nt=await E(dt),{maxPages:Ot}=c.options,Nt=B?Iv:Wv;return{pages:Nt(C.pages,nt,Ot),pageParams:Nt(C.pageParams,w,Ot)}};if(d&&m.length){const C=d==="backward",w=C?i0:zh,B={pages:m,pageParams:S},L=w(r,B);A=await q(B,L,C)}else{const C=i??m.length;do{const w=v===0?S[0]??r.initialPageParam:zh(r,A);if(v>0&&w==null)break;A=await q(A,w),v++}while(vc.options.persister?.(y,{client:c.client,queryKey:c.queryKey,meta:c.options.meta,signal:c.signal},f):c.fetchFn=y}}}function zh(i,{pages:c,pageParams:f}){const r=c.length-1;return c.length>0?i.getNextPageParam(c[r],c,f[r],f):void 0}function i0(i,{pages:c,pageParams:f}){return c.length>0?i.getPreviousPageParam?.(c[0],c,f[0],f):void 0}var u0=class extends Wh{#t;#e;#l;#a;#i;#n;#c;#u;constructor(i){super(),this.#u=!1,this.#c=i.defaultOptions,this.setOptions(i.options),this.observers=[],this.#i=i.client,this.#a=this.#i.getQueryCache(),this.queryKey=i.queryKey,this.queryHash=i.queryHash,this.#e=Ch(this.options),this.state=i.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#t}get promise(){return this.#n?.promise}setOptions(i){if(this.options={...this.#c,...i},i?._type&&(this.#t=i._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const c=Ch(this.options);c.data!==void 0&&(this.setState(Mh(c.data,c.dataUpdatedAt)),this.#e=c)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(i,c){const f=ef(this.state.data,i,this.options);return this.#s({data:f,type:"success",dataUpdatedAt:c?.updatedAt,manual:c?.manual}),f}setState(i){this.#s({type:"setState",state:i})}cancel(i){const c=this.#n?.promise;return this.#n?.cancel(i),c?c.then(de).catch(de):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(i=>Oe(i.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rf||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(i=>Xl(i.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(i=>i.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(i=0){return this.state.data===void 0?!0:i==="static"?!1:this.state.isInvalidated?!0:!Zh(this.state.dataUpdatedAt,i)}onFocus(){this.observers.find(c=>c.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(c=>c.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(i){this.observers.includes(i)||(this.observers.push(i),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:i}))}removeObserver(i){this.observers.includes(i)&&(this.observers=this.observers.filter(c=>c!==i),this.observers.length||(this.#n&&(this.#u||this.#r()?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#a.notify({type:"observerRemoved",query:this,observer:i}))}getObserversCount(){return this.observers.length}#r(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(i,c){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&c?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(i&&this.setOptions(i),!this.options.queryFn){const v=this.observers.find(y=>y.options.queryFn);v&&this.setOptions(v.options)}const f=new AbortController,r=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(this.#u=!0,f.signal)})},d=()=>{const v=Jh(this.options,c),N=(()=>{const j={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(j),j})();return this.#u=!1,this.options.persister?this.options.persister(v,N,this):v(N)},S=(()=>{const v={fetchOptions:c,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:d};return r(v),v})();(this.#t==="infinite"?n0(this.options.pages):this.options.behavior)?.onFetch(S,this),this.#l=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==S.fetchOptions?.meta)&&this.#s({type:"fetch",meta:S.fetchOptions?.meta}),this.#n=$h({initialPromise:c?.initialPromise,fn:S.fetchFn,onCancel:v=>{v instanceof af&&v.revert&&this.setState({...this.#l,fetchStatus:"idle"}),f.abort()},onFail:(v,y)=>{this.#s({type:"failed",failureCount:v,error:y})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:S.options.retry,retryDelay:S.options.retryDelay,networkMode:S.options.networkMode,canRun:()=>!0});try{const v=await this.#n.start();if(v===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(v),this.#a.config.onSuccess?.(v,this),this.#a.config.onSettled?.(v,this.state.error,this),v}catch(v){if(v instanceof af){if(v.silent)return this.#n.promise;if(v.revert){if(this.state.data===void 0)throw v;return this.state.data}}throw this.#s({type:"error",error:v}),this.#a.config.onError?.(v,this),this.#a.config.onSettled?.(this.state.data,v,this),v}finally{this.scheduleGc()}}#s(i){const c=f=>{switch(i.type){case"failed":return{...f,fetchFailureCount:i.failureCount,fetchFailureReason:i.error};case"pause":return{...f,fetchStatus:"paused"};case"continue":return{...f,fetchStatus:"fetching"};case"fetch":return{...f,...Ih(f.data,this.options),fetchMeta:i.meta??null};case"success":const r={...f,...Mh(i.data,i.dataUpdatedAt),dataUpdateCount:f.dataUpdateCount+1,...!i.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=i.manual?r:void 0,r;case"error":const d=i.error;return{...f,error:d,errorUpdateCount:f.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:f.fetchFailureCount+1,fetchFailureReason:d,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...f,isInvalidated:!0};case"setState":return{...f,...i.state}}};this.state=c(this.state),Pt.batch(()=>{this.observers.forEach(f=>{f.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:i})})}};function Ih(i,c){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Fh(c.networkMode)?"fetching":"paused",...i===void 0&&{error:null,status:"pending"}}}function Mh(i,c){return{data:i,dataUpdatedAt:c??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ch(i){const c=typeof i.initialData=="function"?i.initialData():i.initialData,f=c!==void 0,r=f?typeof i.initialDataUpdatedAt=="function"?i.initialDataUpdatedAt():i.initialDataUpdatedAt:0;return{data:c,dataUpdateCount:0,dataUpdatedAt:f?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:f?"success":"pending",fetchStatus:"idle"}}var c0=class extends ei{constructor(i,c){super(),this.options=c,this.#t=i,this.#u=null,this.#c=lf(),this.bindMethods(),this.setOptions(c)}#t;#e=void 0;#l=void 0;#a=void 0;#i;#n;#c;#u;#r;#s;#m;#o;#d;#f;#y=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Dh(this.#e,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return nf(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return nf(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#S(),this.#x(),this.#e.removeObserver(this)}setOptions(i){const c=this.options,f=this.#e;if(this.options=this.#t.defaultQueryOptions(i),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Oe(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#e.setOptions(this.options),c._defaulted&&!Ps(this.options,c)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&_h(this.#e,f,this.options,c)&&this.#h(),this.updateResult(),r&&(this.#e!==f||Oe(this.options.enabled,this.#e)!==Oe(c.enabled,this.#e)||Xl(this.options.staleTime,this.#e)!==Xl(c.staleTime,this.#e))&&this.#v();const d=this.#p();r&&(this.#e!==f||Oe(this.options.enabled,this.#e)!==Oe(c.enabled,this.#e)||d!==this.#f)&&this.#g(d)}getOptimisticResult(i){const c=this.#t.getQueryCache().build(this.#t,i),f=this.createResult(c,i);return f0(this,f)&&(this.#a=f,this.#n=this.options,this.#i=this.#e.state),f}getCurrentResult(){return this.#a}trackResult(i,c){return new Proxy(i,{get:(f,r)=>(this.trackProp(r),c?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#c.status==="pending"&&this.#c.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(f,r))})}trackProp(i){this.#y.add(i)}getCurrentQuery(){return this.#e}refetch({...i}={}){return this.fetch({...i})}fetchOptimistic(i){const c=this.#t.defaultQueryOptions(i),f=this.#t.getQueryCache().build(this.#t,c);return f.fetch().then(()=>this.createResult(f,c))}fetch(i){return this.#h({...i,cancelRefetch:i.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#h(i){this.#j();let c=this.#e.fetch(this.options,i);return i?.throwOnError||(c=c.catch(de)),c}#v(){this.#S();const i=Xl(this.options.staleTime,this.#e);if($n.isServer()||this.#a.isStale||!Is(i))return;const f=Zh(this.#a.dataUpdatedAt,i)+1;this.#o=fa.setTimeout(()=>{this.#a.isStale||this.updateResult()},f)}#p(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#g(i){this.#x(),this.#f=i,!($n.isServer()||Oe(this.options.enabled,this.#e)===!1||!Is(this.#f)||this.#f===0)&&(this.#d=fa.setInterval(()=>{(this.options.refetchIntervalInBackground||sf.isFocused())&&this.#h()},this.#f))}#b(){this.#v(),this.#g(this.#p())}#S(){this.#o!==void 0&&(fa.clearTimeout(this.#o),this.#o=void 0)}#x(){this.#d!==void 0&&(fa.clearInterval(this.#d),this.#d=void 0)}createResult(i,c){const f=this.#e,r=this.options,d=this.#a,m=this.#i,S=this.#n,v=i!==f?i.state:this.#l,{state:y}=i;let N={...y},j=!1,E;if(c._optimisticResults){const ht=this.hasListeners(),Lt=!ht&&Dh(i,c),ne=ht&&_h(i,f,c,r);(Lt||ne)&&(N={...N,...Ih(y.data,i.options)}),c._optimisticResults==="isRestoring"&&(N.fetchStatus="idle")}let{error:q,errorUpdatedAt:C,status:w}=N;E=N.data;let B=!1;if(c.placeholderData!==void 0&&E===void 0&&w==="pending"){let ht;d?.isPlaceholderData&&c.placeholderData===S?.placeholderData?(ht=d.data,B=!0):ht=typeof c.placeholderData=="function"?c.placeholderData(this.#m?.state.data,this.#m):c.placeholderData,ht!==void 0&&(w="success",E=ef(d?.data,ht,c),j=!0)}if(c.select&&E!==void 0&&!B)if(d&&E===m?.data&&c.select===this.#r)E=this.#s;else try{this.#r=c.select,E=c.select(E),E=ef(d?.data,E,c),this.#s=E,this.#u=null}catch(ht){this.#u=ht}this.#u&&(q=this.#u,E=this.#s,C=Date.now(),w="error");const L=N.fetchStatus==="fetching",dt=w==="pending",nt=w==="error",Ot=dt&&L,Nt=E!==void 0,F={status:w,fetchStatus:N.fetchStatus,isPending:dt,isSuccess:w==="success",isError:nt,isInitialLoading:Ot,isLoading:Ot,data:E,dataUpdatedAt:N.dataUpdatedAt,error:q,errorUpdatedAt:C,failureCount:N.fetchFailureCount,failureReason:N.fetchFailureReason,errorUpdateCount:N.errorUpdateCount,isFetched:i.isFetched(),isFetchedAfterMount:N.dataUpdateCount>v.dataUpdateCount||N.errorUpdateCount>v.errorUpdateCount,isFetching:L,isRefetching:L&&!dt,isLoadingError:nt&&!Nt,isPaused:N.fetchStatus==="paused",isPlaceholderData:j,isRefetchError:nt&&Nt,isStale:of(i,c),refetch:this.refetch,promise:this.#c,isEnabled:Oe(c.enabled,i)!==!1};if(this.options.experimental_prefetchInRender){const ht=F.data!==void 0,Lt=F.status==="error"&&!ht,ne=zt=>{Lt?zt.reject(F.error):ht&&zt.resolve(F.data)},Vt=()=>{const zt=this.#c=F.promise=lf();ne(zt)},Ht=this.#c;switch(Ht.status){case"pending":i.queryHash===f.queryHash&&ne(Ht);break;case"fulfilled":(Lt||F.data!==Ht.value)&&Vt();break;case"rejected":(!Lt||F.error!==Ht.reason)&&Vt();break}}return F}updateResult(){const i=this.#a,c=this.createResult(this.#e,this.options);if(this.#i=this.#e.state,this.#n=this.options,this.#i.data!==void 0&&(this.#m=this.#e),Ps(c,i))return;this.#a=c;const f=()=>{if(!i)return!0;const{notifyOnChangeProps:r}=this.options,d=typeof r=="function"?r():r;if(d==="all"||!d&&!this.#y.size)return!0;const m=new Set(d??this.#y);return this.options.throwOnError&&m.add("error"),Object.keys(this.#a).some(S=>{const A=S;return this.#a[A]!==i[A]&&m.has(A)})};this.#E({listeners:f()})}#j(){const i=this.#t.getQueryCache().build(this.#t,this.options);if(i===this.#e)return;const c=this.#e;this.#e=i,this.#l=i.state,this.hasListeners()&&(c?.removeObserver(this),i.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#E(i){Pt.batch(()=>{i.listeners&&this.listeners.forEach(c=>{c(this.#a)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function s0(i,c){return Oe(c.enabled,i)!==!1&&i.state.data===void 0&&!(i.state.status==="error"&&Oe(c.retryOnMount,i)===!1)}function Dh(i,c){return s0(i,c)||i.state.data!==void 0&&nf(i,c,c.refetchOnMount)}function nf(i,c,f){if(Oe(c.enabled,i)!==!1&&Xl(c.staleTime,i)!=="static"){const r=typeof f=="function"?f(i):f;return r==="always"||r!==!1&&of(i,c)}return!1}function _h(i,c,f,r){return(i!==c||Oe(r.enabled,i)===!1)&&(!f.suspense||i.state.status!=="error")&&of(i,f)}function of(i,c){return Oe(c.enabled,i)!==!1&&i.isStaleByTime(Xl(c.staleTime,i))}function f0(i,c){return!Ps(i.getCurrentResult(),c)}var r0=class extends Wh{#t;#e;#l;#a;constructor(i){super(),this.#t=i.client,this.mutationId=i.mutationId,this.#l=i.mutationCache,this.#e=[],this.state=i.state||o0(),this.setOptions(i.options),this.scheduleGc()}setOptions(i){this.options=i,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(i){this.#e.includes(i)||(this.#e.push(i),this.clearGcTimeout(),this.#l.notify({type:"observerAdded",mutation:this,observer:i}))}removeObserver(i){this.#e=this.#e.filter(c=>c!==i),this.scheduleGc(),this.#l.notify({type:"observerRemoved",mutation:this,observer:i})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#l.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(i){const c=()=>{this.#i({type:"continue"})},f={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=$h({fn:()=>this.options.mutationFn?this.options.mutationFn(i,f):Promise.reject(new Error("No mutationFn found")),onFail:(m,S)=>{this.#i({type:"failed",failureCount:m,error:S})},onPause:()=>{this.#i({type:"pause"})},onContinue:c,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#l.canRun(this)});const r=this.state.status==="pending",d=!this.#a.canStart();try{if(r)c();else{this.#i({type:"pending",variables:i,isPaused:d}),this.#l.config.onMutate&&await this.#l.config.onMutate(i,this,f);const S=await this.options.onMutate?.(i,f);S!==this.state.context&&this.#i({type:"pending",context:S,variables:i,isPaused:d})}const m=await this.#a.start();return await this.#l.config.onSuccess?.(m,i,this.state.context,this,f),await this.options.onSuccess?.(m,i,this.state.context,f),await this.#l.config.onSettled?.(m,null,this.state.variables,this.state.context,this,f),await this.options.onSettled?.(m,null,i,this.state.context,f),this.#i({type:"success",data:m}),m}catch(m){try{await this.#l.config.onError?.(m,i,this.state.context,this,f)}catch(S){Promise.reject(S)}try{await this.options.onError?.(m,i,this.state.context,f)}catch(S){Promise.reject(S)}try{await this.#l.config.onSettled?.(void 0,m,this.state.variables,this.state.context,this,f)}catch(S){Promise.reject(S)}try{await this.options.onSettled?.(void 0,m,i,this.state.context,f)}catch(S){Promise.reject(S)}throw this.#i({type:"error",error:m}),m}finally{this.#l.runNext(this)}}#i(i){const c=f=>{switch(i.type){case"failed":return{...f,failureCount:i.failureCount,failureReason:i.error};case"pause":return{...f,isPaused:!0};case"continue":return{...f,isPaused:!1};case"pending":return{...f,context:i.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:i.isPaused,status:"pending",variables:i.variables,submittedAt:Date.now()};case"success":return{...f,data:i.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...f,data:void 0,error:i.error,failureCount:f.failureCount+1,failureReason:i.error,isPaused:!1,status:"error"}}};this.state=c(this.state),Pt.batch(()=>{this.#e.forEach(f=>{f.onMutationUpdate(i)}),this.#l.notify({mutation:this,type:"updated",action:i})})}};function o0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var d0=class extends ei{constructor(i={}){super(),this.config=i,this.#t=new Set,this.#e=new Map,this.#l=0}#t;#e;#l;build(i,c,f){const r=new r0({client:i,mutationCache:this,mutationId:++this.#l,options:i.defaultMutationOptions(c),state:f});return this.add(r),r}add(i){this.#t.add(i);const c=xu(i);if(typeof c=="string"){const f=this.#e.get(c);f?f.push(i):this.#e.set(c,[i])}this.notify({type:"added",mutation:i})}remove(i){if(this.#t.delete(i)){const c=xu(i);if(typeof c=="string"){const f=this.#e.get(c);if(f)if(f.length>1){const r=f.indexOf(i);r!==-1&&f.splice(r,1)}else f[0]===i&&this.#e.delete(c)}}this.notify({type:"removed",mutation:i})}canRun(i){const c=xu(i);if(typeof c=="string"){const r=this.#e.get(c)?.find(d=>d.state.status==="pending");return!r||r===i}else return!0}runNext(i){const c=xu(i);return typeof c=="string"?this.#e.get(c)?.find(r=>r!==i&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Pt.batch(()=>{this.#t.forEach(i=>{this.notify({type:"removed",mutation:i})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(i){const c={exact:!0,...i};return this.getAll().find(f=>Oh(c,f))}findAll(i={}){return this.getAll().filter(c=>Oh(i,c))}notify(i){Pt.batch(()=>{this.listeners.forEach(c=>{c(i)})})}resumePausedMutations(){const i=this.getAll().filter(c=>c.state.isPaused);return Pt.batch(()=>Promise.all(i.map(c=>c.continue().catch(de))))}};function xu(i){return i.options.scope?.id}var h0=class extends ei{constructor(i={}){super(),this.config=i,this.#t=new Map}#t;build(i,c,f){const r=c.queryKey,d=c.queryHash??ff(r,c);let m=this.get(d);return m||(m=new u0({client:i,queryKey:r,queryHash:d,options:i.defaultQueryOptions(c),state:f,defaultOptions:i.getQueryDefaults(r)}),this.add(m)),m}add(i){this.#t.has(i.queryHash)||(this.#t.set(i.queryHash,i),this.notify({type:"added",query:i}))}remove(i){const c=this.#t.get(i.queryHash);c&&(i.destroy(),c===i&&this.#t.delete(i.queryHash),this.notify({type:"removed",query:i}))}clear(){Pt.batch(()=>{this.getAll().forEach(i=>{this.remove(i)})})}get(i){return this.#t.get(i)}getAll(){return[...this.#t.values()]}find(i){const c={exact:!0,...i};return this.getAll().find(f=>Th(c,f))}findAll(i={}){const c=this.getAll();return Object.keys(i).length>0?c.filter(f=>Th(i,f)):c}notify(i){Pt.batch(()=>{this.listeners.forEach(c=>{c(i)})})}onFocus(){Pt.batch(()=>{this.getAll().forEach(i=>{i.onFocus()})})}onOnline(){Pt.batch(()=>{this.getAll().forEach(i=>{i.onOnline()})})}},m0=class{#t;#e;#l;#a;#i;#n;#c;#u;constructor(i={}){this.#t=i.queryCache||new h0,this.#e=i.mutationCache||new d0,this.#l=i.defaultOptions||{},this.#a=new Map,this.#i=new Map,this.#n=0}mount(){this.#n++,this.#n===1&&(this.#c=sf.subscribe(async i=>{i&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#u=Au.subscribe(async i=>{i&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#n--,this.#n===0&&(this.#c?.(),this.#c=void 0,this.#u?.(),this.#u=void 0)}isFetching(i){return this.#t.findAll({...i,fetchStatus:"fetching"}).length}isMutating(i){return this.#e.findAll({...i,status:"pending"}).length}getQueryData(i){const c=this.defaultQueryOptions({queryKey:i});return this.#t.get(c.queryHash)?.state.data}ensureQueryData(i){const c=this.defaultQueryOptions(i),f=this.#t.build(this,c),r=f.state.data;return r===void 0?this.fetchQuery(i):(i.revalidateIfStale&&f.isStaleByTime(Xl(c.staleTime,f))&&this.prefetchQuery(c),Promise.resolve(r))}getQueriesData(i){return this.#t.findAll(i).map(({queryKey:c,state:f})=>{const r=f.data;return[c,r]})}setQueryData(i,c,f){const r=this.defaultQueryOptions({queryKey:i}),m=this.#t.get(r.queryHash)?.state.data,S=kv(c,m);if(S!==void 0)return this.#t.build(this,r).setData(S,{...f,manual:!0})}setQueriesData(i,c,f){return Pt.batch(()=>this.#t.findAll(i).map(({queryKey:r})=>[r,this.setQueryData(r,c,f)]))}getQueryState(i){const c=this.defaultQueryOptions({queryKey:i});return this.#t.get(c.queryHash)?.state}removeQueries(i){const c=this.#t;Pt.batch(()=>{c.findAll(i).forEach(f=>{c.remove(f)})})}resetQueries(i,c){const f=this.#t;return Pt.batch(()=>(f.findAll(i).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...i},c)))}cancelQueries(i,c={}){const f={revert:!0,...c},r=Pt.batch(()=>this.#t.findAll(i).map(d=>d.cancel(f)));return Promise.all(r).then(de).catch(de)}invalidateQueries(i,c={}){return Pt.batch(()=>(this.#t.findAll(i).forEach(f=>{f.invalidate()}),i?.refetchType==="none"?Promise.resolve():this.refetchQueries({...i,type:i?.refetchType??i?.type??"active"},c)))}refetchQueries(i,c={}){const f={...c,cancelRefetch:c.cancelRefetch??!0},r=Pt.batch(()=>this.#t.findAll(i).filter(d=>!d.isDisabled()&&!d.isStatic()).map(d=>{let m=d.fetch(void 0,f);return f.throwOnError||(m=m.catch(de)),d.state.fetchStatus==="paused"?Promise.resolve():m}));return Promise.all(r).then(de)}fetchQuery(i){const c=this.defaultQueryOptions(i);c.retry===void 0&&(c.retry=!1);const f=this.#t.build(this,c);return f.isStaleByTime(Xl(c.staleTime,f))?f.fetch(c):Promise.resolve(f.state.data)}prefetchQuery(i){return this.fetchQuery(i).then(de).catch(de)}fetchInfiniteQuery(i){return i._type="infinite",this.fetchQuery(i)}prefetchInfiniteQuery(i){return this.fetchInfiniteQuery(i).then(de).catch(de)}ensureInfiniteQueryData(i){return i._type="infinite",this.ensureQueryData(i)}resumePausedMutations(){return Au.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#l}setDefaultOptions(i){this.#l=i}setQueryDefaults(i,c){this.#a.set(kn(i),{queryKey:i,defaultOptions:c})}getQueryDefaults(i){const c=[...this.#a.values()],f={};return c.forEach(r=>{Fn(i,r.queryKey)&&Object.assign(f,r.defaultOptions)}),f}setMutationDefaults(i,c){this.#i.set(kn(i),{mutationKey:i,defaultOptions:c})}getMutationDefaults(i){const c=[...this.#i.values()],f={};return c.forEach(r=>{Fn(i,r.mutationKey)&&Object.assign(f,r.defaultOptions)}),f}defaultQueryOptions(i){if(i._defaulted)return i;const c={...this.#l.queries,...this.getQueryDefaults(i.queryKey),...i,_defaulted:!0};return c.queryHash||(c.queryHash=ff(c.queryKey,c)),c.refetchOnReconnect===void 0&&(c.refetchOnReconnect=c.networkMode!=="always"),c.throwOnError===void 0&&(c.throwOnError=!!c.suspense),!c.networkMode&&c.persister&&(c.networkMode="offlineFirst"),c.queryFn===rf&&(c.enabled=!1),c}defaultMutationOptions(i){return i?._defaulted?i:{...this.#l.mutations,...i?.mutationKey&&this.getMutationDefaults(i.mutationKey),...i,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Ph=Q.createContext(void 0),li=i=>{const c=Q.useContext(Ph);if(!c)throw new Error("No QueryClient set, use QueryClientProvider to set one");return c},y0=({client:i,children:c})=>(Q.useEffect(()=>(i.mount(),()=>{i.unmount()}),[i]),o.jsx(Ph.Provider,{value:i,children:c})),tm=Q.createContext(!1),v0=()=>Q.useContext(tm);tm.Provider;function p0(){let i=!1;return{clearReset:()=>{i=!1},reset:()=>{i=!0},isReset:()=>i}}var g0=Q.createContext(p0()),b0=()=>Q.useContext(g0),S0=(i,c,f)=>{const r=f?.state.error&&typeof i.throwOnError=="function"?kh(i.throwOnError,[f.state.error,f]):i.throwOnError;(i.suspense||i.experimental_prefetchInRender||r)&&(c.isReset()||(i.retryOnMount=!1))},x0=i=>{Q.useEffect(()=>{i.clearReset()},[i])},j0=({result:i,errorResetBoundary:c,throwOnError:f,query:r,suspense:d})=>i.isError&&!c.isReset()&&!i.isFetching&&r&&(d&&i.data===void 0||kh(f,[i.error,r])),E0=i=>{if(i.suspense){const f=d=>d==="static"?d:Math.max(d??1e3,1e3),r=i.staleTime;i.staleTime=typeof r=="function"?(...d)=>f(r(...d)):f(r),typeof i.gcTime=="number"&&(i.gcTime=Math.max(i.gcTime,1e3))}},T0=(i,c)=>i.isLoading&&i.isFetching&&!c,O0=(i,c)=>i?.suspense&&c.isPending,Rh=(i,c,f)=>c.fetchOptimistic(i).catch(()=>{f.clearReset()});function A0(i,c,f){const r=v0(),d=b0(),m=li(),S=m.defaultQueryOptions(i);m.getDefaultOptions().queries?._experimental_beforeQuery?.(S);const A=m.getQueryCache().get(S.queryHash),v=i.subscribed!==!1;S._optimisticResults=r?"isRestoring":v?"optimistic":void 0,E0(S),S0(S,d,A),x0(d);const y=!m.getQueryCache().get(S.queryHash),[N]=Q.useState(()=>new c(m,S)),j=N.getOptimisticResult(S),E=!r&&v;if(Q.useSyncExternalStore(Q.useCallback(q=>{const C=E?N.subscribe(Pt.batchCalls(q)):de;return N.updateResult(),C},[N,E]),()=>N.getCurrentResult(),()=>N.getCurrentResult()),Q.useEffect(()=>{N.setOptions(S)},[S,N]),O0(S,j))throw Rh(S,N,d);if(j0({result:j,errorResetBoundary:d,throwOnError:S.throwOnError,query:A,suspense:S.suspense}))throw j.error;return m.getDefaultOptions().queries?._experimental_afterQuery?.(S,j),S.experimental_prefetchInRender&&!$n.isServer()&&T0(j,r)&&(y?Rh(S,N,d):A?.promise)?.catch(de).finally(()=>{N.updateResult()}),S.notifyOnChangeProps?j:N.trackResult(j)}function he(i,c){return A0(i,c0)}function em(){throw location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),new Error("signing in…")}async function Ae(i){const c=await fetch(i);if(c.status===401&&em(),!c.ok)throw new Error(await c.text());return c.json()}async function Ll(i,c,f){const r={method:i};f!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(f));const d=await fetch(c,r);if(!d.ok)throw new Error(await d.text());return d.status===204?{}:d.json()}async function $a(i,c){const f=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c||{})});if(f.status===401&&em(),!f.ok)throw new Error(await f.text());return f.json()}function N0(){return he({queryKey:["config"],queryFn:async()=>{const i=await Ae("/api/config");return i.auth.enabled&&!i.me&&(location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),await new Promise(()=>{})),i},staleTime:1/0})}function z0(){document.body.classList.toggle("sb-open")}function ra(){document.body.classList.remove("sb-open")}function te({name:i}){return o.jsx("svg",{className:"ico","aria-hidden":"true",children:o.jsx("use",{href:`#i-${i}`})})}function Wn(i){return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:"sb-backdrop",onClick:ra}),o.jsxs("aside",{id:"sidebar",children:[i.vault,i.projectsNav,i.tree??o.jsx("nav",{id:"tree","aria-label":"Files"}),i.orgBar]}),o.jsxs("main",{id:"main",children:[i.topbar,o.jsx("article",{id:"content",className:i.contentClass??"markdown",ref:i.contentRef,onScroll:i.onContentScroll,children:i.children})]})]})}function Nu(i){const{name:c,onHome:f,showSignout:r,admin:d,gear:m}=i;return o.jsxs("header",{id:"vault",children:[o.jsx("span",{id:"vault-badge","aria-hidden":"true",children:"🐻"}),o.jsx("span",{id:"vault-name",className:f?"vault-link":void 0,onClick:f,role:f?"button":void 0,tabIndex:f?0:void 0,onKeyDown:S=>{f&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),f())},children:c}),o.jsxs("div",{className:"vault-actions",children:[d&&o.jsxs("button",{id:"adminbar",className:"adminbar",title:"Hub administration — signup policy"+(d.pending?" and pending approvals":""),onClick:d.onClick,children:[o.jsx(te,{name:"shield"}),o.jsxs("span",{children:["Admin",d.pending?" · "+d.pending:""]})]}),m&&o.jsx("button",{id:"settings-btn",className:"icon-btn2",title:"Manage organization","aria-label":"Manage organization",onClick:m.onClick,children:o.jsx(te,{name:"users"})}),r&&o.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:o.jsx(te,{name:"power"})})]})]})}function In(i){return o.jsxs("header",{id:"topbar",children:[o.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu",onClick:z0,children:o.jsx(te,{name:"menu"})}),o.jsx("span",{id:"crumb",children:i.crumb}),o.jsx("span",{id:"meta",children:i.meta}),i.actions]})}let df={msg:"",err:!1,shown:!1},Eu=[],Uh;function Hh(i){df=i,Eu.forEach(c=>c())}function ot(i,c=!1){Hh({msg:i,err:c,shown:!0}),clearTimeout(Uh),Uh=setTimeout(()=>Hh({...df,shown:!1}),3200)}function M0(){const i=Q.useSyncExternalStore(c=>(Eu.push(c),()=>{Eu=Eu.filter(f=>f!==c)}),()=>df);return o.jsx("div",{id:"toast",className:i.shown?"show"+(i.err?" err":""):"",children:i.msg})}let lm=null,Tu=[];function hf(i){lm=i,Tu.forEach(c=>c())}function am(i,c,f="",r="OK"){return new Promise(d=>hf({kind:"prompt",title:i,label:c,value:f,okLabel:r,resolve:d}))}function ju(i,c,f="Confirm",r=!1){return new Promise(d=>hf({kind:"confirm",title:i,message:c,confirmLabel:f,danger:r,resolve:d}))}function C0(){const i=Q.useSyncExternalStore(c=>(Tu.push(c),()=>{Tu=Tu.filter(f=>f!==c)}),()=>lm);return i?i.kind==="prompt"?o.jsx(D0,{m:i}):o.jsx(_0,{m:i}):null}function nm(){hf(null)}function D0({m:i}){const c=Q.useRef(null),f=d=>{nm(),i.resolve(d)},r=()=>f(c.current.value.trim()||null);return Q.useEffect(()=>{c.current.focus(),c.current.select();const d=m=>{m.key==="Escape"&&f(null),m.key==="Enter"&&r()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]),o.jsx("div",{className:"modal-back",onClick:d=>d.target===d.currentTarget&&f(null),children:o.jsxs("div",{className:"modal",children:[o.jsx("h3",{children:i.title}),o.jsx("label",{className:"modal-label",children:i.label}),o.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",defaultValue:i.value,ref:c}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"ai-btn",onClick:()=>f(null),children:"Cancel"}),o.jsx("button",{className:"pbtn",onClick:r,children:i.okLabel})]})]})})}function _0({m:i}){const c=Q.useRef(null),f=r=>{nm(),i.resolve(r)};return Q.useEffect(()=>{c.current.focus();const r=d=>{d.key==="Escape"&&f(!1),d.key==="Enter"&&f(!0)};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),o.jsx("div",{className:"modal-back",onClick:r=>r.target===r.currentTarget&&f(!1),children:o.jsxs("div",{className:"modal",children:[o.jsx("h3",{children:i.title}),o.jsx("p",{className:"modal-msg",children:i.message}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"ai-btn",onClick:()=>f(!1),children:"Cancel"}),o.jsx("button",{className:i.danger?"danger-btn":"pbtn",onClick:()=>f(!0),ref:c,children:i.confirmLabel})]})]})})}function R0(i){return he({queryKey:["projects"],queryFn:()=>Ae("/api/projects"),enabled:i,refetchInterval:3e4,select:c=>c.projects||[]})}function U0(i){return he({queryKey:["orgs"],queryFn:()=>Ae("/api/orgs"),enabled:i,select:c=>c.orgs||[]})}function im(i){return he({queryKey:["admin","pending"],queryFn:()=>Ae("/api/admin/pending"),enabled:i,select:c=>c.pending||[]})}function um(){const i=li();return()=>Promise.all([i.invalidateQueries({queryKey:["projects"]}),i.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function cm(i){return i.split("/").map(encodeURIComponent).join("/")}function qh(i){return i.split("/").map(decodeURIComponent).join("/")}const H0=new Set(["insights","history"]);function sm(i,c){const f=i.replace(/^\/+/,"");if(c!=="hub")return{path:f?qh(f):""};const r=f.indexOf("/");if(r===-1)return{project:f,path:""};const d={project:f.slice(0,r),path:qh(f.slice(r+1))},m=d.path.indexOf("/"),S=m===-1?d.path:d.path.slice(0,m);return H0.has(S)&&(d.view=S,d.viewTarget=m===-1?"":d.path.slice(m+1).replace(/\/+$/,""),d.path=""),d}function q0(i,c){const f=cm(i);return c?"/"+c+(f?"/"+f:""):"/"+f}function wh(i,c,f){let r=(c?"/"+c:"")+"/"+i;return i==="history"&&f&&(r+="/"+cm(f.replace(/\/+$/,""))),r}let mf="POP";const uf=new Set;function fm(){for(const i of uf)i()}window.addEventListener("popstate",()=>{mf="POP",fm()});function ke(i,c){const f=location.pathname+location.search;!c?.replace&&f===i||(history[c?.replace?"replaceState":"pushState"](null,"",i),mf=c?.replace?"REPLACE":"PUSH",fm())}function yf(){return Q.useSyncExternalStore(i=>(uf.add(i),()=>{uf.delete(i)}),()=>location.pathname)}function w0(){return mf}function Q0({to:i}){return Q.useEffect(()=>{ke(i,{replace:!0})},[i]),null}const B0=/\.(md|markdown)$/i,Y0=/\.(png|jpe?g|gif|svg|webp|ico|bmp|avif)$/i,G0=/\.(txt|log|json|ya?ml|toml|csv|go|py|js|ts|jsx|tsx|sh|bash|zsh|rb|rs|c|h|cpp|java|kt|swift|sql|html|css|xml|ini|conf|env|mod|sum|jsonl)$/i;function rm(i){if(i<1024)return i+" B";const c=["KB","MB","GB","TB"];let f=-1;do i/=1024,f++;while(i>=1024&&fd.invalidateQueries({queryKey:["orgs"]}),y=()=>d.invalidateQueries({queryKey:["invites",i.id]}),N=()=>d.invalidateQueries({queryKey:["orgShares",i.id]}),{data:j}=he({queryKey:["invites",i.id],queryFn:()=>Ae(`/api/orgs/${i.id}/invites`),enabled:m,select:C=>C.invites||[]}),{data:E}=he({queryKey:["orgShares",i.id],queryFn:()=>Ae(`/api/orgs/${i.id}/shares`),enabled:m,select:C=>C.shares||[]}),q=c.filter(C=>C.org===i.id);return o.jsxs("div",{className:"admin",children:[o.jsx("h1",{id:"org-title",children:i.name+(m?"":" · member")}),m&&o.jsxs("div",{className:"admin-row",children:[o.jsx("input",{id:"org-rename",type:"text",value:S,onChange:C=>A(C.target.value)}),o.jsx("button",{className:"pbtn",id:"org-rename-btn",onClick:async()=>{try{await Ll("PATCH","/api/orgs/"+i.id,{name:S.trim()}),ot("Renamed."),v()}catch(C){ot(C.message,!0)}},children:"Rename org"})]}),o.jsx("h3",{children:"Members"}),o.jsx("div",{className:"admin-list",children:i.members.map(C=>{const w=!!f&&C.email.toLowerCase()===f.toLowerCase();return o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:C.email+(w?" (you)":"")}),m&&!w?o.jsxs(o.Fragment,{children:[o.jsxs("select",{value:C.role,onChange:async B=>{try{await Ll("PATCH",`/api/orgs/${i.id}/members/${encodeURIComponent(C.email)}`,{role:B.target.value}),ot("Role updated.")}catch(L){ot(L.message,!0)}v()},children:[o.jsx("option",{value:"owner",children:"owner"}),o.jsx("option",{value:"member",children:"member"})]}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await ju("Remove member",`Remove ${C.email} from ${i.name}?`,"Remove",!0))try{await Ll("DELETE",`/api/orgs/${i.id}/members/${encodeURIComponent(C.email)}`),ot("Removed."),v()}catch(B){ot(B.message,!0)}},children:"Remove"})]}):o.jsx("span",{className:"ai-tag",children:C.role})]},C.email)})}),m&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{children:"Projects"}),o.jsxs("div",{className:"admin-list",children:[q.length===0&&o.jsx("div",{className:"admin-empty",children:"No projects yet."}),q.map(C=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:C.name}),o.jsx("button",{className:"ai-btn",onClick:async()=>{const w=await am("Rename project","New name",C.name,"Rename");if(!(!w||w===C.name))try{await Ll("PATCH","/api/projects/"+C.id,{name:w}),ot("Renamed."),await r()}catch(B){ot(B.message,!0)}},children:"Rename"}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await ju("Delete project",`Delete “${C.name}”? Its files stay in storage, but it's removed from the hub.`,"Delete",!0))try{await Ll("DELETE","/api/projects/"+C.id),ot(`Deleted “${C.name}”.`),await r()}catch(w){ot(w.message,!0)}},children:"Delete"})]},C.id))]}),o.jsxs("div",{className:"admin-h",children:[o.jsx("h3",{children:"Invite links"}),o.jsx("button",{className:"pbtn",onClick:async()=>{try{const C=await $a(`/api/orgs/${i.id}/invites`),w=await Pn(C.url);ot(w?"Invite link copied to clipboard.":"Invite created — copy it from the list below."),y()}catch(C){ot(C.message,!0)}},children:"New invite"})]}),o.jsxs("div",{className:"admin-list",children:[j&&j.length===0&&o.jsx("div",{className:"admin-empty",children:"No active invite links."}),(j||[]).map(C=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main mono",style:{cursor:"pointer"},title:"Copy",onClick:()=>Pn(C.url).then(w=>ot(w?"Copied.":"Select and copy the link.")),children:C.url}),o.jsx("span",{className:"ai-tag",children:(C.creator?"by "+C.creator+" · ":"")+(C.uses?C.uses+" joined · ":"unused · ")+"expires "+new Date(C.expires).toLocaleDateString()}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await ju("Revoke invite","Revoke this invite link? Anyone still holding it won't be able to join.","Revoke",!0))try{await Ll("DELETE",`/api/orgs/${i.id}/invites/${C.token}`),ot("Revoked."),y()}catch(w){ot(w.message,!0)}},children:"Revoke"})]},C.token))]}),o.jsx("h3",{children:"Public share links"}),o.jsxs("div",{className:"admin-list",children:[E&&E.length===0&&o.jsx("div",{className:"admin-empty",children:"No public shares."}),(E||[]).map(C=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main mono",style:{cursor:"pointer"},title:C.url,onClick:()=>window.open(C.url,"_blank"),children:C.path}),o.jsx("span",{className:"ai-tag",children:(C.project_name||"")+(C.creator?" · by "+C.creator:"")+(C.created?" · "+new Date(C.created).toLocaleDateString():"")}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await ju("Revoke share link",`Revoke the public link to “${C.path}”? Anyone with the URL will lose access.`,"Revoke",!0))try{await Ll("DELETE","/api/shares/"+C.token),ot("Share revoked."),N()}catch(w){ot(w.message,!0)}},children:"Revoke"})]},C.token))]})]})]})}function X0(){const i=li(),{data:c,error:f}=he({queryKey:["admin","policy"],queryFn:()=>Ae("/api/admin/policy")}),{data:r}=im(!0),[d,m]=Q.useState(!1),[S,A]=Q.useState(!1);if(Q.useEffect(()=>{c&&(m(c.require_verification&&c.mailer),A(c.require_approval))},[c]),Q.useEffect(()=>{f&&ot(f.message,!0)},[f]),!c)return null;const v=async(y,N,j)=>{try{await $a(`/api/admin/pending/${y}/${N}`),ot((N==="approve"?"Approved ":"Denied ")+j),i.invalidateQueries({queryKey:["admin","pending"]})}catch(E){ot(E.message,!0)}};return o.jsxs("div",{className:"admin",children:[o.jsx("h1",{children:"Signup & access"}),o.jsx("p",{className:"admin-sub",children:"Who can create an account on this hub, and how new accounts are vetted."}),o.jsx("h3",{children:"New-account vetting"}),o.jsxs("div",{className:"admin-list",children:[o.jsx(Qh,{label:"Require email verification",desc:c.mailer?"New accounts must click an emailed link before they can sign in — proves they control the address.":"Configure SMTP on the server (auth.smtp) to enable email verification.",checked:d,disabled:!c.mailer,onChange:m}),o.jsx(Qh,{label:"Require admin approval",desc:"New accounts wait for a hub admin to approve them before they gain access.",checked:S,onChange:A})]}),o.jsx("button",{className:"pbtn",style:{marginTop:14},onClick:async()=>{try{await $a("/api/admin/policy",{require_verification:d,require_approval:S}),ot("Signup policy saved."),i.invalidateQueries({queryKey:["admin","policy"]})}catch(y){ot(y.message,!0)}},children:"Save policy"}),o.jsx("h3",{children:"Who can sign up"}),o.jsxs("div",{className:"admin-list",children:[o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:"Allowed email domains"}),o.jsx("span",{className:"ai-tag",children:c.allowed_domains&&c.allowed_domains.length?c.allowed_domains.map(y=>"@"+y).join(", "):"any"})]}),o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:"Self-signup"}),o.jsx("span",{className:"ai-tag",children:c.allow_signup?"open":"invite-only"})]}),o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:"Hub admins"}),o.jsx("span",{className:"ai-tag",children:c.admins&&c.admins.length?c.admins.join(", "):"none"})]})]}),o.jsx("p",{className:"admin-sub",children:"Domains and admins are set in the server config file (they can't be widened from the browser)."}),o.jsx("h3",{children:"Pending signups"}),o.jsxs("div",{className:"admin-list",children:[(!r||r.length===0)&&o.jsx("div",{className:"admin-empty",children:"No one is waiting for approval."}),(r||[]).map(y=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:(y.name?y.name+" · ":"")+y.email}),o.jsx("button",{className:"pbtn",onClick:()=>v(y.id,"approve",y.email),children:"Approve"}),o.jsx("button",{className:"ai-del",onClick:()=>v(y.id,"deny",y.email),children:"Deny"})]},y.id))]})]})}function Qh({label:i,desc:c,checked:f,disabled:r,onChange:d}){return o.jsxs("label",{className:"admin-item toggle",style:r?{opacity:.55}:void 0,children:[o.jsxs("span",{className:"ai-main",children:[o.jsx("div",{className:"tg-label",children:i}),o.jsx("div",{className:"tg-desc",children:c})]}),o.jsx("input",{type:"checkbox",checked:f,disabled:r,onChange:m=>d(m.target.checked)})]})}const Bh=["#5b8def","#f5a623","#4cc38a","#e0679b","#8b7bf0","#3ec8c8","#e6934a"];function K0(i){let c=0;for(const f of i)c=c*31+f.charCodeAt(0)>>>0;return Bh[c%Bh.length]}function Yh({projects:i,currentId:c}){const f=um(),r=async()=>{const d=await am("New project","Project name","","Create");if(d)try{const m=await $a("/api/projects",{name:d});await f(),ke("/"+m.project.id),ot(`Created “${m.project.name}”.`)}catch(m){ot("Could not create the project: "+m.message,!0)}};return o.jsxs("nav",{id:"projects","aria-label":"Projects",children:[o.jsxs("div",{className:"nav-head",children:[o.jsx("span",{children:"Projects"}),o.jsx("button",{className:"nav-add",title:"New project",onClick:r,children:"+"})]}),o.jsx("ul",{children:i.map(d=>o.jsx("li",{children:o.jsxs("div",{className:"row"+(c===d.id?" active":""),title:d.name,tabIndex:0,role:"button",onClick:()=>{ke("/"+d.id),ra()},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),m.currentTarget.click())},children:[o.jsx("span",{className:"proj-mark",style:{background:K0(d.name)},children:d.name.trim()[0]||"?"}),o.jsx("span",{className:"label",children:d.name})]})},d.id))})]})}function Z0({org:i,onManage:c}){return i?o.jsxs("footer",{id:"orgbar",children:[o.jsx("span",{id:"org-name",title:"Manage organization",role:"button",tabIndex:0,onClick:()=>c(i),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),c(i))},children:i.name}),i.role==="owner"&&o.jsx("button",{id:"invite-btn",title:"Manage this organization",onClick:()=>c(i),children:"Manage"})]}):null}function V0({authEnabled:i,onCreate:c}){const f=Q.useRef(null),r=Q.useRef(null),d=()=>{const m=f.current.value.trim(),S=m.match(/join\/([0-9a-f]+)/)||m.match(/^([0-9a-f]{8,})$/);if(!S){ot("That doesn't look like an invite link.",!0);return}location.href="/join/"+S[1]};return o.jsxs("div",{className:"onboard",children:[o.jsx("h1",{children:"Welcome to BearDrive"}),o.jsx("p",{children:"You're signed in, but you're not part of any project yet."}),i&&o.jsxs("div",{className:"ob-card",children:[o.jsx("h3",{children:"Have an invite link?"}),o.jsx("p",{children:"A teammate can send you a join link. Paste it here:"}),o.jsxs("div",{className:"ob-row",children:[o.jsx("input",{id:"ob-invite",type:"text",placeholder:"https://…/join/…",autoComplete:"off",ref:f}),o.jsx("button",{id:"ob-join",className:"pbtn",onClick:d,children:"Join"})]})]}),o.jsxs("div",{className:"ob-card",children:[o.jsx("h3",{children:"Or start a new project"}),o.jsx("p",{children:"Create a shared space for your team's files."}),o.jsxs("div",{className:"ob-row",children:[o.jsx("input",{id:"ob-name",type:"text",placeholder:"Project name, e.g. wiki",autoComplete:"off",ref:r}),o.jsx("button",{id:"ob-create",className:"pbtn",onClick:()=>c(r.current.value.trim()),children:"Create"})]})]})]})}function J0(i,c=!0){const f=he({queryKey:["tree",i],queryFn:()=>Ae(i+"tree"),enabled:c,refetchInterval:15e3}),r=Q.useMemo(()=>{const d=[],m=new Map,S=A=>{for(const v of A.children||[])v.dir?(m.set(v.path,v),S(v)):d.push(v)};return f.data&&S(f.data),{flatFiles:d,dirIndex:m}},[f.data]);return{tree:f.data,...r,loaded:!!f.data}}function k0(i,c){return he({queryKey:["heat",i],queryFn:()=>Ae(i+"heat?days=30"),enabled:c,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function F0(i,c,f){return he({queryKey:["history",i,"prefix",c,20],queryFn:()=>Ae(i+"history?prefix="+encodeURIComponent(c)+"&n=20"),enabled:f,staleTime:15e3}).data?.entries??null}function Gh(i,c,f){if(!i)return null;if(!f)return i[c]||null;const r={human:0,agent:0,share:0};for(const[d,m]of Object.entries(i))d.startsWith(c+"/")&&(r.human+=m.human||0,r.agent+=m.agent||0,r.share+=m.share||0);return r.human||r.agent||r.share?r:null}function ti(i){return(i.human||0)+(i.agent||0)+(i.share||0)}function Ou(i){const c=ti(i);if(!c)return"";let f=c+(c===1?" read":" reads");return i.agent&&(f+=" ("+i.agent+" agent)"),f}function $0(i){const c=ti(i);return c?c<3?1:c<10?2:c<30?3:4:0}async function W0(i,c,f){const r=await f.arrayBuffer(),d=await I0(r),m=async(v,y)=>{const N=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(y)});if(!N.ok)throw new Error(await N.text());return N.json()},S={path:c,sha256:d,size:f.size},A=await m(i+"upload/init",S);if(A.mode==="direct"){if(!A.exists){const v=await fetch(A.url,{method:A.method||"PUT",headers:A.headers||{},body:r});if(!v.ok)throw new Error("storage upload failed: "+v.status)}await m(i+"upload/commit",S)}else{const v=await fetch(i+"upload/content?path="+encodeURIComponent(c),{method:"PUT",body:r});if(!v.ok)throw new Error(await v.text())}}async function I0(i){if(crypto.subtle){const c=await crypto.subtle.digest("SHA-256",i);return[...new Uint8Array(c)].map(f=>f.toString(16).padStart(2,"0")).join("")}return P0(new Uint8Array(i))}function P0(i){const c=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),f=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),r=(v,y)=>v>>>y|v<<32-y,d=i.length,m=new Uint8Array((d+8>>6)+1<<6);m.set(i),m[d]=128;const S=new DataView(m.buffer);S.setUint32(m.length-8,Math.floor(d*8/4294967296)),S.setUint32(m.length-4,d*8>>>0);const A=new Uint32Array(64);for(let v=0;v>>3,nt=r(A[L-2],17)^r(A[L-2],19)^A[L-2]>>>10;A[L]=A[L-16]+dt+A[L-7]+nt>>>0}let[y,N,j,E,q,C,w,B]=f;for(let L=0;L<64;L++){const dt=r(q,6)^r(q,11)^r(q,25),nt=B+dt+(q&C^~q&w)+c[L]+A[L]>>>0,Nt=(r(y,2)^r(y,13)^r(y,22))+(y&N^y&j^N&j)>>>0;B=w,w=C,C=q,q=E+nt>>>0,E=j,j=N,N=y,y=nt+Nt>>>0}f[0]+=y,f[1]+=N,f[2]+=j,f[3]+=E,f[4]+=q,f[5]+=C,f[6]+=w,f[7]+=B}return[...f].map(v=>(v>>>0).toString(16).padStart(8,"0")).join("")}function tp(i){return o.jsx("nav",{id:"tree","aria-label":"Files",children:i.root&&o.jsx(dm,{nodes:i.root.children||[],...i})})}function dm({nodes:i,...c}){return o.jsx("ul",{children:i.map(f=>o.jsx(ep,{node:f,...c},f.path))})}function ep({node:i,...c}){const{expanded:f,onToggle:r,currentPath:d,listingShowing:m,onOpen:S}=c,A=i.dir?f.has(i.path):!1,v=()=>{if(i.dir&&d===i.path&&m){r(i.path);return}S(i.path),i.dir||ra()};return o.jsxs("li",{className:(i.dir?"dir":"file")+(i.dir&&!A?" collapsed":""),children:[o.jsxs("div",{className:"row"+(d===i.path?" active":""),"data-path":i.path,tabIndex:0,role:"button",title:i.name,"aria-expanded":i.dir?A:void 0,onClick:v,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),v())},children:[o.jsx("span",{className:"chev",onClick:y=>{i.dir&&(y.stopPropagation(),r(i.path))},children:o.jsx(te,{name:"chevd"})}),o.jsx("span",{className:"ticon",children:o.jsx(te,{name:i.dir?"folder":"doc"})}),o.jsx("span",{className:"label",children:i.name})]}),i.dir&&o.jsx(dm,{nodes:i.children||[],...c})]})}function lp(i){const c=i.split("/"),f=[];let r="";for(let d=0;d{r=r?r+"/"+d:d;const S=r,A=m===f.length-1;return o.jsxs("span",{children:[m>0&&o.jsx("span",{className:"crumb-sep",children:"/"}),A?o.jsx("span",{children:d}):o.jsx("span",{className:"crumb-seg",title:S,onClick:()=>c(S),children:d})]},S)})})}const np={add:"plus",edit:"edit",delete:"x"},ip={add:"added",edit:"edited",delete:"deleted"};function hm({entry:i,onOpen:c}){const[f,r]=Q.useState(!1),d=i.kind==="put"?"edit":i.kind,m=i.user_name?`${i.user_name} <${i.user}>`:i.user||i.author||"unknown",S=[i.device.name||i.device.id,i.device.os,i.device.ip].filter(Boolean).join(" · "),A=d!=="delete",v=y=>{y.target.tagName!=="A"&&A&&c(i.path)};return o.jsxs("div",{className:"hentry "+d+(A?" clickable":""),tabIndex:A?0:void 0,role:A?"button":void 0,onClick:v,onKeyDown:y=>{A&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),c(i.path))},children:[o.jsxs("div",{className:"hline",children:[o.jsx("span",{className:"hkind",children:o.jsx(te,{name:np[d]||"dot"})}),o.jsx("span",{className:"hpath",children:i.path}),o.jsx("span",{className:"htag",children:ip[d]||d}),o.jsx("span",{className:"htime",children:new Date(i.time).toLocaleString()})]}),o.jsxs("div",{className:"hmeta",children:[o.jsx("span",{className:"hwho",children:m}),o.jsx("span",{className:"hdev",children:S}),o.jsx("span",{className:"hsize",children:i.size?rm(i.size):""})]}),i.note&&o.jsx("div",{className:"hnote"+(f?" open":""),tabIndex:0,role:"button",title:f?"Collapse note":"Show full note","aria-expanded":f,onClick:y=>{y.stopPropagation(),y.target.tagName!=="A"&&r(!f)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation(),r(!f))},children:i.note.split(/(https?:\/\/\S+)/).map((y,N)=>/^https?:\/\//.test(y)?o.jsx("a",{href:y,target:"_blank",rel:"noopener",children:y},N):y)})]})}function up(i){const{node:c,heatMap:f,onOpen:r}=i,d=(c.children||[]).slice().sort((y,N)=>Number(N.dir||!1)-Number(y.dir||!1)||y.name.localeCompare(N.name)),m=d.filter(y=>y.dir).length,S=d.length-m,A=[];m&&A.push(m+(m===1?" folder":" folders")),S&&A.push(S+(S===1?" file":" files"));const v=Gh(f,c.path,!0);return v&&A.push(Ou(v)+" in 30 days"),o.jsxs("div",{className:"dirlist",children:[o.jsxs("h1",{className:"dl-title",children:[o.jsx("span",{className:"dl-title-icon",children:o.jsx(te,{name:"folder"})}),o.jsx("span",{children:c.name})]}),o.jsx("p",{className:"dl-sub",children:A.join(" · ")||"Empty folder"}),d.length===0?o.jsx("div",{className:"dl-empty",children:"Nothing in this folder yet."}):o.jsx("div",{className:"dl-items",children:d.map(y=>{let N="";if(y.dir){const E=(y.children||[]).length;N=E+(E===1?" item":" items")}else N=[y.size?rm(y.size):"",y.time?new Date(y.time).toLocaleDateString():""].filter(Boolean).join(" · ");const j=Gh(f,y.path,!!y.dir);return j&&(N=Ou(j)+(N?" · "+N:"")),o.jsxs("div",{className:"dl-row",tabIndex:0,role:"button",title:y.path,onClick:()=>r(y.path),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),r(y.path))},children:[o.jsx("span",{className:"ticon",children:o.jsx(te,{name:y.dir?"folder":"doc"})}),o.jsx("span",{className:"dl-name",children:y.name}),j&&o.jsx("span",{className:"heatdot lvl"+$0(j),title:Ou(j)+" in 30 days"}),o.jsx("span",{className:"dl-meta",children:N})]},y.path)})}),i.hub&&o.jsx(cp,{apiBase:i.apiBase,prefix:c.path+"/",onOpen:r,onFullHistory:()=>i.onFullHistory(c.path+"/"),onRendered:i.onRendered})]})}function cp(i){const c=F0(i.apiBase,i.prefix,!0),{onRendered:f}=i;return Q.useEffect(()=>{c&&c.length&&f&&f()},[c,f]),!c||c.length===0?null:o.jsxs("div",{className:"dl-history",children:[o.jsx("h3",{className:"dl-h3",children:"Recent changes"}),o.jsx("div",{className:"history dl-hlist",children:c.map((r,d)=>o.jsx(hm,{entry:r,onOpen:i.onOpen},d))}),o.jsx("button",{className:"ai-btn dl-more",onClick:i.onFullHistory,children:"Full history"})]})}function sp(i){const{apiBase:c,path:f,onMeta:r}=i,d=c+"file?path="+encodeURIComponent(f);return Q.useEffect(()=>()=>r(""),[f,r]),B0.test(f)?o.jsx(fp,{...i}):Y0.test(f)?o.jsx(dp,{src:d,alt:f,onRendered:i.onRendered}):G0.test(f)?o.jsx(hp,{...i,fileURL:d}):o.jsxs("div",{className:"filecard",children:[o.jsx("div",{className:"name",children:f.split("/").pop()}),o.jsx("p",{children:"No preview for this file type."}),o.jsx("a",{className:"btn",download:!0,href:c+"download?path="+encodeURIComponent(f),children:"Download"})]})}function fp(i){const{apiBase:c,path:f,heatMap:r,flatFiles:d,onOpenFile:m,onMeta:S,onRendered:A}=i,{data:v,error:y}=he({queryKey:["render",c,f],queryFn:()=>Ae(c+"render?path="+encodeURIComponent(f))}),N=Q.useMemo(()=>v?op(v.html,f,c):"",[v,f,c]);return Q.useEffect(()=>{if(!v)return;const j=[];v.author&&j.push(v.author+(v.device?" on "+v.device:"")),v.time&&j.push(new Date(v.time).toLocaleString());const E=r&&r[v.path];E&&ti(E)&&j.push(Ou(E)+" / 30d"),S(j.join(" · ")),A?.()},[v,r,S,A]),y?o.jsxs("div",{className:"empty",children:["Could not load file: ",y.message]}):v?o.jsx("div",{dangerouslySetInnerHTML:{__html:N},onClick:j=>rp(j,f,d,m)}):null}function rp(i,c,f,r){const d=i.target.closest("a");if(!d||!i.currentTarget.contains(d))return;const m=d.getAttribute("href")||"",S=c.includes("/")?c.slice(0,c.lastIndexOf("/")):"";m.startsWith("wiki:")?(i.preventDefault(),mp(decodeURIComponent(m.slice(5)),f,r)):/^([a-z]+:|\/|#)/i.test(m)||(i.preventDefault(),r(om(S,decodeURIComponent(m))))}function op(i,c,f){const r=c.includes("/")?c.slice(0,c.lastIndexOf("/")):"",d=S=>f+"file?path="+encodeURIComponent(S),m=new DOMParser().parseFromString(i,"text/html");for(const S of m.querySelectorAll("img")){const A=S.getAttribute("src")||"";/^([a-z]+:|\/)/i.test(A)||S.setAttribute("src",d(om(r,A)))}for(const S of m.querySelectorAll("a")){const A=S.getAttribute("href")||"";/^https?:/i.test(A)&&(S.setAttribute("target","_blank"),S.setAttribute("rel","noopener"))}return m.body.innerHTML}function dp({src:i,alt:c,onRendered:f}){return o.jsx("img",{src:i,alt:c,onLoad:f})}function hp(i){const{path:c,fileURL:f,onRendered:r}=i,{data:d,error:m}=he({queryKey:["text",f],queryFn:async()=>{const S=await fetch(f);if(!S.ok)throw new Error(await S.text());return S.text()}});return Q.useEffect(()=>{d!=null&&r?.()},[d,r]),m?o.jsxs("div",{className:"empty",children:["Could not load file: ",m.message]}):d==null?null:o.jsx("pre",{className:"plain",children:d},c)}function mp(i,c,f){const r=i.toLowerCase(),d=c.find(m=>m.path.toLowerCase()===r||m.path.toLowerCase()===r+".md")||c.find(m=>{const S=m.name.toLowerCase();return S===r||S===r+".md"});d&&f(d.path)}function yp({url:i,copied:c,onClose:f}){const r=i.split("/s/")[1];return Q.useEffect(()=>{const d=m=>{m.key==="Escape"&&f()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[f]),o.jsx("div",{className:"modal-back",onClick:d=>d.target===d.currentTarget&&f(),children:o.jsxs("div",{className:"modal",children:[o.jsx("h3",{children:"Public link created"}),o.jsxs("p",{children:[o.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until you revoke it."]}),o.jsx("div",{className:"modal-url",children:i}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("button",{className:"pbtn",onClick:()=>Pn(i).then(d=>ot(d?"Copied.":"Select and copy the link above.")),children:c?"Copied ✓":"Copy link"}),o.jsx("button",{className:"ai-btn",onClick:()=>window.open(i,"_blank"),children:"Open"}),o.jsx("button",{className:"ai-del",onClick:async()=>{try{await Ll("DELETE","/api/shares/"+r),ot("Link revoked — it no longer works."),f()}catch(d){ot(d.message,!0)}},children:"Revoke"}),o.jsx("button",{className:"ai-btn",onClick:f,children:"Done"})]})]})})}function Lh(i,c){if(!i)return{score:0,hits:[]};const f=i.toLowerCase(),r=c.toLowerCase();let d=0,m=0,S=0;const A=[];for(let v=0;v3&&r.endsWith("ies")?d=r.slice(0,-3)+"y":r.length>3&&r.endsWith("es")?d=r.slice(0,-2):r.length>2&&r.endsWith("s")&&(d=r.slice(0,-1)),d?Lh(d,c):null}function pp({text:i,hits:c}){const f=[];let r=0;return c.forEach((d,m)=>{d>r&&f.push(i.slice(r,d)),f.push(o.jsx("b",{children:i[d]},m)),r=d+1}),f.push(i.slice(r)),o.jsx("span",{className:"plabel",children:f})}function gp({open:i,onClose:c,candidates:f}){const[r,d]=Q.useState(""),[m,S]=Q.useState(0),A=Q.useRef(null),v=Q.useRef(null),y=Q.useMemo(()=>{if(!i)return[];const j=[];for(const E of f()){const q=vp(r,E.label);q&&j.push({...E,score:q.score,hits:q.hits})}return j.sort((E,q)=>q.score-E.score),j.slice(0,40)},[i,r,f]);Q.useEffect(()=>{i&&(d(""),S(0),A.current?.focus())},[i]),Q.useEffect(()=>S(0),[r]),Q.useEffect(()=>{v.current?.children[m]?.scrollIntoView({block:"nearest"})},[m,y]);const N=j=>{c(),j.run()};return Q.useEffect(()=>{if(!i)return;const j=E=>{if(E.key==="Escape")E.preventDefault(),c();else if(E.key==="ArrowDown"||E.key==="ArrowUp"){E.preventDefault();const q=y.length;q&&S(C=>(C+(E.key==="ArrowDown"?1:q-1))%q)}else E.key==="Enter"&&(E.preventDefault(),y[m]&&N(y[m]))};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[i,y,m]),i?o.jsx("div",{id:"palette-overlay",onClick:j=>j.target===j.currentTarget&&c(),children:o.jsxs("div",{id:"palette",role:"dialog","aria-label":"Search and quick actions",children:[o.jsxs("div",{id:"palette-inputwrap",children:[o.jsx(te,{name:"search"}),o.jsx("input",{id:"palette-input",type:"text",placeholder:"Search file names, projects, actions…",autoComplete:"off",spellCheck:!1,ref:A,value:r,onChange:j=>d(j.target.value)})]}),o.jsx("ul",{id:"palette-results",ref:v,children:y.length===0?o.jsx("li",{className:"pempty",children:"No matches — search covers file names, projects, and actions"}):y.map((j,E)=>o.jsxs("li",{className:E===m?"selected":void 0,onClick:()=>N(j),onMouseMove:()=>m!==E&&S(E),children:[o.jsx("span",{className:"picon",children:o.jsx(te,{name:j.icon})}),o.jsx(pp,{text:j.label,hits:j.hits}),o.jsx("span",{className:"pkind",children:j.kind})]},j.kind+":"+j.label))}),o.jsx("footer",{id:"palette-hint",children:"↑↓ navigate · ⏎ select · esc close"})]})}):null}const $s=[{key:"claude",label:"Claude Code & Cowork"},{key:"hermes",label:"Hermes",hook:"hermes",note:"Registers BearDrive's hooks in Hermes's config: pull before every turn, push after edits with a session note, and report file reads to Insights."},{key:"codex",label:"Codex",hook:"codex",note:"Registers hooks in .codex/hooks.json.",extra:"Run /hooks inside Codex once to trust the project's .codex layer — after that every turn pulls, edits push automatically, and reads are reported to Insights."}];function bp(i,c){const f=window.location.origin,r=c.id;if(i.key==="claude")return[{title:"Add the BearDrive plugin",desc:"One time, in any Claude Code session. The plugin ships the beardrive skill, the /beardrive commands, and turn-boundary sync hooks — and Claude Cowork shares the same plugins, so installing it once covers both.",code:`/plugin marketplace add runbear-io/beardrive /plugin install beardrive@beardrive`},{title:"Set up this project conversationally",desc:"In a Claude Code or Cowork session in the folder where you want the files, run:",code:"/beardrive:install connect to "+f+", project "+r,extra:"Claude installs the CLI, signs this machine in, mounts the project, and registers the sync hooks — pull the latest before every turn, push after edits (stamped with the session that made them), and report file reads to Insights. It asks before anything it changes."}];const d=(c.name||"project").toLowerCase().replace(/[^a-z0-9._-]+/g,"-")||"project";return[{title:"Install the BearDrive CLI",desc:"One static binary. Homebrew on macOS and Linux; releases and `go install` also work.",code:"brew install runbear-io/tap/beardrive"},{title:"Sign in to this hub",desc:"Opens the browser once and stores a device token on this machine — the synced folder itself never holds credentials.",code:"bdrive login "+f},{title:"Mount the project into a local folder",desc:"Run it where you want the files. An existing folder works too — contents merge, and re-running init later (or after moving the folder) just resumes.",code:"mkdir -p ~/"+d+" && cd ~/"+d+` -bdrive init --project `+r},{title:"Connect "+i.label,desc:i.note,code:"bdrive hooks install --agent "+i.hook,extra:i.extra}]}function Sp(){try{return localStorage.getItem("bdrive-guide-agent")||"claude"}catch{return"claude"}}function xp({project:i}){const[c,f]=Q.useState(Sp),r=$s.find(d=>d.key===c)||$s[0];return o.jsxs("div",{className:"guide",children:[o.jsx("h1",{className:"in-title",children:i.name}),o.jsx("p",{className:"dl-sub",children:"Mount this project as a folder on any machine and connect your coding agent: files sync both ways in the background, every change is journaled with who made it, and agent reads feed Insights."}),o.jsx("div",{className:"gd-tabs",children:$s.map(d=>o.jsx("button",{className:"gd-tab"+(d.key===r.key?" active":""),"data-key":d.key,onClick:()=>{f(d.key);try{localStorage.setItem("bdrive-guide-agent",d.key)}catch{}},children:d.label},d.key))}),o.jsxs("div",{className:"gd-body",children:[bp(r,i).map((d,y)=>o.jsxs("div",{className:"gd-step",children:[o.jsxs("div",{className:"gd-step-head",children:[o.jsx("span",{className:"gd-num",children:y+1}),o.jsx("span",{className:"gd-step-title",children:d.title})]}),d.desc&&o.jsx("p",{className:"gd-desc",children:d.desc}),d.code&&o.jsx(jp,{code:d.code}),d.extra&&o.jsx("p",{className:"gd-desc gd-extra",children:d.extra})]},y)),o.jsx("p",{className:"gd-done",children:"That's it — the folder now syncs on its own. Every agent turn starts from the latest state, edits appear here (and on every teammate's mount) within seconds, and what your agents read shows up in Insights."})]})]})}function jp({code:i}){const[c,f]=Q.useState("Copy");return o.jsxs("pre",{className:"gd-code",children:[o.jsx("code",{children:i}),o.jsx("button",{className:"gd-copy",onClick:async()=>{f(await Pn(i)?"Copied":"Copy failed"),setTimeout(()=>f("Copy"),1400)},children:c})]})}const Jn=3,Fa=30;function Ep(i,c){return he({queryKey:["heatDevices",i],queryFn:()=>Ae(i+"heat?by=device&days=30"),enabled:c,retry:!1,staleTime:6e4}).data?.devices??null}function Xh(i){const[c,f]=Q.useState("all"),{flatFiles:r,heatMap:d,devices:y}=i,S=Date.now(),A=r.map(v=>{const m=d&&d[v.path]||{},N=v.time?Math.max(0,(S-new Date(v.time).getTime())/864e5):0,j=c==="all"?ti(m):m[c]||0;return{path:v.path,reads:j,agent:m.agent||0,total:ti(m),days:N,danger:j>=Jn&&N>=Fa}});return o.jsxs("div",{className:"insights",children:[o.jsx("h1",{className:"in-title",children:"Knowledge insights"}),o.jsx("p",{className:"dl-sub",children:"Reads over the last 30 days × how long since each file changed. Hot but stale knowledge — read a lot, maintained by nobody — is the danger zone."}),o.jsx("div",{className:"in-lens",children:["all","human","agent"].map(v=>o.jsx("button",{className:"in-lens-btn"+(v===c?" active":""),onClick:()=>f(v),children:v==="all"?"All reads":v==="human"?"Human reads":"Agent reads"},v))}),o.jsx("h3",{className:"dl-h3",children:"Map — cell size = reads, color = freshness"}),o.jsx(Op,{pts:A,onOpenFile:i.onOpenFile,onOpenFolder:i.onOpenFolder,isFolder:i.isFolder}),o.jsx("h3",{className:"dl-h3",children:"Reads × freshness"}),o.jsx(Ap,{pts:A,onOpenFile:i.onOpenFile}),o.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),o.jsx(Np,{pts:A,lens:c,onOpenFile:i.onOpenFile}),y&&y.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"dl-h3",children:"Agent coverage — which agents read which areas"}),o.jsx(zp,{devices:y})]})]})}function Tp(i){const c=[[76,195,138],[232,196,84],[224,93,93]],f=Math.min(1,Math.max(0,i/300))*(c.length-1),r=Math.min(c.length-2,Math.floor(f)),d=f-r,y=c[r].map((S,A)=>Math.round(S+(c[r+1][A]-S)*d));return`rgb(${y[0]},${y[1]},${y[2]})`}function Kh(i,c,f,r,d){const y=i.reduce((m,N)=>m+N.value,0);if(!y||r<=0||d<=0)return[];const S=i.slice().sort((m,N)=>N.value-m.value).map(m=>({it:m,a:m.value/y*r*d})),A=(m,N)=>{const E=m.reduce((C,w)=>C+w.a,0)/N;let q=0;for(const C of m){const w=C.a/E;q=Math.max(q,w/E,E/w)}return q},v=[];for(;S.length;){const m=r>=d,N=m?d:r,j=[S.shift()];for(;S.length&&A(j.concat(S[0]),N)<=A(j,N);)j.push(S.shift());const E=j.reduce((C,w)=>C+w.a,0)/N;let q=0;for(const C of j){const w=C.a/E;m?v.push({item:C.it,x:c,y:f+q,w:E,h:w}):v.push({item:C.it,x:c+q,y:f,w,h:E}),q+=w}m?(c+=E,r-=E):(f+=E,d-=E)}return v}const Ws=15;function Op({pts:i,onOpenFile:c,onOpenFolder:f,isFolder:r}){const S=new Map;for(const v of i){const m=v.path.includes("/")?v.path.split("/")[0]:"/";let N=S.get(m);N||S.set(m,N={name:m,files:[],value:0}),N.files.push(v),N.value+=v.reads+1}const A=[];for(const v of Kh([...S.values()],0,0,720,480)){const m=v.item,N=m.name==="/"?"":m.name;if(A.push(o.jsx("rect",{x:v.x+1,y:v.y+1,width:Math.max(0,v.w-2),height:Math.max(0,v.h-2),rx:3,className:"in-tm-group","data-dir":N},"g"+m.name)),v.w>46&&v.h>Ws+10){let E=m.name==="/"?"(root)":m.name;const q=Math.floor((v.w-8)/6);E.length>q&&(E=E.slice(0,Math.max(1,q-1))+"…"),A.push(o.jsx("text",{x:v.x+5,y:v.y+12,className:"in-tm-glabel","data-dir":N,children:E},"gl"+m.name))}const j=Kh(m.files.map(E=>({...E,name:E.path.split("/").pop(),value:E.reads+1})),v.x+2,v.y+Ws,Math.max(0,v.w-4),Math.max(0,v.h-Ws-2));for(const E of j)if(A.push(o.jsx("rect",{x:E.x+.6,y:E.y+.6,width:Math.max(.4,E.w-1.2),height:Math.max(.4,E.h-1.2),rx:1.5,fill:Tp(E.item.days),className:"in-tm-cell","data-path":E.item.path,children:o.jsx("title",{children:`${E.item.path} — ${E.item.reads} read${E.item.reads===1?"":"s"}/30d · changed ${Math.round(E.item.days)}d ago`})},E.item.path)),E.w>54&&E.h>16){const q=Math.floor((E.w-8)/6);let C=(E.item.danger?"⚠ ":"")+E.item.name;C.length>q&&(C=C.slice(0,Math.max(1,q-1))+"…"),q>=5&&A.push(o.jsx("text",{x:E.x+4.5,y:E.y+12.5,className:"in-tm-label","data-path":E.item.path,children:C},"l"+E.item.path))}}return o.jsx("svg",{viewBox:"0 0 720 480",className:"in-chart in-treemap",onClick:v=>{const m=v.target.closest("[data-path], [data-dir]");if(!m)return;const N=m.getAttribute("data-path");if(N)return c(N);const j=m.getAttribute("data-dir");j&&r(j)&&f(j)},children:A})}function Ap({pts:i,onOpenFile:c}){const d={l:44,r:16,t:20,b:34},y=Math.max(Fa*2,...i.map(j=>j.days)),S=Math.max(Jn*2,...i.map(j=>j.reads)),A=j=>Math.log10(j+1)/Math.log10(y+1),v=j=>Math.log10(j+1)/Math.log10(S+1),m=j=>d.l+A(j)*(720-d.l-d.r),N=j=>360-d.b-v(j)*(360-d.t-d.b);return o.jsxs("svg",{viewBox:"0 0 720 360",className:"in-chart",children:[o.jsx("rect",{x:m(Fa),y:d.t,width:720-d.r-m(Fa),height:N(Jn)-d.t,className:"in-danger-zone"}),o.jsx("line",{x1:m(Fa),y1:d.t,x2:m(Fa),y2:360-d.b,className:"in-threshold"}),o.jsx("line",{x1:d.l,y1:N(Jn),x2:720-d.r,y2:N(Jn),className:"in-threshold"}),o.jsx("line",{x1:d.l,y1:360-d.b,x2:720-d.r,y2:360-d.b,className:"in-axis"}),o.jsx("line",{x1:d.l,y1:d.t,x2:d.l,y2:360-d.b,className:"in-axis"}),o.jsx("text",{x:(d.l+720-d.r)/2,y:352,className:"in-label",children:"days since last change →"}),o.jsx("text",{x:12,y:(d.t+360-d.b)/2,className:"in-label",transform:`rotate(-90 12 ${(d.t+360-d.b)/2})`,children:"reads / 30d →"}),o.jsx("text",{x:720-d.r-6,y:d.t+14,className:"in-quad in-quad-danger",textAnchor:"end",children:"hot + stale"}),o.jsx("text",{x:d.l+6,y:d.t+14,className:"in-quad",children:"hot + fresh"}),o.jsx("text",{x:720-d.r-6,y:360-d.b-8,className:"in-quad",textAnchor:"end",children:"cold + stale"}),o.jsx("text",{x:720-d.r-6,y:d.t+28,className:"in-label",textAnchor:"end",children:"dot size = agent share of reads"}),i.map(j=>{const E=j.total?(j.agent||0)/j.total:0;return o.jsx("circle",{cx:Number(m(j.days).toFixed(1)),cy:Number(N(j.reads).toFixed(1)),r:Number((3+4*E).toFixed(1)),className:"in-pt"+(j.danger?" danger":j.reads?"":" cold"),onClick:()=>c(j.path),children:o.jsx("title",{children:`${j.path} — ${j.reads} read${j.reads===1?"":"s"} / 30d · changed ${Math.round(j.days)}d ago`})},j.path)})]})}function Np({pts:i,lens:c,onOpenFile:f}){const r=i.filter(y=>y.reads>0).sort((y,S)=>S.reads-y.reads||S.days-y.days).slice(0,20);if(!r.length)return o.jsx("div",{className:"dl-empty",children:"No reads in the window yet."});const d=r[0].reads;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"in-hotpath",children:r.map(y=>{const S=c==="agent"?1:c==="human"?0:y.total?y.agent/y.total:0,A=y.reads/d*100;return o.jsxs("div",{className:"in-hp-row",tabIndex:0,role:"button",title:y.danger?`${y.reads} read${y.reads===1?"":"s"}/30d · unchanged ${Math.round(y.days)}d — review this file`:y.path,onClick:()=>f(y.path),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f(y.path))},children:[o.jsx("span",{className:"in-hp-name"+(y.danger?" danger":""),children:y.path+(y.danger?" ⚠":"")}),o.jsxs("span",{className:"in-hp-bar",children:[o.jsx("span",{className:"in-hp-agent",style:{width:(A*S).toFixed(1)+"%"}}),o.jsx("span",{className:"in-hp-human",style:{width:(A*(1-S)).toFixed(1)+"%"}})]}),o.jsx("span",{className:"in-hp-count",children:y.reads})]},y.path)})}),o.jsxs("p",{className:"in-legend",children:[o.jsx("span",{className:"in-sw agent"})," agent reads ",o.jsx("span",{className:"in-sw human"})," human reads"]})]})}function zp({devices:i}){const c=new Map;for(const E of i)for(const[q,C]of Object.entries(E.folders||{}))c.set(q,(c.get(q)||0)+C);const f=[...c.entries()].sort((E,q)=>q[1]-E[1]).slice(0,12).map(E=>E[0]),r=i.slice(0,12),d=140,y=6,S=Math.min(76,Math.max(34,(720-d-8)/f.length)),A=26,v=720,m=y+r.length*A+58,N=Math.max(1,...r.flatMap(E=>f.map(q=>(E.folders||{})[q]||0))),j=E=>{const q=[23,25,31],C=[245,166,35],w=q.map((B,L)=>Math.round(B+(C[L]-B)*E));return`rgb(${w[0]},${w[1]},${w[2]})`};return o.jsxs("svg",{viewBox:`0 0 ${v} ${m}`,className:"in-chart in-matrix",children:[r.map((E,q)=>{let C=E.name||E.id||"";return C.length>20&&(C=C.slice(0,19)+"…"),o.jsxs("g",{children:[o.jsx("text",{x:d-8,y:y+q*A+17,textAnchor:"end",className:"in-label",children:C}),f.map((w,B)=>{const L=(E.folders||{})[w]||0;return o.jsx("rect",{x:d+B*S,y:y+q*A,width:S-4,height:A-4,rx:3,fill:j(Math.sqrt(L/N)),children:o.jsx("title",{children:`${E.name||E.id} × ${w||"(root)"}: ${L} read${L===1?"":"s"}/30d`})},w)})]},E.id||q)}),f.map((E,q)=>{const C=d+q*S+(S-4)/2,w=y+r.length*A+14;return o.jsx("text",{x:C,y:w,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${C} ${w})`,children:E||"(root)"},E)})]})}function Mp(i){const{apiBase:c,target:f,isFolder:r,onMeta:d,onRendered:y}=i,S=f?r(f)?{prefix:f+"/"}:{path:f}:{prefix:""},A="path"in S&&S.path!==void 0?"path="+encodeURIComponent(S.path):"prefix="+encodeURIComponent(S.prefix??""),{data:v,error:m}=he({queryKey:["history",c,A,200],queryFn:()=>Ae(c+"history?"+A+"&n=200"),staleTime:15e3});if(Q.useEffect(()=>{m&&d("History unavailable: "+m.message)},[m,d]),Q.useEffect(()=>{v&&y?.()},[v,y]),!v)return null;const N=v.entries||[];return o.jsxs("div",{className:"history",children:[N.length===0&&o.jsx("div",{className:"empty",children:"No history yet."}),N.map((j,E)=>o.jsx(hm,{entry:j,onOpen:i.onOpen},E))]})}function Cp(i,c){return i?c(i)?i+"/ (folder)":i:"all changes"}function mm(i){const{config:c,apiBase:f,route:r,hub:d,project:y}=i,S=yf(),A=li(),{tree:v,flatFiles:m,dirIndex:N,loaded:j}=J0(f,!d||!!y),E=k0(f,d&&!!y&&!!c.reads?.enabled),q=d&&!!y&&!r.path&&!r.view,C=!!i.canInsights&&(r.view==="insights"||q),w=Ep(f,C);Q.useEffect(()=>{C&&A.invalidateQueries({queryKey:["heat",f]})},[C,f,A]);const B=r.path,L=!!B&&N.has(B),dt=!!B&&j&&!N.has(B),nt=L&&!r.view,[Ot,Nt]=Q.useState(()=>new Set),tt=Q.useRef(!0);Q.useEffect(()=>{if(!v||!tt.current)return;tt.current=!1;const k=(v.children||[]).filter(it=>it.dir);k.length===1&&Nt(it=>new Set(it).add(k[0].path))},[v]),Q.useEffect(()=>{if(!B||!j)return;Nt(it=>{const bt=new Set(it);for(const Qe of lp(B))bt.add(Qe);return N.has(B)&&bt.add(B),bt});const k=document.querySelector(`#tree .row[data-path="${CSS.escape(B)}"]`);k&&k.scrollIntoView({block:"nearest"})},[B,j,N]);const F=Q.useCallback(k=>{Nt(it=>{const bt=new Set(it);return bt.has(k)?bt.delete(k):bt.add(k),bt})},[]),ht=Q.useRef(null),Lt=Q.useRef(new Map),ne=Q.useRef({key:"",want:0,attempts:0});Q.useEffect(()=>{ne.current={key:S,want:w0()==="POP"?Lt.current.get(S)??0:0,attempts:0}},[S]);const Vt=Q.useCallback(()=>{const k=ht.current,it=ne.current;!k||it.key!==S||it.attempts>=3||(it.attempts++,k.scrollTo({top:it.want,behavior:"instant"}))},[S]),Ht=Q.useCallback(()=>{ht.current&&Lt.current.set(S,ht.current.scrollTop)},[S]),zt=Q.useCallback(k=>{ke(q0(k,y?.id)),ra()},[y?.id]),ee=Q.useCallback(k=>ke(wh("history",y?.id,k)),[y?.id]),[me,_]=Q.useState(""),[Y,J]=Q.useState(""),[mt,gt]=Q.useState(null),[b,H]=Q.useState(!1),[G,X]=Q.useState(!1),W=Q.useRef(null),et=Q.useRef(null),at=i.panel??null,Jt=!at&&d&&!!y&&dt,Dt=!at&&d&&!!y,Le=!!c.upload?.enabled&&(!d||!!y),Kl=!at&&dt,Wa=!at&&(dt||d&&!!y&&L),ai=f+"download?path="+encodeURIComponent(B),we=Q.useCallback(async()=>{try{const k=await fetch(f+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:B})});if(!k.ok)throw new Error(await k.text());const it=await k.json(),bt=await Pn(it.url);gt({url:it.url,copied:bt})}catch(k){ot("Share failed: "+k.message,!0)}},[f,B]),hl=Q.useCallback(()=>{if(!B)return ee("");ee(L?B+"/":B)},[B,L,ee]),ml=Q.useCallback(()=>W.current?.click(),[]),zu=async()=>{const k=W.current,it=k.files?.[0];if(k.value="",!it)return;const bt=B?L?B:B.includes("/")?B.slice(0,B.lastIndexOf("/")):"":"",Qe=bt?bt+"/"+it.name:it.name;try{J(`Uploading ${Qe}…`),await W0(f,Qe,it),J(`Uploaded ${Qe}`),await A.invalidateQueries({queryKey:["tree",f]}),zt(Qe)}catch(vl){J("Upload failed: "+vl.message)}};Q.useEffect(()=>{J("")},[S]),Q.useEffect(()=>{const k=it=>{(it.metaKey||it.ctrlKey)&&it.key.toLowerCase()==="k"&&(it.preventDefault(),X(bt=>!bt))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const ni=Q.useCallback(()=>{const k=[],it=(bt,Qe,vl,Du)=>k.push({icon:bt,label:Qe,kind:vl,run:Du});if(d&&y&&B&&(dt&&it("share","Share: "+B,"action",we),it("hist","History: "+B,"action",hl),dt&&it("download","Download: "+B,"action",()=>et.current?.click())),d&&y&&it("hist","History: whole project","action",()=>ee("")),Le&&it("upload","Upload a file…","action",ml),d)for(const bt of i.projects||[])(!y||bt.id!==y.id)&&it("folder","Switch to project: "+bt.name,"project",()=>ke("/"+bt.id));c.auth?.enabled&&it("power","Sign out","action",()=>window.location.href="/auth/logout");for(const bt of N.keys())it("folder",bt,"folder",()=>zt(bt));for(const bt of m)it("doc",bt.path,"file",()=>zt(bt.path));return k},[d,y,B,dt,Le,c.auth?.enabled,N,m,i.projects,we,hl,ml,ee,zt]);Q.useEffect(()=>{if(!b)return;const k=()=>H(!1);return document.addEventListener("click",k),()=>document.removeEventListener("click",k)},[b]);const yl=Q.useCallback(k=>N.has(k),[N]);let Xe="markdown",ye;at?(Xe="view",ye=at.body):r.view==="insights"?(Xe="view",ye=i.canInsights?o.jsx(Xh,{flatFiles:m,heatMap:E,devices:w,onOpenFile:zt,onOpenFolder:zt,isFolder:yl}):o.jsx("div",{className:"empty",children:"Insights is for hub admins and org owners."})):r.view==="history"?(Xe="view",ye=o.jsx(Mp,{apiBase:f,target:r.viewTarget||"",isFolder:yl,onOpen:zt,onMeta:_,onRendered:Vt})):B?j?L?(Xe="view",ye=o.jsx(up,{node:N.get(B),heatMap:E,hub:d&&!!y,apiBase:f,onOpen:zt,onFullHistory:ee,onRendered:Vt})):ye=o.jsx(sp,{apiBase:f,path:B,heatMap:E,flatFiles:m,onOpenFile:zt,onMeta:_,onRendered:Vt}):ye=o.jsx("div",{className:"empty",children:"Loading…"}):q?(Xe="view",ye=o.jsxs(o.Fragment,{children:[o.jsx(xp,{project:y}),i.canInsights&&o.jsx("div",{className:"home-insights",children:o.jsx(Xh,{flatFiles:m,heatMap:E,devices:w,onOpenFile:zt,onOpenFolder:zt,isFolder:yl})})]})):ye=o.jsx("div",{className:"empty",children:"Select a file to read it."});const Mu=at?at.crumb:B?o.jsx(ap,{path:B,onOpenFolder:zt}):r.view==="insights"?"Insights — "+(y?.name??""):r.view==="history"?"History — "+Cp(r.viewTarget||"",yl):q?y.name:null,Cu=o.jsx(In,{crumb:Mu,meta:Y||me,actions:o.jsxs(o.Fragment,{children:[o.jsxs("button",{className:"btn ghost",title:"Search (⌘K)",onClick:()=>X(!0),children:[o.jsx(te,{name:"search"})," ",o.jsx("span",{className:"lbl",children:"Search"})," ",o.jsx("kbd",{children:"⌘K"})]}),Jt&&o.jsxs("button",{id:"share-btn",className:"btn",onClick:we,children:[o.jsx(te,{name:"share"})," ",o.jsx("span",{className:"lbl",children:"Share"})]}),Dt&&o.jsxs("button",{id:"history-btn",className:"btn",onClick:hl,children:[o.jsx(te,{name:"hist"})," ",o.jsx("span",{className:"lbl",children:"History"})]}),Le&&o.jsxs("button",{id:"upload-btn",className:"btn",onClick:ml,children:[o.jsx(te,{name:"upload"})," ",o.jsx("span",{className:"lbl",children:"Upload"})]}),o.jsx("input",{type:"file",hidden:!0,ref:W,onChange:zu}),Kl&&o.jsxs("a",{id:"download",className:"btn",download:!0,href:ai,ref:et,children:[o.jsx(te,{name:"download"})," ",o.jsx("span",{className:"lbl",children:"Download"})]}),Wa&&o.jsx("button",{id:"more-btn",className:"btn icon-only",title:"More actions","aria-label":"More actions",onClick:k=>{k.stopPropagation(),H(!b)},children:o.jsx(te,{name:"dots"})}),b&&o.jsxs("div",{id:"more-menu",role:"menu",children:[Dt&&o.jsx("button",{className:"more-item",onClick:hl,children:"History"}),Le&&o.jsx("button",{className:"more-item",onClick:ml,children:"Upload"}),Kl&&o.jsx("button",{className:"more-item",onClick:()=>et.current?.click(),children:"Download"}),i.canInsights&&o.jsx("button",{className:"more-item",onClick:()=>ke(wh("insights",y?.id)),children:"Insights"})]})]})});return o.jsxs(o.Fragment,{children:[o.jsx(Wn,{vault:i.sidebar.vault,projectsNav:i.sidebar.projectsNav,orgBar:i.sidebar.orgBar,tree:o.jsx(tp,{root:v,expanded:Ot,onToggle:F,currentPath:B,listingShowing:nt,onOpen:zt}),topbar:Cu,contentClass:Xe,contentRef:ht,onContentScroll:Ht,children:ye}),mt&&o.jsx(yp,{url:mt.url,copied:mt.copied,onClose:()=>gt(null)}),o.jsx(gp,{open:G,onClose:()=>X(!1),candidates:ni})]})}function Dp({config:i}){const c=yf(),f=um(),[r,d]=Q.useState(null),[y,S]=Q.useState(null);Q.useEffect(()=>S(null),[c]);const A=Q.useMemo(()=>{const tt=c.match(/^\/join\/([0-9a-f]+)\/?$/);return tt?tt[1]:null},[c]),{data:v}=R0(!A),{data:m}=U0(!A),N=!!i.auth.admin,{data:j}=im(N),E=Q.useMemo(()=>sm(c,"hub"),[c]),q=Q.useMemo(()=>v&&(v.find(tt=>tt.id===E.project)||r&&v.find(tt=>tt.org===r)||v[0])||null,[v,E.project,r]);if(Q.useEffect(()=>{document.title=q?q.name+" — BearDrive":i.brand||i.volume||"BearDrive"},[q,i]),A)return o.jsx(_p,{token:A,onDone:async tt=>{d(tt),await f(),ke("/",{replace:!0})}});const C=i.brand||i.volume||"BearDrive",w=q&&m?.find(tt=>tt.id===q.org)||null,B=m?.find(tt=>tt.role==="owner")||null,L=w&&w.role==="owner"?w:B,dt=N||(w?w.role==="owner":!1),nt=o.jsx(Nu,{name:v?q?q.name:C:"…",onHome:q?()=>ke("/"+q.id):void 0,showSignout:i.auth.enabled,admin:N?{pending:j?.length||0,onClick:()=>{S({kind:"hub"}),ra()}}:void 0,gear:L?{onClick:()=>{S({kind:"org",orgId:L.id}),ra()}}:void 0});if(!v||!m)return o.jsx(Wn,{vault:nt,topbar:o.jsx(In,{}),children:o.jsx("div",{className:"empty",children:"Loading…"})});if(!q)return o.jsx(Wn,{vault:nt,projectsNav:o.jsx(Yh,{projects:v}),topbar:o.jsx(In,{}),contentClass:"view",children:o.jsx(V0,{authEnabled:i.auth.enabled,onCreate:async tt=>{if(!tt){ot("Give the project a name.",!0);return}try{const F=await $a("/api/projects",{name:tt});await f(),ke("/"+F.project.id),ot(`Created “${F.project.name}”.`)}catch(F){ot("Could not create the project: "+F.message,!0)}}})});const Ot=y?.kind==="org"?m.find(tt=>tt.id===y.orgId):null,Nt=y?.kind==="hub"?{crumb:"Signup & access",body:o.jsx(X0,{})}:Ot?{crumb:Ot.name,body:o.jsx(L0,{org:Ot,projects:v,myEmail:i.me?.email||"",onProjectsChanged:f})}:null;return E.project!==q.id?o.jsx(Q0,{to:"/"+q.id}):o.jsx(mm,{config:i,apiBase:"/api/p/"+q.id+"/",route:E,hub:!0,project:q,projects:v,canInsights:dt,sidebar:{vault:nt,projectsNav:o.jsx(Yh,{projects:v,currentId:q.id}),orgBar:o.jsx(Z0,{org:w,onManage:tt=>{S({kind:"org",orgId:tt.id}),ra()}})},panel:Nt},q.id)}function _p({token:i,onDone:c}){return Q.useEffect(()=>{let f=!1;return $a("/api/invites/"+i).then(r=>{f||(ot(`Welcome — you joined the “${r.org.name}” team. Opening its projects…`),c(r.org.id))}).catch(r=>{f||String(r.message).includes("signing in")||(ot("Could not accept the invite: "+r.message,!0),c(null))}),()=>{f=!0}},[i]),o.jsx(Wn,{vault:o.jsx(Nu,{name:"…",showSignout:!0}),topbar:o.jsx(In,{}),children:o.jsx("div",{className:"empty",children:"Joining…"})})}function Rp({config:i}){const c=yf(),f=i.volume||"BearDrive";Q.useEffect(()=>{document.title=i.brand||f},[i,f]);const r=Q.useMemo(()=>sm(c,"volume"),[c]);return o.jsx(mm,{config:i,apiBase:"/api/",route:r,hub:!1,sidebar:{vault:o.jsx(Nu,{name:f,showSignout:i.auth.enabled})}})}function Up(){const{data:i}=N0();return o.jsxs(o.Fragment,{children:[i?i.mode==="hub"?o.jsx(Dp,{config:i}):o.jsx(Rp,{config:i}):o.jsx(Wn,{vault:o.jsx(Nu,{name:"…",showSignout:!1}),topbar:o.jsx(In,{}),children:o.jsx("div",{className:"empty",children:"Loading…"})}),o.jsx(M0,{}),o.jsx(C0,{})]})}const Hp=new m0({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});Lv.createRoot(document.getElementById("root")).render(o.jsx(Q.StrictMode,{children:o.jsx(y0,{client:Hp,children:o.jsx(Up,{})})})); +bdrive init --project `+r},{title:"Connect "+i.label,desc:i.note,code:"bdrive hooks install --agent "+i.hook,extra:i.extra}]}function Sp(){try{return localStorage.getItem("bdrive-guide-agent")||"claude"}catch{return"claude"}}function xp({project:i}){const[c,f]=Q.useState(Sp),r=$s.find(d=>d.key===c)||$s[0];return o.jsxs("div",{className:"guide",children:[o.jsx("h1",{className:"in-title",children:i.name}),o.jsx("p",{className:"dl-sub",children:"Mount this project as a folder on any machine and connect your coding agent: files sync both ways in the background, every change is journaled with who made it, and agent reads feed Insights."}),o.jsx("div",{className:"gd-tabs",children:$s.map(d=>o.jsx("button",{className:"gd-tab"+(d.key===r.key?" active":""),"data-key":d.key,onClick:()=>{f(d.key);try{localStorage.setItem("bdrive-guide-agent",d.key)}catch{}},children:d.label},d.key))}),o.jsxs("div",{className:"gd-body",children:[bp(r,i).map((d,m)=>o.jsxs("div",{className:"gd-step",children:[o.jsxs("div",{className:"gd-step-head",children:[o.jsx("span",{className:"gd-num",children:m+1}),o.jsx("span",{className:"gd-step-title",children:d.title})]}),d.desc&&o.jsx("p",{className:"gd-desc",children:d.desc}),d.code&&o.jsx(jp,{code:d.code}),d.extra&&o.jsx("p",{className:"gd-desc gd-extra",children:d.extra})]},m)),o.jsx("p",{className:"gd-done",children:"That's it — the folder now syncs on its own. Every agent turn starts from the latest state, edits appear here (and on every teammate's mount) within seconds, and what your agents read shows up in Insights."})]})]})}function jp({code:i}){const[c,f]=Q.useState("Copy");return o.jsxs("pre",{className:"gd-code",children:[o.jsx("code",{children:i}),o.jsx("button",{className:"gd-copy",onClick:async()=>{f(await Pn(i)?"Copied":"Copy failed"),setTimeout(()=>f("Copy"),1400)},children:c})]})}const Jn=3,Fa=30;function Ep(i,c){return he({queryKey:["heatDevices",i],queryFn:()=>Ae(i+"heat?by=device&days=30"),enabled:c,retry:!1,staleTime:6e4}).data?.devices??null}function Xh(i){const[c,f]=Q.useState("all"),{flatFiles:r,heatMap:d,devices:m}=i,S=Date.now(),A=r.map(v=>{const y=d&&d[v.path]||{},N=v.time?Math.max(0,(S-new Date(v.time).getTime())/864e5):0,j=c==="all"?ti(y):y[c]||0;return{path:v.path,reads:j,agent:y.agent||0,total:ti(y),days:N,danger:j>=Jn&&N>=Fa}});return o.jsxs("div",{className:"insights",children:[o.jsx("h1",{className:"in-title",children:"Knowledge insights"}),o.jsx("p",{className:"dl-sub",children:"Reads over the last 30 days × how long since each file changed. Hot but stale knowledge — read a lot, maintained by nobody — is the danger zone."}),o.jsx("div",{className:"in-lens",children:["all","human","agent"].map(v=>o.jsx("button",{className:"in-lens-btn"+(v===c?" active":""),onClick:()=>f(v),children:v==="all"?"All reads":v==="human"?"Human reads":"Agent reads"},v))}),o.jsx("h3",{className:"dl-h3",children:"Map — cell size = reads, color = freshness"}),o.jsx(Op,{pts:A,onOpenFile:i.onOpenFile,onOpenFolder:i.onOpenFolder,isFolder:i.isFolder}),o.jsx("h3",{className:"dl-h3",children:"Reads × freshness"}),o.jsx(Ap,{pts:A,onOpenFile:i.onOpenFile}),o.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),o.jsx(Np,{pts:A,lens:c,onOpenFile:i.onOpenFile}),m&&m.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"dl-h3",children:"Agent coverage — which agents read which areas"}),o.jsx(zp,{devices:m})]})]})}function Tp(i){const c=[[76,195,138],[232,196,84],[224,93,93]],f=Math.min(1,Math.max(0,i/300))*(c.length-1),r=Math.min(c.length-2,Math.floor(f)),d=f-r,m=c[r].map((S,A)=>Math.round(S+(c[r+1][A]-S)*d));return`rgb(${m[0]},${m[1]},${m[2]})`}function Kh(i,c,f,r,d){const m=i.reduce((y,N)=>y+N.value,0);if(!m||r<=0||d<=0)return[];const S=i.slice().sort((y,N)=>N.value-y.value).map(y=>({it:y,a:y.value/m*r*d})),A=(y,N)=>{const E=y.reduce((C,w)=>C+w.a,0)/N;let q=0;for(const C of y){const w=C.a/E;q=Math.max(q,w/E,E/w)}return q},v=[];for(;S.length;){const y=r>=d,N=y?d:r,j=[S.shift()];for(;S.length&&A(j.concat(S[0]),N)<=A(j,N);)j.push(S.shift());const E=j.reduce((C,w)=>C+w.a,0)/N;let q=0;for(const C of j){const w=C.a/E;y?v.push({item:C.it,x:c,y:f+q,w:E,h:w}):v.push({item:C.it,x:c+q,y:f,w,h:E}),q+=w}y?(c+=E,r-=E):(f+=E,d-=E)}return v}const Ws=15;function Op({pts:i,onOpenFile:c,onOpenFolder:f,isFolder:r}){const S=new Map;for(const v of i){const y=v.path.includes("/")?v.path.split("/")[0]:"/";let N=S.get(y);N||S.set(y,N={name:y,files:[],value:0}),N.files.push(v),N.value+=v.reads+1}const A=[];for(const v of Kh([...S.values()],0,0,720,480)){const y=v.item,N=y.name==="/"?"":y.name;if(A.push(o.jsx("rect",{x:v.x+1,y:v.y+1,width:Math.max(0,v.w-2),height:Math.max(0,v.h-2),rx:3,className:"in-tm-group","data-dir":N},"g"+y.name)),v.w>46&&v.h>Ws+10){let E=y.name==="/"?"(root)":y.name;const q=Math.floor((v.w-8)/6);E.length>q&&(E=E.slice(0,Math.max(1,q-1))+"…"),A.push(o.jsx("text",{x:v.x+5,y:v.y+12,className:"in-tm-glabel","data-dir":N,children:E},"gl"+y.name))}const j=Kh(y.files.map(E=>({...E,name:E.path.split("/").pop(),value:E.reads+1})),v.x+2,v.y+Ws,Math.max(0,v.w-4),Math.max(0,v.h-Ws-2));for(const E of j)if(A.push(o.jsx("rect",{x:E.x+.6,y:E.y+.6,width:Math.max(.4,E.w-1.2),height:Math.max(.4,E.h-1.2),rx:1.5,fill:Tp(E.item.days),className:"in-tm-cell","data-path":E.item.path,children:o.jsx("title",{children:`${E.item.path} — ${E.item.reads} read${E.item.reads===1?"":"s"}/30d · changed ${Math.round(E.item.days)}d ago`})},E.item.path)),E.w>54&&E.h>16){const q=Math.floor((E.w-8)/6);let C=(E.item.danger?"⚠ ":"")+E.item.name;C.length>q&&(C=C.slice(0,Math.max(1,q-1))+"…"),q>=5&&A.push(o.jsx("text",{x:E.x+4.5,y:E.y+12.5,className:"in-tm-label","data-path":E.item.path,children:C},"l"+E.item.path))}}return o.jsx("svg",{viewBox:"0 0 720 480",className:"in-chart in-treemap",onClick:v=>{const y=v.target.closest("[data-path], [data-dir]");if(!y)return;const N=y.getAttribute("data-path");if(N)return c(N);const j=y.getAttribute("data-dir");j&&r(j)&&f(j)},children:A})}function Ap({pts:i,onOpenFile:c}){const d={l:44,r:16,t:20,b:34},m=Math.max(Fa*2,...i.map(j=>j.days)),S=Math.max(Jn*2,...i.map(j=>j.reads)),A=j=>Math.log10(j+1)/Math.log10(m+1),v=j=>Math.log10(j+1)/Math.log10(S+1),y=j=>d.l+A(j)*(720-d.l-d.r),N=j=>360-d.b-v(j)*(360-d.t-d.b);return o.jsxs("svg",{viewBox:"0 0 720 360",className:"in-chart",children:[o.jsx("rect",{x:y(Fa),y:d.t,width:720-d.r-y(Fa),height:N(Jn)-d.t,className:"in-danger-zone"}),o.jsx("line",{x1:y(Fa),y1:d.t,x2:y(Fa),y2:360-d.b,className:"in-threshold"}),o.jsx("line",{x1:d.l,y1:N(Jn),x2:720-d.r,y2:N(Jn),className:"in-threshold"}),o.jsx("line",{x1:d.l,y1:360-d.b,x2:720-d.r,y2:360-d.b,className:"in-axis"}),o.jsx("line",{x1:d.l,y1:d.t,x2:d.l,y2:360-d.b,className:"in-axis"}),o.jsx("text",{x:(d.l+720-d.r)/2,y:352,className:"in-label",children:"days since last change →"}),o.jsx("text",{x:12,y:(d.t+360-d.b)/2,className:"in-label",transform:`rotate(-90 12 ${(d.t+360-d.b)/2})`,children:"reads / 30d →"}),o.jsx("text",{x:720-d.r-6,y:d.t+14,className:"in-quad in-quad-danger",textAnchor:"end",children:"hot + stale"}),o.jsx("text",{x:d.l+6,y:d.t+14,className:"in-quad",children:"hot + fresh"}),o.jsx("text",{x:720-d.r-6,y:360-d.b-8,className:"in-quad",textAnchor:"end",children:"cold + stale"}),o.jsx("text",{x:720-d.r-6,y:d.t+28,className:"in-label",textAnchor:"end",children:"dot size = agent share of reads"}),i.map(j=>{const E=j.total?(j.agent||0)/j.total:0;return o.jsx("circle",{cx:Number(y(j.days).toFixed(1)),cy:Number(N(j.reads).toFixed(1)),r:Number((3+4*E).toFixed(1)),className:"in-pt"+(j.danger?" danger":j.reads?"":" cold"),onClick:()=>c(j.path),children:o.jsx("title",{children:`${j.path} — ${j.reads} read${j.reads===1?"":"s"} / 30d · changed ${Math.round(j.days)}d ago`})},j.path)})]})}function Np({pts:i,lens:c,onOpenFile:f}){const r=i.filter(m=>m.reads>0).sort((m,S)=>S.reads-m.reads||S.days-m.days).slice(0,20);if(!r.length)return o.jsx("div",{className:"dl-empty",children:"No reads in the window yet."});const d=r[0].reads;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"in-hotpath",children:r.map(m=>{const S=c==="agent"?1:c==="human"?0:m.total?m.agent/m.total:0,A=m.reads/d*100;return o.jsxs("div",{className:"in-hp-row",tabIndex:0,role:"button",title:m.danger?`${m.reads} read${m.reads===1?"":"s"}/30d · unchanged ${Math.round(m.days)}d — review this file`:m.path,onClick:()=>f(m.path),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f(m.path))},children:[o.jsx("span",{className:"in-hp-name"+(m.danger?" danger":""),children:m.path+(m.danger?" ⚠":"")}),o.jsxs("span",{className:"in-hp-bar",children:[o.jsx("span",{className:"in-hp-agent",style:{width:(A*S).toFixed(1)+"%"}}),o.jsx("span",{className:"in-hp-human",style:{width:(A*(1-S)).toFixed(1)+"%"}})]}),o.jsx("span",{className:"in-hp-count",children:m.reads})]},m.path)})}),o.jsxs("p",{className:"in-legend",children:[o.jsx("span",{className:"in-sw agent"})," agent reads ",o.jsx("span",{className:"in-sw human"})," human reads"]})]})}function zp({devices:i}){const c=new Map;for(const E of i)for(const[q,C]of Object.entries(E.folders||{}))c.set(q,(c.get(q)||0)+C);const f=[...c.entries()].sort((E,q)=>q[1]-E[1]).slice(0,12).map(E=>E[0]),r=i.slice(0,12),d=140,m=6,S=Math.min(76,Math.max(34,(720-d-8)/f.length)),A=26,v=720,y=m+r.length*A+58,N=Math.max(1,...r.flatMap(E=>f.map(q=>(E.folders||{})[q]||0))),j=E=>{const q=[23,25,31],C=[245,166,35],w=q.map((B,L)=>Math.round(B+(C[L]-B)*E));return`rgb(${w[0]},${w[1]},${w[2]})`};return o.jsxs("svg",{viewBox:`0 0 ${v} ${y}`,className:"in-chart in-matrix",children:[r.map((E,q)=>{let C=E.name||E.id||"";return C.length>20&&(C=C.slice(0,19)+"…"),o.jsxs("g",{children:[o.jsx("text",{x:d-8,y:m+q*A+17,textAnchor:"end",className:"in-label",children:C}),f.map((w,B)=>{const L=(E.folders||{})[w]||0;return o.jsx("rect",{x:d+B*S,y:m+q*A,width:S-4,height:A-4,rx:3,fill:j(Math.sqrt(L/N)),children:o.jsx("title",{children:`${E.name||E.id} × ${w||"(root)"}: ${L} read${L===1?"":"s"}/30d`})},w)})]},E.id||q)}),f.map((E,q)=>{const C=d+q*S+(S-4)/2,w=m+r.length*A+14;return o.jsx("text",{x:C,y:w,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${C} ${w})`,children:E||"(root)"},E)})]})}function Mp(i){const{apiBase:c,target:f,isFolder:r,onMeta:d,onRendered:m}=i,S=f?r(f)?{prefix:f+"/"}:{path:f}:{prefix:""},A="path"in S&&S.path!==void 0?"path="+encodeURIComponent(S.path):"prefix="+encodeURIComponent(S.prefix??""),{data:v,error:y}=he({queryKey:["history",c,A,200],queryFn:()=>Ae(c+"history?"+A+"&n=200"),staleTime:15e3});if(Q.useEffect(()=>{y&&d("History unavailable: "+y.message)},[y,d]),Q.useEffect(()=>{v&&m?.()},[v,m]),!v)return null;const N=v.entries||[];return o.jsxs("div",{className:"history",children:[N.length===0&&o.jsx("div",{className:"empty",children:"No history yet."}),N.map((j,E)=>o.jsx(hm,{entry:j,onOpen:i.onOpen},E))]})}function Cp(i,c){return i?c(i)?i+"/ (folder)":i:"all changes"}function mm(i){const{config:c,apiBase:f,route:r,hub:d,project:m}=i,S=yf(),A=li(),{tree:v,flatFiles:y,dirIndex:N,loaded:j}=J0(f,!d||!!m),E=k0(f,d&&!!m&&!!c.reads?.enabled),q=d&&!!m&&!r.path&&!r.view,C=!!i.canInsights&&(r.view==="insights"||q),w=Ep(f,C);Q.useEffect(()=>{C&&A.invalidateQueries({queryKey:["heat",f]})},[C,f,A]);const B=r.path,L=!!B&&N.has(B),dt=!!B&&j&&!N.has(B),nt=L&&!r.view,[Ot,Nt]=Q.useState(()=>new Set),tt=Q.useRef(!0);Q.useEffect(()=>{if(!v||!tt.current)return;tt.current=!1;const k=(v.children||[]).filter(it=>it.dir);k.length===1&&Nt(it=>new Set(it).add(k[0].path))},[v]),Q.useEffect(()=>{if(!B||!j)return;Nt(it=>{const bt=new Set(it);for(const Qe of lp(B))bt.add(Qe);return N.has(B)&&bt.add(B),bt});const k=document.querySelector(`#tree .row[data-path="${CSS.escape(B)}"]`);k&&k.scrollIntoView({block:"nearest"})},[B,j,N]);const F=Q.useCallback(k=>{Nt(it=>{const bt=new Set(it);return bt.has(k)?bt.delete(k):bt.add(k),bt})},[]),ht=Q.useRef(null),Lt=Q.useRef(new Map),ne=Q.useRef({key:"",want:0,attempts:0});Q.useEffect(()=>{ne.current={key:S,want:w0()==="POP"?Lt.current.get(S)??0:0,attempts:0}},[S]);const Vt=Q.useCallback(()=>{const k=ht.current,it=ne.current;!k||it.key!==S||it.attempts>=3||(it.attempts++,k.scrollTo({top:it.want,behavior:"instant"}))},[S]),Ht=Q.useCallback(()=>{ht.current&&Lt.current.set(S,ht.current.scrollTop)},[S]),zt=Q.useCallback(k=>{ke(q0(k,m?.id)),ra()},[m?.id]),ee=Q.useCallback(k=>ke(wh("history",m?.id,k)),[m?.id]),[me,_]=Q.useState(""),[Y,J]=Q.useState(""),[mt,gt]=Q.useState(null),[b,H]=Q.useState(!1),[G,X]=Q.useState(!1),W=Q.useRef(null),et=Q.useRef(null),at=i.panel??null,Jt=!at&&d&&!!m&&dt,Dt=!at&&d&&!!m,Le=!!c.upload?.enabled&&(!d||!!m),Kl=!at&&dt,Wa=!at&&(dt||d&&!!m&&L),ai=f+"download?path="+encodeURIComponent(B),we=Q.useCallback(async()=>{try{const k=await fetch(f+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:B})});if(!k.ok)throw new Error(await k.text());const it=await k.json(),bt=await Pn(it.url);gt({url:it.url,copied:bt})}catch(k){ot("Share failed: "+k.message,!0)}},[f,B]),hl=Q.useCallback(()=>{if(!B)return ee("");ee(L?B+"/":B)},[B,L,ee]),ml=Q.useCallback(()=>W.current?.click(),[]),zu=async()=>{const k=W.current,it=k.files?.[0];if(k.value="",!it)return;const bt=B?L?B:B.includes("/")?B.slice(0,B.lastIndexOf("/")):"":"",Qe=bt?bt+"/"+it.name:it.name;try{J(`Uploading ${Qe}…`),await W0(f,Qe,it),J(`Uploaded ${Qe}`),await A.invalidateQueries({queryKey:["tree",f]}),zt(Qe)}catch(vl){J("Upload failed: "+vl.message)}};Q.useEffect(()=>{J("")},[S]),Q.useEffect(()=>{const k=it=>{(it.metaKey||it.ctrlKey)&&it.key.toLowerCase()==="k"&&(it.preventDefault(),X(bt=>!bt))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const ni=Q.useCallback(()=>{const k=[],it=(bt,Qe,vl,Du)=>k.push({icon:bt,label:Qe,kind:vl,run:Du});if(d&&m&&B&&(dt&&it("share","Share: "+B,"action",we),it("hist","History: "+B,"action",hl),dt&&it("download","Download: "+B,"action",()=>et.current?.click())),d&&m&&it("hist","History: whole project","action",()=>ee("")),Le&&it("upload","Upload a file…","action",ml),d)for(const bt of i.projects||[])(!m||bt.id!==m.id)&&it("folder","Switch to project: "+bt.name,"project",()=>ke("/"+bt.id));c.auth?.enabled&&it("power","Sign out","action",()=>window.location.href="/auth/logout");for(const bt of N.keys())it("folder",bt,"folder",()=>zt(bt));for(const bt of y)it("doc",bt.path,"file",()=>zt(bt.path));return k},[d,m,B,dt,Le,c.auth?.enabled,N,y,i.projects,we,hl,ml,ee,zt]);Q.useEffect(()=>{if(!b)return;const k=()=>H(!1);return document.addEventListener("click",k),()=>document.removeEventListener("click",k)},[b]);const yl=Q.useCallback(k=>N.has(k),[N]);let Xe="markdown",ye;at?(Xe="view",ye=at.body):r.view==="insights"?(Xe="view",ye=i.canInsights?o.jsx(Xh,{flatFiles:y,heatMap:E,devices:w,onOpenFile:zt,onOpenFolder:zt,isFolder:yl}):o.jsx("div",{className:"empty",children:"Insights is for hub admins and org owners."})):r.view==="history"?(Xe="view",ye=o.jsx(Mp,{apiBase:f,target:r.viewTarget||"",isFolder:yl,onOpen:zt,onMeta:_,onRendered:Vt})):B?j?L?(Xe="view",ye=o.jsx(up,{node:N.get(B),heatMap:E,hub:d&&!!m,apiBase:f,onOpen:zt,onFullHistory:ee,onRendered:Vt})):ye=o.jsx(sp,{apiBase:f,path:B,heatMap:E,flatFiles:y,onOpenFile:zt,onMeta:_,onRendered:Vt}):ye=o.jsx("div",{className:"empty",children:"Loading…"}):q?(Xe="view",ye=o.jsxs(o.Fragment,{children:[o.jsx(xp,{project:m}),i.canInsights&&o.jsx("div",{className:"home-insights",children:o.jsx(Xh,{flatFiles:y,heatMap:E,devices:w,onOpenFile:zt,onOpenFolder:zt,isFolder:yl})})]})):ye=o.jsx("div",{className:"empty",children:"Select a file to read it."});const Mu=at?at.crumb:B?o.jsx(ap,{path:B,onOpenFolder:zt}):r.view==="insights"?"Insights — "+(m?.name??""):r.view==="history"?"History — "+Cp(r.viewTarget||"",yl):q?m.name:null,Cu=o.jsx(In,{crumb:Mu,meta:Y||me,actions:o.jsxs(o.Fragment,{children:[o.jsxs("button",{id:"search-btn",className:"btn ghost",title:"Search (⌘K)",onClick:()=>X(!0),children:[o.jsx(te,{name:"search"})," ",o.jsx("span",{className:"lbl",children:"Search"})," ",o.jsx("kbd",{children:"⌘K"})]}),Jt&&o.jsxs("button",{id:"share-btn",className:"btn",onClick:we,children:[o.jsx(te,{name:"share"})," ",o.jsx("span",{className:"lbl",children:"Share"})]}),Dt&&o.jsxs("button",{id:"history-btn",className:"btn",onClick:hl,children:[o.jsx(te,{name:"hist"})," ",o.jsx("span",{className:"lbl",children:"History"})]}),Le&&o.jsxs("button",{id:"upload-btn",className:"btn",onClick:ml,children:[o.jsx(te,{name:"upload"})," ",o.jsx("span",{className:"lbl",children:"Upload"})]}),o.jsx("input",{type:"file",hidden:!0,ref:W,onChange:zu}),Kl&&o.jsxs("a",{id:"download",className:"btn",download:!0,href:ai,ref:et,children:[o.jsx(te,{name:"download"})," ",o.jsx("span",{className:"lbl",children:"Download"})]}),Wa&&o.jsx("button",{id:"more-btn",className:"btn icon-only",title:"More actions","aria-label":"More actions",onClick:k=>{k.stopPropagation(),H(!b)},children:o.jsx(te,{name:"dots"})}),b&&o.jsxs("div",{id:"more-menu",role:"menu",children:[Dt&&o.jsx("button",{className:"more-item",onClick:hl,children:"History"}),Le&&o.jsx("button",{className:"more-item",onClick:ml,children:"Upload"}),Kl&&o.jsx("button",{className:"more-item",onClick:()=>et.current?.click(),children:"Download"}),i.canInsights&&o.jsx("button",{className:"more-item",onClick:()=>ke(wh("insights",m?.id)),children:"Insights"})]})]})});return o.jsxs(o.Fragment,{children:[o.jsx(Wn,{vault:i.sidebar.vault,projectsNav:i.sidebar.projectsNav,orgBar:i.sidebar.orgBar,tree:o.jsx(tp,{root:v,expanded:Ot,onToggle:F,currentPath:B,listingShowing:nt,onOpen:zt}),topbar:Cu,contentClass:Xe,contentRef:ht,onContentScroll:Ht,children:ye}),mt&&o.jsx(yp,{url:mt.url,copied:mt.copied,onClose:()=>gt(null)}),o.jsx(gp,{open:G,onClose:()=>X(!1),candidates:ni})]})}function Dp({config:i}){const c=yf(),f=um(),[r,d]=Q.useState(null),[m,S]=Q.useState(null);Q.useEffect(()=>S(null),[c]);const A=Q.useMemo(()=>{const tt=c.match(/^\/join\/([0-9a-f]+)\/?$/);return tt?tt[1]:null},[c]),{data:v}=R0(!A),{data:y}=U0(!A),N=!!i.auth.admin,{data:j}=im(N),E=Q.useMemo(()=>sm(c,"hub"),[c]),q=Q.useMemo(()=>v&&(v.find(tt=>tt.id===E.project)||r&&v.find(tt=>tt.org===r)||v[0])||null,[v,E.project,r]);if(Q.useEffect(()=>{document.title=q?q.name+" — BearDrive":i.brand||i.volume||"BearDrive"},[q,i]),A)return o.jsx(_p,{token:A,onDone:async tt=>{d(tt),await f(),ke("/",{replace:!0})}});const C=i.brand||i.volume||"BearDrive",w=q&&y?.find(tt=>tt.id===q.org)||null,B=y?.find(tt=>tt.role==="owner")||null,L=w&&w.role==="owner"?w:B,dt=N||(w?w.role==="owner":!1),nt=o.jsx(Nu,{name:v?q?q.name:C:"…",onHome:q?()=>ke("/"+q.id):void 0,showSignout:i.auth.enabled,admin:N?{pending:j?.length||0,onClick:()=>{S({kind:"hub"}),ra()}}:void 0,gear:L?{onClick:()=>{S({kind:"org",orgId:L.id}),ra()}}:void 0});if(!v||!y)return o.jsx(Wn,{vault:nt,topbar:o.jsx(In,{}),children:o.jsx("div",{className:"empty",children:"Loading…"})});if(!q)return o.jsx(Wn,{vault:nt,projectsNav:o.jsx(Yh,{projects:v}),topbar:o.jsx(In,{}),contentClass:"view",children:o.jsx(V0,{authEnabled:i.auth.enabled,onCreate:async tt=>{if(!tt){ot("Give the project a name.",!0);return}try{const F=await $a("/api/projects",{name:tt});await f(),ke("/"+F.project.id),ot(`Created “${F.project.name}”.`)}catch(F){ot("Could not create the project: "+F.message,!0)}}})});const Ot=m?.kind==="org"?y.find(tt=>tt.id===m.orgId):null,Nt=m?.kind==="hub"?{crumb:"Signup & access",body:o.jsx(X0,{})}:Ot?{crumb:Ot.name,body:o.jsx(L0,{org:Ot,projects:v,myEmail:i.me?.email||"",onProjectsChanged:f})}:null;return E.project!==q.id?o.jsx(Q0,{to:"/"+q.id}):o.jsx(mm,{config:i,apiBase:"/api/p/"+q.id+"/",route:E,hub:!0,project:q,projects:v,canInsights:dt,sidebar:{vault:nt,projectsNav:o.jsx(Yh,{projects:v,currentId:q.id}),orgBar:o.jsx(Z0,{org:w,onManage:tt=>{S({kind:"org",orgId:tt.id}),ra()}})},panel:Nt},q.id)}function _p({token:i,onDone:c}){return Q.useEffect(()=>{let f=!1;return $a("/api/invites/"+i).then(r=>{f||(ot(`Welcome — you joined the “${r.org.name}” team. Opening its projects…`),c(r.org.id))}).catch(r=>{f||String(r.message).includes("signing in")||(ot("Could not accept the invite: "+r.message,!0),c(null))}),()=>{f=!0}},[i]),o.jsx(Wn,{vault:o.jsx(Nu,{name:"…",showSignout:!0}),topbar:o.jsx(In,{}),children:o.jsx("div",{className:"empty",children:"Joining…"})})}function Rp({config:i}){const c=yf(),f=i.volume||"BearDrive";Q.useEffect(()=>{document.title=i.brand||f},[i,f]);const r=Q.useMemo(()=>sm(c,"volume"),[c]);return o.jsx(mm,{config:i,apiBase:"/api/",route:r,hub:!1,sidebar:{vault:o.jsx(Nu,{name:f,showSignout:i.auth.enabled})}})}function Up(){const{data:i}=N0();return o.jsxs(o.Fragment,{children:[i?i.mode==="hub"?o.jsx(Dp,{config:i}):o.jsx(Rp,{config:i}):o.jsx(Wn,{vault:o.jsx(Nu,{name:"…",showSignout:!1}),topbar:o.jsx(In,{}),children:o.jsx("div",{className:"empty",children:"Loading…"})}),o.jsx(M0,{}),o.jsx(C0,{})]})}const Hp=new m0({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});Lv.createRoot(document.getElementById("root")).render(o.jsx(Q.StrictMode,{children:o.jsx(y0,{client:Hp,children:o.jsx(Up,{})})})); diff --git a/internal/webapp/static/index.html b/internal/webapp/static/index.html index 5af822c..63085e7 100644 --- a/internal/webapp/static/index.html +++ b/internal/webapp/static/index.html @@ -5,8 +5,8 @@ BearDrive - - + +