From 3698d70f6886637f119d72b315ed8202cae59efe Mon Sep 17 00:00:00 2001 From: Snow Lee Date: Sun, 19 Jul 2026 09:51:07 -0700 Subject: [PATCH] feat(web): insights scoped to the selected file or folder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ⋯ menu's Insights opens /insights/: a folder scopes the treemap/scatter/hot-path/agent-coverage to its subtree, a file to itself; crumb and title show the scope. urlForView now carries targets for insights like it did for history. 45/45 e2e. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01VbiaaVM2ACxeRi8ySG9ybc --- internal/webapp/frontend/e2e/home.spec.ts | 12 ++++++++ internal/webapp/frontend/src/apps/Browser.tsx | 5 ++-- .../frontend/src/components/Insights.tsx | 29 ++++++++++++++----- internal/webapp/frontend/src/router.ts | 2 +- internal/webapp/frontend/src/style.css | 1 + ...{index-BWf7Qnlg.css => index-BCO_xByM.css} | 2 +- .../{index-b5pl3IMV.js => index-BcyLXD3p.js} | 16 +++++----- internal/webapp/static/index.html | 4 +-- 8 files changed, 50 insertions(+), 21 deletions(-) rename internal/webapp/static/assets/{index-BWf7Qnlg.css => index-BCO_xByM.css} (56%) rename internal/webapp/static/assets/{index-b5pl3IMV.js => index-BcyLXD3p.js} (69%) diff --git a/internal/webapp/frontend/e2e/home.spec.ts b/internal/webapp/frontend/e2e/home.spec.ts index 2b291c6..a36bcdc 100644 --- a/internal/webapp/frontend/e2e/home.spec.ts +++ b/internal/webapp/frontend/e2e/home.spec.ts @@ -151,3 +151,15 @@ test("folder listing's Full history goes to the subtree feed", async ({ page }) const paths = await page.$$eval(".history .hpath", (els) => els.map((e) => e.textContent)); for (const p of paths) expect(p).toContain("notes/"); }); + +test("insights scopes to the selected folder via the ⋯ menu", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.goto(`/${pid}/notes`); + await page.click("#more-btn"); + await page.click("#more-menu .more-item:has-text('Insights')"); + await page.waitForURL(`/${pid}/insights/notes`); + await expect(page.locator(".in-title .in-scope")).toContainText("notes"); + // Scope note in the subtitle is the stable assertion. + await expect(page.locator(".insights .dl-sub")).toContainText("notes and everything in it"); +}); diff --git a/internal/webapp/frontend/src/apps/Browser.tsx b/internal/webapp/frontend/src/apps/Browser.tsx index 2cbe787..69d3609 100644 --- a/internal/webapp/frontend/src/apps/Browser.tsx +++ b/internal/webapp/frontend/src/apps/Browser.tsx @@ -232,6 +232,7 @@ export default function Browser(props: { flatFiles={flatFiles} heatMap={heatMap} devices={devices} + scope={route.viewTarget || ""} onOpenFile={openPath} onOpenFolder={openPath} isFolder={isFolderFn} @@ -333,7 +334,7 @@ export default function Browser(props: { ) : path ? ( ) : route.view === "insights" ? ( - "Insights — " + (project?.name ?? "") + "Insights — " + (route.viewTarget || project?.name || "") ) : route.view === "history" ? ( "History — " + historyTitle(route.viewTarget || "", isFolderFn) ) : isHome ? ( @@ -393,7 +394,7 @@ export default function Browser(props: { {props.canInsights && ( diff --git a/internal/webapp/frontend/src/components/Insights.tsx b/internal/webapp/frontend/src/components/Insights.tsx index bd00cc6..2926044 100644 --- a/internal/webapp/frontend/src/components/Insights.tsx +++ b/internal/webapp/frontend/src/components/Insights.tsx @@ -48,15 +48,29 @@ export function Insights(props: { flatFiles: Node[]; heatMap: HeatMap | null; devices: DeviceHeat[] | null; + scope?: string; // "" = whole project; a folder scopes to its subtree, a file to itself onOpenFile: (path: string) => void; onOpenFolder: (path: string) => void; isFolder: (path: string) => boolean; }) { const [lens, setLens] = useState("all"); - const { flatFiles, heatMap, devices } = props; + const { flatFiles, heatMap, devices, scope } = props; + + const inScope = (p: string) => !scope || p === scope || p.startsWith(scope + "/"); + const scoped = scope ? flatFiles.filter((f) => inScope(f.path)) : flatFiles; + const scopedDevices = + devices && scope + ? devices + .map((d) => { + const folders: Record = {}; + for (const [f, n] of Object.entries(d.folders || {})) if (inScope(f)) folders[f] = n; + return { ...d, folders }; + }) + .filter((d) => Object.keys(d.folders).length > 0) + : devices; const now = Date.now(); - const pts: Pt[] = flatFiles.map((f) => { + const pts: Pt[] = scoped.map((f) => { const e = (heatMap && heatMap[f.path]) || {}; const days = f.time ? Math.max(0, (now - new Date(f.time).getTime()) / 86400000) : 0; const reads = lens === "all" ? heatTotal(e) : e[lens] || 0; @@ -72,10 +86,11 @@ export function Insights(props: { return (
-

Knowledge insights

+

Knowledge insights{scope ? · {scope} : null}

- 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. + {scope + ? `Reads over the last 30 days × freshness, for ${scope} and everything in it.` + : "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."}

{(["all", "human", "agent"] as const).map((l) => ( @@ -98,10 +113,10 @@ export function Insights(props: {

Hot path — top files by reads

- {devices && devices.length > 0 && ( + {scopedDevices && scopedDevices.length > 0 && ( <>

Agent coverage — which agents read which areas

- + )}
diff --git a/internal/webapp/frontend/src/router.ts b/internal/webapp/frontend/src/router.ts index 1451ff1..f36787c 100644 --- a/internal/webapp/frontend/src/router.ts +++ b/internal/webapp/frontend/src/router.ts @@ -59,6 +59,6 @@ export function urlForView( target?: string, ): string { let s = (projectId ? "/" + projectId : "") + "/" + view; - if (view === "history" && target) s += "/" + encodePath(target.replace(/\/+$/, "")); + if (target) s += "/" + encodePath(target.replace(/\/+$/, "")); return s; } diff --git a/internal/webapp/frontend/src/style.css b/internal/webapp/frontend/src/style.css index 3720161..2d0ba23 100644 --- a/internal/webapp/frontend/src/style.css +++ b/internal/webapp/frontend/src/style.css @@ -330,6 +330,7 @@ button, input, a.btn { font-family: inherit; } /* ---- insights (read×write matrix) ---- */ .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-title .in-scope { color: var(--text-ghost); font-weight: 500; font-size: 15px; } .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); } diff --git a/internal/webapp/static/assets/index-BWf7Qnlg.css b/internal/webapp/static/assets/index-BCO_xByM.css similarity index 56% rename from internal/webapp/static/assets/index-BWf7Qnlg.css rename to internal/webapp/static/assets/index-BCO_xByM.css index ce90a9a..c75a2ad 100644 --- a/internal/webapp/static/assets/index-BWf7Qnlg.css +++ b/internal/webapp/static/assets/index-BCO_xByM.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}#vault #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}#vault #signout:hover,.icon-btn2:hover{color:var(--text);background:var(--hover)}#vault #signout .ico,.icon-btn2 .ico{width:16px;height:16px}#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)}.proj-row{display:flex;align-items:center;gap:4px;padding:0 10px 4px 12px}.proj-select-wrap{position:relative;flex:1;min-width:0;display:flex;align-items:center}.proj-select-wrap .proj-mark{position:absolute;left:9px;pointer-events:none}.proj-select-wrap>.ico{position:absolute;right:8px;width:14px;height:14px;color:var(--text-ghost);pointer-events:none}#project-select{flex:1;min-width:0;height:30px;padding:0 26px 0 30px;appearance:none;-webkit-appearance:none;border:1px solid var(--border);border-radius:var(--r-ctl);background:var(--surface);color:var(--text);font:inherit;font-size:12.5px;font-weight:500;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#project-select:hover{background:var(--hover);border-color:var(--border-2)}#accountbar{position:relative;border-top:1px solid var(--border);padding:7px 10px}#account-btn{width:100%;display:flex;align-items:center;gap:9px;text-align:left;padding:6px 8px;border:none;border-radius:7px;background:transparent;color:var(--text-dim);cursor:pointer;font:inherit}#account-btn:hover{background:var(--hover);color:var(--text)}#account-btn .avatar{width:26px;height:26px;flex:none;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:12px;font-weight:700}#account-btn .acct{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}#account-btn .acct b{font-size:12.5px;font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#account-btn .acct small{font-size:11px;color:var(--text-ghost);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#account-btn>.ico{width:14px;height:14px;color:var(--text-ghost)}#account-menu{position:absolute;left:10px;right:10px;bottom:calc(100% + 4px);padding:5px;border:1px solid var(--border-2);border-radius:9px;background:var(--surface);box-shadow:0 10px 32px #00000059;display:flex;flex-direction:column;z-index:30}#account-menu .menu-sec{padding:7px 9px 3px;font-size:10.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--text-ghost)}#account-menu [role=menuitem]{display:flex;align-items:center;gap:8px;padding:7px 9px;border:none;border-radius:6px;background:transparent;text-align:left;color:var(--text-dim);font:inherit;font-size:12.5px;cursor:pointer;text-decoration:none}#account-menu [role=menuitem]:hover{background:var(--hover);color:var(--text)}#account-menu [role=menuitem] b{font-weight:600}#account-menu [role=menuitem] .ico{width:15px;height:15px}#account-menu #signout{color:var(--danger, #e5534b)}#account-menu #signout:hover{color:var(--danger, #e5534b);background:var(--hover)}#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,#tree li>.row,#projects .row{height:44px}#account-btn,#project-select{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 table.frontmatter{margin:0 0 1.8em;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:8px;border-collapse:separate;border-spacing:0}.markdown table.frontmatter th{text-transform:none;letter-spacing:0;font-size:11.5px;color:var(--text-faint);font-weight:600;text-align:left;white-space:nowrap;vertical-align:top;padding:6px 14px 6px 12px;border-bottom:1px solid var(--border)}.markdown table.frontmatter td{color:var(--text-dim);padding:6px 12px 6px 0;border-bottom:1px solid var(--border)}.markdown table.frontmatter tr:last-child th,.markdown table.frontmatter tr:last-child td{border-bottom:none}.markdown table.frontmatter code{white-space:pre-wrap;font-size:11px}.markdown input[type=checkbox]{accent-color:var(--accent)}.htmlview{display:block;width:100%;height:calc(100vh - 150px);border:1px solid var(--border);border-radius:var(--r-card);background:#fff}.notfound{margin-top:12vh;text-align:center;color:var(--text-dim)}.notfound h1{color:var(--text);font-size:1.4em;margin-bottom:.5em}.notfound code{background:var(--hover);border:1px solid var(--border);padding:.15em .5em;border-radius:6px}.notfound .nf-sub{max-width:440px;margin:12px auto 20px;font-size:13px;color:var(--text-faint);line-height:1.6}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}#vault #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}#vault #signout:hover,.icon-btn2:hover{color:var(--text);background:var(--hover)}#vault #signout .ico,.icon-btn2 .ico{width:16px;height:16px}#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)}.proj-row{display:flex;align-items:center;gap:4px;padding:0 10px 4px 12px}.proj-select-wrap{position:relative;flex:1;min-width:0;display:flex;align-items:center}.proj-select-wrap .proj-mark{position:absolute;left:9px;pointer-events:none}.proj-select-wrap>.ico{position:absolute;right:8px;width:14px;height:14px;color:var(--text-ghost);pointer-events:none}#project-select{flex:1;min-width:0;height:30px;padding:0 26px 0 30px;appearance:none;-webkit-appearance:none;border:1px solid var(--border);border-radius:var(--r-ctl);background:var(--surface);color:var(--text);font:inherit;font-size:12.5px;font-weight:500;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#project-select:hover{background:var(--hover);border-color:var(--border-2)}#accountbar{position:relative;border-top:1px solid var(--border);padding:7px 10px}#account-btn{width:100%;display:flex;align-items:center;gap:9px;text-align:left;padding:6px 8px;border:none;border-radius:7px;background:transparent;color:var(--text-dim);cursor:pointer;font:inherit}#account-btn:hover{background:var(--hover);color:var(--text)}#account-btn .avatar{width:26px;height:26px;flex:none;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:12px;font-weight:700}#account-btn .acct{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}#account-btn .acct b{font-size:12.5px;font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#account-btn .acct small{font-size:11px;color:var(--text-ghost);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#account-btn>.ico{width:14px;height:14px;color:var(--text-ghost)}#account-menu{position:absolute;left:10px;right:10px;bottom:calc(100% + 4px);padding:5px;border:1px solid var(--border-2);border-radius:9px;background:var(--surface);box-shadow:0 10px 32px #00000059;display:flex;flex-direction:column;z-index:30}#account-menu .menu-sec{padding:7px 9px 3px;font-size:10.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--text-ghost)}#account-menu [role=menuitem]{display:flex;align-items:center;gap:8px;padding:7px 9px;border:none;border-radius:6px;background:transparent;text-align:left;color:var(--text-dim);font:inherit;font-size:12.5px;cursor:pointer;text-decoration:none}#account-menu [role=menuitem]:hover{background:var(--hover);color:var(--text)}#account-menu [role=menuitem] b{font-weight:600}#account-menu [role=menuitem] .ico{width:15px;height:15px}#account-menu #signout{color:var(--danger, #e5534b)}#account-menu #signout:hover{color:var(--danger, #e5534b);background:var(--hover)}#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-title .in-scope{color:var(--text-ghost);font-weight:500;font-size:15px}.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,#tree li>.row,#projects .row{height:44px}#account-btn,#project-select{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 table.frontmatter{margin:0 0 1.8em;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:8px;border-collapse:separate;border-spacing:0}.markdown table.frontmatter th{text-transform:none;letter-spacing:0;font-size:11.5px;color:var(--text-faint);font-weight:600;text-align:left;white-space:nowrap;vertical-align:top;padding:6px 14px 6px 12px;border-bottom:1px solid var(--border)}.markdown table.frontmatter td{color:var(--text-dim);padding:6px 12px 6px 0;border-bottom:1px solid var(--border)}.markdown table.frontmatter tr:last-child th,.markdown table.frontmatter tr:last-child td{border-bottom:none}.markdown table.frontmatter code{white-space:pre-wrap;font-size:11px}.markdown input[type=checkbox]{accent-color:var(--accent)}.htmlview{display:block;width:100%;height:calc(100vh - 150px);border:1px solid var(--border);border-radius:var(--r-card);background:#fff}.notfound{margin-top:12vh;text-align:center;color:var(--text-dim)}.notfound h1{color:var(--text);font-size:1.4em;margin-bottom:.5em}.notfound code{background:var(--hover);border:1px solid var(--border);padding:.15em .5em;border-radius:6px}.notfound .nf-sub{max-width:440px;margin:12px auto 20px;font-size:13px;color:var(--text-faint);line-height:1.6}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-b5pl3IMV.js b/internal/webapp/static/assets/index-BcyLXD3p.js similarity index 69% rename from internal/webapp/static/assets/index-b5pl3IMV.js rename to internal/webapp/static/assets/index-BcyLXD3p.js index 3429051..ff9dcba 100644 --- a/internal/webapp/static/assets/index-b5pl3IMV.js +++ b/internal/webapp/static/assets/index-BcyLXD3p.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 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 Ys={exports:{}},Xn={};var mh;function Bv(){if(mh)return Xn;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 Xn.Fragment=c,Xn.jsx=f,Xn.jsxs=f,Xn}var yh;function Lv(){return yh||(yh=1,Ys.exports=Bv()),Ys.exports}var o=Lv(),Gs={exports:{}},W={};var vh;function Yv(){if(vh)return W;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"),M=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),E=Symbol.iterator;function w(b){return b===null||typeof b!="object"?null:(b=E&&b[E]||b["@@iterator"],typeof b=="function"?b:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Q=Object.assign,Y={};function F(b,H,L){this.props=b,this.context=H,this.refs=Y,this.updater=L||z}F.prototype.isReactComponent={},F.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")},F.prototype.forceUpdate=function(b){this.updater.enqueueForceUpdate(this,b,"forceUpdate")};function yt(){}yt.prototype=F.prototype;function ot(b,H,L){this.props=b,this.context=H,this.refs=Y,this.updater=L||z}var zt=ot.prototype=new yt;zt.constructor=ot,Q(zt,F.prototype),zt.isPureReactComponent=!0;var lt=Array.isArray;function Nt(){}var $={H:null,A:null,T:null,S:null},gt=Object.prototype.hasOwnProperty;function wt(b,H,L){var G=L.ref;return{$$typeof:i,type:b,key:H,ref:G!==void 0?G:null,props:L}}function ue(b,H){return wt(b.type,H,b.props)}function le(b){return typeof b=="object"&&b!==null&&b.$$typeof===i}function Dt(b){var H={"=":"=0",":":"=2"};return"$"+b.replace(/[=:]/g,function(L){return H[L]})}var ce=/\/+/g;function Ut(b,H){return typeof b=="object"&&b!==null&&b.key!=null?Dt(""+b.key):H.toString(36)}function kt(b){switch(b.status){case"fulfilled":return b.value;case"rejected":throw b.reason;default:switch(typeof b.status=="string"?b.then(Nt,Nt):(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 D(b,H,L,G,V){var et=typeof b;(et==="undefined"||et==="boolean")&&(b=null);var ft=!1;if(b===null)ft=!0;else switch(et){case"bigint":case"string":case"number":ft=!0;break;case"object":switch(b.$$typeof){case i:case c:ft=!0;break;case M:return ft=b._init,D(ft(b._payload),H,L,G,V)}}if(ft)return V=V(b),ft=G===""?"."+Ut(b,0):G,lt(V)?(L="",ft!=null&&(L=ft.replace(ce,"$&/")+"/"),D(V,H,L,"",function(Gl){return Gl})):V!=null&&(le(V)&&(V=ue(V,L+(V.key==null||b&&b.key===V.key?"":(""+V.key).replace(ce,"$&/")+"/")+ft)),H.push(V)),1;ft=0;var Vt=G===""?".":G+":";if(lt(b))for(var Rt=0;Rt>>1,dt=D[vt];if(0>>1;vtd(L,k))Gd(V,L)?(D[vt]=V,D[G]=k,vt=G):(D[vt]=L,D[H]=k,vt=H);else if(Gd(V,k))D[vt]=V,D[G]=k,vt=G;else break t}}return B}function d(D,B){var k=D.sortIndex-B.sortIndex;return k!==0?k:D.id-B.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=[],M=1,j=null,E=3,w=!1,z=!1,Q=!1,Y=!1,F=typeof setTimeout=="function"?setTimeout:null,yt=typeof clearTimeout=="function"?clearTimeout:null,ot=typeof setImmediate<"u"?setImmediate:null;function zt(D){for(var B=f(y);B!==null;){if(B.callback===null)r(y);else if(B.startTime<=D)r(y),B.sortIndex=B.expirationTime,c(v,B);else break;B=f(y)}}function lt(D){if(Q=!1,zt(D),!z)if(f(v)!==null)z=!0,Nt||(Nt=!0,Dt());else{var B=f(y);B!==null&&kt(lt,B.startTime-D)}}var Nt=!1,$=-1,gt=5,wt=-1;function ue(){return Y?!0:!(i.unstable_now()-wtD&&ue());){var vt=j.callback;if(typeof vt=="function"){j.callback=null,E=j.priorityLevel;var dt=vt(j.expirationTime<=D);if(D=i.unstable_now(),typeof dt=="function"){j.callback=dt,zt(D),B=!0;break e}j===f(v)&&r(v),zt(D)}else r(v);j=f(v)}if(j!==null)B=!0;else{var b=f(y);b!==null&&kt(lt,b.startTime-D),B=!1}}break t}finally{j=null,E=k,w=!1}B=void 0}}finally{B?Dt():Nt=!1}}}var Dt;if(typeof ot=="function")Dt=function(){ot(le)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,Ut=ce.port2;ce.port1.onmessage=le,Dt=function(){Ut.postMessage(null)}}else Dt=function(){F(le,0)};function kt(D,B){$=F(function(){D(i.unstable_now())},B)}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(D){D.callback=null},i.unstable_forceFrameRate=function(D){0>D||125vt?(D.sortIndex=k,c(y,D),f(v)===null&&D===f(y)&&(Q?(yt($),$=-1):Q=!0,kt(lt,k-vt))):(D.sortIndex=dt,c(v,D),z||w||(z=!0,Nt||(Nt=!0,Dt()))),D},i.unstable_shouldYield=ue,i.unstable_wrapCallback=function(D){var B=E;return function(){var k=E;E=B;try{return D.apply(this,arguments)}finally{E=k}}}})(Zs)),Zs}var bh;function Xv(){return bh||(bh=1,Ks.exports=Gv()),Ks.exports}var ks={exports:{}},ae={};var Sh;function Kv(){if(Sh)return ae;Sh=1;var i=nf();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(),ks.exports=Kv(),ks.exports}var jh;function kv(){if(jh)return Kn;jh=1;var i=Xv(),c=nf(),f=Zv();function r(t){var e="https://react.dev/errors/"+t;if(1dt||(t.current=vt[dt],vt[dt]=null,dt--)}function L(t,e){dt++,vt[dt]=t.current,t.current=e}var G=b(null),V=b(null),et=b(null),ft=b(null);function Vt(t,e){switch(L(et,e),L(V,t),L(G,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(G),L(G,t)}function Rt(){H(G),H(V),H(et)}function Gl(t){t.memoizedState!==null&&L(ft,t);var e=G.current,l=Qd(e,t.type);e!==l&&(L(V,t),L(G,l))}function hl(t){V.current===t&&(H(G),H(V)),ft.current===t&&(H(ft),Bn._currentValue=k)}var ml,ei;function Ce(t){if(ml===void 0)try{throw Error()}catch(l){var e=l.stack.trim().match(/\n( *(at )?)/);ml=e&&e[1]||"",ei=-1{for(const m of d)if(m.type==="childList")for(const g of m.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&r(g)}).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 Ys={exports:{}},Xn={};var mh;function Bv(){if(mh)return Xn;mh=1;var i=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function f(r,d,m){var g=null;if(m!==void 0&&(g=""+m),d.key!==void 0&&(g=""+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:g,ref:d!==void 0?d:null,props:m}}return Xn.Fragment=c,Xn.jsx=f,Xn.jsxs=f,Xn}var yh;function Lv(){return yh||(yh=1,Ys.exports=Bv()),Ys.exports}var o=Lv(),Gs={exports:{}},W={};var vh;function Yv(){if(vh)return W;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"),g=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),x=Symbol.iterator;function q(S){return S===null||typeof S!="object"?null:(S=x&&S[x]||S["@@iterator"],typeof S=="function"?S:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,Y={};function F(S,H,L){this.props=S,this.context=H,this.refs=Y,this.updater=L||z}F.prototype.isReactComponent={},F.prototype.setState=function(S,H){if(typeof S!="object"&&typeof S!="function"&&S!=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,S,H,"setState")},F.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function yt(){}yt.prototype=F.prototype;function ot(S,H,L){this.props=S,this.context=H,this.refs=Y,this.updater=L||z}var zt=ot.prototype=new yt;zt.constructor=ot,w(zt,F.prototype),zt.isPureReactComponent=!0;var lt=Array.isArray;function Ot(){}var $={H:null,A:null,T:null,S:null},gt=Object.prototype.hasOwnProperty;function wt(S,H,L){var G=L.ref;return{$$typeof:i,type:S,key:H,ref:G!==void 0?G:null,props:L}}function ue(S,H){return wt(S.type,H,S.props)}function le(S){return typeof S=="object"&&S!==null&&S.$$typeof===i}function Dt(S){var H={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function(L){return H[L]})}var ce=/\/+/g;function Ut(S,H){return typeof S=="object"&&S!==null&&S.key!=null?Dt(""+S.key):H.toString(36)}function kt(S){switch(S.status){case"fulfilled":return S.value;case"rejected":throw S.reason;default:switch(typeof S.status=="string"?S.then(Ot,Ot):(S.status="pending",S.then(function(H){S.status==="pending"&&(S.status="fulfilled",S.value=H)},function(H){S.status==="pending"&&(S.status="rejected",S.reason=H)})),S.status){case"fulfilled":return S.value;case"rejected":throw S.reason}}throw S}function D(S,H,L,G,V){var et=typeof S;(et==="undefined"||et==="boolean")&&(S=null);var ft=!1;if(S===null)ft=!0;else switch(et){case"bigint":case"string":case"number":ft=!0;break;case"object":switch(S.$$typeof){case i:case c:ft=!0;break;case M:return ft=S._init,D(ft(S._payload),H,L,G,V)}}if(ft)return V=V(S),ft=G===""?"."+Ut(S,0):G,lt(V)?(L="",ft!=null&&(L=ft.replace(ce,"$&/")+"/"),D(V,H,L,"",function(Gl){return Gl})):V!=null&&(le(V)&&(V=ue(V,L+(V.key==null||S&&S.key===V.key?"":(""+V.key).replace(ce,"$&/")+"/")+ft)),H.push(V)),1;ft=0;var Vt=G===""?".":G+":";if(lt(S))for(var Rt=0;Rt>>1,dt=D[vt];if(0>>1;vtd(L,k))Gd(V,L)?(D[vt]=V,D[G]=k,vt=G):(D[vt]=L,D[H]=k,vt=H);else if(Gd(V,k))D[vt]=V,D[G]=k,vt=G;else break t}}return B}function d(D,B){var k=D.sortIndex-B.sortIndex;return k!==0?k:D.id-B.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 g=Date,A=g.now();i.unstable_now=function(){return g.now()-A}}var p=[],y=[],M=1,E=null,x=3,q=!1,z=!1,w=!1,Y=!1,F=typeof setTimeout=="function"?setTimeout:null,yt=typeof clearTimeout=="function"?clearTimeout:null,ot=typeof setImmediate<"u"?setImmediate:null;function zt(D){for(var B=f(y);B!==null;){if(B.callback===null)r(y);else if(B.startTime<=D)r(y),B.sortIndex=B.expirationTime,c(p,B);else break;B=f(y)}}function lt(D){if(w=!1,zt(D),!z)if(f(p)!==null)z=!0,Ot||(Ot=!0,Dt());else{var B=f(y);B!==null&&kt(lt,B.startTime-D)}}var Ot=!1,$=-1,gt=5,wt=-1;function ue(){return Y?!0:!(i.unstable_now()-wtD&&ue());){var vt=E.callback;if(typeof vt=="function"){E.callback=null,x=E.priorityLevel;var dt=vt(E.expirationTime<=D);if(D=i.unstable_now(),typeof dt=="function"){E.callback=dt,zt(D),B=!0;break e}E===f(p)&&r(p),zt(D)}else r(p);E=f(p)}if(E!==null)B=!0;else{var S=f(y);S!==null&&kt(lt,S.startTime-D),B=!1}}break t}finally{E=null,x=k,q=!1}B=void 0}}finally{B?Dt():Ot=!1}}}var Dt;if(typeof ot=="function")Dt=function(){ot(le)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,Ut=ce.port2;ce.port1.onmessage=le,Dt=function(){Ut.postMessage(null)}}else Dt=function(){F(le,0)};function kt(D,B){$=F(function(){D(i.unstable_now())},B)}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(D){D.callback=null},i.unstable_forceFrameRate=function(D){0>D||125vt?(D.sortIndex=k,c(y,D),f(p)===null&&D===f(y)&&(w?(yt($),$=-1):w=!0,kt(lt,k-vt))):(D.sortIndex=dt,c(p,D),z||q||(z=!0,Ot||(Ot=!0,Dt()))),D},i.unstable_shouldYield=ue,i.unstable_wrapCallback=function(D){var B=x;return function(){var k=x;x=B;try{return D.apply(this,arguments)}finally{x=k}}}})(Zs)),Zs}var bh;function Xv(){return bh||(bh=1,Ks.exports=Gv()),Ks.exports}var ks={exports:{}},ae={};var Sh;function Kv(){if(Sh)return ae;Sh=1;var i=nf();function c(p){var y="https://react.dev/errors/"+p;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(c){console.error(c)}}return i(),ks.exports=Kv(),ks.exports}var jh;function kv(){if(jh)return Kn;jh=1;var i=Xv(),c=nf(),f=Zv();function r(t){var e="https://react.dev/errors/"+t;if(1dt||(t.current=vt[dt],vt[dt]=null,dt--)}function L(t,e){dt++,vt[dt]=t.current,t.current=e}var G=S(null),V=S(null),et=S(null),ft=S(null);function Vt(t,e){switch(L(et,e),L(V,t),L(G,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(G),L(G,t)}function Rt(){H(G),H(V),H(et)}function Gl(t){t.memoizedState!==null&&L(ft,t);var e=G.current,l=Qd(e,t.type);e!==l&&(L(V,t),L(G,l))}function hl(t){V.current===t&&(H(G),H(V)),ft.current===t&&(H(ft),Bn._currentValue=k)}var ml,ei;function Ce(t){if(ml===void 0)try{throw Error()}catch(l){var e=l.stack.trim().match(/\n( *(at )?)/);ml=e&&e[1]||"",ei=-1)":-1n||p[a]!==N[n]){var _=` -`+p[a].replace(" at new "," at ");return t.displayName&&_.includes("")&&(_=_.replace("",t.displayName)),_}while(1<=a&&0<=n);break}}}finally{Le=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?Ce(l):""}function Mu(t,e){switch(t.tag){case 26:case 27:case 5:return Ce(t.type);case 16:return Ce("Lazy");case 13:return t.child!==e&&e!==null?Ce("Suspense Fallback"):Ce("Suspense");case 19:return Ce("SuspenseList");case 0:case 15:return se(t.type,!1);case 11:return se(t.type.render,!1);case 1:return se(t.type,!0);case 31:return Ce("Activity");default:return""}}function li(t){try{var e="",l=null;do e+=Mu(t,l),l=t,t=t.return;while(t);return e}catch(a){return` +`+ml+t+ei}var Le=!1;function se(t,e){if(!t||Le)return"";Le=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(e){var U=function(){throw Error()};if(Object.defineProperty(U.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(U,[])}catch(C){var N=C}Reflect.construct(t,[],U)}else{try{U.call()}catch(C){N=C}t.call(U.prototype)}}else{try{throw Error()}catch(C){N=C}(U=t())&&typeof U.catch=="function"&&U.catch(function(){})}}catch(C){if(C&&N&&typeof C.stack=="string")return[C.stack,N.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=a.DetermineComponentFrameRoot(),s=u[0],h=u[1];if(s&&h){var v=s.split(` +`),O=h.split(` +`);for(n=a=0;an||v[a]!==O[n]){var _=` +`+v[a].replace(" at new "," at ");return t.displayName&&_.includes("")&&(_=_.replace("",t.displayName)),_}while(1<=a&&0<=n);break}}}finally{Le=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?Ce(l):""}function Mu(t,e){switch(t.tag){case 26:case 27:case 5:return Ce(t.type);case 16:return Ce("Lazy");case 13:return t.child!==e&&e!==null?Ce("Suspense Fallback"):Ce("Suspense");case 19:return Ce("SuspenseList");case 0:case 15:return se(t.type,!1);case 11:return se(t.type.render,!1);case 1:return se(t.type,!0);case 31:return Ce("Activity");default:return""}}function li(t){try{var e="",l=null;do e+=Mu(t,l),l=t,t=t.return;while(t);return e}catch(a){return` Error generating stack: `+a.message+` -`+a.stack}}var P=Object.prototype.hasOwnProperty,rt=i.unstable_scheduleCallback,xt=i.unstable_cancelCallback,Fa=i.unstable_shouldYield,Au=i.unstable_requestPaint,ne=i.unstable_now,bm=i.unstable_getCurrentPriorityLevel,mf=i.unstable_ImmediatePriority,yf=i.unstable_UserBlockingPriority,ai=i.unstable_NormalPriority,Sm=i.unstable_LowPriority,vf=i.unstable_IdlePriority,xm=i.log,jm=i.unstable_setDisableYieldValue,$a=null,ge=null;function yl(t){if(typeof xm=="function"&&jm(t),ge&&typeof ge.setStrictMode=="function")try{ge.setStrictMode($a,t)}catch{}}var be=Math.clz32?Math.clz32:Nm,Em=Math.log,Tm=Math.LN2;function Nm(t){return t>>>=0,t===0?32:31-(Em(t)/Tm|0)|0}var ni=256,ii=262144,ui=4194304;function Xl(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 ci(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=Xl(a):(s&=h,s!==0?n=Xl(s):l||(l=h&~t,l!==0&&(n=Xl(l))))):(h=a&~u,h!==0?n=Xl(h):s!==0?n=Xl(s):l||(l=a&~t,l!==0&&(n=Xl(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 Wa(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function Om(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=ui;return ui<<=1,(ui&62914560)===0&&(ui=4194304),t}function Cu(t){for(var e=[],l=0;31>l;l++)e.push(t);return e}function Ia(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Mm(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,N=t.hiddenUpdates;for(l=s&~l;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Rm=/[\n"\\]/g;function _e(t){return t.replace(Rm,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Hu(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=""+ze(e)):t.value!==""+ze(e)&&(t.value=""+ze(e)):s!=="submit"&&s!=="reset"||t.removeAttribute("value"),e!=null?qu(t,s,ze(e)):l!=null?qu(t,s,ze(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=""+ze(h):t.removeAttribute("name")}function zf(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)){Uu(t);return}l=l!=null?""+ze(l):"",e=e!=null?""+ze(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),Uu(t)}function qu(t,e,l){e==="number"&&ri(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function ma(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"),Yu=!1;if(We)try{var ln={};Object.defineProperty(ln,"passive",{get:function(){Yu=!0}}),window.addEventListener("test",ln,ln),window.removeEventListener("test",ln,ln)}catch{Yu=!1}var pl=null,Gu=null,di=null;function wf(){if(di)return di;var t,e=Gu,l=e.length,a,n="value"in pl?pl.value:pl.textContent,u=n.length;for(t=0;t=un),Xf=" ",Kf=!1;function Zf(t,e){switch(t){case"keyup":return cy.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ga=!1;function fy(t,e){switch(t){case"compositionend":return kf(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 ry(t,e){if(ga)return t==="compositionend"||!Vu&&Zf(t,e)?(t=wf(),di=Gu=pl=null,ga=!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=ri(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=ri(t.document)}return e}function $u(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 gy=We&&"documentMode"in document&&11>=document.documentMode,ba=null,Wu=null,rn=null,Iu=!1;function nr(t,e,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Iu||ba==null||ba!==ri(a)||(a=ba,"selectionStart"in a&&$u(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}),rn&&fn(rn,a)||(rn=a,a=iu(Wu,"onSelect"),0>=s,n-=s,Ke=1<<32-be(e)+n|l<tt?(ut=K,K=null):ut=K.sibling;var mt=O(x,K,T[tt],R);if(mt===null){K===null&&(K=ut);break}t&&K&&mt.alternate===null&&e(x,K),g=u(mt,g,tt),ht===null?Z=mt:ht.sibling=mt,ht=mt,K=ut}if(tt===T.length)return l(x,K),ct&&Pe(x,tt),Z;if(K===null){for(;tttt?(ut=K,K=null):ut=K.sibling;var Bl=O(x,K,mt.value,R);if(Bl===null){K===null&&(K=ut);break}t&&K&&Bl.alternate===null&&e(x,K),g=u(Bl,g,tt),ht===null?Z=Bl:ht.sibling=Bl,ht=Bl,K=ut}if(mt.done)return l(x,K),ct&&Pe(x,tt),Z;if(K===null){for(;!mt.done;tt++,mt=T.next())mt=U(x,mt.value,R),mt!==null&&(g=u(mt,g,tt),ht===null?Z=mt:ht.sibling=mt,ht=mt);return ct&&Pe(x,tt),Z}for(K=a(K);!mt.done;tt++,mt=T.next())mt=C(K,x,tt,mt.value,R),mt!==null&&(t&&mt.alternate!==null&&K.delete(mt.key===null?tt:mt.key),g=u(mt,g,tt),ht===null?Z=mt:ht.sibling=mt,ht=mt);return t&&K.forEach(function(Qv){return e(x,Qv)}),ct&&Pe(x,tt),Z}function Tt(x,g,T,R){if(typeof T=="object"&&T!==null&&T.type===Q&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case w:t:{for(var Z=T.key;g!==null;){if(g.key===Z){if(Z=T.type,Z===Q){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===Z||typeof Z=="object"&&Z!==null&&Z.$$typeof===gt&&ta(Z)===g.type){l(x,g.sibling),R=n(g,T.props),vn(R,T),R.return=x,x=R;break t}l(x,g);break}else e(x,g);g=g.sibling}T.type===Q?(R=Fl(T.props.children,x.mode,R,T.key),R.return=x,x=R):(R=ji(T.type,T.key,T.props,null,x.mode,R),vn(R,T),R.return=x,x=R)}return s(x);case z:t:{for(Z=T.key;g!==null;){if(g.key===Z)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=ic(T,x.mode,R),R.return=x,x=R}return s(x);case gt:return T=ta(T),Tt(x,g,T,R)}if(kt(T))return X(x,g,T,R);if(Dt(T)){if(Z=Dt(T),typeof Z!="function")throw Error(r(150));return T=Z.call(T),J(x,g,T,R)}if(typeof T.then=="function")return Tt(x,g,Ci(T),R);if(T.$$typeof===ot)return Tt(x,g,Ni(x,T),R);zi(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=nc(T,x.mode,R),R.return=x,x=R),s(x)):l(x,g)}return function(x,g,T,R){try{yn=0;var Z=Tt(x,g,T,R);return za=null,Z}catch(K){if(K===Ca||K===Mi)throw K;var ht=xe(29,K,null,x.mode);return ht.lanes=R,ht.return=x,ht}}}var la=Mr(!0),Ar=Mr(!1),jl=!1;function pc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gc(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 El(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Tl(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=xi(t),or(t,null,l),e}return Si(t,a,e,l),xi(t)}function pn(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 bc(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 Sc=!1;function gn(){if(Sc){var t=Aa;if(t!==null)throw t}}function bn(t,e,l,a){Sc=!1;var n=t.updateQueue;jl=!1;var u=n.firstBaseUpdate,s=n.lastBaseUpdate,h=n.shared.pending;if(h!==null){n.shared.pending=null;var p=h,N=p.next;p.next=null,s===null?u=N:s.next=N,s=p;var _=t.alternate;_!==null&&(_=_.updateQueue,h=_.lastBaseUpdate,h!==s&&(h===null?_.firstBaseUpdate=N:h.next=N,_.lastBaseUpdate=p))}if(u!==null){var U=n.baseState;s=0,_=N=p=null,h=u;do{var O=h.lane&-536870913,C=O!==h.lane;if(C?(it&O)===O:(a&O)===O){O!==0&&O===Ma&&(Sc=!0),_!==null&&(_=_.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});t:{var X=t,J=h;O=e;var Tt=l;switch(J.tag){case 1:if(X=J.payload,typeof X=="function"){U=X.call(Tt,U,O);break t}U=X;break t;case 3:X.flags=X.flags&-65537|128;case 0:if(X=J.payload,O=typeof X=="function"?X.call(Tt,U,O):X,O==null)break t;U=j({},U,O);break t;case 2:jl=!0}}O=h.callback,O!==null&&(t.flags|=64,C&&(t.flags|=8192),C=n.callbacks,C===null?n.callbacks=[O]:C.push(O))}else C={lane:O,tag:h.tag,payload:h.payload,callback:h.callback,next:null},_===null?(N=_=C,p=U):_=_.next=C,s|=O;if(h=h.next,h===null){if(h=n.shared.pending,h===null)break;C=h,h=C.next,C.next=null,n.lastBaseUpdate=C,n.shared.pending=null}}while(!0);_===null&&(p=U),n.baseState=p,n.firstBaseUpdate=N,n.lastBaseUpdate=_,u===null&&(n.shared.lanes=0),Cl|=s,t.lanes=s,t.memoizedState=U}}function Cr(t,e){if(typeof t!="function")throw Error(r(191,t));t.call(e)}function zr(t,e){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;tu?u:8;var s=D.T,h={};D.T=h,Bc(t,!1,e,l);try{var p=n(),N=D.S;if(N!==null&&N(h,p),p!==null&&typeof p=="object"&&typeof p.then=="function"){var _=My(p,a);jn(t,e,_,Oe(t))}else jn(t,e,a,Oe(t))}catch(U){jn(t,e,{then:function(){},status:"rejected",reason:U},Oe())}finally{B.p=u,s!==null&&h.types!==null&&(s.types=h.types),D.T=s}}function Ry(){}function wc(t,e,l,a){if(t.tag!==5)throw Error(r(476));var n=so(t).queue;co(t,n,e,k,l===null?Ry:function(){return fo(t),l(a)})}function so(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:k,baseState:k,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:k},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),jn(t,e.next.queue,{},Oe())}function Qc(){return It(Bn)}function ro(){return Bt().memoizedState}function oo(){return Bt().memoizedState}function Uy(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var l=Oe();t=El(l);var a=Tl(e,t,l);a!==null&&(ye(a,e,l),pn(a,e,l)),e={cache:hc()},t.payload=e;return}e=e.return}}function Hy(t,e,l){var a=Oe();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Li(t)?mo(e,l):(l=lc(t,e,l,a),l!==null&&(ye(l,t,a),yo(l,e,a)))}function ho(t,e,l){var a=Oe();jn(t,e,l,a)}function jn(t,e,l,a){var n={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Li(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,Se(h,s))return Si(t,e,n,0),Ot===null&&bi(),!1}catch{}if(l=lc(t,e,n,a),l!==null)return ye(l,t,a),yo(l,e,a),!0}return!1}function Bc(t,e,l,a){if(a={lane:2,revertLane:ps(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Li(t)){if(e)throw Error(r(479))}else e=lc(t,l,a,2),e!==null&&ye(e,t,2)}function Li(t){var e=t.alternate;return t===I||e!==null&&e===I}function mo(t,e){Da=Ri=!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 En={readContext:It,use:qi,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};En.useEffectEvent=Ht;var vo={readContext:It,use:qi,useCallback:function(t,e){return ie().memoizedState=[t,e===void 0?null:e],t},useContext:It,useEffect:Ir,useImperativeHandle:function(t,e,l){l=l!=null?l.concat([t]):null,Qi(4194308,4,lo.bind(null,e,t),l)},useLayoutEffect:function(t,e){return Qi(4194308,4,t,e)},useInsertionEffect:function(t,e){Qi(4,2,t,e)},useMemo:function(t,e){var l=ie();e=e===void 0?null:e;var a=t();if(aa){yl(!0);try{t()}finally{yl(!1)}}return l.memoizedState=[a,e],a},useReducer:function(t,e,l){var a=ie();if(l!==void 0){var n=l(e);if(aa){yl(!0);try{l(e)}finally{yl(!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=Hy.bind(null,I,t),[a.memoizedState,t]},useRef:function(t){var e=ie();return t={current:t},e.memoizedState=t},useState:function(t){t=Dc(t);var e=t.queue,l=ho.bind(null,I,e);return e.dispatch=l,[t.memoizedState,l]},useDebugValue:Hc,useDeferredValue:function(t,e){var l=ie();return qc(l,t,e)},useTransition:function(){var t=Dc(!1);return t=co.bind(null,I,t.queue,!0,!1),ie().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,l){var a=I,n=ie();if(ct){if(l===void 0)throw Error(r(407));l=l()}else{if(l=e(),Ot===null)throw Error(r(349));(it&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,Ua(9,{destroy:void 0},wr.bind(null,a,u,l,e),null),l},useId:function(){var t=ie(),e=Ot.identifierPrefix;if(ct){var l=Ze,a=Ke;l=(a&~(1<<32-be(a)-1)).toString(32)+l,e="_"+e+"R_"+l,l=Ui++,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[$t]=e,u[fe]=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(te(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 At(e),Pc(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=Wt,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}t[$t]=e,t=!!(t.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||Hd(t.nodeValue,l)),t||Sl(e,!0)}else t=uu(t).createTextNode(a),t[$t]=e,e.stateNode=t}return At(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[$t]=e}else $l(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;At(e),t=!1}else l=fc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return e.flags&256?(Ee(e),e):(Ee(e),null);if((e.flags&128)!==0)throw Error(r(558))}return At(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[$t]=e}else $l(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;At(e),n=!1}else n=fc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),n=!0;if(!n)return e.flags&256?(Ee(e),e):(Ee(e),null)}return Ee(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),Zi(e,e.updateQueue),At(e),null);case 4:return Rt(),t===null&&xs(e.stateNode.containerInfo),At(e),null;case 10:return el(e.type),At(e),null;case 19:if(H(Qt),a=e.memoizedState,a===null)return At(e),null;if(n=(e.flags&128)!==0,u=a.rendering,u===null)if(n)Nn(a,!1);else{if(qt!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(u=Di(t),u!==null){for(e.flags|=128,Nn(a,!1),t=u.updateQueue,e.updateQueue=t,Zi(e,t),e.subtreeFlags=0,t=l,l=e.child;l!==null;)dr(l,t),l=l.sibling;return L(Qt,Qt.current&1|2),ct&&Pe(e,a.treeForkCount),e.child}t=t.sibling}a.tail!==null&&ne()>$i&&(e.flags|=128,n=!0,Nn(a,!1),e.lanes=4194304)}else{if(!n)if(t=Di(u),t!==null){if(e.flags|=128,n=!0,t=t.updateQueue,e.updateQueue=t,Zi(e,t),Nn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!ct)return At(e),null}else 2*ne()-a.renderingStartTime>$i&&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=ne(),t.sibling=null,l=Qt.current,L(Qt,n?l&1|2:l&1),ct&&Pe(e,a.treeForkCount),t):(At(e),null);case 22:case 23:return Ee(e),jc(),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&&(At(e),e.subtreeFlags&6&&(e.flags|=8192)):At(e),l=e.updateQueue,l!==null&&Zi(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(Pl),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),e.memoizedState.cache!==l&&(e.flags|=2048),el(Lt),At(e),null;case 25:return null;case 30:return null}throw Error(r(156,e.tag))}function Ly(t,e){switch(cc(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return el(Lt),Rt(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return hl(e),null;case 31:if(e.memoizedState!==null){if(Ee(e),e.alternate===null)throw Error(r(340));$l()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(Ee(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(r(340));$l()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return H(Qt),null;case 4:return Rt(),null;case 10:return el(e.type),null;case 22:case 23:return Ee(e),jc(),t!==null&&H(Pl),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return el(Lt),null;case 25:return null;default:return null}}function Lo(t,e){switch(cc(e),e.tag){case 3:el(Lt),Rt();break;case 26:case 27:case 5:hl(e);break;case 4:Rt();break;case 31:e.memoizedState!==null&&Ee(e);break;case 13:Ee(e);break;case 19:H(Qt);break;case 10:el(e.type);break;case 22:case 23:Ee(e),jc(),t!==null&&H(Pl);break;case 24:el(Lt)}}function On(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){St(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,N=h;try{N()}catch(_){St(n,p,_)}}}a=a.next}while(a!==u)}}catch(_){St(e,e.return,_)}}function Yo(t){var e=t.updateQueue;if(e!==null){var l=t.stateNode;try{zr(e,l)}catch(a){St(t,t.return,a)}}}function Go(t,e,l){l.props=na(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(a){St(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){St(t,e,n)}}function ke(t,e){var l=t.ref,a=t.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(n){St(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){St(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){St(t,t.return,n)}}function ts(t,e,l){try{var a=t.stateNode;sv(a,t.type,l,e),a[fe]=e}catch(n){St(t,t.return,n)}}function Ko(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ul(t.type)||t.tag===4}function es(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&&Ul(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 ls(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&&Ul(t.type)&&(l=t.stateNode,e=null),t=t.child,t!==null))for(ls(t,e,l),t=t.sibling;t!==null;)ls(t,e,l),t=t.sibling}function ki(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&&Ul(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(ki(t,e,l),t=t.sibling;t!==null;)ki(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]);te(e,a,l),e[$t]=t,e[fe]=l}catch(u){St(t,t.return,u)}}var ul=!1,Xt=!1,as=!1,ko=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function Yy(t,e){if(t=t.containerInfo,Ts=hu,t=ar(t),$u(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,N=0,_=0,U=t,O=null;e:for(;;){for(var C;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),(C=U.firstChild)!==null;)O=U,U=C;for(;;){if(U===t)break e;if(O===l&&++N===n&&(h=s),O===u&&++_===a&&(p=s),(C=U.nextSibling)!==null)break;U=O,O=U.parentNode}U=C}l=h===-1||p===-1?null:{start:h,end:p}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ns={focusedElem:t,selectionRange:l},hu=!1,Ft=e;Ft!==null;)if(e=Ft,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Ft=t;else for(;Ft!==null;){switch(e=Ft,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"))),te(u,a,l),u[$t]=t,Jt(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=J,J=s);var x=er(h,J),g=er(h,Tt);if(x&&g&&(C.rangeCount!==1||C.anchorNode!==x.node||C.anchorOffset!==x.offset||C.focusNode!==g.node||C.focusOffset!==g.offset)){var T=U.createRange();T.setStart(x.node,x.offset),C.removeAllRanges(),J>Tt?(C.addRange(T),C.extend(g.node,g.offset)):(T.setEnd(g.node,g.offset),C.addRange(T))}}}}for(U=[],C=h;C=C.parentNode;)C.nodeType===1&&U.push({element:C,left:C.scrollLeft,top:C.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;hl?32:l,D.T=null,l=rs,rs=null;var u=_l,s=ol;if(Zt=0,Ba=_l=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,Rn(0,!1),ge&&typeof ge.onPostCommitFiberRoot=="function")try{ge.onPostCommitFiberRoot($a,u)}catch{}return!0}finally{B.p=n,D.T=a,xd(t,e)}}function Ed(t,e,l){e=Re(l,e),e=Xc(t.stateNode,e,2),t=Tl(t,e,2),t!==null&&(Ia(t,2),Ve(t))}function St(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"&&(zl===null||!zl.has(a))){t=Re(l,t),l=To(2),a=Tl(e,l,2),a!==null&&(No(l,a,e,t),Ia(a,2),Ve(a));break}}e=e.return}}function ms(t,e,l){var a=t.pingCache;if(a===null){a=t.pingCache=new Ky;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)||(us=!0,n.add(l),t=Fy.bind(null,t,e,l),e.then(t,t))}function Fy(t,e,l){var a=t.pingCache;a!==null&&a.delete(e),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,Ot===t&&(it&l)===l&&(qt===4||qt===3&&(it&62914560)===it&&300>ne()-Fi?(pt&2)===0&&La(t,0):cs|=l,Qa===it&&(Qa=0)),Ve(t)}function Td(t,e){e===0&&(e=pf()),t=Jl(t,e),t!==null&&(Ia(t,e),Ve(t))}function $y(t){var e=t.memoizedState,l=0;e!==null&&(l=e.retryLane),Td(t,l)}function Wy(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 Iy(t,e){return rt(t,e)}var lu=null,Ga=null,ys=!1,au=!1,vs=!1,Rl=0;function Ve(t){t!==Ga&&t.next===null&&(Ga===null?lu=Ga=t:Ga=Ga.next=t),au=!0,ys||(ys=!0,tv())}function Rn(t,e){if(!vs&&au){vs=!0;do for(var l=!1,a=lu;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-be(42|t)+1)-1,u&=n&~(s&~h),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,Ad(a,u))}else u=it,u=ci(a,a===Ot?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Wa(a,u)||(l=!0,Ad(a,u));a=a.next}while(l);vs=!1}}function Py(){Nd()}function Nd(){au=ys=!1;var t=0;Rl!==0&&rv()&&(t=Rl);for(var e=ne(),l=null,a=lu;a!==null;){var n=a.next,u=Od(a,e);u===0?(a.next=null,l===null?lu=n:l.next=n,n===null&&(Ga=l)):(l=a,(t!==0||(u&3)!==0)&&(au=!0)),a=n}Zt!==0&&Zt!==5||Rn(t),Rl!==0&&(Rl=0)}function Od(t,e){for(var l=t.suspendedLanes,a=t.pingedLanes,n=t.expirationTimes,u=t.pendingLanes&-62914561;0h)break;var _=p.transferSize,U=p.initiatorType;_&&qd(U)&&(p=p.responseEnd,s+=_*(p"u"?null:document;function Jd(t,e,l){var a=Xa;if(a&&typeof e=="string"&&e){var n=_e(e);n='link[rel="'+t+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),Vd.has(n)||(Vd.add(n),t={rel:t,crossOrigin:l,href:e},a.querySelector(n)===null&&(e=a.createElement("link"),te(e,"link",t),Jt(e),a.head.appendChild(e)))}}function bv(t){dl.D(t),Jd("dns-prefetch",t,null)}function Sv(t,e){dl.C(t,e),Jd("preconnect",t,e)}function xv(t,e,l){dl.L(t,e,l);var a=Xa;if(a&&t&&e){var n='link[rel="preload"][as="'+_e(e)+'"]';e==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+_e(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+_e(l.imageSizes)+'"]')):n+='[href="'+_e(t)+'"]';var u=n;switch(e){case"style":u=Ka(t);break;case"script":u=Za(t)}Be.has(u)||(t=j({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),Be.set(u,t),a.querySelector(n)!==null||e==="style"&&a.querySelector(wn(u))||e==="script"&&a.querySelector(Qn(u))||(e=a.createElement("link"),te(e,"link",t),Jt(e),a.head.appendChild(e)))}}function jv(t,e){dl.m(t,e);var l=Xa;if(l&&t){var a=e&&typeof e.as=="string"?e.as:"script",n='link[rel="modulepreload"][as="'+_e(a)+'"][href="'+_e(t)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Za(t)}if(!Be.has(u)&&(t=j({rel:"modulepreload",href:t},e),Be.set(u,t),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Qn(u)))return}a=l.createElement("link"),te(a,"link",t),Jt(a),l.head.appendChild(a)}}}function Ev(t,e,l){dl.S(t,e,l);var a=Xa;if(a&&t){var n=da(a).hoistableStyles,u=Ka(t);e=e||"default";var s=n.get(u);if(!s){var h={loading:0,preload:null};if(s=a.querySelector(wn(u)))h.loading=5;else{t=j({rel:"stylesheet",href:t,"data-precedence":e},l),(l=Be.get(u))&&Ds(t,l);var p=s=a.createElement("link");Jt(p),te(p,"link",t),p._p=new Promise(function(N,_){p.onload=N,p.onerror=_}),p.addEventListener("load",function(){h.loading|=1}),p.addEventListener("error",function(){h.loading|=2}),h.loading|=4,su(s,e,a)}s={type:"stylesheet",instance:s,count:1,state:h},n.set(u,s)}}}function Tv(t,e){dl.X(t,e);var l=Xa;if(l&&t){var a=da(l).hoistableScripts,n=Za(t),u=a.get(n);u||(u=l.querySelector(Qn(n)),u||(t=j({src:t,async:!0},e),(e=Be.get(n))&&Rs(t,e),u=l.createElement("script"),Jt(u),te(u,"link",t),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function Nv(t,e){dl.M(t,e);var l=Xa;if(l&&t){var a=da(l).hoistableScripts,n=Za(t),u=a.get(n);u||(u=l.querySelector(Qn(n)),u||(t=j({src:t,async:!0,type:"module"},e),(e=Be.get(n))&&Rs(t,e),u=l.createElement("script"),Jt(u),te(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)?cu(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=Ka(l.href),l=da(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=Ka(l.href);var u=da(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(wn(t)))&&!u._p&&(s.instance=u,s.state.loading=5),Be.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},Be.set(t,l),u||Ov(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=Za(l),l=da(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 Ka(t){return'href="'+_e(t)+'"'}function wn(t){return'link[rel="stylesheet"]['+t+"]"}function $d(t){return j({},t,{"data-precedence":t.precedence,precedence:null})}function Ov(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}),te(e,"link",l),Jt(e),t.head.appendChild(e))}function Za(t){return'[src="'+_e(t)+'"]'}function Qn(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~="'+_e(l.href)+'"]');if(a)return e.instance=a,Jt(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"),Jt(a),te(a,"style",n),su(a,l.precedence,t),e.instance=a;case"stylesheet":n=Ka(l.href);var u=t.querySelector(wn(n));if(u)return e.state.loading|=4,e.instance=u,Jt(u),u;a=$d(l),(n=Be.get(n))&&Ds(a,n),u=(t.ownerDocument||t).createElement("link"),Jt(u);var s=u;return s._p=new Promise(function(h,p){s.onload=h,s.onerror=p}),te(u,"link",a),e.state.loading|=4,su(u,l.precedence,t),e.instance=u;case"script":return u=Za(l.src),(n=t.querySelector(Qn(u)))?(e.instance=n,Jt(n),n):(a=l,(n=Be.get(u))&&(a=j({},l),Rs(a,n)),t=t.ownerDocument||t,n=t.createElement("script"),Jt(n),te(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,su(a,l.precedence,t));return e.instance}function su(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 Mv(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 Av(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=Ka(a.href),u=e.querySelector(wn(n));if(u){e=u._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=ru.bind(t),e.then(t,t)),l.state.loading|=4,l.instance=u,Jt(u);return}u=e.ownerDocument||e,a=$d(a),(n=Be.get(n))&&Ds(a,n),u=u.createElement("link"),Jt(u);var s=u;s._p=new Promise(function(h,p){s.onload=h,s.onerror=p}),te(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=ru.bind(t),e.addEventListener("load",l),e.addEventListener("error",l))}}var Us=0;function Cv(t,e){return t.stylesheets&&t.count===0&&du(t,t.stylesheets),0Us?50:800)+e);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function ru(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)du(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var ou=null;function du(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,ou=new Map,e.forEach(zv,t),ou=null,ru.call(t))}function zv(t,e){if(!(e.state.loading&4)){var l=ou.get(t);if(l)var a=l.get(null);else{l=new Map,ou.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(),Xs.exports=kv(),Xs.exports}var Jv=Vv(),Pn=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(){}},Fv=class extends Pn{#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"}},uf=new Fv,$v={setTimeout:(i,c)=>setTimeout(i,c),clearTimeout:i=>clearTimeout(i),setInterval:(i,c)=>setInterval(i,c),clearInterval:i=>clearInterval(i)},Wv=class{#t=$v;#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)}},ca=new Wv;function Iv(i){setTimeout(i,0)}var Pv=typeof window>"u"||"Deno"in globalThis;function ve(){}function t0(i,c){return typeof i=="function"?i(c):i}function $s(i){return typeof i=="number"&&i>=0&&i!==1/0}function kh(i,c){return Math.max(i+(c||0)-Date.now(),0)}function Yl(i,c){return typeof i=="function"?i(c):i}function Me(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!==cf(S,c.options))return!1}else if(!Vn(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 Nh(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(!Vn(c.options.mutationKey,m))return!1}return!(r&&c.state.status!==r||d&&!d(c))}function cf(i,c){return(c?.queryKeyHashFn||kn)(i)}function kn(i){return JSON.stringify(i,(c,f)=>Is(f)?Object.keys(f).sort().reduce((r,d)=>(r[d]=f[d],r),{}):f)}function Vn(i,c){return i===c?!0:typeof i!=typeof c?!1:i&&c&&typeof i=="object"&&typeof c=="object"?Object.keys(c).every(f=>Vn(i[f],c[f])):!1}var e0=Object.prototype.hasOwnProperty;function Vh(i,c,f=0){if(i===c)return i;if(f>500)return c;const r=Oh(i)&&Oh(c);if(!r&&!(Is(i)&&Is(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 M=0;M{ca.setTimeout(c,i)})}function Ps(i,c,f){return typeof f.structuralSharing=="function"?f.structuralSharing(i,c):f.structuralSharing!==!1?Vh(i,c):c}function a0(i,c,f=0){const r=[...i,c];return f&&r.length>f?r.slice(1):r}function n0(i,c,f=0){const r=[c,...i];return f&&r.length>f?r.slice(0,-1):r}var sf=Symbol();function Jh(i,c){return!i.queryFn&&c?.initialPromise?()=>c.initialPromise:!i.queryFn||i.queryFn===sf?()=>Promise.reject(new Error(`Missing queryFn: '${i.queryHash}'`)):i.queryFn}function Fh(i,c){return typeof i=="function"?i(...c):!!i}function i0(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 Jn=(()=>{let i=()=>Pv;return{isServer(){return i()},setIsServer(c){i=c}}})();function tf(){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 u0=Iv;function c0(){let i=[],c=0,f=A=>{A()},r=A=>{A()},d=u0;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 ee=c0(),s0=class extends Pn{#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}},Nu=new s0;function f0(i){return Math.min(1e3*2**i,3e4)}function $h(i){return(i??"online")==="online"?Nu.isOnline():!0}var ef=class extends Error{constructor(i){super("CancelledError"),this.revert=i?.revert,this.silent=i?.silent}};function Wh(i){let c=!1,f=0,r;const d=tf(),m=()=>d.status!=="pending",S=Q=>{if(!m()){const Y=new ef(Q);E(Y),i.onCancel?.(Y)}},A=()=>{c=!0},v=()=>{c=!1},y=()=>uf.isFocused()&&(i.networkMode==="always"||Nu.isOnline())&&i.canRun(),M=()=>$h(i.networkMode)&&i.canRun(),j=Q=>{m()||(r?.(),d.resolve(Q))},E=Q=>{m()||(r?.(),d.reject(Q))},w=()=>new Promise(Q=>{r=Y=>{(m()||y())&&Q(Y)},i.onPause?.()}).then(()=>{r=void 0,m()||i.onContinue?.()}),z=()=>{if(m())return;let Q;const Y=f===0?i.initialPromise:void 0;try{Q=Y??i.fn()}catch(F){Q=Promise.reject(F)}Promise.resolve(Q).then(j).catch(F=>{if(m())return;const yt=i.retry??(Jn.isServer()?0:3),ot=i.retryDelay??f0,zt=typeof ot=="function"?ot(f,F):ot,lt=yt===!0||typeof yt=="number"&&fy()?void 0:w()).then(()=>{c?E(F):z()})})};return{promise:d,status:()=>d.status,cancel:S,continue:()=>(r?.(),d),cancelRetry:A,continueRetry:v,canStart:M,start:()=>(M()?z():w().then(z),d)}}var Ih=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$s(this.gcTime)&&(this.#t=ca.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(i){this.gcTime=Math.max(this.gcTime||0,i??(Jn.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#t!==void 0&&(ca.clearTimeout(this.#t),this.#t=void 0)}};function r0(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 M=!1;const j=z=>{i0(z,()=>c.signal,()=>M=!0)},E=Jh(c.options,c.fetchOptions),w=async(z,Q,Y)=>{if(M)return Promise.reject(c.signal.reason);if(Q==null&&z.pages.length)return Promise.resolve(z);const yt=(()=>{const Nt={client:c.client,queryKey:c.queryKey,pageParam:Q,direction:Y?"backward":"forward",meta:c.options.meta};return j(Nt),Nt})(),ot=await E(yt),{maxPages:zt}=c.options,lt=Y?n0:a0;return{pages:lt(z.pages,ot,zt),pageParams:lt(z.pageParams,Q,zt)}};if(d&&m.length){const z=d==="backward",Q=z?o0:Ah,Y={pages:m,pageParams:S},F=Q(r,Y);A=await w(Y,F,z)}else{const z=i??m.length;do{const Q=v===0?S[0]??r.initialPageParam:Ah(r,A);if(v>0&&Q==null)break;A=await w(A,Q),v++}while(vc.options.persister?.(y,{client:c.client,queryKey:c.queryKey,meta:c.options.meta,signal:c.signal},f):c.fetchFn=y}}}function Ah(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 o0(i,{pages:c,pageParams:f}){return c.length>0?i.getPreviousPageParam?.(c[0],c,f[0],f):void 0}var d0=class extends Ih{#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=zh(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=zh(this.options);c.data!==void 0&&(this.setState(Ch(c.data,c.dataUpdatedAt)),this.#e=c)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(i,c){const f=Ps(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(ve).catch(ve):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=>Me(i.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===sf||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(i=>Yl(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:!kh(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),M=(()=>{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,M,this):v(M)},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"?r0(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=Wh({initialPromise:c?.initialPromise,fn:S.fetchFn,onCancel:v=>{v instanceof ef&&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 ef){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,...Ph(f.data,this.options),fetchMeta:i.meta??null};case"success":const r={...f,...Ch(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),ee.batch(()=>{this.observers.forEach(f=>{f.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:i})})}};function Ph(i,c){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$h(c.networkMode)?"fetching":"paused",...i===void 0&&{error:null,status:"pending"}}}function Ch(i,c){return{data:i,dataUpdatedAt:c??Date.now(),error:null,isInvalidated:!1,status:"success"}}function zh(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 h0=class extends Pn{constructor(i,c){super(),this.options=c,this.#t=i,this.#u=null,this.#c=tf(),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),_h(this.#e,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return lf(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return lf(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 Me(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&&!Ws(this.options,c)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Dh(this.#e,f,this.options,c)&&this.#h(),this.updateResult(),r&&(this.#e!==f||Me(this.options.enabled,this.#e)!==Me(c.enabled,this.#e)||Yl(this.options.staleTime,this.#e)!==Yl(c.staleTime,this.#e))&&this.#v();const d=this.#p();r&&(this.#e!==f||Me(this.options.enabled,this.#e)!==Me(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 y0(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(ve)),c}#v(){this.#S();const i=Yl(this.options.staleTime,this.#e);if(Jn.isServer()||this.#a.isStale||!$s(i))return;const f=kh(this.#a.dataUpdatedAt,i)+1;this.#o=ca.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,!(Jn.isServer()||Me(this.options.enabled,this.#e)===!1||!$s(this.#f)||this.#f===0)&&(this.#d=ca.setInterval(()=>{(this.options.refetchIntervalInBackground||uf.isFocused())&&this.#h()},this.#f))}#b(){this.#v(),this.#g(this.#p())}#S(){this.#o!==void 0&&(ca.clearTimeout(this.#o),this.#o=void 0)}#x(){this.#d!==void 0&&(ca.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 M={...y},j=!1,E;if(c._optimisticResults){const gt=this.hasListeners(),wt=!gt&&_h(i,c),ue=gt&&Dh(i,f,c,r);(wt||ue)&&(M={...M,...Ph(y.data,i.options)}),c._optimisticResults==="isRestoring"&&(M.fetchStatus="idle")}let{error:w,errorUpdatedAt:z,status:Q}=M;E=M.data;let Y=!1;if(c.placeholderData!==void 0&&E===void 0&&Q==="pending"){let gt;d?.isPlaceholderData&&c.placeholderData===S?.placeholderData?(gt=d.data,Y=!0):gt=typeof c.placeholderData=="function"?c.placeholderData(this.#m?.state.data,this.#m):c.placeholderData,gt!==void 0&&(Q="success",E=Ps(d?.data,gt,c),j=!0)}if(c.select&&E!==void 0&&!Y)if(d&&E===m?.data&&c.select===this.#r)E=this.#s;else try{this.#r=c.select,E=c.select(E),E=Ps(d?.data,E,c),this.#s=E,this.#u=null}catch(gt){this.#u=gt}this.#u&&(w=this.#u,E=this.#s,z=Date.now(),Q="error");const F=M.fetchStatus==="fetching",yt=Q==="pending",ot=Q==="error",zt=yt&&F,lt=E!==void 0,$={status:Q,fetchStatus:M.fetchStatus,isPending:yt,isSuccess:Q==="success",isError:ot,isInitialLoading:zt,isLoading:zt,data:E,dataUpdatedAt:M.dataUpdatedAt,error:w,errorUpdatedAt:z,failureCount:M.fetchFailureCount,failureReason:M.fetchFailureReason,errorUpdateCount:M.errorUpdateCount,isFetched:i.isFetched(),isFetchedAfterMount:M.dataUpdateCount>v.dataUpdateCount||M.errorUpdateCount>v.errorUpdateCount,isFetching:F,isRefetching:F&&!yt,isLoadingError:ot&&!lt,isPaused:M.fetchStatus==="paused",isPlaceholderData:j,isRefetchError:ot&<,isStale:ff(i,c),refetch:this.refetch,promise:this.#c,isEnabled:Me(c.enabled,i)!==!1};if(this.options.experimental_prefetchInRender){const gt=$.data!==void 0,wt=$.status==="error"&&!gt,ue=ce=>{wt?ce.reject($.error):gt&&ce.resolve($.data)},le=()=>{const ce=this.#c=$.promise=tf();ue(ce)},Dt=this.#c;switch(Dt.status){case"pending":i.queryHash===f.queryHash&&ue(Dt);break;case"fulfilled":(wt||$.data!==Dt.value)&&le();break;case"rejected":(!wt||$.error!==Dt.reason)&&le();break}}return $}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),Ws(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){ee.batch(()=>{i.listeners&&this.listeners.forEach(c=>{c(this.#a)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function m0(i,c){return Me(c.enabled,i)!==!1&&i.state.data===void 0&&!(i.state.status==="error"&&Me(c.retryOnMount,i)===!1)}function _h(i,c){return m0(i,c)||i.state.data!==void 0&&lf(i,c,c.refetchOnMount)}function lf(i,c,f){if(Me(c.enabled,i)!==!1&&Yl(c.staleTime,i)!=="static"){const r=typeof f=="function"?f(i):f;return r==="always"||r!==!1&&ff(i,c)}return!1}function Dh(i,c,f,r){return(i!==c||Me(r.enabled,i)===!1)&&(!f.suspense||i.state.status!=="error")&&ff(i,f)}function ff(i,c){return Me(c.enabled,i)!==!1&&i.isStaleByTime(Yl(c.staleTime,i))}function y0(i,c){return!Ws(i.getCurrentResult(),c)}var v0=class extends Ih{#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||p0(),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=Wh({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),ee.batch(()=>{this.#e.forEach(f=>{f.onMutationUpdate(i)}),this.#l.notify({mutation:this,type:"updated",action:i})})}};function p0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var g0=class extends Pn{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 v0({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=Su(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=Su(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=Su(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=Su(i);return typeof c=="string"?this.#e.get(c)?.find(r=>r!==i&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ee.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=>Nh(c,f))}findAll(i={}){return this.getAll().filter(c=>Nh(i,c))}notify(i){ee.batch(()=>{this.listeners.forEach(c=>{c(i)})})}resumePausedMutations(){const i=this.getAll().filter(c=>c.state.isPaused);return ee.batch(()=>Promise.all(i.map(c=>c.continue().catch(ve))))}};function Su(i){return i.options.scope?.id}var b0=class extends Pn{constructor(i={}){super(),this.config=i,this.#t=new Map}#t;build(i,c,f){const r=c.queryKey,d=c.queryHash??cf(r,c);let m=this.get(d);return m||(m=new d0({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(){ee.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){ee.batch(()=>{this.listeners.forEach(c=>{c(i)})})}onFocus(){ee.batch(()=>{this.getAll().forEach(i=>{i.onFocus()})})}onOnline(){ee.batch(()=>{this.getAll().forEach(i=>{i.onOnline()})})}},S0=class{#t;#e;#l;#a;#i;#n;#c;#u;constructor(i={}){this.#t=i.queryCache||new b0,this.#e=i.mutationCache||new g0,this.#l=i.defaultOptions||{},this.#a=new Map,this.#i=new Map,this.#n=0}mount(){this.#n++,this.#n===1&&(this.#c=uf.subscribe(async i=>{i&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#u=Nu.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(Yl(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=t0(c,m);if(S!==void 0)return this.#t.build(this,r).setData(S,{...f,manual:!0})}setQueriesData(i,c,f){return ee.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;ee.batch(()=>{c.findAll(i).forEach(f=>{c.remove(f)})})}resetQueries(i,c){const f=this.#t;return ee.batch(()=>(f.findAll(i).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...i},c)))}cancelQueries(i,c={}){const f={revert:!0,...c},r=ee.batch(()=>this.#t.findAll(i).map(d=>d.cancel(f)));return Promise.all(r).then(ve).catch(ve)}invalidateQueries(i,c={}){return ee.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=ee.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(ve)),d.state.fetchStatus==="paused"?Promise.resolve():m}));return Promise.all(r).then(ve)}fetchQuery(i){const c=this.defaultQueryOptions(i);c.retry===void 0&&(c.retry=!1);const f=this.#t.build(this,c);return f.isStaleByTime(Yl(c.staleTime,f))?f.fetch(c):Promise.resolve(f.state.data)}prefetchQuery(i){return this.fetchQuery(i).then(ve).catch(ve)}fetchInfiniteQuery(i){return i._type="infinite",this.fetchQuery(i)}prefetchInfiniteQuery(i){return this.fetchInfiniteQuery(i).then(ve).catch(ve)}ensureInfiniteQueryData(i){return i._type="infinite",this.ensureQueryData(i)}resumePausedMutations(){return Nu.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=>{Vn(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=>{Vn(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=cf(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===sf&&(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()}},tm=q.createContext(void 0),ti=i=>{const c=q.useContext(tm);if(!c)throw new Error("No QueryClient set, use QueryClientProvider to set one");return c},x0=({client:i,children:c})=>(q.useEffect(()=>(i.mount(),()=>{i.unmount()}),[i]),o.jsx(tm.Provider,{value:i,children:c})),em=q.createContext(!1),j0=()=>q.useContext(em);em.Provider;function E0(){let i=!1;return{clearReset:()=>{i=!1},reset:()=>{i=!0},isReset:()=>i}}var T0=q.createContext(E0()),N0=()=>q.useContext(T0),O0=(i,c,f)=>{const r=f?.state.error&&typeof i.throwOnError=="function"?Fh(i.throwOnError,[f.state.error,f]):i.throwOnError;(i.suspense||i.experimental_prefetchInRender||r)&&(c.isReset()||(i.retryOnMount=!1))},M0=i=>{q.useEffect(()=>{i.clearReset()},[i])},A0=({result:i,errorResetBoundary:c,throwOnError:f,query:r,suspense:d})=>i.isError&&!c.isReset()&&!i.isFetching&&r&&(d&&i.data===void 0||Fh(f,[i.error,r])),C0=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))}},z0=(i,c)=>i.isLoading&&i.isFetching&&!c,_0=(i,c)=>i?.suspense&&c.isPending,Rh=(i,c,f)=>c.fetchOptimistic(i).catch(()=>{f.clearReset()});function D0(i,c,f){const r=j0(),d=N0(),m=ti(),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,C0(S),O0(S,d,A),M0(d);const y=!m.getQueryCache().get(S.queryHash),[M]=q.useState(()=>new c(m,S)),j=M.getOptimisticResult(S),E=!r&&v;if(q.useSyncExternalStore(q.useCallback(w=>{const z=E?M.subscribe(ee.batchCalls(w)):ve;return M.updateResult(),z},[M,E]),()=>M.getCurrentResult(),()=>M.getCurrentResult()),q.useEffect(()=>{M.setOptions(S)},[S,M]),_0(S,j))throw Rh(S,M,d);if(A0({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&&!Jn.isServer()&&z0(j,r)&&(y?Rh(S,M,d):A?.promise)?.catch(ve).finally(()=>{M.updateResult()}),S.notifyOnChangeProps?j:M.trackResult(j)}function pe(i,c){return D0(i,h0)}function lm(){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&&lm(),!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 Ja(i,c){const f=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c||{})});if(f.status===401&&lm(),!f.ok)throw new Error(await f.text());return f.json()}function R0(){return pe({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})}const am=(...i)=>i.filter((c,f,r)=>!!c&&c.trim()!==""&&r.indexOf(c)===f).join(" ").trim();const U0=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const H0=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(c,f,r)=>r?r.toUpperCase():f.toLowerCase());const Uh=i=>{const c=H0(i);return c.charAt(0).toUpperCase()+c.slice(1)};var Vs={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const q0=i=>{for(const c in i)if(c.startsWith("aria-")||c==="role"||c==="title")return!0;return!1},w0=q.createContext({}),Q0=()=>q.useContext(w0),B0=q.forwardRef(({color:i,size:c,strokeWidth:f,absoluteStrokeWidth:r,className:d="",children:m,iconNode:S,...A},v)=>{const{size:y=24,strokeWidth:M=2,absoluteStrokeWidth:j=!1,color:E="currentColor",className:w=""}=Q0()??{},z=r??j?Number(f??M)*24/Number(c??y):f??M;return q.createElement("svg",{ref:v,...Vs,width:c??y??Vs.width,height:c??y??Vs.height,stroke:i??E,strokeWidth:z,className:am("lucide",w,d),...!m&&!q0(A)&&{"aria-hidden":"true"},...A},[...S.map(([Q,Y])=>q.createElement(Q,Y)),...Array.isArray(m)?m:[m]])});const Ct=(i,c)=>{const f=q.forwardRef(({className:r,...d},m)=>q.createElement(B0,{ref:m,iconNode:c,className:am(`lucide-${U0(Uh(i))}`,`lucide-${i}`,r),...d}));return f.displayName=Uh(i),f};const L0=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Y0=Ct("check",L0);const G0=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],X0=Ct("chevron-down",G0);const K0=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Z0=Ct("chevron-right",K0);const k0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],V0=Ct("clock",k0);const J0=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],F0=Ct("copy",J0);const $0=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],W0=Ct("download",$0);const I0=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],P0=Ct("ellipsis",I0);const tp=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ep=Ct("file-text",tp);const lp=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ap=Ct("folder",lp);const np=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],ip=Ct("globe",np);const up=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],cp=Ct("history",up);const sp=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],fp=Ct("link",sp);const rp=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],op=Ct("lock",rp);const dp=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],hp=Ct("log-out",dp);const mp=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],yp=Ct("menu",mp);const vp=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],pp=Ct("plus",vp);const gp=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],bp=Ct("search",gp);const Sp=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],xp=Ct("settings",Sp);const jp=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Ep=Ct("share-2",jp);const Tp=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Np=Ct("shield",Tp);const Op=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Mp=Ct("trash-2",Op);const Ap=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Cp=Ct("triangle-alert",Ap);const zp=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],_p=Ct("upload",zp);const Dp=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Rp=Ct("users",Dp);const Up=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Hp=Ct("x",Up);function qp(){document.body.classList.toggle("sb-open")}function sa(){document.body.classList.remove("sb-open")}const wp={alert:Cp,check:Y0,chev:Z0,chevd:X0,clock:V0,copy:F0,doc:ep,dots:P0,download:W0,folder:ap,gear:xp,globe:ip,hist:cp,link:fp,lock:op,menu:yp,plus:pp,power:hp,search:bp,share:Ep,shield:Np,trash:Mp,upload:_p,users:Rp,x:Hp};function Kt({name:i}){const c=wp[i];return c?o.jsx(c,{className:"ico","aria-hidden":"true"}):null}function Fn(i){return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:"sb-backdrop",onClick:sa}),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 Ou(i){const{name:c,onHome:f,showSignout:r}=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:d=>{f&&(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),f())},children:c}),o.jsx("div",{className:"vault-actions",children:r&&o.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:o.jsx(Kt,{name:"power"})})})]})}function $n(i){return o.jsxs("header",{id:"topbar",children:[o.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu",onClick:qp,children:o.jsx(Kt,{name:"menu"})}),o.jsx("span",{id:"crumb",children:i.crumb}),o.jsx("span",{id:"meta",children:i.meta}),i.actions]})}let rf={msg:"",err:!1,shown:!1},ju=[],Hh;function qh(i){rf=i,ju.forEach(c=>c())}function st(i,c=!1){qh({msg:i,err:c,shown:!0}),clearTimeout(Hh),Hh=setTimeout(()=>qh({...rf,shown:!1}),3200)}function Qp(){const i=q.useSyncExternalStore(c=>(ju.push(c),()=>{ju=ju.filter(f=>f!==c)}),()=>rf);return o.jsx("div",{id:"toast",className:i.shown?"show"+(i.err?" err":""):"",children:i.msg})}let nm=null,Eu=[];function of(i){nm=i,Eu.forEach(c=>c())}function im(i,c,f="",r="OK"){return new Promise(d=>of({kind:"prompt",title:i,label:c,value:f,okLabel:r,resolve:d}))}function xu(i,c,f="Confirm",r=!1){return new Promise(d=>of({kind:"confirm",title:i,message:c,confirmLabel:f,danger:r,resolve:d}))}function Bp(){const i=q.useSyncExternalStore(c=>(Eu.push(c),()=>{Eu=Eu.filter(f=>f!==c)}),()=>nm);return i?i.kind==="prompt"?o.jsx(Lp,{m:i}):o.jsx(Yp,{m:i}):null}function um(){of(null)}function Lp({m:i}){const c=q.useRef(null),f=d=>{um(),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 Yp({m:i}){const c=q.useRef(null),f=r=>{um(),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 Gp(i){return pe({queryKey:["projects"],queryFn:()=>Ae("/api/projects"),enabled:i,refetchInterval:3e4,select:c=>c.projects||[]})}function Xp(i){return pe({queryKey:["orgs"],queryFn:()=>Ae("/api/orgs"),enabled:i,select:c=>c.orgs||[]})}function cm(i){return pe({queryKey:["admin","pending"],queryFn:()=>Ae("/api/admin/pending"),enabled:i,select:c=>c.pending||[]})}function sm(){const i=ti();return()=>Promise.all([i.invalidateQueries({queryKey:["projects"]}),i.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function fm(i){return i.split("/").map(encodeURIComponent).join("/")}function wh(i){return i.split("/").map(decodeURIComponent).join("/")}const Kp=new Set(["insights","history"]);function rm(i,c){const f=i.replace(/^\/+/,"");if(c!=="hub")return{path:f?wh(f):""};const r=f.indexOf("/");if(r===-1)return{project:f,path:""};const d={project:f.slice(0,r),path:wh(f.slice(r+1))},m=d.path.indexOf("/"),S=m===-1?d.path:d.path.slice(0,m);return Kp.has(S)&&(d.view=S,d.viewTarget=m===-1?"":d.path.slice(m+1).replace(/\/+$/,""),d.path=""),d}function Zp(i,c){const f=fm(i);return c?"/"+c+(f?"/"+f:""):"/"+f}function Qh(i,c,f){let r=(c?"/"+c:"")+"/"+i;return i==="history"&&f&&(r+="/"+fm(f.replace(/\/+$/,""))),r}let df="POP";const af=new Set;function om(){for(const i of af)i()}window.addEventListener("popstate",()=>{df="POP",om()});function Je(i,c){const f=location.pathname+location.search;!c?.replace&&f===i||(history[c?.replace?"replaceState":"pushState"](null,"",i),df=c?.replace?"REPLACE":"PUSH",om())}function hf(){return q.useSyncExternalStore(i=>(af.add(i),()=>{af.delete(i)}),()=>location.pathname)}function kp(){return df}function Vp({to:i}){return q.useEffect(()=>{Je(i,{replace:!0})},[i]),null}const Jp=/\.(md|markdown)$/i,Fp=/\.(png|jpe?g|gif|svg|webp|ico|bmp|avif)$/i,$p=/\.html?$/i,Wp=/\.(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|css|xml|ini|conf|env|mod|sum|jsonl)$/i;function dm(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]}),M=()=>d.invalidateQueries({queryKey:["orgShares",i.id]}),{data:j}=pe({queryKey:["invites",i.id],queryFn:()=>Ae(`/api/orgs/${i.id}/invites`),enabled:m,select:z=>z.invites||[]}),{data:E}=pe({queryKey:["orgShares",i.id],queryFn:()=>Ae(`/api/orgs/${i.id}/shares`),enabled:m,select:z=>z.shares||[]}),w=c.filter(z=>z.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:z=>A(z.target.value)}),o.jsx("button",{className:"pbtn",id:"org-rename-btn",onClick:async()=>{try{await Ll("PATCH","/api/orgs/"+i.id,{name:S.trim()}),st("Renamed."),v()}catch(z){st(z.message,!0)}},children:"Rename org"})]}),o.jsx("h3",{children:"Members"}),o.jsx("div",{className:"admin-list",children:i.members.map(z=>{const Q=!!f&&z.email.toLowerCase()===f.toLowerCase();return o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:z.email+(Q?" (you)":"")}),m&&!Q?o.jsxs(o.Fragment,{children:[o.jsxs("select",{value:z.role,onChange:async Y=>{try{await Ll("PATCH",`/api/orgs/${i.id}/members/${encodeURIComponent(z.email)}`,{role:Y.target.value}),st("Role updated.")}catch(F){st(F.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 xu("Remove member",`Remove ${z.email} from ${i.name}?`,"Remove",!0))try{await Ll("DELETE",`/api/orgs/${i.id}/members/${encodeURIComponent(z.email)}`),st("Removed."),v()}catch(Y){st(Y.message,!0)}},children:"Remove"})]}):o.jsx("span",{className:"ai-tag",children:z.role})]},z.email)})}),m&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{children:"Projects"}),o.jsxs("div",{className:"admin-list",children:[w.length===0&&o.jsx("div",{className:"admin-empty",children:"No projects yet."}),w.map(z=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:z.name}),o.jsx("button",{className:"ai-btn",onClick:async()=>{const Q=await im("Rename project","New name",z.name,"Rename");if(!(!Q||Q===z.name))try{await Ll("PATCH","/api/projects/"+z.id,{name:Q}),st("Renamed."),await r()}catch(Y){st(Y.message,!0)}},children:"Rename"}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await xu("Delete project",`Delete “${z.name}”? Its files stay in storage, but it's removed from the hub.`,"Delete",!0))try{await Ll("DELETE","/api/projects/"+z.id),st(`Deleted “${z.name}”.`),await r()}catch(Q){st(Q.message,!0)}},children:"Delete"})]},z.id))]}),o.jsxs("div",{className:"admin-h",children:[o.jsx("h3",{children:"Invite links"}),o.jsx("button",{className:"pbtn",onClick:async()=>{try{const z=await Ja(`/api/orgs/${i.id}/invites`),Q=await Wn(z.url);st(Q?"Invite link copied to clipboard.":"Invite created — copy it from the list below."),y()}catch(z){st(z.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(z=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main mono",style:{cursor:"pointer"},title:"Copy",onClick:()=>Wn(z.url).then(Q=>st(Q?"Copied.":"Select and copy the link.")),children:z.url}),o.jsx("span",{className:"ai-tag",children:(z.creator?"by "+z.creator+" · ":"")+(z.uses?z.uses+" joined · ":"unused · ")+"expires "+new Date(z.expires).toLocaleDateString()}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await xu("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/${z.token}`),st("Revoked."),y()}catch(Q){st(Q.message,!0)}},children:"Revoke"})]},z.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(z=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main mono",style:{cursor:"pointer"},title:z.url,onClick:()=>window.open(z.url,"_blank"),children:z.path}),o.jsx("span",{className:"ai-tag",children:(z.project_name||"")+(z.creator?" · by "+z.creator:"")+(z.created?" · "+new Date(z.created).toLocaleDateString():"")}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await xu("Revoke share link",`Revoke the public link to “${z.path}”? Anyone with the URL will lose access.`,"Revoke",!0))try{await Ll("DELETE","/api/shares/"+z.token),st("Share revoked."),M()}catch(Q){st(Q.message,!0)}},children:"Revoke"})]},z.token))]})]})]})}function Pp(){const i=ti(),{data:c,error:f}=pe({queryKey:["admin","policy"],queryFn:()=>Ae("/api/admin/policy")}),{data:r}=cm(!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&&st(f.message,!0)},[f]),!c)return null;const v=async(y,M,j)=>{try{await Ja(`/api/admin/pending/${y}/${M}`),st((M==="approve"?"Approved ":"Denied ")+j),i.invalidateQueries({queryKey:["admin","pending"]})}catch(E){st(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(Bh,{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(Bh,{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 Ja("/api/admin/policy",{require_verification:d,require_approval:S}),st("Signup policy saved."),i.invalidateQueries({queryKey:["admin","policy"]})}catch(y){st(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 Bh({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 Lh=["#5b8def","#f5a623","#4cc38a","#e0679b","#8b7bf0","#3ec8c8","#e6934a"];function mm(i){let c=0;for(const f of i)c=c*31+f.charCodeAt(0)>>>0;return Lh[c%Lh.length]}function Yh({projects:i,currentId:c,onOpenSettings:f}){const r=sm(),d=async()=>{const m=await im("New project","Project name","","Create");if(m)try{const S=await Ja("/api/projects",{name:m});await r(),Je("/"+S.project.id),st(`Created “${S.project.name}”.`)}catch(S){st("Could not create the project: "+S.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:d,children:"+"})]}),o.jsxs("div",{className:"proj-row",children:[o.jsxs("span",{className:"proj-select-wrap",children:[c&&o.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:mm(i.find(m=>m.id===c)?.name||"")}}),o.jsxs("select",{id:"project-select","aria-label":"Switch project",value:c||"",onChange:m=>{m.target.value&&(Je("/"+m.target.value),sa())},children:[!c&&o.jsx("option",{value:"",disabled:!0}),i.map(m=>o.jsx("option",{value:m.id,children:m.name},m.id))]}),o.jsx(Kt,{name:"chevd"})]}),f&&o.jsx("button",{id:"project-settings-btn",className:"icon-btn2",title:"Project settings","aria-label":"Project settings",onClick:f,children:o.jsx(Kt,{name:"gear"})})]})]})}function tg({me:i,org:c,admin:f,onOrgSettings:r}){const[d,m]=q.useState(!1),S=q.useRef(null);q.useEffect(()=>{if(!d)return;const v=M=>{S.current&&!S.current.contains(M.target)&&m(!1)},y=M=>{M.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",v),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",y)}},[d]);const A=i.name||i.email;return o.jsxs("footer",{id:"accountbar",ref:S,children:[d&&o.jsxs("div",{id:"account-menu",role:"menu","aria-label":"Account menu",children:[c&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-sec",children:"Organization"}),o.jsxs("button",{id:"menu-org-settings",role:"menuitem",onClick:()=>{m(!1),r(c)},children:[o.jsx(Kt,{name:"gear"}),o.jsxs("span",{children:[o.jsx("b",{children:c.name})," Settings"]})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-sec",children:"Hub"}),o.jsxs("button",{id:"menu-hub-admin",role:"menuitem",onClick:()=>{m(!1),f.onClick()},children:[o.jsx(Kt,{name:"shield"}),o.jsxs("span",{children:["Signup & access",f.pending?` · ${f.pending}`:""]})]})]}),o.jsx("div",{className:"menu-sec",children:"Account"}),o.jsxs("a",{id:"signout",role:"menuitem",href:"/auth/logout",children:[o.jsx(Kt,{name:"power"}),o.jsx("span",{children:"Log out"})]})]}),o.jsxs("button",{id:"account-btn","aria-haspopup":"menu","aria-expanded":d,onClick:()=>m(v=>!v),children:[o.jsx("span",{className:"avatar",style:{background:mm(i.email)},"aria-hidden":"true",children:(A.trim()[0]||"?").toUpperCase()}),o.jsxs("span",{className:"acct",children:[o.jsx("b",{children:A}),i.name&&o.jsx("small",{children:i.email})]}),o.jsx(Kt,{name:"chev"})]})]})}const Js=[{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 eg(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 P=Object.prototype.hasOwnProperty,rt=i.unstable_scheduleCallback,xt=i.unstable_cancelCallback,Fa=i.unstable_shouldYield,Au=i.unstable_requestPaint,ne=i.unstable_now,bm=i.unstable_getCurrentPriorityLevel,mf=i.unstable_ImmediatePriority,yf=i.unstable_UserBlockingPriority,ai=i.unstable_NormalPriority,Sm=i.unstable_LowPriority,vf=i.unstable_IdlePriority,xm=i.log,jm=i.unstable_setDisableYieldValue,$a=null,ge=null;function yl(t){if(typeof xm=="function"&&jm(t),ge&&typeof ge.setStrictMode=="function")try{ge.setStrictMode($a,t)}catch{}}var be=Math.clz32?Math.clz32:Om,Em=Math.log,Tm=Math.LN2;function Om(t){return t>>>=0,t===0?32:31-(Em(t)/Tm|0)|0}var ni=256,ii=262144,ui=4194304;function Xl(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 ci(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=Xl(a):(s&=h,s!==0?n=Xl(s):l||(l=h&~t,l!==0&&(n=Xl(l))))):(h=a&~u,h!==0?n=Xl(h):s!==0?n=Xl(s):l||(l=a&~t,l!==0&&(n=Xl(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 Wa(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function Nm(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=ui;return ui<<=1,(ui&62914560)===0&&(ui=4194304),t}function Cu(t){for(var e=[],l=0;31>l;l++)e.push(t);return e}function Ia(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Mm(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,v=t.expirationTimes,O=t.hiddenUpdates;for(l=s&~l;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Rm=/[\n"\\]/g;function _e(t){return t.replace(Rm,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Hu(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=""+ze(e)):t.value!==""+ze(e)&&(t.value=""+ze(e)):s!=="submit"&&s!=="reset"||t.removeAttribute("value"),e!=null?qu(t,s,ze(e)):l!=null?qu(t,s,ze(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=""+ze(h):t.removeAttribute("name")}function zf(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)){Uu(t);return}l=l!=null?""+ze(l):"",e=e!=null?""+ze(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),Uu(t)}function qu(t,e,l){e==="number"&&ri(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function ma(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"),Yu=!1;if(We)try{var ln={};Object.defineProperty(ln,"passive",{get:function(){Yu=!0}}),window.addEventListener("test",ln,ln),window.removeEventListener("test",ln,ln)}catch{Yu=!1}var pl=null,Gu=null,di=null;function wf(){if(di)return di;var t,e=Gu,l=e.length,a,n="value"in pl?pl.value:pl.textContent,u=n.length;for(t=0;t=un),Xf=" ",Kf=!1;function Zf(t,e){switch(t){case"keyup":return cy.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ga=!1;function fy(t,e){switch(t){case"compositionend":return kf(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 ry(t,e){if(ga)return t==="compositionend"||!Vu&&Zf(t,e)?(t=wf(),di=Gu=pl=null,ga=!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=ri(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=ri(t.document)}return e}function $u(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 gy=We&&"documentMode"in document&&11>=document.documentMode,ba=null,Wu=null,rn=null,Iu=!1;function nr(t,e,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Iu||ba==null||ba!==ri(a)||(a=ba,"selectionStart"in a&&$u(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}),rn&&fn(rn,a)||(rn=a,a=iu(Wu,"onSelect"),0>=s,n-=s,Ke=1<<32-be(e)+n|l<tt?(ut=K,K=null):ut=K.sibling;var mt=N(j,K,T[tt],R);if(mt===null){K===null&&(K=ut);break}t&&K&&mt.alternate===null&&e(j,K),b=u(mt,b,tt),ht===null?Z=mt:ht.sibling=mt,ht=mt,K=ut}if(tt===T.length)return l(j,K),ct&&Pe(j,tt),Z;if(K===null){for(;tttt?(ut=K,K=null):ut=K.sibling;var Bl=N(j,K,mt.value,R);if(Bl===null){K===null&&(K=ut);break}t&&K&&Bl.alternate===null&&e(j,K),b=u(Bl,b,tt),ht===null?Z=Bl:ht.sibling=Bl,ht=Bl,K=ut}if(mt.done)return l(j,K),ct&&Pe(j,tt),Z;if(K===null){for(;!mt.done;tt++,mt=T.next())mt=U(j,mt.value,R),mt!==null&&(b=u(mt,b,tt),ht===null?Z=mt:ht.sibling=mt,ht=mt);return ct&&Pe(j,tt),Z}for(K=a(K);!mt.done;tt++,mt=T.next())mt=C(K,j,tt,mt.value,R),mt!==null&&(t&&mt.alternate!==null&&K.delete(mt.key===null?tt:mt.key),b=u(mt,b,tt),ht===null?Z=mt:ht.sibling=mt,ht=mt);return t&&K.forEach(function(Qv){return e(j,Qv)}),ct&&Pe(j,tt),Z}function Tt(j,b,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 Z=T.key;b!==null;){if(b.key===Z){if(Z=T.type,Z===w){if(b.tag===7){l(j,b.sibling),R=n(b,T.props.children),R.return=j,j=R;break t}}else if(b.elementType===Z||typeof Z=="object"&&Z!==null&&Z.$$typeof===gt&&ta(Z)===b.type){l(j,b.sibling),R=n(b,T.props),vn(R,T),R.return=j,j=R;break t}l(j,b);break}else e(j,b);b=b.sibling}T.type===w?(R=Fl(T.props.children,j.mode,R,T.key),R.return=j,j=R):(R=ji(T.type,T.key,T.props,null,j.mode,R),vn(R,T),R.return=j,j=R)}return s(j);case z:t:{for(Z=T.key;b!==null;){if(b.key===Z)if(b.tag===4&&b.stateNode.containerInfo===T.containerInfo&&b.stateNode.implementation===T.implementation){l(j,b.sibling),R=n(b,T.children||[]),R.return=j,j=R;break t}else{l(j,b);break}else e(j,b);b=b.sibling}R=ic(T,j.mode,R),R.return=j,j=R}return s(j);case gt:return T=ta(T),Tt(j,b,T,R)}if(kt(T))return X(j,b,T,R);if(Dt(T)){if(Z=Dt(T),typeof Z!="function")throw Error(r(150));return T=Z.call(T),J(j,b,T,R)}if(typeof T.then=="function")return Tt(j,b,Ci(T),R);if(T.$$typeof===ot)return Tt(j,b,Oi(j,T),R);zi(j,T)}return typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint"?(T=""+T,b!==null&&b.tag===6?(l(j,b.sibling),R=n(b,T),R.return=j,j=R):(l(j,b),R=nc(T,j.mode,R),R.return=j,j=R),s(j)):l(j,b)}return function(j,b,T,R){try{yn=0;var Z=Tt(j,b,T,R);return za=null,Z}catch(K){if(K===Ca||K===Mi)throw K;var ht=xe(29,K,null,j.mode);return ht.lanes=R,ht.return=j,ht}}}var la=Mr(!0),Ar=Mr(!1),jl=!1;function pc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gc(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 El(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Tl(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=xi(t),or(t,null,l),e}return Si(t,a,e,l),xi(t)}function pn(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 bc(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 Sc=!1;function gn(){if(Sc){var t=Aa;if(t!==null)throw t}}function bn(t,e,l,a){Sc=!1;var n=t.updateQueue;jl=!1;var u=n.firstBaseUpdate,s=n.lastBaseUpdate,h=n.shared.pending;if(h!==null){n.shared.pending=null;var v=h,O=v.next;v.next=null,s===null?u=O:s.next=O,s=v;var _=t.alternate;_!==null&&(_=_.updateQueue,h=_.lastBaseUpdate,h!==s&&(h===null?_.firstBaseUpdate=O:h.next=O,_.lastBaseUpdate=v))}if(u!==null){var U=n.baseState;s=0,_=O=v=null,h=u;do{var N=h.lane&-536870913,C=N!==h.lane;if(C?(it&N)===N:(a&N)===N){N!==0&&N===Ma&&(Sc=!0),_!==null&&(_=_.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});t:{var X=t,J=h;N=e;var Tt=l;switch(J.tag){case 1:if(X=J.payload,typeof X=="function"){U=X.call(Tt,U,N);break t}U=X;break t;case 3:X.flags=X.flags&-65537|128;case 0:if(X=J.payload,N=typeof X=="function"?X.call(Tt,U,N):X,N==null)break t;U=E({},U,N);break t;case 2:jl=!0}}N=h.callback,N!==null&&(t.flags|=64,C&&(t.flags|=8192),C=n.callbacks,C===null?n.callbacks=[N]:C.push(N))}else C={lane:N,tag:h.tag,payload:h.payload,callback:h.callback,next:null},_===null?(O=_=C,v=U):_=_.next=C,s|=N;if(h=h.next,h===null){if(h=n.shared.pending,h===null)break;C=h,h=C.next,C.next=null,n.lastBaseUpdate=C,n.shared.pending=null}}while(!0);_===null&&(v=U),n.baseState=v,n.firstBaseUpdate=O,n.lastBaseUpdate=_,u===null&&(n.shared.lanes=0),Cl|=s,t.lanes=s,t.memoizedState=U}}function Cr(t,e){if(typeof t!="function")throw Error(r(191,t));t.call(e)}function zr(t,e){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;tu?u:8;var s=D.T,h={};D.T=h,Bc(t,!1,e,l);try{var v=n(),O=D.S;if(O!==null&&O(h,v),v!==null&&typeof v=="object"&&typeof v.then=="function"){var _=My(v,a);jn(t,e,_,Ne(t))}else jn(t,e,a,Ne(t))}catch(U){jn(t,e,{then:function(){},status:"rejected",reason:U},Ne())}finally{B.p=u,s!==null&&h.types!==null&&(s.types=h.types),D.T=s}}function Ry(){}function wc(t,e,l,a){if(t.tag!==5)throw Error(r(476));var n=so(t).queue;co(t,n,e,k,l===null?Ry:function(){return fo(t),l(a)})}function so(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:k,baseState:k,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:k},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),jn(t,e.next.queue,{},Ne())}function Qc(){return It(Bn)}function ro(){return Bt().memoizedState}function oo(){return Bt().memoizedState}function Uy(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var l=Ne();t=El(l);var a=Tl(e,t,l);a!==null&&(ye(a,e,l),pn(a,e,l)),e={cache:hc()},t.payload=e;return}e=e.return}}function Hy(t,e,l){var a=Ne();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Li(t)?mo(e,l):(l=lc(t,e,l,a),l!==null&&(ye(l,t,a),yo(l,e,a)))}function ho(t,e,l){var a=Ne();jn(t,e,l,a)}function jn(t,e,l,a){var n={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Li(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,Se(h,s))return Si(t,e,n,0),Nt===null&&bi(),!1}catch{}if(l=lc(t,e,n,a),l!==null)return ye(l,t,a),yo(l,e,a),!0}return!1}function Bc(t,e,l,a){if(a={lane:2,revertLane:ps(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Li(t)){if(e)throw Error(r(479))}else e=lc(t,l,a,2),e!==null&&ye(e,t,2)}function Li(t){var e=t.alternate;return t===I||e!==null&&e===I}function mo(t,e){Da=Ri=!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 En={readContext:It,use:qi,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};En.useEffectEvent=Ht;var vo={readContext:It,use:qi,useCallback:function(t,e){return ie().memoizedState=[t,e===void 0?null:e],t},useContext:It,useEffect:Ir,useImperativeHandle:function(t,e,l){l=l!=null?l.concat([t]):null,Qi(4194308,4,lo.bind(null,e,t),l)},useLayoutEffect:function(t,e){return Qi(4194308,4,t,e)},useInsertionEffect:function(t,e){Qi(4,2,t,e)},useMemo:function(t,e){var l=ie();e=e===void 0?null:e;var a=t();if(aa){yl(!0);try{t()}finally{yl(!1)}}return l.memoizedState=[a,e],a},useReducer:function(t,e,l){var a=ie();if(l!==void 0){var n=l(e);if(aa){yl(!0);try{l(e)}finally{yl(!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=Hy.bind(null,I,t),[a.memoizedState,t]},useRef:function(t){var e=ie();return t={current:t},e.memoizedState=t},useState:function(t){t=Dc(t);var e=t.queue,l=ho.bind(null,I,e);return e.dispatch=l,[t.memoizedState,l]},useDebugValue:Hc,useDeferredValue:function(t,e){var l=ie();return qc(l,t,e)},useTransition:function(){var t=Dc(!1);return t=co.bind(null,I,t.queue,!0,!1),ie().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,l){var a=I,n=ie();if(ct){if(l===void 0)throw Error(r(407));l=l()}else{if(l=e(),Nt===null)throw Error(r(349));(it&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,Ua(9,{destroy:void 0},wr.bind(null,a,u,l,e),null),l},useId:function(){var t=ie(),e=Nt.identifierPrefix;if(ct){var l=Ze,a=Ke;l=(a&~(1<<32-be(a)-1)).toString(32)+l,e="_"+e+"R_"+l,l=Ui++,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[$t]=e,u[fe]=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(te(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 At(e),Pc(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,Oa(e)){if(t=e.stateNode,l=e.memoizedProps,a=null,n=Wt,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}t[$t]=e,t=!!(t.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||Hd(t.nodeValue,l)),t||Sl(e,!0)}else t=uu(t).createTextNode(a),t[$t]=e,e.stateNode=t}return At(e),null;case 31:if(l=e.memoizedState,t===null||t.memoizedState!==null){if(a=Oa(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[$t]=e}else $l(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;At(e),t=!1}else l=fc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return e.flags&256?(Ee(e),e):(Ee(e),null);if((e.flags&128)!==0)throw Error(r(558))}return At(e),null;case 13:if(a=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(n=Oa(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[$t]=e}else $l(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;At(e),n=!1}else n=fc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),n=!0;if(!n)return e.flags&256?(Ee(e),e):(Ee(e),null)}return Ee(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),Zi(e,e.updateQueue),At(e),null);case 4:return Rt(),t===null&&xs(e.stateNode.containerInfo),At(e),null;case 10:return el(e.type),At(e),null;case 19:if(H(Qt),a=e.memoizedState,a===null)return At(e),null;if(n=(e.flags&128)!==0,u=a.rendering,u===null)if(n)On(a,!1);else{if(qt!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(u=Di(t),u!==null){for(e.flags|=128,On(a,!1),t=u.updateQueue,e.updateQueue=t,Zi(e,t),e.subtreeFlags=0,t=l,l=e.child;l!==null;)dr(l,t),l=l.sibling;return L(Qt,Qt.current&1|2),ct&&Pe(e,a.treeForkCount),e.child}t=t.sibling}a.tail!==null&&ne()>$i&&(e.flags|=128,n=!0,On(a,!1),e.lanes=4194304)}else{if(!n)if(t=Di(u),t!==null){if(e.flags|=128,n=!0,t=t.updateQueue,e.updateQueue=t,Zi(e,t),On(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!ct)return At(e),null}else 2*ne()-a.renderingStartTime>$i&&l!==536870912&&(e.flags|=128,n=!0,On(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=ne(),t.sibling=null,l=Qt.current,L(Qt,n?l&1|2:l&1),ct&&Pe(e,a.treeForkCount),t):(At(e),null);case 22:case 23:return Ee(e),jc(),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&&(At(e),e.subtreeFlags&6&&(e.flags|=8192)):At(e),l=e.updateQueue,l!==null&&Zi(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(Pl),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),e.memoizedState.cache!==l&&(e.flags|=2048),el(Lt),At(e),null;case 25:return null;case 30:return null}throw Error(r(156,e.tag))}function Ly(t,e){switch(cc(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return el(Lt),Rt(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return hl(e),null;case 31:if(e.memoizedState!==null){if(Ee(e),e.alternate===null)throw Error(r(340));$l()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(Ee(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(r(340));$l()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return H(Qt),null;case 4:return Rt(),null;case 10:return el(e.type),null;case 22:case 23:return Ee(e),jc(),t!==null&&H(Pl),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return el(Lt),null;case 25:return null;default:return null}}function Lo(t,e){switch(cc(e),e.tag){case 3:el(Lt),Rt();break;case 26:case 27:case 5:hl(e);break;case 4:Rt();break;case 31:e.memoizedState!==null&&Ee(e);break;case 13:Ee(e);break;case 19:H(Qt);break;case 10:el(e.type);break;case 22:case 23:Ee(e),jc(),t!==null&&H(Pl);break;case 24:el(Lt)}}function Nn(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){St(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 v=l,O=h;try{O()}catch(_){St(n,v,_)}}}a=a.next}while(a!==u)}}catch(_){St(e,e.return,_)}}function Yo(t){var e=t.updateQueue;if(e!==null){var l=t.stateNode;try{zr(e,l)}catch(a){St(t,t.return,a)}}}function Go(t,e,l){l.props=na(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(a){St(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){St(t,e,n)}}function ke(t,e){var l=t.ref,a=t.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(n){St(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){St(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){St(t,t.return,n)}}function ts(t,e,l){try{var a=t.stateNode;sv(a,t.type,l,e),a[fe]=e}catch(n){St(t,t.return,n)}}function Ko(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ul(t.type)||t.tag===4}function es(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&&Ul(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 ls(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&&Ul(t.type)&&(l=t.stateNode,e=null),t=t.child,t!==null))for(ls(t,e,l),t=t.sibling;t!==null;)ls(t,e,l),t=t.sibling}function ki(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&&Ul(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(ki(t,e,l),t=t.sibling;t!==null;)ki(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]);te(e,a,l),e[$t]=t,e[fe]=l}catch(u){St(t,t.return,u)}}var ul=!1,Xt=!1,as=!1,ko=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function Yy(t,e){if(t=t.containerInfo,Ts=hu,t=ar(t),$u(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,v=-1,O=0,_=0,U=t,N=null;e:for(;;){for(var C;U!==l||n!==0&&U.nodeType!==3||(h=s+n),U!==u||a!==0&&U.nodeType!==3||(v=s+a),U.nodeType===3&&(s+=U.nodeValue.length),(C=U.firstChild)!==null;)N=U,U=C;for(;;){if(U===t)break e;if(N===l&&++O===n&&(h=s),N===u&&++_===a&&(v=s),(C=U.nextSibling)!==null)break;U=N,N=U.parentNode}U=C}l=h===-1||v===-1?null:{start:h,end:v}}else l=null}l=l||{start:0,end:0}}else l=null;for(Os={focusedElem:t,selectionRange:l},hu=!1,Ft=e;Ft!==null;)if(e=Ft,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Ft=t;else for(;Ft!==null;){switch(e=Ft,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"))),te(u,a,l),u[$t]=t,Jt(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=J,J=s);var j=er(h,J),b=er(h,Tt);if(j&&b&&(C.rangeCount!==1||C.anchorNode!==j.node||C.anchorOffset!==j.offset||C.focusNode!==b.node||C.focusOffset!==b.offset)){var T=U.createRange();T.setStart(j.node,j.offset),C.removeAllRanges(),J>Tt?(C.addRange(T),C.extend(b.node,b.offset)):(T.setEnd(b.node,b.offset),C.addRange(T))}}}}for(U=[],C=h;C=C.parentNode;)C.nodeType===1&&U.push({element:C,left:C.scrollLeft,top:C.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;hl?32:l,D.T=null,l=rs,rs=null;var u=_l,s=ol;if(Zt=0,Ba=_l=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,Rn(0,!1),ge&&typeof ge.onPostCommitFiberRoot=="function")try{ge.onPostCommitFiberRoot($a,u)}catch{}return!0}finally{B.p=n,D.T=a,xd(t,e)}}function Ed(t,e,l){e=Re(l,e),e=Xc(t.stateNode,e,2),t=Tl(t,e,2),t!==null&&(Ia(t,2),Ve(t))}function St(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"&&(zl===null||!zl.has(a))){t=Re(l,t),l=To(2),a=Tl(e,l,2),a!==null&&(Oo(l,a,e,t),Ia(a,2),Ve(a));break}}e=e.return}}function ms(t,e,l){var a=t.pingCache;if(a===null){a=t.pingCache=new Ky;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)||(us=!0,n.add(l),t=Fy.bind(null,t,e,l),e.then(t,t))}function Fy(t,e,l){var a=t.pingCache;a!==null&&a.delete(e),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,Nt===t&&(it&l)===l&&(qt===4||qt===3&&(it&62914560)===it&&300>ne()-Fi?(pt&2)===0&&La(t,0):cs|=l,Qa===it&&(Qa=0)),Ve(t)}function Td(t,e){e===0&&(e=pf()),t=Jl(t,e),t!==null&&(Ia(t,e),Ve(t))}function $y(t){var e=t.memoizedState,l=0;e!==null&&(l=e.retryLane),Td(t,l)}function Wy(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 Iy(t,e){return rt(t,e)}var lu=null,Ga=null,ys=!1,au=!1,vs=!1,Rl=0;function Ve(t){t!==Ga&&t.next===null&&(Ga===null?lu=Ga=t:Ga=Ga.next=t),au=!0,ys||(ys=!0,tv())}function Rn(t,e){if(!vs&&au){vs=!0;do for(var l=!1,a=lu;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-be(42|t)+1)-1,u&=n&~(s&~h),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,Ad(a,u))}else u=it,u=ci(a,a===Nt?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Wa(a,u)||(l=!0,Ad(a,u));a=a.next}while(l);vs=!1}}function Py(){Od()}function Od(){au=ys=!1;var t=0;Rl!==0&&rv()&&(t=Rl);for(var e=ne(),l=null,a=lu;a!==null;){var n=a.next,u=Nd(a,e);u===0?(a.next=null,l===null?lu=n:l.next=n,n===null&&(Ga=l)):(l=a,(t!==0||(u&3)!==0)&&(au=!0)),a=n}Zt!==0&&Zt!==5||Rn(t),Rl!==0&&(Rl=0)}function Nd(t,e){for(var l=t.suspendedLanes,a=t.pingedLanes,n=t.expirationTimes,u=t.pendingLanes&-62914561;0h)break;var _=v.transferSize,U=v.initiatorType;_&&qd(U)&&(v=v.responseEnd,s+=_*(v"u"?null:document;function Jd(t,e,l){var a=Xa;if(a&&typeof e=="string"&&e){var n=_e(e);n='link[rel="'+t+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),Vd.has(n)||(Vd.add(n),t={rel:t,crossOrigin:l,href:e},a.querySelector(n)===null&&(e=a.createElement("link"),te(e,"link",t),Jt(e),a.head.appendChild(e)))}}function bv(t){dl.D(t),Jd("dns-prefetch",t,null)}function Sv(t,e){dl.C(t,e),Jd("preconnect",t,e)}function xv(t,e,l){dl.L(t,e,l);var a=Xa;if(a&&t&&e){var n='link[rel="preload"][as="'+_e(e)+'"]';e==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+_e(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+_e(l.imageSizes)+'"]')):n+='[href="'+_e(t)+'"]';var u=n;switch(e){case"style":u=Ka(t);break;case"script":u=Za(t)}Be.has(u)||(t=E({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),Be.set(u,t),a.querySelector(n)!==null||e==="style"&&a.querySelector(wn(u))||e==="script"&&a.querySelector(Qn(u))||(e=a.createElement("link"),te(e,"link",t),Jt(e),a.head.appendChild(e)))}}function jv(t,e){dl.m(t,e);var l=Xa;if(l&&t){var a=e&&typeof e.as=="string"?e.as:"script",n='link[rel="modulepreload"][as="'+_e(a)+'"][href="'+_e(t)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Za(t)}if(!Be.has(u)&&(t=E({rel:"modulepreload",href:t},e),Be.set(u,t),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Qn(u)))return}a=l.createElement("link"),te(a,"link",t),Jt(a),l.head.appendChild(a)}}}function Ev(t,e,l){dl.S(t,e,l);var a=Xa;if(a&&t){var n=da(a).hoistableStyles,u=Ka(t);e=e||"default";var s=n.get(u);if(!s){var h={loading:0,preload:null};if(s=a.querySelector(wn(u)))h.loading=5;else{t=E({rel:"stylesheet",href:t,"data-precedence":e},l),(l=Be.get(u))&&Ds(t,l);var v=s=a.createElement("link");Jt(v),te(v,"link",t),v._p=new Promise(function(O,_){v.onload=O,v.onerror=_}),v.addEventListener("load",function(){h.loading|=1}),v.addEventListener("error",function(){h.loading|=2}),h.loading|=4,su(s,e,a)}s={type:"stylesheet",instance:s,count:1,state:h},n.set(u,s)}}}function Tv(t,e){dl.X(t,e);var l=Xa;if(l&&t){var a=da(l).hoistableScripts,n=Za(t),u=a.get(n);u||(u=l.querySelector(Qn(n)),u||(t=E({src:t,async:!0},e),(e=Be.get(n))&&Rs(t,e),u=l.createElement("script"),Jt(u),te(u,"link",t),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function Ov(t,e){dl.M(t,e);var l=Xa;if(l&&t){var a=da(l).hoistableScripts,n=Za(t),u=a.get(n);u||(u=l.querySelector(Qn(n)),u||(t=E({src:t,async:!0,type:"module"},e),(e=Be.get(n))&&Rs(t,e),u=l.createElement("script"),Jt(u),te(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)?cu(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=Ka(l.href),l=da(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=Ka(l.href);var u=da(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(wn(t)))&&!u._p&&(s.instance=u,s.state.loading=5),Be.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},Be.set(t,l),u||Nv(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=Za(l),l=da(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 Ka(t){return'href="'+_e(t)+'"'}function wn(t){return'link[rel="stylesheet"]['+t+"]"}function $d(t){return E({},t,{"data-precedence":t.precedence,precedence:null})}function Nv(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}),te(e,"link",l),Jt(e),t.head.appendChild(e))}function Za(t){return'[src="'+_e(t)+'"]'}function Qn(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~="'+_e(l.href)+'"]');if(a)return e.instance=a,Jt(a),a;var n=E({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),Jt(a),te(a,"style",n),su(a,l.precedence,t),e.instance=a;case"stylesheet":n=Ka(l.href);var u=t.querySelector(wn(n));if(u)return e.state.loading|=4,e.instance=u,Jt(u),u;a=$d(l),(n=Be.get(n))&&Ds(a,n),u=(t.ownerDocument||t).createElement("link"),Jt(u);var s=u;return s._p=new Promise(function(h,v){s.onload=h,s.onerror=v}),te(u,"link",a),e.state.loading|=4,su(u,l.precedence,t),e.instance=u;case"script":return u=Za(l.src),(n=t.querySelector(Qn(u)))?(e.instance=n,Jt(n),n):(a=l,(n=Be.get(u))&&(a=E({},l),Rs(a,n)),t=t.ownerDocument||t,n=t.createElement("script"),Jt(n),te(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,su(a,l.precedence,t));return e.instance}function su(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 Mv(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 Av(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=Ka(a.href),u=e.querySelector(wn(n));if(u){e=u._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=ru.bind(t),e.then(t,t)),l.state.loading|=4,l.instance=u,Jt(u);return}u=e.ownerDocument||e,a=$d(a),(n=Be.get(n))&&Ds(a,n),u=u.createElement("link"),Jt(u);var s=u;s._p=new Promise(function(h,v){s.onload=h,s.onerror=v}),te(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=ru.bind(t),e.addEventListener("load",l),e.addEventListener("error",l))}}var Us=0;function Cv(t,e){return t.stylesheets&&t.count===0&&du(t,t.stylesheets),0Us?50:800)+e);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function ru(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)du(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var ou=null;function du(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,ou=new Map,e.forEach(zv,t),ou=null,ru.call(t))}function zv(t,e){if(!(e.state.loading&4)){var l=ou.get(t);if(l)var a=l.get(null);else{l=new Map,ou.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(),Xs.exports=kv(),Xs.exports}var Jv=Vv(),Pn=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(){}},Fv=class extends Pn{#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"}},uf=new Fv,$v={setTimeout:(i,c)=>setTimeout(i,c),clearTimeout:i=>clearTimeout(i),setInterval:(i,c)=>setInterval(i,c),clearInterval:i=>clearInterval(i)},Wv=class{#t=$v;#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)}},ca=new Wv;function Iv(i){setTimeout(i,0)}var Pv=typeof window>"u"||"Deno"in globalThis;function ve(){}function t0(i,c){return typeof i=="function"?i(c):i}function $s(i){return typeof i=="number"&&i>=0&&i!==1/0}function kh(i,c){return Math.max(i+(c||0)-Date.now(),0)}function Yl(i,c){return typeof i=="function"?i(c):i}function Me(i,c){return typeof i=="function"?i(c):i}function Th(i,c){const{type:f="all",exact:r,fetchStatus:d,predicate:m,queryKey:g,stale:A}=i;if(g){if(r){if(c.queryHash!==cf(g,c.options))return!1}else if(!Vn(c.queryKey,g))return!1}if(f!=="all"){const p=c.isActive();if(f==="active"&&!p||f==="inactive"&&p)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(!Vn(c.options.mutationKey,m))return!1}return!(r&&c.state.status!==r||d&&!d(c))}function cf(i,c){return(c?.queryKeyHashFn||kn)(i)}function kn(i){return JSON.stringify(i,(c,f)=>Is(f)?Object.keys(f).sort().reduce((r,d)=>(r[d]=f[d],r),{}):f)}function Vn(i,c){return i===c?!0:typeof i!=typeof c?!1:i&&c&&typeof i=="object"&&typeof c=="object"?Object.keys(c).every(f=>Vn(i[f],c[f])):!1}var e0=Object.prototype.hasOwnProperty;function Vh(i,c,f=0){if(i===c)return i;if(f>500)return c;const r=Nh(i)&&Nh(c);if(!r&&!(Is(i)&&Is(c)))return c;const m=(r?i:Object.keys(i)).length,g=r?c:Object.keys(c),A=g.length,p=r?new Array(A):{};let y=0;for(let M=0;M{ca.setTimeout(c,i)})}function Ps(i,c,f){return typeof f.structuralSharing=="function"?f.structuralSharing(i,c):f.structuralSharing!==!1?Vh(i,c):c}function a0(i,c,f=0){const r=[...i,c];return f&&r.length>f?r.slice(1):r}function n0(i,c,f=0){const r=[c,...i];return f&&r.length>f?r.slice(0,-1):r}var sf=Symbol();function Jh(i,c){return!i.queryFn&&c?.initialPromise?()=>c.initialPromise:!i.queryFn||i.queryFn===sf?()=>Promise.reject(new Error(`Missing queryFn: '${i.queryHash}'`)):i.queryFn}function Fh(i,c){return typeof i=="function"?i(...c):!!i}function i0(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 Jn=(()=>{let i=()=>Pv;return{isServer(){return i()},setIsServer(c){i=c}}})();function tf(){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 u0=Iv;function c0(){let i=[],c=0,f=A=>{A()},r=A=>{A()},d=u0;const m=A=>{c?i.push(A):d(()=>{f(A)})},g=()=>{const A=i;i=[],A.length&&d(()=>{r(()=>{A.forEach(p=>{f(p)})})})};return{batch:A=>{let p;c++;try{p=A()}finally{c--,c||g()}return p},batchCalls:A=>(...p)=>{m(()=>{A(...p)})},schedule:m,setNotifyFunction:A=>{f=A},setBatchNotifyFunction:A=>{r=A},setScheduler:A=>{d=A}}}var ee=c0(),s0=class extends Pn{#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}},Ou=new s0;function f0(i){return Math.min(1e3*2**i,3e4)}function $h(i){return(i??"online")==="online"?Ou.isOnline():!0}var ef=class extends Error{constructor(i){super("CancelledError"),this.revert=i?.revert,this.silent=i?.silent}};function Wh(i){let c=!1,f=0,r;const d=tf(),m=()=>d.status!=="pending",g=w=>{if(!m()){const Y=new ef(w);x(Y),i.onCancel?.(Y)}},A=()=>{c=!0},p=()=>{c=!1},y=()=>uf.isFocused()&&(i.networkMode==="always"||Ou.isOnline())&&i.canRun(),M=()=>$h(i.networkMode)&&i.canRun(),E=w=>{m()||(r?.(),d.resolve(w))},x=w=>{m()||(r?.(),d.reject(w))},q=()=>new Promise(w=>{r=Y=>{(m()||y())&&w(Y)},i.onPause?.()}).then(()=>{r=void 0,m()||i.onContinue?.()}),z=()=>{if(m())return;let w;const Y=f===0?i.initialPromise:void 0;try{w=Y??i.fn()}catch(F){w=Promise.reject(F)}Promise.resolve(w).then(E).catch(F=>{if(m())return;const yt=i.retry??(Jn.isServer()?0:3),ot=i.retryDelay??f0,zt=typeof ot=="function"?ot(f,F):ot,lt=yt===!0||typeof yt=="number"&&fy()?void 0:q()).then(()=>{c?x(F):z()})})};return{promise:d,status:()=>d.status,cancel:g,continue:()=>(r?.(),d),cancelRetry:A,continueRetry:p,canStart:M,start:()=>(M()?z():q().then(z),d)}}var Ih=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$s(this.gcTime)&&(this.#t=ca.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(i){this.gcTime=Math.max(this.gcTime||0,i??(Jn.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#t!==void 0&&(ca.clearTimeout(this.#t),this.#t=void 0)}};function r0(i){return{onFetch:(c,f)=>{const r=c.options,d=c.fetchOptions?.meta?.fetchMore?.direction,m=c.state.data?.pages||[],g=c.state.data?.pageParams||[];let A={pages:[],pageParams:[]},p=0;const y=async()=>{let M=!1;const E=z=>{i0(z,()=>c.signal,()=>M=!0)},x=Jh(c.options,c.fetchOptions),q=async(z,w,Y)=>{if(M)return Promise.reject(c.signal.reason);if(w==null&&z.pages.length)return Promise.resolve(z);const yt=(()=>{const Ot={client:c.client,queryKey:c.queryKey,pageParam:w,direction:Y?"backward":"forward",meta:c.options.meta};return E(Ot),Ot})(),ot=await x(yt),{maxPages:zt}=c.options,lt=Y?n0:a0;return{pages:lt(z.pages,ot,zt),pageParams:lt(z.pageParams,w,zt)}};if(d&&m.length){const z=d==="backward",w=z?o0:Ah,Y={pages:m,pageParams:g},F=w(r,Y);A=await q(Y,F,z)}else{const z=i??m.length;do{const w=p===0?g[0]??r.initialPageParam:Ah(r,A);if(p>0&&w==null)break;A=await q(A,w),p++}while(pc.options.persister?.(y,{client:c.client,queryKey:c.queryKey,meta:c.options.meta,signal:c.signal},f):c.fetchFn=y}}}function Ah(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 o0(i,{pages:c,pageParams:f}){return c.length>0?i.getPreviousPageParam?.(c[0],c,f[0],f):void 0}var d0=class extends Ih{#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=zh(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=zh(this.options);c.data!==void 0&&(this.setState(Ch(c.data,c.dataUpdatedAt)),this.#e=c)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(i,c){const f=Ps(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(ve).catch(ve):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=>Me(i.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===sf||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(i=>Yl(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:!kh(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 p=this.observers.find(y=>y.options.queryFn);p&&this.setOptions(p.options)}const f=new AbortController,r=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(this.#u=!0,f.signal)})},d=()=>{const p=Jh(this.options,c),M=(()=>{const E={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(E),E})();return this.#u=!1,this.options.persister?this.options.persister(p,M,this):p(M)},g=(()=>{const p={fetchOptions:c,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:d};return r(p),p})();(this.#t==="infinite"?r0(this.options.pages):this.options.behavior)?.onFetch(g,this),this.#l=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==g.fetchOptions?.meta)&&this.#s({type:"fetch",meta:g.fetchOptions?.meta}),this.#n=Wh({initialPromise:c?.initialPromise,fn:g.fetchFn,onCancel:p=>{p instanceof ef&&p.revert&&this.setState({...this.#l,fetchStatus:"idle"}),f.abort()},onFail:(p,y)=>{this.#s({type:"failed",failureCount:p,error:y})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:g.options.retry,retryDelay:g.options.retryDelay,networkMode:g.options.networkMode,canRun:()=>!0});try{const p=await this.#n.start();if(p===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(p),this.#a.config.onSuccess?.(p,this),this.#a.config.onSettled?.(p,this.state.error,this),p}catch(p){if(p instanceof ef){if(p.silent)return this.#n.promise;if(p.revert){if(this.state.data===void 0)throw p;return this.state.data}}throw this.#s({type:"error",error:p}),this.#a.config.onError?.(p,this),this.#a.config.onSettled?.(this.state.data,p,this),p}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,...Ph(f.data,this.options),fetchMeta:i.meta??null};case"success":const r={...f,...Ch(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),ee.batch(()=>{this.observers.forEach(f=>{f.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:i})})}};function Ph(i,c){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$h(c.networkMode)?"fetching":"paused",...i===void 0&&{error:null,status:"pending"}}}function Ch(i,c){return{data:i,dataUpdatedAt:c??Date.now(),error:null,isInvalidated:!1,status:"success"}}function zh(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 h0=class extends Pn{constructor(i,c){super(),this.options=c,this.#t=i,this.#u=null,this.#c=tf(),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),_h(this.#e,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return lf(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return lf(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 Me(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&&!Ws(this.options,c)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Dh(this.#e,f,this.options,c)&&this.#h(),this.updateResult(),r&&(this.#e!==f||Me(this.options.enabled,this.#e)!==Me(c.enabled,this.#e)||Yl(this.options.staleTime,this.#e)!==Yl(c.staleTime,this.#e))&&this.#v();const d=this.#p();r&&(this.#e!==f||Me(this.options.enabled,this.#e)!==Me(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 y0(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(ve)),c}#v(){this.#S();const i=Yl(this.options.staleTime,this.#e);if(Jn.isServer()||this.#a.isStale||!$s(i))return;const f=kh(this.#a.dataUpdatedAt,i)+1;this.#o=ca.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,!(Jn.isServer()||Me(this.options.enabled,this.#e)===!1||!$s(this.#f)||this.#f===0)&&(this.#d=ca.setInterval(()=>{(this.options.refetchIntervalInBackground||uf.isFocused())&&this.#h()},this.#f))}#b(){this.#v(),this.#g(this.#p())}#S(){this.#o!==void 0&&(ca.clearTimeout(this.#o),this.#o=void 0)}#x(){this.#d!==void 0&&(ca.clearInterval(this.#d),this.#d=void 0)}createResult(i,c){const f=this.#e,r=this.options,d=this.#a,m=this.#i,g=this.#n,p=i!==f?i.state:this.#l,{state:y}=i;let M={...y},E=!1,x;if(c._optimisticResults){const gt=this.hasListeners(),wt=!gt&&_h(i,c),ue=gt&&Dh(i,f,c,r);(wt||ue)&&(M={...M,...Ph(y.data,i.options)}),c._optimisticResults==="isRestoring"&&(M.fetchStatus="idle")}let{error:q,errorUpdatedAt:z,status:w}=M;x=M.data;let Y=!1;if(c.placeholderData!==void 0&&x===void 0&&w==="pending"){let gt;d?.isPlaceholderData&&c.placeholderData===g?.placeholderData?(gt=d.data,Y=!0):gt=typeof c.placeholderData=="function"?c.placeholderData(this.#m?.state.data,this.#m):c.placeholderData,gt!==void 0&&(w="success",x=Ps(d?.data,gt,c),E=!0)}if(c.select&&x!==void 0&&!Y)if(d&&x===m?.data&&c.select===this.#r)x=this.#s;else try{this.#r=c.select,x=c.select(x),x=Ps(d?.data,x,c),this.#s=x,this.#u=null}catch(gt){this.#u=gt}this.#u&&(q=this.#u,x=this.#s,z=Date.now(),w="error");const F=M.fetchStatus==="fetching",yt=w==="pending",ot=w==="error",zt=yt&&F,lt=x!==void 0,$={status:w,fetchStatus:M.fetchStatus,isPending:yt,isSuccess:w==="success",isError:ot,isInitialLoading:zt,isLoading:zt,data:x,dataUpdatedAt:M.dataUpdatedAt,error:q,errorUpdatedAt:z,failureCount:M.fetchFailureCount,failureReason:M.fetchFailureReason,errorUpdateCount:M.errorUpdateCount,isFetched:i.isFetched(),isFetchedAfterMount:M.dataUpdateCount>p.dataUpdateCount||M.errorUpdateCount>p.errorUpdateCount,isFetching:F,isRefetching:F&&!yt,isLoadingError:ot&&!lt,isPaused:M.fetchStatus==="paused",isPlaceholderData:E,isRefetchError:ot&<,isStale:ff(i,c),refetch:this.refetch,promise:this.#c,isEnabled:Me(c.enabled,i)!==!1};if(this.options.experimental_prefetchInRender){const gt=$.data!==void 0,wt=$.status==="error"&&!gt,ue=ce=>{wt?ce.reject($.error):gt&&ce.resolve($.data)},le=()=>{const ce=this.#c=$.promise=tf();ue(ce)},Dt=this.#c;switch(Dt.status){case"pending":i.queryHash===f.queryHash&&ue(Dt);break;case"fulfilled":(wt||$.data!==Dt.value)&&le();break;case"rejected":(!wt||$.error!==Dt.reason)&&le();break}}return $}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),Ws(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(g=>{const A=g;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){ee.batch(()=>{i.listeners&&this.listeners.forEach(c=>{c(this.#a)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function m0(i,c){return Me(c.enabled,i)!==!1&&i.state.data===void 0&&!(i.state.status==="error"&&Me(c.retryOnMount,i)===!1)}function _h(i,c){return m0(i,c)||i.state.data!==void 0&&lf(i,c,c.refetchOnMount)}function lf(i,c,f){if(Me(c.enabled,i)!==!1&&Yl(c.staleTime,i)!=="static"){const r=typeof f=="function"?f(i):f;return r==="always"||r!==!1&&ff(i,c)}return!1}function Dh(i,c,f,r){return(i!==c||Me(r.enabled,i)===!1)&&(!f.suspense||i.state.status!=="error")&&ff(i,f)}function ff(i,c){return Me(c.enabled,i)!==!1&&i.isStaleByTime(Yl(c.staleTime,i))}function y0(i,c){return!Ws(i.getCurrentResult(),c)}var v0=class extends Ih{#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||p0(),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=Wh({fn:()=>this.options.mutationFn?this.options.mutationFn(i,f):Promise.reject(new Error("No mutationFn found")),onFail:(m,g)=>{this.#i({type:"failed",failureCount:m,error:g})},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 g=await this.options.onMutate?.(i,f);g!==this.state.context&&this.#i({type:"pending",context:g,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(g){Promise.reject(g)}try{await this.options.onError?.(m,i,this.state.context,f)}catch(g){Promise.reject(g)}try{await this.#l.config.onSettled?.(void 0,m,this.state.variables,this.state.context,this,f)}catch(g){Promise.reject(g)}try{await this.options.onSettled?.(void 0,m,i,this.state.context,f)}catch(g){Promise.reject(g)}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),ee.batch(()=>{this.#e.forEach(f=>{f.onMutationUpdate(i)}),this.#l.notify({mutation:this,type:"updated",action:i})})}};function p0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var g0=class extends Pn{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 v0({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=Su(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=Su(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=Su(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=Su(i);return typeof c=="string"?this.#e.get(c)?.find(r=>r!==i&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ee.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){ee.batch(()=>{this.listeners.forEach(c=>{c(i)})})}resumePausedMutations(){const i=this.getAll().filter(c=>c.state.isPaused);return ee.batch(()=>Promise.all(i.map(c=>c.continue().catch(ve))))}};function Su(i){return i.options.scope?.id}var b0=class extends Pn{constructor(i={}){super(),this.config=i,this.#t=new Map}#t;build(i,c,f){const r=c.queryKey,d=c.queryHash??cf(r,c);let m=this.get(d);return m||(m=new d0({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(){ee.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){ee.batch(()=>{this.listeners.forEach(c=>{c(i)})})}onFocus(){ee.batch(()=>{this.getAll().forEach(i=>{i.onFocus()})})}onOnline(){ee.batch(()=>{this.getAll().forEach(i=>{i.onOnline()})})}},S0=class{#t;#e;#l;#a;#i;#n;#c;#u;constructor(i={}){this.#t=i.queryCache||new b0,this.#e=i.mutationCache||new g0,this.#l=i.defaultOptions||{},this.#a=new Map,this.#i=new Map,this.#n=0}mount(){this.#n++,this.#n===1&&(this.#c=uf.subscribe(async i=>{i&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#u=Ou.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(Yl(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,g=t0(c,m);if(g!==void 0)return this.#t.build(this,r).setData(g,{...f,manual:!0})}setQueriesData(i,c,f){return ee.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;ee.batch(()=>{c.findAll(i).forEach(f=>{c.remove(f)})})}resetQueries(i,c){const f=this.#t;return ee.batch(()=>(f.findAll(i).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...i},c)))}cancelQueries(i,c={}){const f={revert:!0,...c},r=ee.batch(()=>this.#t.findAll(i).map(d=>d.cancel(f)));return Promise.all(r).then(ve).catch(ve)}invalidateQueries(i,c={}){return ee.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=ee.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(ve)),d.state.fetchStatus==="paused"?Promise.resolve():m}));return Promise.all(r).then(ve)}fetchQuery(i){const c=this.defaultQueryOptions(i);c.retry===void 0&&(c.retry=!1);const f=this.#t.build(this,c);return f.isStaleByTime(Yl(c.staleTime,f))?f.fetch(c):Promise.resolve(f.state.data)}prefetchQuery(i){return this.fetchQuery(i).then(ve).catch(ve)}fetchInfiniteQuery(i){return i._type="infinite",this.fetchQuery(i)}prefetchInfiniteQuery(i){return this.fetchInfiniteQuery(i).then(ve).catch(ve)}ensureInfiniteQueryData(i){return i._type="infinite",this.ensureQueryData(i)}resumePausedMutations(){return Ou.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=>{Vn(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=>{Vn(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=cf(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===sf&&(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()}},tm=Q.createContext(void 0),ti=i=>{const c=Q.useContext(tm);if(!c)throw new Error("No QueryClient set, use QueryClientProvider to set one");return c},x0=({client:i,children:c})=>(Q.useEffect(()=>(i.mount(),()=>{i.unmount()}),[i]),o.jsx(tm.Provider,{value:i,children:c})),em=Q.createContext(!1),j0=()=>Q.useContext(em);em.Provider;function E0(){let i=!1;return{clearReset:()=>{i=!1},reset:()=>{i=!0},isReset:()=>i}}var T0=Q.createContext(E0()),O0=()=>Q.useContext(T0),N0=(i,c,f)=>{const r=f?.state.error&&typeof i.throwOnError=="function"?Fh(i.throwOnError,[f.state.error,f]):i.throwOnError;(i.suspense||i.experimental_prefetchInRender||r)&&(c.isReset()||(i.retryOnMount=!1))},M0=i=>{Q.useEffect(()=>{i.clearReset()},[i])},A0=({result:i,errorResetBoundary:c,throwOnError:f,query:r,suspense:d})=>i.isError&&!c.isReset()&&!i.isFetching&&r&&(d&&i.data===void 0||Fh(f,[i.error,r])),C0=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))}},z0=(i,c)=>i.isLoading&&i.isFetching&&!c,_0=(i,c)=>i?.suspense&&c.isPending,Rh=(i,c,f)=>c.fetchOptimistic(i).catch(()=>{f.clearReset()});function D0(i,c,f){const r=j0(),d=O0(),m=ti(),g=m.defaultQueryOptions(i);m.getDefaultOptions().queries?._experimental_beforeQuery?.(g);const A=m.getQueryCache().get(g.queryHash),p=i.subscribed!==!1;g._optimisticResults=r?"isRestoring":p?"optimistic":void 0,C0(g),N0(g,d,A),M0(d);const y=!m.getQueryCache().get(g.queryHash),[M]=Q.useState(()=>new c(m,g)),E=M.getOptimisticResult(g),x=!r&&p;if(Q.useSyncExternalStore(Q.useCallback(q=>{const z=x?M.subscribe(ee.batchCalls(q)):ve;return M.updateResult(),z},[M,x]),()=>M.getCurrentResult(),()=>M.getCurrentResult()),Q.useEffect(()=>{M.setOptions(g)},[g,M]),_0(g,E))throw Rh(g,M,d);if(A0({result:E,errorResetBoundary:d,throwOnError:g.throwOnError,query:A,suspense:g.suspense}))throw E.error;return m.getDefaultOptions().queries?._experimental_afterQuery?.(g,E),g.experimental_prefetchInRender&&!Jn.isServer()&&z0(E,r)&&(y?Rh(g,M,d):A?.promise)?.catch(ve).finally(()=>{M.updateResult()}),g.notifyOnChangeProps?E:M.trackResult(E)}function pe(i,c){return D0(i,h0)}function lm(){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&&lm(),!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 Ja(i,c){const f=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c||{})});if(f.status===401&&lm(),!f.ok)throw new Error(await f.text());return f.json()}function R0(){return pe({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})}const am=(...i)=>i.filter((c,f,r)=>!!c&&c.trim()!==""&&r.indexOf(c)===f).join(" ").trim();const U0=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const H0=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(c,f,r)=>r?r.toUpperCase():f.toLowerCase());const Uh=i=>{const c=H0(i);return c.charAt(0).toUpperCase()+c.slice(1)};var Vs={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const q0=i=>{for(const c in i)if(c.startsWith("aria-")||c==="role"||c==="title")return!0;return!1},w0=Q.createContext({}),Q0=()=>Q.useContext(w0),B0=Q.forwardRef(({color:i,size:c,strokeWidth:f,absoluteStrokeWidth:r,className:d="",children:m,iconNode:g,...A},p)=>{const{size:y=24,strokeWidth:M=2,absoluteStrokeWidth:E=!1,color:x="currentColor",className:q=""}=Q0()??{},z=r??E?Number(f??M)*24/Number(c??y):f??M;return Q.createElement("svg",{ref:p,...Vs,width:c??y??Vs.width,height:c??y??Vs.height,stroke:i??x,strokeWidth:z,className:am("lucide",q,d),...!m&&!q0(A)&&{"aria-hidden":"true"},...A},[...g.map(([w,Y])=>Q.createElement(w,Y)),...Array.isArray(m)?m:[m]])});const Ct=(i,c)=>{const f=Q.forwardRef(({className:r,...d},m)=>Q.createElement(B0,{ref:m,iconNode:c,className:am(`lucide-${U0(Uh(i))}`,`lucide-${i}`,r),...d}));return f.displayName=Uh(i),f};const L0=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Y0=Ct("check",L0);const G0=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],X0=Ct("chevron-down",G0);const K0=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Z0=Ct("chevron-right",K0);const k0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],V0=Ct("clock",k0);const J0=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],F0=Ct("copy",J0);const $0=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],W0=Ct("download",$0);const I0=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],P0=Ct("ellipsis",I0);const tp=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ep=Ct("file-text",tp);const lp=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ap=Ct("folder",lp);const np=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],ip=Ct("globe",np);const up=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],cp=Ct("history",up);const sp=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],fp=Ct("link",sp);const rp=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],op=Ct("lock",rp);const dp=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],hp=Ct("log-out",dp);const mp=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],yp=Ct("menu",mp);const vp=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],pp=Ct("plus",vp);const gp=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],bp=Ct("search",gp);const Sp=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],xp=Ct("settings",Sp);const jp=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Ep=Ct("share-2",jp);const Tp=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Op=Ct("shield",Tp);const Np=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Mp=Ct("trash-2",Np);const Ap=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Cp=Ct("triangle-alert",Ap);const zp=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],_p=Ct("upload",zp);const Dp=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Rp=Ct("users",Dp);const Up=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Hp=Ct("x",Up);function qp(){document.body.classList.toggle("sb-open")}function sa(){document.body.classList.remove("sb-open")}const wp={alert:Cp,check:Y0,chev:Z0,chevd:X0,clock:V0,copy:F0,doc:ep,dots:P0,download:W0,folder:ap,gear:xp,globe:ip,hist:cp,link:fp,lock:op,menu:yp,plus:pp,power:hp,search:bp,share:Ep,shield:Op,trash:Mp,upload:_p,users:Rp,x:Hp};function Kt({name:i}){const c=wp[i];return c?o.jsx(c,{className:"ico","aria-hidden":"true"}):null}function Fn(i){return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:"sb-backdrop",onClick:sa}),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}=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:d=>{f&&(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),f())},children:c}),o.jsx("div",{className:"vault-actions",children:r&&o.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:o.jsx(Kt,{name:"power"})})})]})}function $n(i){return o.jsxs("header",{id:"topbar",children:[o.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu",onClick:qp,children:o.jsx(Kt,{name:"menu"})}),o.jsx("span",{id:"crumb",children:i.crumb}),o.jsx("span",{id:"meta",children:i.meta}),i.actions]})}let rf={msg:"",err:!1,shown:!1},ju=[],Hh;function qh(i){rf=i,ju.forEach(c=>c())}function st(i,c=!1){qh({msg:i,err:c,shown:!0}),clearTimeout(Hh),Hh=setTimeout(()=>qh({...rf,shown:!1}),3200)}function Qp(){const i=Q.useSyncExternalStore(c=>(ju.push(c),()=>{ju=ju.filter(f=>f!==c)}),()=>rf);return o.jsx("div",{id:"toast",className:i.shown?"show"+(i.err?" err":""):"",children:i.msg})}let nm=null,Eu=[];function of(i){nm=i,Eu.forEach(c=>c())}function im(i,c,f="",r="OK"){return new Promise(d=>of({kind:"prompt",title:i,label:c,value:f,okLabel:r,resolve:d}))}function xu(i,c,f="Confirm",r=!1){return new Promise(d=>of({kind:"confirm",title:i,message:c,confirmLabel:f,danger:r,resolve:d}))}function Bp(){const i=Q.useSyncExternalStore(c=>(Eu.push(c),()=>{Eu=Eu.filter(f=>f!==c)}),()=>nm);return i?i.kind==="prompt"?o.jsx(Lp,{m:i}):o.jsx(Yp,{m:i}):null}function um(){of(null)}function Lp({m:i}){const c=Q.useRef(null),f=d=>{um(),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 Yp({m:i}){const c=Q.useRef(null),f=r=>{um(),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 Gp(i){return pe({queryKey:["projects"],queryFn:()=>Ae("/api/projects"),enabled:i,refetchInterval:3e4,select:c=>c.projects||[]})}function Xp(i){return pe({queryKey:["orgs"],queryFn:()=>Ae("/api/orgs"),enabled:i,select:c=>c.orgs||[]})}function cm(i){return pe({queryKey:["admin","pending"],queryFn:()=>Ae("/api/admin/pending"),enabled:i,select:c=>c.pending||[]})}function sm(){const i=ti();return()=>Promise.all([i.invalidateQueries({queryKey:["projects"]}),i.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function fm(i){return i.split("/").map(encodeURIComponent).join("/")}function wh(i){return i.split("/").map(decodeURIComponent).join("/")}const Kp=new Set(["insights","history"]);function rm(i,c){const f=i.replace(/^\/+/,"");if(c!=="hub")return{path:f?wh(f):""};const r=f.indexOf("/");if(r===-1)return{project:f,path:""};const d={project:f.slice(0,r),path:wh(f.slice(r+1))},m=d.path.indexOf("/"),g=m===-1?d.path:d.path.slice(0,m);return Kp.has(g)&&(d.view=g,d.viewTarget=m===-1?"":d.path.slice(m+1).replace(/\/+$/,""),d.path=""),d}function Zp(i,c){const f=fm(i);return c?"/"+c+(f?"/"+f:""):"/"+f}function Qh(i,c,f){let r=(c?"/"+c:"")+"/"+i;return f&&(r+="/"+fm(f.replace(/\/+$/,""))),r}let df="POP";const af=new Set;function om(){for(const i of af)i()}window.addEventListener("popstate",()=>{df="POP",om()});function Je(i,c){const f=location.pathname+location.search;!c?.replace&&f===i||(history[c?.replace?"replaceState":"pushState"](null,"",i),df=c?.replace?"REPLACE":"PUSH",om())}function hf(){return Q.useSyncExternalStore(i=>(af.add(i),()=>{af.delete(i)}),()=>location.pathname)}function kp(){return df}function Vp({to:i}){return Q.useEffect(()=>{Je(i,{replace:!0})},[i]),null}const Jp=/\.(md|markdown)$/i,Fp=/\.(png|jpe?g|gif|svg|webp|ico|bmp|avif)$/i,$p=/\.html?$/i,Wp=/\.(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|css|xml|ini|conf|env|mod|sum|jsonl)$/i;function dm(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]}),M=()=>d.invalidateQueries({queryKey:["orgShares",i.id]}),{data:E}=pe({queryKey:["invites",i.id],queryFn:()=>Ae(`/api/orgs/${i.id}/invites`),enabled:m,select:z=>z.invites||[]}),{data:x}=pe({queryKey:["orgShares",i.id],queryFn:()=>Ae(`/api/orgs/${i.id}/shares`),enabled:m,select:z=>z.shares||[]}),q=c.filter(z=>z.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:g,onChange:z=>A(z.target.value)}),o.jsx("button",{className:"pbtn",id:"org-rename-btn",onClick:async()=>{try{await Ll("PATCH","/api/orgs/"+i.id,{name:g.trim()}),st("Renamed."),p()}catch(z){st(z.message,!0)}},children:"Rename org"})]}),o.jsx("h3",{children:"Members"}),o.jsx("div",{className:"admin-list",children:i.members.map(z=>{const w=!!f&&z.email.toLowerCase()===f.toLowerCase();return o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:z.email+(w?" (you)":"")}),m&&!w?o.jsxs(o.Fragment,{children:[o.jsxs("select",{value:z.role,onChange:async Y=>{try{await Ll("PATCH",`/api/orgs/${i.id}/members/${encodeURIComponent(z.email)}`,{role:Y.target.value}),st("Role updated.")}catch(F){st(F.message,!0)}p()},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 xu("Remove member",`Remove ${z.email} from ${i.name}?`,"Remove",!0))try{await Ll("DELETE",`/api/orgs/${i.id}/members/${encodeURIComponent(z.email)}`),st("Removed."),p()}catch(Y){st(Y.message,!0)}},children:"Remove"})]}):o.jsx("span",{className:"ai-tag",children:z.role})]},z.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(z=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main",children:z.name}),o.jsx("button",{className:"ai-btn",onClick:async()=>{const w=await im("Rename project","New name",z.name,"Rename");if(!(!w||w===z.name))try{await Ll("PATCH","/api/projects/"+z.id,{name:w}),st("Renamed."),await r()}catch(Y){st(Y.message,!0)}},children:"Rename"}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await xu("Delete project",`Delete “${z.name}”? Its files stay in storage, but it's removed from the hub.`,"Delete",!0))try{await Ll("DELETE","/api/projects/"+z.id),st(`Deleted “${z.name}”.`),await r()}catch(w){st(w.message,!0)}},children:"Delete"})]},z.id))]}),o.jsxs("div",{className:"admin-h",children:[o.jsx("h3",{children:"Invite links"}),o.jsx("button",{className:"pbtn",onClick:async()=>{try{const z=await Ja(`/api/orgs/${i.id}/invites`),w=await Wn(z.url);st(w?"Invite link copied to clipboard.":"Invite created — copy it from the list below."),y()}catch(z){st(z.message,!0)}},children:"New invite"})]}),o.jsxs("div",{className:"admin-list",children:[E&&E.length===0&&o.jsx("div",{className:"admin-empty",children:"No active invite links."}),(E||[]).map(z=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main mono",style:{cursor:"pointer"},title:"Copy",onClick:()=>Wn(z.url).then(w=>st(w?"Copied.":"Select and copy the link.")),children:z.url}),o.jsx("span",{className:"ai-tag",children:(z.creator?"by "+z.creator+" · ":"")+(z.uses?z.uses+" joined · ":"unused · ")+"expires "+new Date(z.expires).toLocaleDateString()}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await xu("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/${z.token}`),st("Revoked."),y()}catch(w){st(w.message,!0)}},children:"Revoke"})]},z.token))]}),o.jsx("h3",{children:"Public share links"}),o.jsxs("div",{className:"admin-list",children:[x&&x.length===0&&o.jsx("div",{className:"admin-empty",children:"No public shares."}),(x||[]).map(z=>o.jsxs("div",{className:"admin-item",children:[o.jsx("span",{className:"ai-main mono",style:{cursor:"pointer"},title:z.url,onClick:()=>window.open(z.url,"_blank"),children:z.path}),o.jsx("span",{className:"ai-tag",children:(z.project_name||"")+(z.creator?" · by "+z.creator:"")+(z.created?" · "+new Date(z.created).toLocaleDateString():"")}),o.jsx("button",{className:"ai-del",onClick:async()=>{if(await xu("Revoke share link",`Revoke the public link to “${z.path}”? Anyone with the URL will lose access.`,"Revoke",!0))try{await Ll("DELETE","/api/shares/"+z.token),st("Share revoked."),M()}catch(w){st(w.message,!0)}},children:"Revoke"})]},z.token))]})]})]})}function Pp(){const i=ti(),{data:c,error:f}=pe({queryKey:["admin","policy"],queryFn:()=>Ae("/api/admin/policy")}),{data:r}=cm(!0),[d,m]=Q.useState(!1),[g,A]=Q.useState(!1);if(Q.useEffect(()=>{c&&(m(c.require_verification&&c.mailer),A(c.require_approval))},[c]),Q.useEffect(()=>{f&&st(f.message,!0)},[f]),!c)return null;const p=async(y,M,E)=>{try{await Ja(`/api/admin/pending/${y}/${M}`),st((M==="approve"?"Approved ":"Denied ")+E),i.invalidateQueries({queryKey:["admin","pending"]})}catch(x){st(x.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(Bh,{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(Bh,{label:"Require admin approval",desc:"New accounts wait for a hub admin to approve them before they gain access.",checked:g,onChange:A})]}),o.jsx("button",{className:"pbtn",style:{marginTop:14},onClick:async()=>{try{await Ja("/api/admin/policy",{require_verification:d,require_approval:g}),st("Signup policy saved."),i.invalidateQueries({queryKey:["admin","policy"]})}catch(y){st(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:()=>p(y.id,"approve",y.email),children:"Approve"}),o.jsx("button",{className:"ai-del",onClick:()=>p(y.id,"deny",y.email),children:"Deny"})]},y.id))]})]})}function Bh({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 Lh=["#5b8def","#f5a623","#4cc38a","#e0679b","#8b7bf0","#3ec8c8","#e6934a"];function mm(i){let c=0;for(const f of i)c=c*31+f.charCodeAt(0)>>>0;return Lh[c%Lh.length]}function Yh({projects:i,currentId:c,onOpenSettings:f}){const r=sm(),d=async()=>{const m=await im("New project","Project name","","Create");if(m)try{const g=await Ja("/api/projects",{name:m});await r(),Je("/"+g.project.id),st(`Created “${g.project.name}”.`)}catch(g){st("Could not create the project: "+g.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:d,children:"+"})]}),o.jsxs("div",{className:"proj-row",children:[o.jsxs("span",{className:"proj-select-wrap",children:[c&&o.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:mm(i.find(m=>m.id===c)?.name||"")}}),o.jsxs("select",{id:"project-select","aria-label":"Switch project",value:c||"",onChange:m=>{m.target.value&&(Je("/"+m.target.value),sa())},children:[!c&&o.jsx("option",{value:"",disabled:!0}),i.map(m=>o.jsx("option",{value:m.id,children:m.name},m.id))]}),o.jsx(Kt,{name:"chevd"})]}),f&&o.jsx("button",{id:"project-settings-btn",className:"icon-btn2",title:"Project settings","aria-label":"Project settings",onClick:f,children:o.jsx(Kt,{name:"gear"})})]})]})}function tg({me:i,org:c,admin:f,onOrgSettings:r}){const[d,m]=Q.useState(!1),g=Q.useRef(null);Q.useEffect(()=>{if(!d)return;const p=M=>{g.current&&!g.current.contains(M.target)&&m(!1)},y=M=>{M.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",y)}},[d]);const A=i.name||i.email;return o.jsxs("footer",{id:"accountbar",ref:g,children:[d&&o.jsxs("div",{id:"account-menu",role:"menu","aria-label":"Account menu",children:[c&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-sec",children:"Organization"}),o.jsxs("button",{id:"menu-org-settings",role:"menuitem",onClick:()=>{m(!1),r(c)},children:[o.jsx(Kt,{name:"gear"}),o.jsxs("span",{children:[o.jsx("b",{children:c.name})," Settings"]})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-sec",children:"Hub"}),o.jsxs("button",{id:"menu-hub-admin",role:"menuitem",onClick:()=>{m(!1),f.onClick()},children:[o.jsx(Kt,{name:"shield"}),o.jsxs("span",{children:["Signup & access",f.pending?` · ${f.pending}`:""]})]})]}),o.jsx("div",{className:"menu-sec",children:"Account"}),o.jsxs("a",{id:"signout",role:"menuitem",href:"/auth/logout",children:[o.jsx(Kt,{name:"power"}),o.jsx("span",{children:"Log out"})]})]}),o.jsxs("button",{id:"account-btn","aria-haspopup":"menu","aria-expanded":d,onClick:()=>m(p=>!p),children:[o.jsx("span",{className:"avatar",style:{background:mm(i.email)},"aria-hidden":"true",children:(A.trim()[0]||"?").toUpperCase()}),o.jsxs("span",{className:"acct",children:[o.jsx("b",{children:A}),i.name&&o.jsx("small",{children:i.email})]}),o.jsx(Kt,{name:"chev"})]})]})}const Js=[{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 eg(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 lg(){try{return localStorage.getItem("bdrive-guide-agent")||"claude"}catch{return"claude"}}function ym({project:i}){const[c,f]=q.useState(lg),r=Js.find(d=>d.key===c)||Js[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:Js.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:[eg(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(ag,{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 ag({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 Wn(i)?"Copied":"Copy failed"),setTimeout(()=>f("Copy"),1400)},children:c})]})}function ng({project:i,org:c}){return o.jsxs("div",{className:"project-settings",children:[o.jsx("h2",{children:i.name}),o.jsxs("dl",{className:"ps-facts",children:[o.jsx("dt",{children:"Project id"}),o.jsx("dd",{children:o.jsx("code",{children:i.id})}),c&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Workspace"}),o.jsx("dd",{children:c.name})]}),i.created&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Created"}),o.jsx("dd",{children:new Date(i.created).toLocaleDateString()})]})]}),o.jsx("h3",{children:"Connect a device"}),o.jsx(ym,{project:i})]})}function ig({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){st("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 ug(i,c=!0){const f=pe({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 cg(i,c){return pe({queryKey:["heat",i],queryFn:()=>Ae(i+"heat?days=30"),enabled:c,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function sg(i,c,f){return pe({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 In(i){return(i.human||0)+(i.agent||0)+(i.share||0)}function Tu(i){const c=In(i);if(!c)return"";let f=c+(c===1?" read":" reads");return i.agent&&(f+=" ("+i.agent+" agent)"),f}function fg(i){const c=In(i);return c?c<3?1:c<10?2:c<30?3:4:0}function rg(i){return o.jsx("nav",{id:"tree","aria-label":"Files",children:i.root&&o.jsx(vm,{nodes:i.root.children||[],...i})})}function vm({nodes:i,...c}){return o.jsx("ul",{children:i.map(f=>o.jsx(og,{node:f,...c},f.path))})}function og({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||sa()};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(Kt,{name:"chevd"})}),o.jsx("span",{className:"ticon",children:o.jsx(Kt,{name:i.dir?"folder":"doc"})}),o.jsx("span",{className:"label",children:i.name})]}),i.dir&&o.jsx(vm,{nodes:i.children||[],...c})]})}function dg(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 mg={add:"plus",edit:"edit",delete:"x"},yg={add:"added",edit:"edited",delete:"deleted"};function pm({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(Kt,{name:mg[d]||"dot"})}),o.jsx("span",{className:"hpath",children:i.path}),o.jsx("span",{className:"htag",children:yg[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?dm(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,M)=>/^https?:\/\//.test(y)?o.jsx("a",{href:y,target:"_blank",rel:"noopener",children:y},M):y)})]})}function vg(i){const{node:c,heatMap:f,onOpen:r}=i,d=(c.children||[]).slice().sort((y,M)=>Number(M.dir||!1)-Number(y.dir||!1)||y.name.localeCompare(M.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(Tu(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(Kt,{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 M="";if(y.dir){const E=(y.children||[]).length;M=E+(E===1?" item":" items")}else M=[y.size?dm(y.size):"",y.time?new Date(y.time).toLocaleDateString():""].filter(Boolean).join(" · ");const j=Gh(f,y.path,!!y.dir);return j&&(M=Tu(j)+(M?" · "+M:"")),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(Kt,{name:y.dir?"folder":"doc"})}),o.jsx("span",{className:"dl-name",children:y.name}),j&&o.jsx("span",{className:"heatdot lvl"+fg(j),title:Tu(j)+" in 30 days"}),o.jsx("span",{className:"dl-meta",children:M})]},y.path)})}),i.hub&&o.jsx(pg,{apiBase:i.apiBase,prefix:c.path+"/",onOpen:r,onFullHistory:()=>i.onFullHistory(c.path+"/"),onRendered:i.onRendered})]})}function pg(i){const c=sg(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(pm,{entry:r,onOpen:i.onOpen},d))}),o.jsx("button",{className:"ai-btn dl-more",onClick:i.onFullHistory,children:"Full history"})]})}function gg(i){const{apiBase:c,path:f,onMeta:r}=i,d=c+"file?path="+encodeURIComponent(f);return q.useEffect(()=>()=>r(""),[f,r]),Jp.test(f)?o.jsx(bg,{...i}):$p.test(f)?o.jsx("iframe",{className:"htmlview",sandbox:"allow-scripts",src:d,title:f,onLoad:i.onRendered}):Fp.test(f)?o.jsx(jg,{src:d,alt:f,onRendered:i.onRendered}):Wp.test(f)?o.jsx(Eg,{...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 bg(i){const{apiBase:c,path:f,heatMap:r,flatFiles:d,onOpenFile:m,onMeta:S,onRendered:A}=i,{data:v,error:y}=pe({queryKey:["render",c,f],queryFn:()=>Ae(c+"render?path="+encodeURIComponent(f))}),M=q.useMemo(()=>v?xg(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&&In(E)&&j.push(Tu(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:M},onClick:j=>Sg(j,f,d,m)}):null}function Sg(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(),Tg(decodeURIComponent(m.slice(5)),f,r)):/^([a-z]+:|\/|#)/i.test(m)||(i.preventDefault(),r(hm(S,decodeURIComponent(m))))}function xg(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(hm(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 jg({src:i,alt:c,onRendered:f}){return o.jsx("img",{src:i,alt:c,onLoad:f})}function Eg(i){const{path:c,fileURL:f,onRendered:r}=i,{data:d,error:m}=pe({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 Tg(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 Ng({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:()=>Wn(i).then(d=>st(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),st("Link revoked — it no longer works."),f()}catch(d){st(d.message,!0)}},children:"Revoke"}),o.jsx("button",{className:"ai-btn",onClick:f,children:"Done"})]})]})})}function Xh(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?Xh(d,c):null}function Mg({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 Ag({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 w=Og(r,E.label);w&&j.push({...E,score:w.score,hits:w.hits})}return j.sort((E,w)=>w.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 M=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 w=y.length;w&&S(z=>(z+(E.key==="ArrowDown"?1:w-1))%w)}else E.key==="Enter"&&(E.preventDefault(),y[m]&&M(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(Kt,{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:()=>M(j),onMouseMove:()=>m!==E&&S(E),children:[o.jsx("span",{className:"picon",children:o.jsx(Kt,{name:j.icon})}),o.jsx(Mg,{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 Zn=3,Va=30;function Cg(i,c){return pe({queryKey:["heatDevices",i],queryFn:()=>Ae(i+"heat?by=device&days=30"),enabled:c,retry:!1,staleTime:6e4}).data?.devices??null}function Kh(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]||{},M=v.time?Math.max(0,(S-new Date(v.time).getTime())/864e5):0,j=c==="all"?In(y):y[c]||0;return{path:v.path,reads:j,agent:y.agent||0,total:In(y),days:M,danger:j>=Zn&&M>=Va}});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(_g,{pts:A,onOpenFile:i.onOpenFile,onOpenFolder:i.onOpenFolder,isFolder:i.isFolder}),o.jsx("h3",{className:"dl-h3",children:"Reads × freshness"}),o.jsx(Dg,{pts:A,onOpenFile:i.onOpenFile}),o.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),o.jsx(Rg,{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(Ug,{devices:m})]})]})}function zg(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 Zh(i,c,f,r,d){const m=i.reduce((y,M)=>y+M.value,0);if(!m||r<=0||d<=0)return[];const S=i.slice().sort((y,M)=>M.value-y.value).map(y=>({it:y,a:y.value/m*r*d})),A=(y,M)=>{const E=y.reduce((z,Q)=>z+Q.a,0)/M;let w=0;for(const z of y){const Q=z.a/E;w=Math.max(w,Q/E,E/Q)}return w},v=[];for(;S.length;){const y=r>=d,M=y?d:r,j=[S.shift()];for(;S.length&&A(j.concat(S[0]),M)<=A(j,M);)j.push(S.shift());const E=j.reduce((z,Q)=>z+Q.a,0)/M;let w=0;for(const z of j){const Q=z.a/E;y?v.push({item:z.it,x:c,y:f+w,w:E,h:Q}):v.push({item:z.it,x:c+w,y:f,w:Q,h:E}),w+=Q}y?(c+=E,r-=E):(f+=E,d-=E)}return v}const Fs=15;function _g({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 M=S.get(y);M||S.set(y,M={name:y,files:[],value:0}),M.files.push(v),M.value+=v.reads+1}const A=[];for(const v of Zh([...S.values()],0,0,720,480)){const y=v.item,M=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":M},"g"+y.name)),v.w>46&&v.h>Fs+10){let E=y.name==="/"?"(root)":y.name;const w=Math.floor((v.w-8)/6);E.length>w&&(E=E.slice(0,Math.max(1,w-1))+"…"),A.push(o.jsx("text",{x:v.x+5,y:v.y+12,className:"in-tm-glabel","data-dir":M,children:E},"gl"+y.name))}const j=Zh(y.files.map(E=>({...E,name:E.path.split("/").pop(),value:E.reads+1})),v.x+2,v.y+Fs,Math.max(0,v.w-4),Math.max(0,v.h-Fs-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:zg(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 w=Math.floor((E.w-8)/6);let z=(E.item.danger?"⚠ ":"")+E.item.name;z.length>w&&(z=z.slice(0,Math.max(1,w-1))+"…"),w>=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:z},"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 M=y.getAttribute("data-path");if(M)return c(M);const j=y.getAttribute("data-dir");j&&r(j)&&f(j)},children:A})}function Dg({pts:i,onOpenFile:c}){const d={l:44,r:16,t:20,b:34},m=Math.max(Va*2,...i.map(j=>j.days)),S=Math.max(Zn*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),M=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(Va),y:d.t,width:720-d.r-y(Va),height:M(Zn)-d.t,className:"in-danger-zone"}),o.jsx("line",{x1:y(Va),y1:d.t,x2:y(Va),y2:360-d.b,className:"in-threshold"}),o.jsx("line",{x1:d.l,y1:M(Zn),x2:720-d.r,y2:M(Zn),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(M(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 Rg({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 Ug({devices:i}){const c=new Map;for(const E of i)for(const[w,z]of Object.entries(E.folders||{}))c.set(w,(c.get(w)||0)+z);const f=[...c.entries()].sort((E,w)=>w[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,M=Math.max(1,...r.flatMap(E=>f.map(w=>(E.folders||{})[w]||0))),j=E=>{const w=[23,25,31],z=[245,166,35],Q=w.map((Y,F)=>Math.round(Y+(z[F]-Y)*E));return`rgb(${Q[0]},${Q[1]},${Q[2]})`};return o.jsxs("svg",{viewBox:`0 0 ${v} ${y}`,className:"in-chart in-matrix",children:[r.map((E,w)=>{let z=E.name||E.id||"";return z.length>20&&(z=z.slice(0,19)+"…"),o.jsxs("g",{children:[o.jsx("text",{x:d-8,y:m+w*A+17,textAnchor:"end",className:"in-label",children:z}),f.map((Q,Y)=>{const F=(E.folders||{})[Q]||0;return o.jsx("rect",{x:d+Y*S,y:m+w*A,width:S-4,height:A-4,rx:3,fill:j(Math.sqrt(F/M)),children:o.jsx("title",{children:`${E.name||E.id} × ${Q||"(root)"}: ${F} read${F===1?"":"s"}/30d`})},Q)})]},E.id||w)}),f.map((E,w)=>{const z=d+w*S+(S-4)/2,Q=m+r.length*A+14;return o.jsx("text",{x:z,y:Q,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${z} ${Q})`,children:E||"(root)"},E)})]})}function Hg(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}=pe({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 M=v.entries||[];return o.jsxs("div",{className:"history",children:[M.length===0&&o.jsx("div",{className:"empty",children:"No history yet."}),M.map((j,E)=>o.jsx(pm,{entry:j,onOpen:i.onOpen},E))]})}function qg(i,c){return i?c(i)?i+"/ (folder)":i:"all changes"}function gm(i){const{config:c,apiBase:f,route:r,hub:d,project:m}=i,S=hf(),A=ti(),{tree:v,flatFiles:y,dirIndex:M,loaded:j}=ug(f,!d||!!m),E=cg(f,d&&!!m&&!!c.reads?.enabled),w=d&&!!m&&!r.path&&!r.view,z=!!i.canInsights&&(r.view==="insights"||w),Q=Cg(f,z);q.useEffect(()=>{z&&A.invalidateQueries({queryKey:["heat",f]})},[z,f,A]);const Y=r.path,F=!!Y&&M.has(Y),yt=!!Y&&j&&!F&&y.some(P=>P.path===Y),ot=!!Y&&j&&!F&&!yt,zt=F&&!r.view,[lt,Nt]=q.useState(()=>new Set),$=q.useRef(!0);q.useEffect(()=>{if(!v||!$.current)return;$.current=!1;const P=(v.children||[]).filter(rt=>rt.dir);P.length===1&&Nt(rt=>new Set(rt).add(P[0].path))},[v]),q.useEffect(()=>{if(!Y||!j)return;Nt(rt=>{const xt=new Set(rt);for(const Fa of dg(Y))xt.add(Fa);return M.has(Y)&&xt.add(Y),xt});const P=document.querySelector(`#tree .row[data-path="${CSS.escape(Y)}"]`);P&&P.scrollIntoView({block:"nearest"})},[Y,j,M]);const gt=q.useCallback(P=>{Nt(rt=>{const xt=new Set(rt);return xt.has(P)?xt.delete(P):xt.add(P),xt})},[]),wt=q.useRef(null),ue=q.useRef(new Map),le=q.useRef({key:"",want:0,attempts:0});q.useEffect(()=>{le.current={key:S,want:kp()==="POP"?ue.current.get(S)??0:0,attempts:0}},[S]);const Dt=q.useCallback(()=>{const P=wt.current,rt=le.current;!P||rt.key!==S||rt.attempts>=3||(rt.attempts++,P.scrollTo({top:rt.want,behavior:"instant"}))},[S]),ce=q.useCallback(()=>{wt.current&&ue.current.set(S,wt.current.scrollTop)},[S]),Ut=q.useCallback(P=>{Je(Zp(P,m?.id)),sa()},[m?.id]),kt=q.useCallback(P=>Je(Qh("history",m?.id,P)),[m?.id]),[D,B]=q.useState(""),[k,vt]=q.useState(null),[dt,b]=q.useState(!1),[H,L]=q.useState(!1),G=q.useRef(null),V=i.panel??null,et=!V&&d&&!!m&&yt,ft=!V&&d&&!!m,Vt=!V&&yt,Rt=!V&&(yt||d&&!!m&&F),Gl=f+"download?path="+encodeURIComponent(Y),hl=q.useCallback(async()=>{try{const P=await fetch(f+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Y})});if(!P.ok)throw new Error(await P.text());const rt=await P.json(),xt=await Wn(rt.url);vt({url:rt.url,copied:xt})}catch(P){st("Share failed: "+P.message,!0)}},[f,Y]),ml=q.useCallback(()=>{if(!Y)return kt("");kt(F?Y+"/":Y)},[Y,F,kt]);q.useEffect(()=>{const P=rt=>{(rt.metaKey||rt.ctrlKey)&&rt.key.toLowerCase()==="k"&&(rt.preventDefault(),L(xt=>!xt))};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[]);const ei=q.useCallback(()=>{const P=[],rt=(xt,Fa,Au,ne)=>P.push({icon:xt,label:Fa,kind:Au,run:ne});if(d&&m&&Y&&(yt&&rt("share","Share: "+Y,"action",hl),rt("hist","History: "+Y,"action",ml),yt&&rt("download","Download: "+Y,"action",()=>G.current?.click())),d&&m&&rt("hist","History: whole project","action",()=>kt("")),d)for(const xt of i.projects||[])(!m||xt.id!==m.id)&&rt("folder","Switch to project: "+xt.name,"project",()=>Je("/"+xt.id));c.auth?.enabled&&rt("power","Sign out","action",()=>window.location.href="/auth/logout");for(const xt of M.keys())rt("folder",xt,"folder",()=>Ut(xt));for(const xt of y)rt("doc",xt.path,"file",()=>Ut(xt.path));return P},[d,m,Y,yt,c.auth?.enabled,M,y,i.projects,hl,ml,kt,Ut]);q.useEffect(()=>{if(!dt)return;const P=()=>b(!1);return document.addEventListener("click",P),()=>document.removeEventListener("click",P)},[dt]);const Ce=q.useCallback(P=>M.has(P),[M]);let Le="markdown",se;V?(Le="view",se=V.body):r.view==="insights"?(Le="view",se=i.canInsights?o.jsx(Kh,{flatFiles:y,heatMap:E,devices:Q,onOpenFile:Ut,onOpenFolder:Ut,isFolder:Ce}):o.jsx("div",{className:"empty",children:"Insights is for hub admins and org owners."})):r.view==="history"?(Le="view",se=o.jsx(Hg,{apiBase:f,target:r.viewTarget||"",isFolder:Ce,onOpen:Ut,onMeta:B,onRendered:Dt})):Y?j?ot?(Le="view",se=o.jsxs("div",{className:"notfound",children:[o.jsx("h1",{children:"Couldn't find that"}),o.jsxs("p",{children:[o.jsx("code",{children:Y})," isn't in this project right now."]}),o.jsx("p",{className:"nf-sub",children:"If it was just created, it may still be uploading or syncing from a teammate's device — this page checks again automatically every few seconds, so refresh or come back in a moment."}),o.jsx("button",{className:"pbtn",onClick:()=>A.invalidateQueries({queryKey:["tree",f]}),children:"Check again"})]})):F?(Le="view",se=o.jsx(vg,{node:M.get(Y),heatMap:E,hub:d&&!!m,apiBase:f,onOpen:Ut,onFullHistory:kt,onRendered:Dt})):se=o.jsx(gg,{apiBase:f,path:Y,heatMap:E,flatFiles:y,onOpenFile:Ut,onMeta:B,onRendered:Dt}):se=o.jsx("div",{className:"empty",children:"Loading…"}):w?(Le="view",se=o.jsxs(o.Fragment,{children:[o.jsx(ym,{project:m}),i.canInsights&&o.jsx("div",{className:"home-insights",children:o.jsx(Kh,{flatFiles:y,heatMap:E,devices:Q,onOpenFile:Ut,onOpenFolder:Ut,isFolder:Ce})})]})):se=o.jsx("div",{className:"empty",children:"Select a file to read it."});const Mu=V?V.crumb:Y?o.jsx(hg,{path:Y,onOpenFolder:Ut}):r.view==="insights"?"Insights — "+(m?.name??""):r.view==="history"?"History — "+qg(r.viewTarget||"",Ce):w?m.name:null,li=o.jsx($n,{crumb:Mu,meta:D,actions:o.jsxs(o.Fragment,{children:[o.jsxs("button",{id:"search-btn",className:"btn ghost",title:"Search (⌘K)",onClick:()=>L(!0),children:[o.jsx(Kt,{name:"search"})," ",o.jsx("span",{className:"lbl",children:"Search"})," ",o.jsx("kbd",{children:"⌘K"})]}),et&&o.jsxs("button",{id:"share-btn",className:"btn",onClick:hl,children:[o.jsx(Kt,{name:"share"})," ",o.jsx("span",{className:"lbl",children:"Share"})]}),ft&&o.jsxs("button",{id:"history-btn",className:"btn",onClick:ml,children:[o.jsx(Kt,{name:"hist"})," ",o.jsx("span",{className:"lbl",children:"History"})]}),Vt&&o.jsxs("a",{id:"download",className:"btn",download:!0,href:Gl,ref:G,children:[o.jsx(Kt,{name:"download"})," ",o.jsx("span",{className:"lbl",children:"Download"})]}),Rt&&o.jsx("button",{id:"more-btn",className:"btn icon-only",title:"More actions","aria-label":"More actions",onClick:P=>{P.stopPropagation(),b(!dt)},children:o.jsx(Kt,{name:"dots"})}),dt&&o.jsxs("div",{id:"more-menu",role:"menu",children:[ft&&o.jsx("button",{className:"more-item",onClick:ml,children:"History"}),Vt&&o.jsx("button",{className:"more-item",onClick:()=>G.current?.click(),children:"Download"}),i.canInsights&&o.jsx("button",{className:"more-item",onClick:()=>Je(Qh("insights",m?.id)),children:"Insights"})]})]})});return o.jsxs(o.Fragment,{children:[o.jsx(Fn,{vault:i.sidebar.vault,projectsNav:i.sidebar.projectsNav,orgBar:i.sidebar.orgBar,tree:o.jsx(rg,{root:v,expanded:lt,onToggle:gt,currentPath:Y,listingShowing:zt,onOpen:Ut}),topbar:li,contentClass:Le,contentRef:wt,onContentScroll:ce,children:se}),k&&o.jsx(Ng,{url:k.url,copied:k.copied,onClose:()=>vt(null)}),o.jsx(Ag,{open:H,onClose:()=>L(!1),candidates:ei})]})}function wg({config:i}){const c=hf(),f=sm(),[r,d]=q.useState(null),[m,S]=q.useState(null);q.useEffect(()=>S(null),[c]);const A=q.useMemo(()=>{const lt=c.match(/^\/join\/([0-9a-f]+)\/?$/);return lt?lt[1]:null},[c]),{data:v}=Gp(!A),{data:y}=Xp(!A),M=!!i.auth.admin,{data:j}=cm(M),E=q.useMemo(()=>rm(c,"hub"),[c]),w=q.useMemo(()=>v&&(v.find(lt=>lt.id===E.project)||r&&v.find(lt=>lt.org===r)||v[0])||null,[v,E.project,r]);if(q.useEffect(()=>{document.title=w?w.name+" — BearDrive":i.brand||i.volume||"BearDrive"},[w,i]),A)return o.jsx(Qg,{token:A,onDone:async lt=>{d(lt),await f(),Je("/",{replace:!0})}});const z=i.brand||i.volume||"BearDrive",Q=w&&y?.find(lt=>lt.id===w.org)||null,Y=M||(Q?Q.role==="owner":!1),F=o.jsx(Ou,{name:z,onHome:()=>Je("/")}),yt=i.me?o.jsx(tg,{me:i.me,org:Q,admin:M?{pending:j?.length||0,onClick:()=>{S({kind:"hub"}),sa()}}:void 0,onOrgSettings:lt=>{S({kind:"org",orgId:lt.id}),sa()}}):void 0;if(!v||!y)return o.jsx(Fn,{vault:F,topbar:o.jsx($n,{}),children:o.jsx("div",{className:"empty",children:"Loading…"})});if(!w)return o.jsx(Fn,{vault:F,projectsNav:o.jsx(Yh,{projects:v}),orgBar:yt,topbar:o.jsx($n,{}),contentClass:"view",children:o.jsx(ig,{authEnabled:i.auth.enabled,onCreate:async lt=>{if(!lt){st("Give the project a name.",!0);return}try{const Nt=await Ja("/api/projects",{name:lt});await f(),Je("/"+Nt.project.id),st(`Created “${Nt.project.name}”.`)}catch(Nt){st("Could not create the project: "+Nt.message,!0)}}})});const ot=m?.kind==="org"?y.find(lt=>lt.id===m.orgId):null,zt=m?.kind==="hub"?{crumb:"Signup & access",body:o.jsx(Pp,{})}:m?.kind==="project"?{crumb:"Project settings",body:o.jsx(ng,{project:w,org:Q})}:ot?{crumb:ot.name,body:o.jsx(Ip,{org:ot,projects:v,myEmail:i.me?.email||"",onProjectsChanged:f})}:null;return E.project!==w.id?o.jsx(Vp,{to:"/"+w.id}):o.jsx(gm,{config:i,apiBase:"/api/p/"+w.id+"/",route:E,hub:!0,project:w,projects:v,canInsights:Y,sidebar:{vault:F,projectsNav:o.jsx(Yh,{projects:v,currentId:w.id,onOpenSettings:()=>{S({kind:"project"}),sa()}}),orgBar:yt},panel:zt},w.id)}function Qg({token:i,onDone:c}){return q.useEffect(()=>{let f=!1;return Ja("/api/invites/"+i).then(r=>{f||(st(`Welcome — you joined the “${r.org.name}” team. Opening its projects…`),c(r.org.id))}).catch(r=>{f||String(r.message).includes("signing in")||(st("Could not accept the invite: "+r.message,!0),c(null))}),()=>{f=!0}},[i]),o.jsx(Fn,{vault:o.jsx(Ou,{name:"BearDrive"}),topbar:o.jsx($n,{}),children:o.jsx("div",{className:"empty",children:"Joining…"})})}function Bg({config:i}){const c=hf(),f=i.volume||"BearDrive";q.useEffect(()=>{document.title=i.brand||f},[i,f]);const r=q.useMemo(()=>rm(c,"volume"),[c]);return o.jsx(gm,{config:i,apiBase:"/api/",route:r,hub:!1,sidebar:{vault:o.jsx(Ou,{name:f,showSignout:i.auth.enabled})}})}function Lg(){const{data:i}=R0();return o.jsxs(o.Fragment,{children:[i?i.mode==="hub"?o.jsx(wg,{config:i}):o.jsx(Bg,{config:i}):o.jsx(Fn,{vault:o.jsx(Ou,{name:"…",showSignout:!1}),topbar:o.jsx($n,{}),children:o.jsx("div",{className:"empty",children:"Loading…"})}),o.jsx(Qp,{}),o.jsx(Bp,{})]})}const Yg=new S0({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});Jv.createRoot(document.getElementById("root")).render(o.jsx(q.StrictMode,{children:o.jsx(x0,{client:Yg,children:o.jsx(Lg,{})})})); +bdrive init --project `+r},{title:"Connect "+i.label,desc:i.note,code:"bdrive hooks install --agent "+i.hook,extra:i.extra}]}function lg(){try{return localStorage.getItem("bdrive-guide-agent")||"claude"}catch{return"claude"}}function ym({project:i}){const[c,f]=Q.useState(lg),r=Js.find(d=>d.key===c)||Js[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:Js.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:[eg(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(ag,{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 ag({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 Wn(i)?"Copied":"Copy failed"),setTimeout(()=>f("Copy"),1400)},children:c})]})}function ng({project:i,org:c}){return o.jsxs("div",{className:"project-settings",children:[o.jsx("h2",{children:i.name}),o.jsxs("dl",{className:"ps-facts",children:[o.jsx("dt",{children:"Project id"}),o.jsx("dd",{children:o.jsx("code",{children:i.id})}),c&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Workspace"}),o.jsx("dd",{children:c.name})]}),i.created&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Created"}),o.jsx("dd",{children:new Date(i.created).toLocaleDateString()})]})]}),o.jsx("h3",{children:"Connect a device"}),o.jsx(ym,{project:i})]})}function ig({authEnabled:i,onCreate:c}){const f=Q.useRef(null),r=Q.useRef(null),d=()=>{const m=f.current.value.trim(),g=m.match(/join\/([0-9a-f]+)/)||m.match(/^([0-9a-f]{8,})$/);if(!g){st("That doesn't look like an invite link.",!0);return}location.href="/join/"+g[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 ug(i,c=!0){const f=pe({queryKey:["tree",i],queryFn:()=>Ae(i+"tree"),enabled:c,refetchInterval:15e3}),r=Q.useMemo(()=>{const d=[],m=new Map,g=A=>{for(const p of A.children||[])p.dir?(m.set(p.path,p),g(p)):d.push(p)};return f.data&&g(f.data),{flatFiles:d,dirIndex:m}},[f.data]);return{tree:f.data,...r,loaded:!!f.data}}function cg(i,c){return pe({queryKey:["heat",i],queryFn:()=>Ae(i+"heat?days=30"),enabled:c,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function sg(i,c,f){return pe({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 In(i){return(i.human||0)+(i.agent||0)+(i.share||0)}function Tu(i){const c=In(i);if(!c)return"";let f=c+(c===1?" read":" reads");return i.agent&&(f+=" ("+i.agent+" agent)"),f}function fg(i){const c=In(i);return c?c<3?1:c<10?2:c<30?3:4:0}function rg(i){return o.jsx("nav",{id:"tree","aria-label":"Files",children:i.root&&o.jsx(vm,{nodes:i.root.children||[],...i})})}function vm({nodes:i,...c}){return o.jsx("ul",{children:i.map(f=>o.jsx(og,{node:f,...c},f.path))})}function og({node:i,...c}){const{expanded:f,onToggle:r,currentPath:d,listingShowing:m,onOpen:g}=c,A=i.dir?f.has(i.path):!1,p=()=>{if(i.dir&&d===i.path&&m){r(i.path);return}g(i.path),i.dir||sa()};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:p,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),p())},children:[o.jsx("span",{className:"chev",onClick:y=>{i.dir&&(y.stopPropagation(),r(i.path))},children:o.jsx(Kt,{name:"chevd"})}),o.jsx("span",{className:"ticon",children:o.jsx(Kt,{name:i.dir?"folder":"doc"})}),o.jsx("span",{className:"label",children:i.name})]}),i.dir&&o.jsx(vm,{nodes:i.children||[],...c})]})}function dg(i){const c=i.split("/"),f=[];let r="";for(let d=0;d{r=r?r+"/"+d:d;const g=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:g,onClick:()=>c(g),children:d})]},g)})})}const mg={add:"plus",edit:"edit",delete:"x"},yg={add:"added",edit:"edited",delete:"deleted"};function pm({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",g=[i.device.name||i.device.id,i.device.os,i.device.ip].filter(Boolean).join(" · "),A=d!=="delete",p=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:p,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(Kt,{name:mg[d]||"dot"})}),o.jsx("span",{className:"hpath",children:i.path}),o.jsx("span",{className:"htag",children:yg[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:g}),o.jsx("span",{className:"hsize",children:i.size?dm(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,M)=>/^https?:\/\//.test(y)?o.jsx("a",{href:y,target:"_blank",rel:"noopener",children:y},M):y)})]})}function vg(i){const{node:c,heatMap:f,onOpen:r}=i,d=(c.children||[]).slice().sort((y,M)=>Number(M.dir||!1)-Number(y.dir||!1)||y.name.localeCompare(M.name)),m=d.filter(y=>y.dir).length,g=d.length-m,A=[];m&&A.push(m+(m===1?" folder":" folders")),g&&A.push(g+(g===1?" file":" files"));const p=Gh(f,c.path,!0);return p&&A.push(Tu(p)+" 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(Kt,{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 M="";if(y.dir){const x=(y.children||[]).length;M=x+(x===1?" item":" items")}else M=[y.size?dm(y.size):"",y.time?new Date(y.time).toLocaleDateString():""].filter(Boolean).join(" · ");const E=Gh(f,y.path,!!y.dir);return E&&(M=Tu(E)+(M?" · "+M:"")),o.jsxs("div",{className:"dl-row",tabIndex:0,role:"button",title:y.path,onClick:()=>r(y.path),onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),r(y.path))},children:[o.jsx("span",{className:"ticon",children:o.jsx(Kt,{name:y.dir?"folder":"doc"})}),o.jsx("span",{className:"dl-name",children:y.name}),E&&o.jsx("span",{className:"heatdot lvl"+fg(E),title:Tu(E)+" in 30 days"}),o.jsx("span",{className:"dl-meta",children:M})]},y.path)})}),i.hub&&o.jsx(pg,{apiBase:i.apiBase,prefix:c.path+"/",onOpen:r,onFullHistory:()=>i.onFullHistory(c.path+"/"),onRendered:i.onRendered})]})}function pg(i){const c=sg(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(pm,{entry:r,onOpen:i.onOpen},d))}),o.jsx("button",{className:"ai-btn dl-more",onClick:i.onFullHistory,children:"Full history"})]})}function gg(i){const{apiBase:c,path:f,onMeta:r}=i,d=c+"file?path="+encodeURIComponent(f);return Q.useEffect(()=>()=>r(""),[f,r]),Jp.test(f)?o.jsx(bg,{...i}):$p.test(f)?o.jsx("iframe",{className:"htmlview",sandbox:"allow-scripts",src:d,title:f,onLoad:i.onRendered}):Fp.test(f)?o.jsx(jg,{src:d,alt:f,onRendered:i.onRendered}):Wp.test(f)?o.jsx(Eg,{...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 bg(i){const{apiBase:c,path:f,heatMap:r,flatFiles:d,onOpenFile:m,onMeta:g,onRendered:A}=i,{data:p,error:y}=pe({queryKey:["render",c,f],queryFn:()=>Ae(c+"render?path="+encodeURIComponent(f))}),M=Q.useMemo(()=>p?xg(p.html,f,c):"",[p,f,c]);return Q.useEffect(()=>{if(!p)return;const E=[];p.author&&E.push(p.author+(p.device?" on "+p.device:"")),p.time&&E.push(new Date(p.time).toLocaleString());const x=r&&r[p.path];x&&In(x)&&E.push(Tu(x)+" / 30d"),g(E.join(" · ")),A?.()},[p,r,g,A]),y?o.jsxs("div",{className:"empty",children:["Could not load file: ",y.message]}):p?o.jsx("div",{dangerouslySetInnerHTML:{__html:M},onClick:E=>Sg(E,f,d,m)}):null}function Sg(i,c,f,r){const d=i.target.closest("a");if(!d||!i.currentTarget.contains(d))return;const m=d.getAttribute("href")||"",g=c.includes("/")?c.slice(0,c.lastIndexOf("/")):"";m.startsWith("wiki:")?(i.preventDefault(),Tg(decodeURIComponent(m.slice(5)),f,r)):/^([a-z]+:|\/|#)/i.test(m)||(i.preventDefault(),r(hm(g,decodeURIComponent(m))))}function xg(i,c,f){const r=c.includes("/")?c.slice(0,c.lastIndexOf("/")):"",d=g=>f+"file?path="+encodeURIComponent(g),m=new DOMParser().parseFromString(i,"text/html");for(const g of m.querySelectorAll("img")){const A=g.getAttribute("src")||"";/^([a-z]+:|\/)/i.test(A)||g.setAttribute("src",d(hm(r,A)))}for(const g of m.querySelectorAll("a")){const A=g.getAttribute("href")||"";/^https?:/i.test(A)&&(g.setAttribute("target","_blank"),g.setAttribute("rel","noopener"))}return m.body.innerHTML}function jg({src:i,alt:c,onRendered:f}){return o.jsx("img",{src:i,alt:c,onLoad:f})}function Eg(i){const{path:c,fileURL:f,onRendered:r}=i,{data:d,error:m}=pe({queryKey:["text",f],queryFn:async()=>{const g=await fetch(f);if(!g.ok)throw new Error(await g.text());return g.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 Tg(i,c,f){const r=i.toLowerCase(),d=c.find(m=>m.path.toLowerCase()===r||m.path.toLowerCase()===r+".md")||c.find(m=>{const g=m.name.toLowerCase();return g===r||g===r+".md"});d&&f(d.path)}function Og({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:()=>Wn(i).then(d=>st(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),st("Link revoked — it no longer works."),f()}catch(d){st(d.message,!0)}},children:"Revoke"}),o.jsx("button",{className:"ai-btn",onClick:f,children:"Done"})]})]})})}function Xh(i,c){if(!i)return{score:0,hits:[]};const f=i.toLowerCase(),r=c.toLowerCase();let d=0,m=0,g=0;const A=[];for(let p=0;p3&&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?Xh(d,c):null}function Mg({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 Ag({open:i,onClose:c,candidates:f}){const[r,d]=Q.useState(""),[m,g]=Q.useState(0),A=Q.useRef(null),p=Q.useRef(null),y=Q.useMemo(()=>{if(!i)return[];const E=[];for(const x of f()){const q=Ng(r,x.label);q&&E.push({...x,score:q.score,hits:q.hits})}return E.sort((x,q)=>q.score-x.score),E.slice(0,40)},[i,r,f]);Q.useEffect(()=>{i&&(d(""),g(0),A.current?.focus())},[i]),Q.useEffect(()=>g(0),[r]),Q.useEffect(()=>{p.current?.children[m]?.scrollIntoView({block:"nearest"})},[m,y]);const M=E=>{c(),E.run()};return Q.useEffect(()=>{if(!i)return;const E=x=>{if(x.key==="Escape")x.preventDefault(),c();else if(x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();const q=y.length;q&&g(z=>(z+(x.key==="ArrowDown"?1:q-1))%q)}else x.key==="Enter"&&(x.preventDefault(),y[m]&&M(y[m]))};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[i,y,m]),i?o.jsx("div",{id:"palette-overlay",onClick:E=>E.target===E.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(Kt,{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:E=>d(E.target.value)})]}),o.jsx("ul",{id:"palette-results",ref:p,children:y.length===0?o.jsx("li",{className:"pempty",children:"No matches — search covers file names, projects, and actions"}):y.map((E,x)=>o.jsxs("li",{className:x===m?"selected":void 0,onClick:()=>M(E),onMouseMove:()=>m!==x&&g(x),children:[o.jsx("span",{className:"picon",children:o.jsx(Kt,{name:E.icon})}),o.jsx(Mg,{text:E.label,hits:E.hits}),o.jsx("span",{className:"pkind",children:E.kind})]},E.kind+":"+E.label))}),o.jsx("footer",{id:"palette-hint",children:"↑↓ navigate · ⏎ select · esc close"})]})}):null}const Zn=3,Va=30;function Cg(i,c){return pe({queryKey:["heatDevices",i],queryFn:()=>Ae(i+"heat?by=device&days=30"),enabled:c,retry:!1,staleTime:6e4}).data?.devices??null}function Kh(i){const[c,f]=Q.useState("all"),{flatFiles:r,heatMap:d,devices:m,scope:g}=i,A=x=>!g||x===g||x.startsWith(g+"/"),p=g?r.filter(x=>A(x.path)):r,y=m&&g?m.map(x=>{const q={};for(const[z,w]of Object.entries(x.folders||{}))A(z)&&(q[z]=w);return{...x,folders:q}}).filter(x=>Object.keys(x.folders).length>0):m,M=Date.now(),E=p.map(x=>{const q=d&&d[x.path]||{},z=x.time?Math.max(0,(M-new Date(x.time).getTime())/864e5):0,w=c==="all"?In(q):q[c]||0;return{path:x.path,reads:w,agent:q.agent||0,total:In(q),days:z,danger:w>=Zn&&z>=Va}});return o.jsxs("div",{className:"insights",children:[o.jsxs("h1",{className:"in-title",children:["Knowledge insights",g?o.jsxs("span",{className:"in-scope",children:[" · ",g]}):null]}),o.jsx("p",{className:"dl-sub",children:g?`Reads over the last 30 days × freshness, for ${g} and everything in it.`:"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(x=>o.jsx("button",{className:"in-lens-btn"+(x===c?" active":""),onClick:()=>f(x),children:x==="all"?"All reads":x==="human"?"Human reads":"Agent reads"},x))}),o.jsx("h3",{className:"dl-h3",children:"Map — cell size = reads, color = freshness"}),o.jsx(_g,{pts:E,onOpenFile:i.onOpenFile,onOpenFolder:i.onOpenFolder,isFolder:i.isFolder}),o.jsx("h3",{className:"dl-h3",children:"Reads × freshness"}),o.jsx(Dg,{pts:E,onOpenFile:i.onOpenFile}),o.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),o.jsx(Rg,{pts:E,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(Ug,{devices:y})]})]})}function zg(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((g,A)=>Math.round(g+(c[r+1][A]-g)*d));return`rgb(${m[0]},${m[1]},${m[2]})`}function Zh(i,c,f,r,d){const m=i.reduce((y,M)=>y+M.value,0);if(!m||r<=0||d<=0)return[];const g=i.slice().sort((y,M)=>M.value-y.value).map(y=>({it:y,a:y.value/m*r*d})),A=(y,M)=>{const x=y.reduce((z,w)=>z+w.a,0)/M;let q=0;for(const z of y){const w=z.a/x;q=Math.max(q,w/x,x/w)}return q},p=[];for(;g.length;){const y=r>=d,M=y?d:r,E=[g.shift()];for(;g.length&&A(E.concat(g[0]),M)<=A(E,M);)E.push(g.shift());const x=E.reduce((z,w)=>z+w.a,0)/M;let q=0;for(const z of E){const w=z.a/x;y?p.push({item:z.it,x:c,y:f+q,w:x,h:w}):p.push({item:z.it,x:c+q,y:f,w,h:x}),q+=w}y?(c+=x,r-=x):(f+=x,d-=x)}return p}const Fs=15;function _g({pts:i,onOpenFile:c,onOpenFolder:f,isFolder:r}){const g=new Map;for(const p of i){const y=p.path.includes("/")?p.path.split("/")[0]:"/";let M=g.get(y);M||g.set(y,M={name:y,files:[],value:0}),M.files.push(p),M.value+=p.reads+1}const A=[];for(const p of Zh([...g.values()],0,0,720,480)){const y=p.item,M=y.name==="/"?"":y.name;if(A.push(o.jsx("rect",{x:p.x+1,y:p.y+1,width:Math.max(0,p.w-2),height:Math.max(0,p.h-2),rx:3,className:"in-tm-group","data-dir":M},"g"+y.name)),p.w>46&&p.h>Fs+10){let x=y.name==="/"?"(root)":y.name;const q=Math.floor((p.w-8)/6);x.length>q&&(x=x.slice(0,Math.max(1,q-1))+"…"),A.push(o.jsx("text",{x:p.x+5,y:p.y+12,className:"in-tm-glabel","data-dir":M,children:x},"gl"+y.name))}const E=Zh(y.files.map(x=>({...x,name:x.path.split("/").pop(),value:x.reads+1})),p.x+2,p.y+Fs,Math.max(0,p.w-4),Math.max(0,p.h-Fs-2));for(const x of E)if(A.push(o.jsx("rect",{x:x.x+.6,y:x.y+.6,width:Math.max(.4,x.w-1.2),height:Math.max(.4,x.h-1.2),rx:1.5,fill:zg(x.item.days),className:"in-tm-cell","data-path":x.item.path,children:o.jsx("title",{children:`${x.item.path} — ${x.item.reads} read${x.item.reads===1?"":"s"}/30d · changed ${Math.round(x.item.days)}d ago`})},x.item.path)),x.w>54&&x.h>16){const q=Math.floor((x.w-8)/6);let z=(x.item.danger?"⚠ ":"")+x.item.name;z.length>q&&(z=z.slice(0,Math.max(1,q-1))+"…"),q>=5&&A.push(o.jsx("text",{x:x.x+4.5,y:x.y+12.5,className:"in-tm-label","data-path":x.item.path,children:z},"l"+x.item.path))}}return o.jsx("svg",{viewBox:"0 0 720 480",className:"in-chart in-treemap",onClick:p=>{const y=p.target.closest("[data-path], [data-dir]");if(!y)return;const M=y.getAttribute("data-path");if(M)return c(M);const E=y.getAttribute("data-dir");E&&r(E)&&f(E)},children:A})}function Dg({pts:i,onOpenFile:c}){const d={l:44,r:16,t:20,b:34},m=Math.max(Va*2,...i.map(E=>E.days)),g=Math.max(Zn*2,...i.map(E=>E.reads)),A=E=>Math.log10(E+1)/Math.log10(m+1),p=E=>Math.log10(E+1)/Math.log10(g+1),y=E=>d.l+A(E)*(720-d.l-d.r),M=E=>360-d.b-p(E)*(360-d.t-d.b);return o.jsxs("svg",{viewBox:"0 0 720 360",className:"in-chart",children:[o.jsx("rect",{x:y(Va),y:d.t,width:720-d.r-y(Va),height:M(Zn)-d.t,className:"in-danger-zone"}),o.jsx("line",{x1:y(Va),y1:d.t,x2:y(Va),y2:360-d.b,className:"in-threshold"}),o.jsx("line",{x1:d.l,y1:M(Zn),x2:720-d.r,y2:M(Zn),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(E=>{const x=E.total?(E.agent||0)/E.total:0;return o.jsx("circle",{cx:Number(y(E.days).toFixed(1)),cy:Number(M(E.reads).toFixed(1)),r:Number((3+4*x).toFixed(1)),className:"in-pt"+(E.danger?" danger":E.reads?"":" cold"),onClick:()=>c(E.path),children:o.jsx("title",{children:`${E.path} — ${E.reads} read${E.reads===1?"":"s"} / 30d · changed ${Math.round(E.days)}d ago`})},E.path)})]})}function Rg({pts:i,lens:c,onOpenFile:f}){const r=i.filter(m=>m.reads>0).sort((m,g)=>g.reads-m.reads||g.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 g=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:p=>{(p.key==="Enter"||p.key===" ")&&(p.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*g).toFixed(1)+"%"}}),o.jsx("span",{className:"in-hp-human",style:{width:(A*(1-g)).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 Ug({devices:i}){const c=new Map;for(const x of i)for(const[q,z]of Object.entries(x.folders||{}))c.set(q,(c.get(q)||0)+z);const f=[...c.entries()].sort((x,q)=>q[1]-x[1]).slice(0,12).map(x=>x[0]),r=i.slice(0,12),d=140,m=6,g=Math.min(76,Math.max(34,(720-d-8)/f.length)),A=26,p=720,y=m+r.length*A+58,M=Math.max(1,...r.flatMap(x=>f.map(q=>(x.folders||{})[q]||0))),E=x=>{const q=[23,25,31],z=[245,166,35],w=q.map((Y,F)=>Math.round(Y+(z[F]-Y)*x));return`rgb(${w[0]},${w[1]},${w[2]})`};return o.jsxs("svg",{viewBox:`0 0 ${p} ${y}`,className:"in-chart in-matrix",children:[r.map((x,q)=>{let z=x.name||x.id||"";return z.length>20&&(z=z.slice(0,19)+"…"),o.jsxs("g",{children:[o.jsx("text",{x:d-8,y:m+q*A+17,textAnchor:"end",className:"in-label",children:z}),f.map((w,Y)=>{const F=(x.folders||{})[w]||0;return o.jsx("rect",{x:d+Y*g,y:m+q*A,width:g-4,height:A-4,rx:3,fill:E(Math.sqrt(F/M)),children:o.jsx("title",{children:`${x.name||x.id} × ${w||"(root)"}: ${F} read${F===1?"":"s"}/30d`})},w)})]},x.id||q)}),f.map((x,q)=>{const z=d+q*g+(g-4)/2,w=m+r.length*A+14;return o.jsx("text",{x:z,y:w,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${z} ${w})`,children:x||"(root)"},x)})]})}function Hg(i){const{apiBase:c,target:f,isFolder:r,onMeta:d,onRendered:m}=i,g=f?r(f)?{prefix:f+"/"}:{path:f}:{prefix:""},A="path"in g&&g.path!==void 0?"path="+encodeURIComponent(g.path):"prefix="+encodeURIComponent(g.prefix??""),{data:p,error:y}=pe({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(()=>{p&&m?.()},[p,m]),!p)return null;const M=p.entries||[];return o.jsxs("div",{className:"history",children:[M.length===0&&o.jsx("div",{className:"empty",children:"No history yet."}),M.map((E,x)=>o.jsx(pm,{entry:E,onOpen:i.onOpen},x))]})}function qg(i,c){return i?c(i)?i+"/ (folder)":i:"all changes"}function gm(i){const{config:c,apiBase:f,route:r,hub:d,project:m}=i,g=hf(),A=ti(),{tree:p,flatFiles:y,dirIndex:M,loaded:E}=ug(f,!d||!!m),x=cg(f,d&&!!m&&!!c.reads?.enabled),q=d&&!!m&&!r.path&&!r.view,z=!!i.canInsights&&(r.view==="insights"||q),w=Cg(f,z);Q.useEffect(()=>{z&&A.invalidateQueries({queryKey:["heat",f]})},[z,f,A]);const Y=r.path,F=!!Y&&M.has(Y),yt=!!Y&&E&&!F&&y.some(P=>P.path===Y),ot=!!Y&&E&&!F&&!yt,zt=F&&!r.view,[lt,Ot]=Q.useState(()=>new Set),$=Q.useRef(!0);Q.useEffect(()=>{if(!p||!$.current)return;$.current=!1;const P=(p.children||[]).filter(rt=>rt.dir);P.length===1&&Ot(rt=>new Set(rt).add(P[0].path))},[p]),Q.useEffect(()=>{if(!Y||!E)return;Ot(rt=>{const xt=new Set(rt);for(const Fa of dg(Y))xt.add(Fa);return M.has(Y)&&xt.add(Y),xt});const P=document.querySelector(`#tree .row[data-path="${CSS.escape(Y)}"]`);P&&P.scrollIntoView({block:"nearest"})},[Y,E,M]);const gt=Q.useCallback(P=>{Ot(rt=>{const xt=new Set(rt);return xt.has(P)?xt.delete(P):xt.add(P),xt})},[]),wt=Q.useRef(null),ue=Q.useRef(new Map),le=Q.useRef({key:"",want:0,attempts:0});Q.useEffect(()=>{le.current={key:g,want:kp()==="POP"?ue.current.get(g)??0:0,attempts:0}},[g]);const Dt=Q.useCallback(()=>{const P=wt.current,rt=le.current;!P||rt.key!==g||rt.attempts>=3||(rt.attempts++,P.scrollTo({top:rt.want,behavior:"instant"}))},[g]),ce=Q.useCallback(()=>{wt.current&&ue.current.set(g,wt.current.scrollTop)},[g]),Ut=Q.useCallback(P=>{Je(Zp(P,m?.id)),sa()},[m?.id]),kt=Q.useCallback(P=>Je(Qh("history",m?.id,P)),[m?.id]),[D,B]=Q.useState(""),[k,vt]=Q.useState(null),[dt,S]=Q.useState(!1),[H,L]=Q.useState(!1),G=Q.useRef(null),V=i.panel??null,et=!V&&d&&!!m&&yt,ft=!V&&d&&!!m,Vt=!V&&yt,Rt=!V&&(yt||d&&!!m&&F),Gl=f+"download?path="+encodeURIComponent(Y),hl=Q.useCallback(async()=>{try{const P=await fetch(f+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Y})});if(!P.ok)throw new Error(await P.text());const rt=await P.json(),xt=await Wn(rt.url);vt({url:rt.url,copied:xt})}catch(P){st("Share failed: "+P.message,!0)}},[f,Y]),ml=Q.useCallback(()=>{if(!Y)return kt("");kt(F?Y+"/":Y)},[Y,F,kt]);Q.useEffect(()=>{const P=rt=>{(rt.metaKey||rt.ctrlKey)&&rt.key.toLowerCase()==="k"&&(rt.preventDefault(),L(xt=>!xt))};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[]);const ei=Q.useCallback(()=>{const P=[],rt=(xt,Fa,Au,ne)=>P.push({icon:xt,label:Fa,kind:Au,run:ne});if(d&&m&&Y&&(yt&&rt("share","Share: "+Y,"action",hl),rt("hist","History: "+Y,"action",ml),yt&&rt("download","Download: "+Y,"action",()=>G.current?.click())),d&&m&&rt("hist","History: whole project","action",()=>kt("")),d)for(const xt of i.projects||[])(!m||xt.id!==m.id)&&rt("folder","Switch to project: "+xt.name,"project",()=>Je("/"+xt.id));c.auth?.enabled&&rt("power","Sign out","action",()=>window.location.href="/auth/logout");for(const xt of M.keys())rt("folder",xt,"folder",()=>Ut(xt));for(const xt of y)rt("doc",xt.path,"file",()=>Ut(xt.path));return P},[d,m,Y,yt,c.auth?.enabled,M,y,i.projects,hl,ml,kt,Ut]);Q.useEffect(()=>{if(!dt)return;const P=()=>S(!1);return document.addEventListener("click",P),()=>document.removeEventListener("click",P)},[dt]);const Ce=Q.useCallback(P=>M.has(P),[M]);let Le="markdown",se;V?(Le="view",se=V.body):r.view==="insights"?(Le="view",se=i.canInsights?o.jsx(Kh,{flatFiles:y,heatMap:x,devices:w,scope:r.viewTarget||"",onOpenFile:Ut,onOpenFolder:Ut,isFolder:Ce}):o.jsx("div",{className:"empty",children:"Insights is for hub admins and org owners."})):r.view==="history"?(Le="view",se=o.jsx(Hg,{apiBase:f,target:r.viewTarget||"",isFolder:Ce,onOpen:Ut,onMeta:B,onRendered:Dt})):Y?E?ot?(Le="view",se=o.jsxs("div",{className:"notfound",children:[o.jsx("h1",{children:"Couldn't find that"}),o.jsxs("p",{children:[o.jsx("code",{children:Y})," isn't in this project right now."]}),o.jsx("p",{className:"nf-sub",children:"If it was just created, it may still be uploading or syncing from a teammate's device — this page checks again automatically every few seconds, so refresh or come back in a moment."}),o.jsx("button",{className:"pbtn",onClick:()=>A.invalidateQueries({queryKey:["tree",f]}),children:"Check again"})]})):F?(Le="view",se=o.jsx(vg,{node:M.get(Y),heatMap:x,hub:d&&!!m,apiBase:f,onOpen:Ut,onFullHistory:kt,onRendered:Dt})):se=o.jsx(gg,{apiBase:f,path:Y,heatMap:x,flatFiles:y,onOpenFile:Ut,onMeta:B,onRendered:Dt}):se=o.jsx("div",{className:"empty",children:"Loading…"}):q?(Le="view",se=o.jsxs(o.Fragment,{children:[o.jsx(ym,{project:m}),i.canInsights&&o.jsx("div",{className:"home-insights",children:o.jsx(Kh,{flatFiles:y,heatMap:x,devices:w,onOpenFile:Ut,onOpenFolder:Ut,isFolder:Ce})})]})):se=o.jsx("div",{className:"empty",children:"Select a file to read it."});const Mu=V?V.crumb:Y?o.jsx(hg,{path:Y,onOpenFolder:Ut}):r.view==="insights"?"Insights — "+(r.viewTarget||m?.name||""):r.view==="history"?"History — "+qg(r.viewTarget||"",Ce):q?m.name:null,li=o.jsx($n,{crumb:Mu,meta:D,actions:o.jsxs(o.Fragment,{children:[o.jsxs("button",{id:"search-btn",className:"btn ghost",title:"Search (⌘K)",onClick:()=>L(!0),children:[o.jsx(Kt,{name:"search"})," ",o.jsx("span",{className:"lbl",children:"Search"})," ",o.jsx("kbd",{children:"⌘K"})]}),et&&o.jsxs("button",{id:"share-btn",className:"btn",onClick:hl,children:[o.jsx(Kt,{name:"share"})," ",o.jsx("span",{className:"lbl",children:"Share"})]}),ft&&o.jsxs("button",{id:"history-btn",className:"btn",onClick:ml,children:[o.jsx(Kt,{name:"hist"})," ",o.jsx("span",{className:"lbl",children:"History"})]}),Vt&&o.jsxs("a",{id:"download",className:"btn",download:!0,href:Gl,ref:G,children:[o.jsx(Kt,{name:"download"})," ",o.jsx("span",{className:"lbl",children:"Download"})]}),Rt&&o.jsx("button",{id:"more-btn",className:"btn icon-only",title:"More actions","aria-label":"More actions",onClick:P=>{P.stopPropagation(),S(!dt)},children:o.jsx(Kt,{name:"dots"})}),dt&&o.jsxs("div",{id:"more-menu",role:"menu",children:[ft&&o.jsx("button",{className:"more-item",onClick:ml,children:"History"}),Vt&&o.jsx("button",{className:"more-item",onClick:()=>G.current?.click(),children:"Download"}),i.canInsights&&o.jsx("button",{className:"more-item",onClick:()=>Je(Qh("insights",m?.id,Y)),children:"Insights"})]})]})});return o.jsxs(o.Fragment,{children:[o.jsx(Fn,{vault:i.sidebar.vault,projectsNav:i.sidebar.projectsNav,orgBar:i.sidebar.orgBar,tree:o.jsx(rg,{root:p,expanded:lt,onToggle:gt,currentPath:Y,listingShowing:zt,onOpen:Ut}),topbar:li,contentClass:Le,contentRef:wt,onContentScroll:ce,children:se}),k&&o.jsx(Og,{url:k.url,copied:k.copied,onClose:()=>vt(null)}),o.jsx(Ag,{open:H,onClose:()=>L(!1),candidates:ei})]})}function wg({config:i}){const c=hf(),f=sm(),[r,d]=Q.useState(null),[m,g]=Q.useState(null);Q.useEffect(()=>g(null),[c]);const A=Q.useMemo(()=>{const lt=c.match(/^\/join\/([0-9a-f]+)\/?$/);return lt?lt[1]:null},[c]),{data:p}=Gp(!A),{data:y}=Xp(!A),M=!!i.auth.admin,{data:E}=cm(M),x=Q.useMemo(()=>rm(c,"hub"),[c]),q=Q.useMemo(()=>p&&(p.find(lt=>lt.id===x.project)||r&&p.find(lt=>lt.org===r)||p[0])||null,[p,x.project,r]);if(Q.useEffect(()=>{document.title=q?q.name+" — BearDrive":i.brand||i.volume||"BearDrive"},[q,i]),A)return o.jsx(Qg,{token:A,onDone:async lt=>{d(lt),await f(),Je("/",{replace:!0})}});const z=i.brand||i.volume||"BearDrive",w=q&&y?.find(lt=>lt.id===q.org)||null,Y=M||(w?w.role==="owner":!1),F=o.jsx(Nu,{name:z,onHome:()=>Je("/")}),yt=i.me?o.jsx(tg,{me:i.me,org:w,admin:M?{pending:E?.length||0,onClick:()=>{g({kind:"hub"}),sa()}}:void 0,onOrgSettings:lt=>{g({kind:"org",orgId:lt.id}),sa()}}):void 0;if(!p||!y)return o.jsx(Fn,{vault:F,topbar:o.jsx($n,{}),children:o.jsx("div",{className:"empty",children:"Loading…"})});if(!q)return o.jsx(Fn,{vault:F,projectsNav:o.jsx(Yh,{projects:p}),orgBar:yt,topbar:o.jsx($n,{}),contentClass:"view",children:o.jsx(ig,{authEnabled:i.auth.enabled,onCreate:async lt=>{if(!lt){st("Give the project a name.",!0);return}try{const Ot=await Ja("/api/projects",{name:lt});await f(),Je("/"+Ot.project.id),st(`Created “${Ot.project.name}”.`)}catch(Ot){st("Could not create the project: "+Ot.message,!0)}}})});const ot=m?.kind==="org"?y.find(lt=>lt.id===m.orgId):null,zt=m?.kind==="hub"?{crumb:"Signup & access",body:o.jsx(Pp,{})}:m?.kind==="project"?{crumb:"Project settings",body:o.jsx(ng,{project:q,org:w})}:ot?{crumb:ot.name,body:o.jsx(Ip,{org:ot,projects:p,myEmail:i.me?.email||"",onProjectsChanged:f})}:null;return x.project!==q.id?o.jsx(Vp,{to:"/"+q.id}):o.jsx(gm,{config:i,apiBase:"/api/p/"+q.id+"/",route:x,hub:!0,project:q,projects:p,canInsights:Y,sidebar:{vault:F,projectsNav:o.jsx(Yh,{projects:p,currentId:q.id,onOpenSettings:()=>{g({kind:"project"}),sa()}}),orgBar:yt},panel:zt},q.id)}function Qg({token:i,onDone:c}){return Q.useEffect(()=>{let f=!1;return Ja("/api/invites/"+i).then(r=>{f||(st(`Welcome — you joined the “${r.org.name}” team. Opening its projects…`),c(r.org.id))}).catch(r=>{f||String(r.message).includes("signing in")||(st("Could not accept the invite: "+r.message,!0),c(null))}),()=>{f=!0}},[i]),o.jsx(Fn,{vault:o.jsx(Nu,{name:"BearDrive"}),topbar:o.jsx($n,{}),children:o.jsx("div",{className:"empty",children:"Joining…"})})}function Bg({config:i}){const c=hf(),f=i.volume||"BearDrive";Q.useEffect(()=>{document.title=i.brand||f},[i,f]);const r=Q.useMemo(()=>rm(c,"volume"),[c]);return o.jsx(gm,{config:i,apiBase:"/api/",route:r,hub:!1,sidebar:{vault:o.jsx(Nu,{name:f,showSignout:i.auth.enabled})}})}function Lg(){const{data:i}=R0();return o.jsxs(o.Fragment,{children:[i?i.mode==="hub"?o.jsx(wg,{config:i}):o.jsx(Bg,{config:i}):o.jsx(Fn,{vault:o.jsx(Nu,{name:"…",showSignout:!1}),topbar:o.jsx($n,{}),children:o.jsx("div",{className:"empty",children:"Loading…"})}),o.jsx(Qp,{}),o.jsx(Bp,{})]})}const Yg=new S0({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});Jv.createRoot(document.getElementById("root")).render(o.jsx(Q.StrictMode,{children:o.jsx(x0,{client:Yg,children:o.jsx(Lg,{})})})); diff --git a/internal/webapp/static/index.html b/internal/webapp/static/index.html index 0740fb7..fd6d33f 100644 --- a/internal/webapp/static/index.html +++ b/internal/webapp/static/index.html @@ -5,8 +5,8 @@ BearDrive - - + +