From a085c12cb4e8718786f4a0e01bb96aeb5e25be9c Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 20 Mar 2026 18:37:00 +0000 Subject: [PATCH] refactor: remove index.html, update package-lock.json, and enhance graph loading logic - Deleted the `index.html` file from the project. - Removed unnecessary "peer" properties from various dependencies in `package-lock.json`. - Enhanced the graph loading logic in `App.tsx` to handle different graph statuses and fetch initial entities. - Updated `GraphView.tsx` to display appropriate messages based on the graph status. - Modified `useGraph.ts` to include a new `GraphStatus` type and manage graph loading states more effectively. --- .claude/settings.json | 14 -- internal/api/handlers.go | 2 +- ui/dist/assets/index-Bn6RzH4k.css | 1 - ui/dist/assets/index-CqR1egPu.js | 234 --------------------------- ui/dist/index.html | 15 -- ui/package-lock.json | 13 -- ui/src/App.tsx | 20 ++- ui/src/components/docs/GraphView.tsx | 14 +- ui/src/hooks/useGraph.ts | 52 +++--- 9 files changed, 61 insertions(+), 304 deletions(-) delete mode 100644 .claude/settings.json delete mode 100644 ui/dist/assets/index-Bn6RzH4k.css delete mode 100644 ui/dist/assets/index-CqR1egPu.js delete mode 100644 ui/dist/index.html diff --git a/.claude/settings.json b/.claude/settings.json deleted file mode 100644 index 0bfa2c2..0000000 --- a/.claude/settings.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "hooks": { - "Stop": [ - { - "hooks": [ - { - "type": "prompt", - "prompt": "Check if the work done in this session introduced changes that should be reflected in CLAUDE.md or README.md. Specifically check: (1) Were any new dependencies added or removed? (2) Were any architectural changes made (new packages, changed interfaces, removed components)? (3) Were any supported features, file types, or providers changed? (4) Were any new CLI commands or API endpoints added? If ANY of these apply and the relevant doc file was NOT already updated in this session, output JSON: {\"decision\": \"block\", \"reason\": \"CLAUDE.md and/or README.md may need updating to reflect the changes made in this session. Please review and update if needed.\"}. If docs are already up to date or no doc-worthy changes were made, output nothing.", - } - ] - } - ] - } -} diff --git a/internal/api/handlers.go b/internal/api/handlers.go index 4dc29b2..784bbbf 100644 --- a/internal/api/handlers.go +++ b/internal/api/handlers.go @@ -168,7 +168,7 @@ func (h *handlers) graphNeighborhood(w http.ResponseWriter, r *http.Request) { return } if entity == nil { - writeJSON(w, 200, map[string]any{"nodes": []any{}, "edges": []any{}}) + writeJSON(w, 404, map[string]any{"error": "entity not found", "nodes": []any{}, "edges": []any{}}) return } diff --git a/ui/dist/assets/index-Bn6RzH4k.css b/ui/dist/assets/index-Bn6RzH4k.css deleted file mode 100644 index 67d7a71..0000000 --- a/ui/dist/assets/index-Bn6RzH4k.css +++ /dev/null @@ -1 +0,0 @@ -*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:root,[data-theme=dark]{--bg-base: #000;--bg-nav: #0a0a0a;--bg-panel: #0f0f0f;--bg-card: #0a0a0a;--bg-input: #050505;--border: #1f1f1f;--border-hover: #2a2a2a;--border-strong: #333;--text-primary: #fff;--text-secondary: #ccc;--text-muted: #666;--text-dim: #444;--text-faint: #333;--nav-active-bg: #1a1a1a;--nav-active-border: #2a2a2a;--nav-active-text: #fff;--nav-inactive-text: #666;--color-accent: #38bdf8;--color-accent-hover: #0ea5e9;--accent-error: #ff4444;--color-warn: #fb923c;--color-success: #4ade80;--code-bg: #050505;--code-text: #ccc;--syntax-key: #93c5fd;--syntax-str: #86efac;--syntax-bool: #fcd34d;--syntax-null: #94a3b8;--syntax-num: #67e8f9;--accent-glow: rgba(56, 189, 248, .2)}[data-theme=light]{--bg-base: #f5f5f5;--bg-nav: #fff;--bg-panel: #fff;--bg-card: #f0f0f0;--bg-input: #f8f8f8;--border: #e5e5e5;--border-hover: #d0d0d0;--border-strong: #bbb;--text-primary: #111;--text-secondary: #333;--text-muted: #777;--text-dim: #aaa;--text-faint: #bbb;--nav-active-bg: #ebebeb;--nav-active-border: #d0d0d0;--nav-active-text: #111;--nav-inactive-text: #777;--color-accent: #0ea5e9;--color-accent-hover: #0284c7;--accent-error: #cc2222;--color-warn: #ea580c;--color-success: #16a34a;--code-bg: #0a0a0a;--code-text: #ccc;--syntax-key: #93c5fd;--syntax-str: #86efac;--syntax-bool: #fcd34d;--syntax-null: #94a3b8;--syntax-num: #67e8f9;--accent-glow: rgba(14, 165, 233, .2)}[data-theme=dark] .icon-sun{display:flex}[data-theme=dark] .icon-moon,[data-theme=light] .icon-sun{display:none}[data-theme=light] .icon-moon{display:flex}[data-radix-popper-content-wrapper]{z-index:100!important}html,body{height:100%;overflow:hidden;background:var(--bg-base);color:var(--text-primary);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:16px}#root{height:100%;display:flex;flex-direction:column}::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-track{background:var(--bg-base)}::-webkit-scrollbar-thumb{background:var(--border-hover);border-radius:3px}::-webkit-scrollbar-thumb:hover{background:var(--border-strong)}code{background:var(--bg-card);padding:1px 5px;border-radius:3px;color:var(--text-secondary);font-family:SF Mono,ui-monospace,monospace}.top-nav{height:48px;flex-shrink:0;background:var(--bg-nav);border-bottom:1px solid var(--border);display:flex;align-items:center;padding:0 1rem;gap:.25rem;position:relative;z-index:10;overflow-x:auto}.top-nav::-webkit-scrollbar{height:0}.logo{display:flex;align-items:center;gap:.5rem;padding-right:1rem;margin-right:.25rem;border-right:1px solid var(--border);text-decoration:none;color:inherit;flex-shrink:0}.logo-mark{font-size:.7rem;font-weight:700;letter-spacing:.12em;color:var(--text-primary)}.logo-ver{font-size:.6rem;color:var(--text-faint);letter-spacing:.02em;margin-left:2px;font-family:ui-monospace,monospace}.nav-link{display:flex;align-items:center;gap:.35rem;padding:.3rem .7rem;border-radius:6px;font-size:.78rem;font-weight:500;cursor:pointer;border:1px solid transparent;color:var(--nav-inactive-text);background:none;text-decoration:none;transition:all .15s;flex-shrink:0;font-family:inherit}.nav-link:hover{color:var(--text-secondary);background:var(--nav-active-bg)}.nav-link.active{color:var(--nav-active-text);background:var(--nav-active-bg);border-color:var(--nav-active-border)}.theme-btn{width:32px;height:32px;border-radius:6px;margin-left:.25rem;background:none;display:flex;align-items:center;justify-content:center;color:var(--text-dim);border:1px solid var(--border);cursor:pointer;transition:all .15s}.theme-btn:hover{border-color:var(--border-hover);color:var(--text-muted)}.status-bar{height:24px;display:flex;align-items:center;gap:14px;padding:0 18px;background:var(--bg-nav);border-top:1px solid var(--border);font-size:10px;color:var(--text-muted);flex-shrink:0}.status-item{display:flex;align-items:center;gap:4px}.status-key{padding:0 4px;background:var(--bg-card);border:1px solid var(--border);border-radius:3px;font-size:9px;font-weight:600;color:var(--text-secondary);font-family:SF Mono,ui-monospace,monospace}.main-content{flex:1;overflow:hidden;display:flex;flex-direction:column;background:var(--bg-base)}.card{background:var(--bg-panel);border:1px solid var(--border);border-radius:10px;padding:1rem;transition:border-color .15s}.card:hover{border-color:var(--border-hover)}.badge{display:inline-flex;align-items:center;padding:.15rem .5rem;border-radius:5px;font-size:.62rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;background:var(--bg-card);border:1px solid var(--border);color:var(--text-dim)}.badge-green{background:#064e3b;border-color:#10b981;color:#6ee7b7}.badge-blue{background:#0c4a6e;border-color:var(--syntax-num);color:#a5f3fc}.badge-purple{background:#1e1b4b;border-color:var(--syntax-key);color:#c7d7fe}.badge-orange{background:#451a03;border-color:var(--color-warn);color:#fed7aa}.search-bar{display:flex;align-items:center;gap:.5rem;padding:.75rem 1.25rem;border-bottom:1px solid var(--border);background:var(--bg-nav);flex-shrink:0}.search-wrap{position:relative;flex:1;max-width:600px}.search-wrap svg{position:absolute;left:9px;top:50%;transform:translateY(-50%);opacity:.4;pointer-events:none}.search-input{width:100%;background:var(--bg-input);color:var(--text-primary);border:1px solid var(--border);border-radius:8px;padding:6px 10px 6px 30px;font-family:SF Mono,ui-monospace,monospace;font-size:12px;outline:none;transition:border-color .2s,box-shadow .2s}.search-input:focus{border-color:var(--color-accent);box-shadow:0 0 0 3px var(--accent-glow)}.search-input::placeholder{color:var(--text-muted)}.mode-pill{padding:.3rem .75rem;border-radius:6px;font-size:.75rem;font-weight:600;cursor:pointer;border:1px solid var(--border);background:none;color:var(--text-muted);transition:all .15s;font-family:inherit}.mode-pill.active{background:var(--nav-active-bg);border-color:var(--color-accent);color:var(--color-accent)}.mode-pill:hover:not(.active){background:var(--nav-active-bg);color:var(--text-secondary)}.mcp-view{flex:1;display:flex;flex-direction:column;overflow:hidden;background:var(--bg-base)}.mc-status-bar{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;padding:.6rem 1.25rem;flex-shrink:0;background:var(--bg-panel);border-bottom:1px solid var(--border)}.mc-badge{font-size:.65rem;font-weight:600;padding:.2rem .55rem;border-radius:4px;font-family:ui-monospace,monospace;letter-spacing:.08em;background:var(--bg-card);color:var(--text-dim);border:1px solid var(--border)}.mc-btn-icon{display:flex;align-items:center;gap:.3rem;height:30px;border-radius:6px;border:1px solid var(--border);background:var(--bg-card);color:var(--text-dim);cursor:pointer;transition:all .15s;padding:0 .6rem;font-size:.72rem;font-family:inherit}.mc-btn-icon:hover{border-color:var(--border-hover);color:var(--text-muted)}.mc-tool-card{background:var(--bg-panel);border:1px solid var(--border);border-radius:10px;padding:.9rem;position:relative;overflow:hidden;transition:border-color .15s,box-shadow .15s;display:flex;flex-direction:column}.mc-tool-card:hover{border-color:var(--border-hover);box-shadow:0 0 12px #ffffff08}.mc-param-tag{font-family:ui-monospace,monospace;font-size:.62rem;padding:.12rem .35rem;border-radius:4px;background:var(--bg-card);border:1px solid var(--border)}.mc-param-req{border-color:var(--border-hover);color:var(--text-secondary)}.mc-param-opt{color:var(--text-dim)}.mc-btn-call{font-size:.7rem;padding:.3rem .7rem;border-radius:6px;background:var(--bg-card);color:var(--text-secondary);border:1px solid var(--border-hover);cursor:pointer;font-weight:600;transition:background .12s;font-family:inherit}.mc-btn-call:hover{background:var(--bg-panel);color:var(--text-primary);border-color:var(--border-strong)}.mc-btn-rpc{font-family:ui-monospace,monospace;font-size:.7rem;padding:.3rem .7rem;border-radius:6px;background:var(--bg-card);color:var(--text-muted);border:1px solid var(--border);cursor:pointer;font-weight:600;transition:background .12s}.mc-btn-rpc:hover{background:var(--bg-panel);color:var(--text-secondary)}.mc-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:40;background:#000000bf;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.mc-modal{position:relative;border-radius:14px;border:1px solid var(--border-hover);background:var(--bg-panel);box-shadow:0 24px 64px #0009}.mc-code{background:#050505;color:var(--code-text);border:1px solid var(--border);border-radius:8px;font-family:ui-monospace,monospace;font-size:.75rem}.mc-textarea{width:100%;background:#050505;color:#86efac;border:1px solid var(--border);border-radius:8px;font-family:ui-monospace,monospace;font-size:.74rem;padding:.6rem .75rem;resize:none;outline:none;transition:border-color .15s}.mc-textarea:focus{border-color:var(--border-hover)}.mc-send-btn{width:100%;padding:.6rem;font-size:.82rem;font-weight:700;border-radius:8px;background:var(--text-primary);color:var(--bg-base);border:none;cursor:pointer;transition:opacity .15s;font-family:inherit}.mc-send-btn:hover{opacity:.85}.mc-send-btn:disabled{opacity:.4;cursor:not-allowed}.mc-copy-btn{display:flex;align-items:center;gap:.35rem;font-size:.72rem;padding:.25rem .6rem;border-radius:5px;background:var(--bg-card);color:var(--text-muted);border:1px solid var(--border);cursor:pointer;transition:all .12s;font-family:inherit}.mc-copy-btn:hover{color:var(--text-secondary);border-color:var(--border-hover)}[data-radix-tabs-trigger][data-state=active]{color:var(--text-primary)!important;border-bottom-color:var(--color-accent)!important}[data-radix-tabs-trigger]{outline:none}[data-radix-tabs-trigger]:focus-visible{box-shadow:inset 0 0 0 2px var(--color-accent)}@keyframes mc-ping{75%,to{transform:scale(2);opacity:0}}.stats{display:flex;align-items:center;gap:.5rem;flex-shrink:0}.stat{display:flex;flex-direction:column;justify-content:center;min-width:72px;padding:.35rem .55rem;border:1px solid var(--border);border-radius:8px;background:var(--bg-card)}.stat-val{font-size:.85rem;font-weight:700;line-height:1;color:var(--text-primary)}.stat-lbl{margin-top:.18rem;font-size:.62rem;text-transform:uppercase;letter-spacing:.08em;color:var(--text-dim)} diff --git a/ui/dist/assets/index-CqR1egPu.js b/ui/dist/assets/index-CqR1egPu.js deleted file mode 100644 index bf9abae..0000000 --- a/ui/dist/assets/index-CqR1egPu.js +++ /dev/null @@ -1,234 +0,0 @@ -function h0(i,s){for(var o=0;or[m]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))r(m);new MutationObserver(m=>{for(const v of m)if(v.type==="childList")for(const S of v.addedNodes)S.tagName==="LINK"&&S.rel==="modulepreload"&&r(S)}).observe(document,{childList:!0,subtree:!0});function o(m){const v={};return m.integrity&&(v.integrity=m.integrity),m.referrerPolicy&&(v.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?v.credentials="include":m.crossOrigin==="anonymous"?v.credentials="omit":v.credentials="same-origin",v}function r(m){if(m.ep)return;m.ep=!0;const v=o(m);fetch(m.href,v)}})();function Bm(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Br={exports:{}},Un={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var fm;function y0(){if(fm)return Un;fm=1;var i=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function o(r,m,v){var S=null;if(v!==void 0&&(S=""+v),m.key!==void 0&&(S=""+m.key),"key"in m){v={};for(var p in m)p!=="key"&&(v[p]=m[p])}else v=m;return m=v.ref,{$$typeof:i,type:r,key:S,ref:m!==void 0?m:null,props:v}}return Un.Fragment=s,Un.jsx=o,Un.jsxs=o,Un}var dm;function g0(){return dm||(dm=1,Br.exports=y0()),Br.exports}var d=g0(),qr={exports:{}},ee={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var mm;function p0(){if(mm)return ee;mm=1;var i=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),S=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),A=Symbol.for("react.activity"),M=Symbol.iterator;function N(x){return x===null||typeof x!="object"?null:(x=M&&x[M]||x["@@iterator"],typeof x=="function"?x:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,L={};function Y(x,q,Q){this.props=x,this.context=q,this.refs=L,this.updater=Q||w}Y.prototype.isReactComponent={},Y.prototype.setState=function(x,q){if(typeof x!="object"&&typeof x!="function"&&x!=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,x,q,"setState")},Y.prototype.forceUpdate=function(x){this.updater.enqueueForceUpdate(this,x,"forceUpdate")};function K(){}K.prototype=Y.prototype;function V(x,q,Q){this.props=x,this.context=q,this.refs=L,this.updater=Q||w}var W=V.prototype=new K;W.constructor=V,R(W,Y.prototype),W.isPureReactComponent=!0;var ae=Array.isArray;function F(){}var X={H:null,A:null,T:null,S:null},ue=Object.prototype.hasOwnProperty;function Ce(x,q,Q){var J=Q.ref;return{$$typeof:i,type:x,key:q,ref:J!==void 0?J:null,props:Q}}function Ve(x,q){return Ce(x.type,q,x.props)}function _e(x){return typeof x=="object"&&x!==null&&x.$$typeof===i}function De(x){var q={"=":"=0",":":"=2"};return"$"+x.replace(/[=:]/g,function(Q){return q[Q]})}var Ge=/\/+/g;function St(x,q){return typeof x=="object"&&x!==null&&x.key!=null?De(""+x.key):q.toString(36)}function $e(x){switch(x.status){case"fulfilled":return x.value;case"rejected":throw x.reason;default:switch(typeof x.status=="string"?x.then(F,F):(x.status="pending",x.then(function(q){x.status==="pending"&&(x.status="fulfilled",x.value=q)},function(q){x.status==="pending"&&(x.status="rejected",x.reason=q)})),x.status){case"fulfilled":return x.value;case"rejected":throw x.reason}}throw x}function _(x,q,Q,J,te){var ie=typeof x;(ie==="undefined"||ie==="boolean")&&(x=null);var he=!1;if(x===null)he=!0;else switch(ie){case"bigint":case"string":case"number":he=!0;break;case"object":switch(x.$$typeof){case i:case s:he=!0;break;case j:return he=x._init,_(he(x._payload),q,Q,J,te)}}if(he)return te=te(x),he=J===""?"."+St(x,0):J,ae(te)?(Q="",he!=null&&(Q=he.replace(Ge,"$&/")+"/"),_(te,q,Q,"",function(Ya){return Ya})):te!=null&&(_e(te)&&(te=Ve(te,Q+(te.key==null||x&&x.key===te.key?"":(""+te.key).replace(Ge,"$&/")+"/")+he)),q.push(te)),1;he=0;var Pe=J===""?".":J+":";if(ae(x))for(var Re=0;Re>>1,Ee=_[pe];if(0>>1;pem(Q,P))Jm(te,Q)?(_[pe]=te,_[J]=P,pe=J):(_[pe]=Q,_[q]=P,pe=q);else if(Jm(te,P))_[pe]=te,_[J]=P,pe=J;else break e}}return G}function m(_,G){var P=_.sortIndex-G.sortIndex;return P!==0?P:_.id-G.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var v=performance;i.unstable_now=function(){return v.now()}}else{var S=Date,p=S.now();i.unstable_now=function(){return S.now()-p}}var T=[],h=[],j=1,A=null,M=3,N=!1,w=!1,R=!1,L=!1,Y=typeof setTimeout=="function"?setTimeout:null,K=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function W(_){for(var G=o(h);G!==null;){if(G.callback===null)r(h);else if(G.startTime<=_)r(h),G.sortIndex=G.expirationTime,s(T,G);else break;G=o(h)}}function ae(_){if(R=!1,W(_),!w)if(o(T)!==null)w=!0,F||(F=!0,De());else{var G=o(h);G!==null&&$e(ae,G.startTime-_)}}var F=!1,X=-1,ue=5,Ce=-1;function Ve(){return L?!0:!(i.unstable_now()-Ce_&&Ve());){var pe=A.callback;if(typeof pe=="function"){A.callback=null,M=A.priorityLevel;var Ee=pe(A.expirationTime<=_);if(_=i.unstable_now(),typeof Ee=="function"){A.callback=Ee,W(_),G=!0;break t}A===o(T)&&r(T),W(_)}else r(T);A=o(T)}if(A!==null)G=!0;else{var x=o(h);x!==null&&$e(ae,x.startTime-_),G=!1}}break e}finally{A=null,M=P,N=!1}G=void 0}}finally{G?De():F=!1}}}var De;if(typeof V=="function")De=function(){V(_e)};else if(typeof MessageChannel<"u"){var Ge=new MessageChannel,St=Ge.port2;Ge.port1.onmessage=_e,De=function(){St.postMessage(null)}}else De=function(){Y(_e,0)};function $e(_,G){X=Y(function(){_(i.unstable_now())},G)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(_){_.callback=null},i.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ue=0<_?Math.floor(1e3/_):5},i.unstable_getCurrentPriorityLevel=function(){return M},i.unstable_next=function(_){switch(M){case 1:case 2:case 3:var G=3;break;default:G=M}var P=M;M=G;try{return _()}finally{M=P}},i.unstable_requestPaint=function(){L=!0},i.unstable_runWithPriority=function(_,G){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var P=M;M=_;try{return G()}finally{M=P}},i.unstable_scheduleCallback=function(_,G,P){var pe=i.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0pe?(_.sortIndex=P,s(h,_),o(T)===null&&_===o(h)&&(R?(K(X),X=-1):R=!0,$e(ae,P-pe))):(_.sortIndex=Ee,s(T,_),w||N||(w=!0,F||(F=!0,De()))),_},i.unstable_shouldYield=Ve,i.unstable_wrapCallback=function(_){var G=M;return function(){var P=M;M=G;try{return _.apply(this,arguments)}finally{M=P}}}})(Yr)),Yr}var ym;function b0(){return ym||(ym=1,wr.exports=S0()),wr.exports}var Gr={exports:{}},Ie={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var gm;function x0(){if(gm)return Ie;gm=1;var i=ts();function s(T){var h="https://react.dev/errors/"+T;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(s){console.error(s)}}return i(),Gr.exports=x0(),Gr.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Sm;function E0(){if(Sm)return Hn;Sm=1;var i=b0(),s=ts(),o=Lm();function r(e){var t="https://react.dev/errors/"+e;if(1Ee||(e.current=pe[Ee],pe[Ee]=null,Ee--)}function Q(e,t){Ee++,pe[Ee]=e.current,e.current=t}var J=x(null),te=x(null),ie=x(null),he=x(null);function Pe(e,t){switch(Q(ie,t),Q(te,e),Q(J,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Hd(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}q(J),Q(J,e)}function Re(){q(J),q(te),q(ie)}function Ya(e){e.memoizedState!==null&&Q(he,e);var t=J.current,l=Hd(t,e.type);t!==l&&(Q(te,e),Q(J,l))}function Yn(e){te.current===e&&(q(J),q(te)),he.current===e&&(q(he),Nn._currentValue=P)}var pi,rs;function _l(e){if(pi===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);pi=t&&t[1]||"",rs=-1)":-1n||g[a]!==C[n]){var U=` -`+g[a].replace(" at new "," at ");return e.displayName&&U.includes("")&&(U=U.replace("",e.displayName)),U}while(1<=a&&0<=n);break}}}finally{Si=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?_l(l):""}function Kv(e,t){switch(e.tag){case 26:case 27:case 5:return _l(e.type);case 16:return _l("Lazy");case 13:return e.child!==t&&t!==null?_l("Suspense Fallback"):_l("Suspense");case 19:return _l("SuspenseList");case 0:case 15:return bi(e.type,!1);case 11:return bi(e.type.render,!1);case 1:return bi(e.type,!0);case 31:return _l("Activity");default:return""}}function ss(e){try{var t="",l=null;do t+=Kv(e,l),l=e,e=e.return;while(e);return t}catch(a){return` -Error generating stack: `+a.message+` -`+a.stack}}var xi=Object.prototype.hasOwnProperty,Ei=i.unstable_scheduleCallback,Ti=i.unstable_cancelCallback,Jv=i.unstable_shouldYield,kv=i.unstable_requestPaint,st=i.unstable_now,Wv=i.unstable_getCurrentPriorityLevel,os=i.unstable_ImmediatePriority,fs=i.unstable_UserBlockingPriority,Gn=i.unstable_NormalPriority,Fv=i.unstable_LowPriority,ds=i.unstable_IdlePriority,$v=i.log,Iv=i.unstable_setDisableYieldValue,Ga=null,ot=null;function nl(e){if(typeof $v=="function"&&Iv(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(Ga,e)}catch{}}var ft=Math.clz32?Math.clz32:th,Pv=Math.log,eh=Math.LN2;function th(e){return e>>>=0,e===0?32:31-(Pv(e)/eh|0)|0}var Xn=256,Qn=262144,Vn=4194304;function Dl(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Zn(e,t,l){var a=e.pendingLanes;if(a===0)return 0;var n=0,u=e.suspendedLanes,c=e.pingedLanes;e=e.warmLanes;var f=a&134217727;return f!==0?(a=f&~u,a!==0?n=Dl(a):(c&=f,c!==0?n=Dl(c):l||(l=f&~e,l!==0&&(n=Dl(l))))):(f=a&~u,f!==0?n=Dl(f):c!==0?n=Dl(c):l||(l=a&~e,l!==0&&(n=Dl(l)))),n===0?0:t!==0&&t!==n&&(t&u)===0&&(u=n&-n,l=t&-t,u>=l||u===32&&(l&4194048)!==0)?t:n}function Xa(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function lh(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 ms(){var e=Vn;return Vn<<=1,(Vn&62914560)===0&&(Vn=4194304),e}function Ai(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Qa(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ah(e,t,l,a,n,u){var c=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var f=e.entanglements,g=e.expirationTimes,C=e.hiddenUpdates;for(l=c&~l;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var sh=/[\n"\\]/g;function xt(e){return e.replace(sh,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ni(e,t,l,a,n,u,c,f){e.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?e.type=c:e.removeAttribute("type"),t!=null?c==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+bt(t)):e.value!==""+bt(t)&&(e.value=""+bt(t)):c!=="submit"&&c!=="reset"||e.removeAttribute("value"),t!=null?_i(e,c,bt(t)):l!=null?_i(e,c,bt(l)):a!=null&&e.removeAttribute("value"),n==null&&u!=null&&(e.defaultChecked=!!u),n!=null&&(e.checked=n&&typeof n!="function"&&typeof n!="symbol"),f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.name=""+bt(f):e.removeAttribute("name")}function Cs(e,t,l,a,n,u,c,f){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||l!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Oi(e);return}l=l!=null?""+bt(l):"",t=t!=null?""+bt(t):l,f||t===e.value||(e.value=t),e.defaultValue=t}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=f?e.checked:!!a,e.defaultChecked=!!a,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.name=c),Oi(e)}function _i(e,t,l){t==="number"&&kn(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function la(e,t,l,a){if(e=e.options,t){t={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bi=!1;if(Xt)try{var Ja={};Object.defineProperty(Ja,"passive",{get:function(){Bi=!0}}),window.addEventListener("test",Ja,Ja),window.removeEventListener("test",Ja,Ja)}catch{Bi=!1}var il=null,qi=null,Fn=null;function Rs(){if(Fn)return Fn;var e,t=qi,l=t.length,a,n="value"in il?il.value:il.textContent,u=n.length;for(e=0;e=Fa),ws=" ",Ys=!1;function Gs(e,t){switch(e){case"keyup":return qh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xs(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ia=!1;function wh(e,t){switch(e){case"compositionend":return Xs(t);case"keypress":return t.which!==32?null:(Ys=!0,ws);case"textInput":return e=t.data,e===ws&&Ys?null:e;default:return null}}function Yh(e,t){if(ia)return e==="compositionend"||!Xi&&Gs(e,t)?(e=Rs(),Fn=qi=il=null,ia=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:l,offset:t-e};e=a}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Fs(l)}}function Is(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Is(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ps(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=kn(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=kn(e.document)}return t}function Zi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var kh=Xt&&"documentMode"in document&&11>=document.documentMode,ca=null,Ki=null,en=null,Ji=!1;function eo(e,t,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ji||ca==null||ca!==kn(a)||(a=ca,"selectionStart"in a&&Zi(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}),en&&Pa(en,a)||(en=a,a=Qu(Ki,"onSelect"),0>=c,n-=c,Ut=1<<32-ft(t)+n|l<ne?(oe=k,k=null):oe=k.sibling;var me=O(E,k,z[ne],H);if(me===null){k===null&&(k=oe);break}e&&k&&me.alternate===null&&t(E,k),b=u(me,b,ne),de===null?$=me:de.sibling=me,de=me,k=oe}if(ne===z.length)return l(E,k),fe&&Vt(E,ne),$;if(k===null){for(;nene?(oe=k,k=null):oe=k.sibling;var Ml=O(E,k,me.value,H);if(Ml===null){k===null&&(k=oe);break}e&&k&&Ml.alternate===null&&t(E,k),b=u(Ml,b,ne),de===null?$=Ml:de.sibling=Ml,de=Ml,k=oe}if(me.done)return l(E,k),fe&&Vt(E,ne),$;if(k===null){for(;!me.done;ne++,me=z.next())me=B(E,me.value,H),me!==null&&(b=u(me,b,ne),de===null?$=me:de.sibling=me,de=me);return fe&&Vt(E,ne),$}for(k=a(k);!me.done;ne++,me=z.next())me=D(k,E,ne,me.value,H),me!==null&&(e&&me.alternate!==null&&k.delete(me.key===null?ne:me.key),b=u(me,b,ne),de===null?$=me:de.sibling=me,de=me);return e&&k.forEach(function(v0){return t(E,v0)}),fe&&Vt(E,ne),$}function xe(E,b,z,H){if(typeof z=="object"&&z!==null&&z.type===R&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case N:e:{for(var $=z.key;b!==null;){if(b.key===$){if($=z.type,$===R){if(b.tag===7){l(E,b.sibling),H=n(b,z.props.children),H.return=E,E=H;break e}}else if(b.elementType===$||typeof $=="object"&&$!==null&&$.$$typeof===ue&&Ql($)===b.type){l(E,b.sibling),H=n(b,z.props),cn(H,z),H.return=E,E=H;break e}l(E,b);break}else t(E,b);b=b.sibling}z.type===R?(H=Ll(z.props.children,E.mode,H,z.key),H.return=E,E=H):(H=iu(z.type,z.key,z.props,null,E.mode,H),cn(H,z),H.return=E,E=H)}return c(E);case w:e:{for($=z.key;b!==null;){if(b.key===$)if(b.tag===4&&b.stateNode.containerInfo===z.containerInfo&&b.stateNode.implementation===z.implementation){l(E,b.sibling),H=n(b,z.children||[]),H.return=E,E=H;break e}else{l(E,b);break}else t(E,b);b=b.sibling}H=ec(z,E.mode,H),H.return=E,E=H}return c(E);case ue:return z=Ql(z),xe(E,b,z,H)}if($e(z))return Z(E,b,z,H);if(De(z)){if($=De(z),typeof $!="function")throw Error(r(150));return z=$.call(z),I(E,b,z,H)}if(typeof z.then=="function")return xe(E,b,mu(z),H);if(z.$$typeof===V)return xe(E,b,su(E,z),H);vu(E,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,b!==null&&b.tag===6?(l(E,b.sibling),H=n(b,z),H.return=E,E=H):(l(E,b),H=Pi(z,E.mode,H),H.return=E,E=H),c(E)):l(E,b)}return function(E,b,z,H){try{un=0;var $=xe(E,b,z,H);return pa=null,$}catch(k){if(k===ga||k===fu)throw k;var de=mt(29,k,null,E.mode);return de.lanes=H,de.return=E,de}finally{}}}var Zl=Ao(!0),zo=Ao(!1),fl=!1;function dc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function mc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function dl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ml(e,t,l){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(ve&2)!==0){var n=a.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),a.pending=t,t=uu(e),co(e,null,l),t}return nu(e,a,t,l),uu(e)}function rn(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,hs(e,l)}}function vc(e,t){var l=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,l===a)){var n=null,u=null;if(l=l.firstBaseUpdate,l!==null){do{var c={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};u===null?n=u=c:u=u.next=c,l=l.next}while(l!==null);u===null?n=u=t:u=u.next=t}else n=u=t;l={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var hc=!1;function sn(){if(hc){var e=ya;if(e!==null)throw e}}function on(e,t,l,a){hc=!1;var n=e.updateQueue;fl=!1;var u=n.firstBaseUpdate,c=n.lastBaseUpdate,f=n.shared.pending;if(f!==null){n.shared.pending=null;var g=f,C=g.next;g.next=null,c===null?u=C:c.next=C,c=g;var U=e.alternate;U!==null&&(U=U.updateQueue,f=U.lastBaseUpdate,f!==c&&(f===null?U.firstBaseUpdate=C:f.next=C,U.lastBaseUpdate=g))}if(u!==null){var B=n.baseState;c=0,U=C=g=null,f=u;do{var O=f.lane&-536870913,D=O!==f.lane;if(D?(se&O)===O:(a&O)===O){O!==0&&O===ha&&(hc=!0),U!==null&&(U=U.next={lane:0,tag:f.tag,payload:f.payload,callback:null,next:null});e:{var Z=e,I=f;O=t;var xe=l;switch(I.tag){case 1:if(Z=I.payload,typeof Z=="function"){B=Z.call(xe,B,O);break e}B=Z;break e;case 3:Z.flags=Z.flags&-65537|128;case 0:if(Z=I.payload,O=typeof Z=="function"?Z.call(xe,B,O):Z,O==null)break e;B=A({},B,O);break e;case 2:fl=!0}}O=f.callback,O!==null&&(e.flags|=64,D&&(e.flags|=8192),D=n.callbacks,D===null?n.callbacks=[O]:D.push(O))}else D={lane:O,tag:f.tag,payload:f.payload,callback:f.callback,next:null},U===null?(C=U=D,g=B):U=U.next=D,c|=O;if(f=f.next,f===null){if(f=n.shared.pending,f===null)break;D=f,f=D.next,D.next=null,n.lastBaseUpdate=D,n.shared.pending=null}}while(!0);U===null&&(g=B),n.baseState=g,n.firstBaseUpdate=C,n.lastBaseUpdate=U,u===null&&(n.shared.lanes=0),pl|=c,e.lanes=c,e.memoizedState=B}}function Co(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function jo(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;eu?u:8;var c=_.T,f={};_.T=f,Uc(e,!1,t,l);try{var g=n(),C=_.S;if(C!==null&&C(f,g),g!==null&&typeof g=="object"&&typeof g.then=="function"){var U=ay(g,a);mn(e,t,U,pt(e))}else mn(e,t,a,pt(e))}catch(B){mn(e,t,{then:function(){},status:"rejected",reason:B},pt())}finally{G.p=u,c!==null&&f.types!==null&&(c.types=f.types),_.T=c}}function sy(){}function Dc(e,t,l,a){if(e.tag!==5)throw Error(r(476));var n=uf(e).queue;nf(e,n,t,P,l===null?sy:function(){return cf(e),l(a)})}function uf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kt,lastRenderedState:P},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kt,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function cf(e){var t=uf(e);t.next===null&&(t=e.alternate.memoizedState),mn(e,t.next.queue,{},pt())}function Rc(){return Je(Nn)}function rf(){return He().memoizedState}function sf(){return He().memoizedState}function oy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=pt();e=dl(l);var a=ml(t,e,l);a!==null&&(rt(a,t,l),rn(a,t,l)),t={cache:rc()},e.payload=t;return}t=t.return}}function fy(e,t,l){var a=pt();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Au(e)?ff(t,l):(l=$i(e,t,l,a),l!==null&&(rt(l,e,a),df(l,t,a)))}function of(e,t,l){var a=pt();mn(e,t,l,a)}function mn(e,t,l,a){var n={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Au(e))ff(t,n);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var c=t.lastRenderedState,f=u(c,l);if(n.hasEagerState=!0,n.eagerState=f,dt(f,c))return nu(e,t,n,0),Te===null&&au(),!1}catch{}finally{}if(l=$i(e,t,n,a),l!==null)return rt(l,e,a),df(l,t,a),!0}return!1}function Uc(e,t,l,a){if(a={lane:2,revertLane:dr(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Au(e)){if(t)throw Error(r(479))}else t=$i(e,l,a,2),t!==null&&rt(t,e,2)}function Au(e){var t=e.alternate;return e===le||t!==null&&t===le}function ff(e,t){ba=gu=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function df(e,t,l){if((l&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,hs(e,l)}}var vn={readContext:Je,use:bu,useCallback:Oe,useContext:Oe,useEffect:Oe,useImperativeHandle:Oe,useLayoutEffect:Oe,useInsertionEffect:Oe,useMemo:Oe,useReducer:Oe,useRef:Oe,useState:Oe,useDebugValue:Oe,useDeferredValue:Oe,useTransition:Oe,useSyncExternalStore:Oe,useId:Oe,useHostTransitionStatus:Oe,useFormState:Oe,useActionState:Oe,useOptimistic:Oe,useMemoCache:Oe,useCacheRefresh:Oe};vn.useEffectEvent=Oe;var mf={readContext:Je,use:bu,useCallback:function(e,t){return et().memoizedState=[e,t===void 0?null:t],e},useContext:Je,useEffect:Wo,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,Eu(4194308,4,Po.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Eu(4194308,4,e,t)},useInsertionEffect:function(e,t){Eu(4,2,e,t)},useMemo:function(e,t){var l=et();t=t===void 0?null:t;var a=e();if(Kl){nl(!0);try{e()}finally{nl(!1)}}return l.memoizedState=[a,t],a},useReducer:function(e,t,l){var a=et();if(l!==void 0){var n=l(t);if(Kl){nl(!0);try{l(t)}finally{nl(!1)}}}else n=t;return a.memoizedState=a.baseState=n,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=fy.bind(null,le,e),[a.memoizedState,e]},useRef:function(e){var t=et();return e={current:e},t.memoizedState=e},useState:function(e){e=jc(e);var t=e.queue,l=of.bind(null,le,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Nc,useDeferredValue:function(e,t){var l=et();return _c(l,e,t)},useTransition:function(){var e=jc(!1);return e=nf.bind(null,le,e.queue,!0,!1),et().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var a=le,n=et();if(fe){if(l===void 0)throw Error(r(407));l=l()}else{if(l=t(),Te===null)throw Error(r(349));(se&127)!==0||Ro(a,t,l)}n.memoizedState=l;var u={value:l,getSnapshot:t};return n.queue=u,Wo(Ho.bind(null,a,u,e),[e]),a.flags|=2048,Ea(9,{destroy:void 0},Uo.bind(null,a,u,l,t),null),l},useId:function(){var e=et(),t=Te.identifierPrefix;if(fe){var l=Ht,a=Ut;l=(a&~(1<<32-ft(a)-1)).toString(32)+l,t="_"+t+"R_"+l,l=pu++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?c.createElement("select",{is:a.is}):c.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?c.createElement(n,{is:a.is}):c.createElement(n)}}u[Ze]=t,u[lt]=a;e:for(c=t.child;c!==null;){if(c.tag===5||c.tag===6)u.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)break e;for(;c.sibling===null;){if(c.return===null||c.return===t)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}t.stateNode=u;e:switch(We(u,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Ft(t)}}return ze(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Ft(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(r(166));if(e=ie.current,ma(t)){if(e=t.stateNode,l=t.memoizedProps,a=null,n=Ke,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}e[Ze]=t,e=!!(e.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||Dd(e.nodeValue,l)),e||sl(t,!0)}else e=Vu(e).createTextNode(a),e[Ze]=t,t.stateNode=e}return ze(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(a=ma(t),l!==null){if(e===null){if(!a)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[Ze]=t}else wl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ze(t),e=!1}else l=nc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(ht(t),t):(ht(t),null);if((t.flags&128)!==0)throw Error(r(558))}return ze(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(n=ma(t),a!==null&&a.dehydrated!==null){if(e===null){if(!n)throw Error(r(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));n[Ze]=t}else wl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ze(t),n=!1}else n=nc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),n=!0;if(!n)return t.flags&256?(ht(t),t):(ht(t),null)}return ht(t),(t.flags&128)!==0?(t.lanes=l,t):(l=a!==null,e=e!==null&&e.memoizedState!==null,l&&(a=t.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!==e&&l&&(t.child.flags|=8192),Ou(t,t.updateQueue),ze(t),null);case 4:return Re(),e===null&&yr(t.stateNode.containerInfo),ze(t),null;case 10:return Kt(t.type),ze(t),null;case 19:if(q(Ue),a=t.memoizedState,a===null)return ze(t),null;if(n=(t.flags&128)!==0,u=a.rendering,u===null)if(n)yn(a,!1);else{if(Ne!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=yu(e),u!==null){for(t.flags|=128,yn(a,!1),e=u.updateQueue,t.updateQueue=e,Ou(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)ro(l,e),l=l.sibling;return Q(Ue,Ue.current&1|2),fe&&Vt(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&st()>Uu&&(t.flags|=128,n=!0,yn(a,!1),t.lanes=4194304)}else{if(!n)if(e=yu(u),e!==null){if(t.flags|=128,n=!0,e=e.updateQueue,t.updateQueue=e,Ou(t,e),yn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!fe)return ze(t),null}else 2*st()-a.renderingStartTime>Uu&&l!==536870912&&(t.flags|=128,n=!0,yn(a,!1),t.lanes=4194304);a.isBackwards?(u.sibling=t.child,t.child=u):(e=a.last,e!==null?e.sibling=u:t.child=u,a.last=u)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=st(),e.sibling=null,l=Ue.current,Q(Ue,n?l&1|2:l&1),fe&&Vt(t,a.treeForkCount),e):(ze(t),null);case 22:case 23:return ht(t),gc(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(l&536870912)!==0&&(t.flags&128)===0&&(ze(t),t.subtreeFlags&6&&(t.flags|=8192)):ze(t),l=t.updateQueue,l!==null&&Ou(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==l&&(t.flags|=2048),e!==null&&q(Xl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Kt(Be),ze(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function yy(e,t){switch(lc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kt(Be),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Yn(t),null;case 31:if(t.memoizedState!==null){if(ht(t),t.alternate===null)throw Error(r(340));wl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ht(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));wl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q(Ue),null;case 4:return Re(),null;case 10:return Kt(t.type),null;case 22:case 23:return ht(t),gc(),e!==null&&q(Xl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Kt(Be),null;case 25:return null;default:return null}}function qf(e,t){switch(lc(t),t.tag){case 3:Kt(Be),Re();break;case 26:case 27:case 5:Yn(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&ht(t);break;case 13:ht(t);break;case 19:q(Ue);break;case 10:Kt(t.type);break;case 22:case 23:ht(t),gc(),e!==null&&q(Xl);break;case 24:Kt(Be)}}function gn(e,t){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var n=a.next;l=n;do{if((l.tag&e)===e){a=void 0;var u=l.create,c=l.inst;a=u(),c.destroy=a}l=l.next}while(l!==n)}}catch(f){ge(t,t.return,f)}}function yl(e,t,l){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var u=n.next;a=u;do{if((a.tag&e)===e){var c=a.inst,f=c.destroy;if(f!==void 0){c.destroy=void 0,n=t;var g=l,C=f;try{C()}catch(U){ge(n,g,U)}}}a=a.next}while(a!==u)}}catch(U){ge(t,t.return,U)}}function Lf(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{jo(t,l)}catch(a){ge(e,e.return,a)}}}function wf(e,t,l){l.props=Jl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(a){ge(e,t,a)}}function pn(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof l=="function"?e.refCleanup=l(a):l.current=a}}catch(n){ge(e,t,n)}}function Bt(e,t){var l=e.ref,a=e.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(n){ge(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(n){ge(e,t,n)}else l.current=null}function Yf(e){var t=e.type,l=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&a.focus();break e;case"img":l.src?a.src=l.src:l.srcSet&&(a.srcset=l.srcSet)}}catch(n){ge(e,e.return,n)}}function Wc(e,t,l){try{var a=e.stateNode;Ly(a,e.type,l,t),a[lt]=t}catch(n){ge(e,e.return,n)}}function Gf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Tl(e.type)||e.tag===4}function Fc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Gf(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Tl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=Gt));else if(a!==4&&(a===27&&Tl(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,l),e=e.sibling;e!==null;)$c(e,t,l),e=e.sibling}function Nu(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(a!==4&&(a===27&&Tl(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Nu(e,t,l),e=e.sibling;e!==null;)Nu(e,t,l),e=e.sibling}function Xf(e){var t=e.stateNode,l=e.memoizedProps;try{for(var a=e.type,n=t.attributes;n.length;)t.removeAttributeNode(n[0]);We(t,a,l),t[Ze]=e,t[lt]=l}catch(u){ge(e,e.return,u)}}var $t=!1,we=!1,Ic=!1,Qf=typeof WeakSet=="function"?WeakSet:Set,Qe=null;function gy(e,t){if(e=e.containerInfo,Sr=$u,e=Ps(e),Zi(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.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 e}var c=0,f=-1,g=-1,C=0,U=0,B=e,O=null;t:for(;;){for(var D;B!==l||n!==0&&B.nodeType!==3||(f=c+n),B!==u||a!==0&&B.nodeType!==3||(g=c+a),B.nodeType===3&&(c+=B.nodeValue.length),(D=B.firstChild)!==null;)O=B,B=D;for(;;){if(B===e)break t;if(O===l&&++C===n&&(f=c),O===u&&++U===a&&(g=c),(D=B.nextSibling)!==null)break;B=O,O=B.parentNode}B=D}l=f===-1||g===-1?null:{start:f,end:g}}else l=null}l=l||{start:0,end:0}}else l=null;for(br={focusedElem:e,selectionRange:l},$u=!1,Qe=t;Qe!==null;)if(t=Qe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Qe=e;else for(;Qe!==null;){switch(t=Qe,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l title"))),We(u,a,l),u[Ze]=e,Xe(u),a=u;break e;case"link":var c=Wd("link","href",n).get(a+(l.href||""));if(c){for(var f=0;fxe&&(c=xe,xe=I,I=c);var E=$s(f,I),b=$s(f,xe);if(E&&b&&(D.rangeCount!==1||D.anchorNode!==E.node||D.anchorOffset!==E.offset||D.focusNode!==b.node||D.focusOffset!==b.offset)){var z=B.createRange();z.setStart(E.node,E.offset),D.removeAllRanges(),I>xe?(D.addRange(z),D.extend(b.node,b.offset)):(z.setEnd(b.node,b.offset),D.addRange(z))}}}}for(B=[],D=f;D=D.parentNode;)D.nodeType===1&&B.push({element:D,left:D.scrollLeft,top:D.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;fl?32:l,_.T=null,l=ur,ur=null;var u=bl,c=ll;if(Ye=0,ja=bl=null,ll=0,(ve&6)!==0)throw Error(r(331));var f=ve;if(ve|=4,ed(u.current),$f(u,u.current,c,l),ve=f,An(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(Ga,u)}catch{}return!0}finally{G.p=n,_.T=a,pd(e,t)}}function bd(e,t,l){t=Tt(l,t),t=Lc(e.stateNode,t,2),e=ml(e,t,2),e!==null&&(Qa(e,2),qt(e))}function ge(e,t,l){if(e.tag===3)bd(e,e,l);else for(;t!==null;){if(t.tag===3){bd(t,e,l);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Sl===null||!Sl.has(a))){e=Tt(l,e),l=xf(2),a=ml(t,l,2),a!==null&&(Ef(l,a,t,e),Qa(a,2),qt(a));break}}t=t.return}}function sr(e,t,l){var a=e.pingCache;if(a===null){a=e.pingCache=new by;var n=new Set;a.set(t,n)}else n=a.get(t),n===void 0&&(n=new Set,a.set(t,n));n.has(l)||(tr=!0,n.add(l),e=zy.bind(null,e,t,l),t.then(e,e))}function zy(e,t,l){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Te===e&&(se&l)===l&&(Ne===4||Ne===3&&(se&62914560)===se&&300>st()-Ru?(ve&2)===0&&Ma(e,0):lr|=l,Ca===se&&(Ca=0)),qt(e)}function xd(e,t){t===0&&(t=ms()),e=ql(e,t),e!==null&&(Qa(e,t),qt(e))}function Cy(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),xd(e,l)}function jy(e,t){var l=0;switch(e.tag){case 31:case 13:var a=e.stateNode,n=e.memoizedState;n!==null&&(l=n.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(r(314))}a!==null&&a.delete(t),xd(e,l)}function My(e,t){return Ei(e,t)}var Yu=null,Na=null,or=!1,Gu=!1,fr=!1,El=0;function qt(e){e!==Na&&e.next===null&&(Na===null?Yu=Na=e:Na=Na.next=e),Gu=!0,or||(or=!0,Ny())}function An(e,t){if(!fr&&Gu){fr=!0;do for(var l=!1,a=Yu;a!==null;){if(e!==0){var n=a.pendingLanes;if(n===0)var u=0;else{var c=a.suspendedLanes,f=a.pingedLanes;u=(1<<31-ft(42|e)+1)-1,u&=n&~(c&~f),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,zd(a,u))}else u=se,u=Zn(a,a===Te?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Xa(a,u)||(l=!0,zd(a,u));a=a.next}while(l);fr=!1}}function Oy(){Ed()}function Ed(){Gu=or=!1;var e=0;El!==0&&Yy()&&(e=El);for(var t=st(),l=null,a=Yu;a!==null;){var n=a.next,u=Td(a,t);u===0?(a.next=null,l===null?Yu=n:l.next=n,n===null&&(Na=l)):(l=a,(e!==0||(u&3)!==0)&&(Gu=!0)),a=n}Ye!==0&&Ye!==5||An(e),El!==0&&(El=0)}function Td(e,t){for(var l=e.suspendedLanes,a=e.pingedLanes,n=e.expirationTimes,u=e.pendingLanes&-62914561;0f)break;var U=g.transferSize,B=g.initiatorType;U&&Rd(B)&&(g=g.responseEnd,c+=U*(g"u"?null:document;function Zd(e,t,l){var a=_a;if(a&&typeof t=="string"&&t){var n=xt(t);n='link[rel="'+e+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),Vd.has(n)||(Vd.add(n),e={rel:e,crossOrigin:l,href:t},a.querySelector(n)===null&&(t=a.createElement("link"),We(t,"link",e),Xe(t),a.head.appendChild(t)))}}function Wy(e){al.D(e),Zd("dns-prefetch",e,null)}function Fy(e,t){al.C(e,t),Zd("preconnect",e,t)}function $y(e,t,l){al.L(e,t,l);var a=_a;if(a&&e&&t){var n='link[rel="preload"][as="'+xt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+xt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+xt(l.imageSizes)+'"]')):n+='[href="'+xt(e)+'"]';var u=n;switch(t){case"style":u=Da(e);break;case"script":u=Ra(e)}Ot.has(u)||(e=A({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Ot.set(u,e),a.querySelector(n)!==null||t==="style"&&a.querySelector(Mn(u))||t==="script"&&a.querySelector(On(u))||(t=a.createElement("link"),We(t,"link",e),Xe(t),a.head.appendChild(t)))}}function Iy(e,t){al.m(e,t);var l=_a;if(l&&e){var a=t&&typeof t.as=="string"?t.as:"script",n='link[rel="modulepreload"][as="'+xt(a)+'"][href="'+xt(e)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ra(e)}if(!Ot.has(u)&&(e=A({rel:"modulepreload",href:e},t),Ot.set(u,e),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(On(u)))return}a=l.createElement("link"),We(a,"link",e),Xe(a),l.head.appendChild(a)}}}function Py(e,t,l){al.S(e,t,l);var a=_a;if(a&&e){var n=ea(a).hoistableStyles,u=Da(e);t=t||"default";var c=n.get(u);if(!c){var f={loading:0,preload:null};if(c=a.querySelector(Mn(u)))f.loading=5;else{e=A({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Ot.get(u))&&jr(e,l);var g=c=a.createElement("link");Xe(g),We(g,"link",e),g._p=new Promise(function(C,U){g.onload=C,g.onerror=U}),g.addEventListener("load",function(){f.loading|=1}),g.addEventListener("error",function(){f.loading|=2}),f.loading|=4,Ku(c,t,a)}c={type:"stylesheet",instance:c,count:1,state:f},n.set(u,c)}}}function e0(e,t){al.X(e,t);var l=_a;if(l&&e){var a=ea(l).hoistableScripts,n=Ra(e),u=a.get(n);u||(u=l.querySelector(On(n)),u||(e=A({src:e,async:!0},t),(t=Ot.get(n))&&Mr(e,t),u=l.createElement("script"),Xe(u),We(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function t0(e,t){al.M(e,t);var l=_a;if(l&&e){var a=ea(l).hoistableScripts,n=Ra(e),u=a.get(n);u||(u=l.querySelector(On(n)),u||(e=A({src:e,async:!0,type:"module"},t),(t=Ot.get(n))&&Mr(e,t),u=l.createElement("script"),Xe(u),We(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function Kd(e,t,l,a){var n=(n=ie.current)?Zu(n):null;if(!n)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=Da(l.href),l=ea(n).hoistableStyles,a=l.get(t),a||(a={type:"style",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=Da(l.href);var u=ea(n).hoistableStyles,c=u.get(e);if(c||(n=n.ownerDocument||n,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,c),(u=n.querySelector(Mn(e)))&&!u._p&&(c.instance=u,c.state.loading=5),Ot.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ot.set(e,l),u||l0(n,e,l,c.state))),t&&a===null)throw Error(r(528,""));return c}if(t&&a!==null)throw Error(r(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ra(l),l=ea(n).hoistableScripts,a=l.get(t),a||(a={type:"script",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Da(e){return'href="'+xt(e)+'"'}function Mn(e){return'link[rel="stylesheet"]['+e+"]"}function Jd(e){return A({},e,{"data-precedence":e.precedence,precedence:null})}function l0(e,t,l,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),We(t,"link",l),Xe(t),e.head.appendChild(t))}function Ra(e){return'[src="'+xt(e)+'"]'}function On(e){return"script[async]"+e}function kd(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+xt(l.href)+'"]');if(a)return t.instance=a,Xe(a),a;var n=A({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Xe(a),We(a,"style",n),Ku(a,l.precedence,e),t.instance=a;case"stylesheet":n=Da(l.href);var u=e.querySelector(Mn(n));if(u)return t.state.loading|=4,t.instance=u,Xe(u),u;a=Jd(l),(n=Ot.get(n))&&jr(a,n),u=(e.ownerDocument||e).createElement("link"),Xe(u);var c=u;return c._p=new Promise(function(f,g){c.onload=f,c.onerror=g}),We(u,"link",a),t.state.loading|=4,Ku(u,l.precedence,e),t.instance=u;case"script":return u=Ra(l.src),(n=e.querySelector(On(u)))?(t.instance=n,Xe(n),n):(a=l,(n=Ot.get(u))&&(a=A({},l),Mr(a,n)),e=e.ownerDocument||e,n=e.createElement("script"),Xe(n),We(n,"link",a),e.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Ku(a,l.precedence,e));return t.instance}function Ku(e,t,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,u=n,c=0;c title"):null)}function a0(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function $d(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function n0(e,t,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=Da(a.href),u=t.querySelector(Mn(n));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ku.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=u,Xe(u);return}u=t.ownerDocument||t,a=Jd(a),(n=Ot.get(n))&&jr(a,n),u=u.createElement("link"),Xe(u);var c=u;c._p=new Promise(function(f,g){c.onload=f,c.onerror=g}),We(u,"link",a),l.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=ku.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Or=0;function u0(e,t){return e.stylesheets&&e.count===0&&Fu(e,e.stylesheets),0Or?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function ku(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Wu=null;function Fu(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Wu=new Map,t.forEach(i0,e),Wu=null,ku.call(e))}function i0(e,t){if(!(t.state.loading&4)){var l=Wu.get(e);if(l)var a=l.get(null);else{l=new Map,Wu.set(e,l);for(var n=e.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(s){console.error(s)}}return i(),Lr.exports=E0(),Lr.exports}var A0=T0();/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const z0=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wm=(...i)=>i.filter((s,o,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===o).join(" ").trim();/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var C0={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"};/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const j0=y.forwardRef(({color:i="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:m="",children:v,iconNode:S,...p},T)=>y.createElement("svg",{ref:T,...C0,width:s,height:s,stroke:i,strokeWidth:r?Number(o)*24/Number(s):o,className:wm("lucide",m),...p},[...S.map(([h,j])=>y.createElement(h,j)),...Array.isArray(v)?v:[v]]));/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Me=(i,s)=>{const o=y.forwardRef(({className:r,...m},v)=>y.createElement(j0,{ref:v,iconNode:s,className:wm(`lucide-${z0(i)}`,r),...m}));return o.displayName=`${i}`,o};/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const M0=Me("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ym=Me("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const O0=Me("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const N0=Me("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _0=Me("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const D0=Me("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const R0=Me("Copy",[["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"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const U0=Me("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const H0=Me("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gm=Me("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const B0=Me("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xm=Me("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const q0=Me("Orbit",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qm=Me("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const L0=Me("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const w0=Me("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vm=Me("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Y0=Me("SendHorizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const G0=Me("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const X0=Me("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Zm=Me("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Q0=Me("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const V0=Me("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Km=Me("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ls(i){return Z0(JSON.stringify(i,null,2)).replace(/"([^"]+)":/g,'"$1":').replace(/: "([^"]*)"/g,': "$1"').replace(/: (true|false)/g,': $1').replace(/: (null)/g,': $1').replace(/: (-?\d+\.?\d*)/g,': $1')}function Z0(i){return i.replace(/&/g,"&").replace(//g,">")}function si(i){return i>=1e6?`${(i/1e6).toFixed(1)}M`:i>=1e3?`${(i/1e3).toFixed(1)}K`:String(i)}const K0=[{view:"overview",label:"Overview",icon:U0},{view:"search",label:"Search",icon:Vm},{view:"documents",label:"Documents",icon:Ym},{view:"graph",label:"Graph",icon:Gm},{view:"communities",label:"Communities",icon:Xm},{view:"upload",label:"Upload",icon:Q0},{view:"mcp",label:"MCP Console",icon:V0}];function J0({currentView:i,onViewChange:s,stats:o,onThemeToggle:r}){return d.jsxs("nav",{className:"top-nav",children:[d.jsxs("a",{className:"logo",href:"/",children:[d.jsx(Ym,{size:17,style:{color:"var(--color-accent)",flexShrink:0}}),d.jsx("span",{className:"logo-mark",children:"DOCSCONTEXT"}),d.jsx("span",{className:"logo-ver",children:"knowledge graph"})]}),K0.map(({view:m,label:v,icon:S})=>d.jsxs("button",{className:`nav-link${i===m?" active":""}`,onClick:()=>s(m),children:[d.jsx(S,{size:13})," ",v]},m)),d.jsxs("div",{className:"stats",style:{marginLeft:"auto"},children:[d.jsxs("div",{className:"stat",children:[d.jsx("span",{className:"stat-val",children:si((o==null?void 0:o.documents)??0)}),d.jsx("span",{className:"stat-lbl",children:"Docs"})]}),d.jsxs("div",{className:"stat",children:[d.jsx("span",{className:"stat-val",children:si((o==null?void 0:o.entities)??0)}),d.jsx("span",{className:"stat-lbl",children:"Entities"})]}),d.jsxs("div",{className:"stat",children:[d.jsx("span",{className:"stat-val",children:si((o==null?void 0:o.communities)??0)}),d.jsx("span",{className:"stat-lbl",children:"Groups"})]})]}),d.jsxs("button",{className:"theme-btn",onClick:r,title:"Toggle theme",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[d.jsx(X0,{size:15,className:"icon-sun"}),d.jsx(B0,{size:15,className:"icon-moon"})]})]})}const k0=[{key:"documents",label:"Documents",icon:H0},{key:"chunks",label:"Chunks",icon:O0},{key:"entities",label:"Entities",icon:G0},{key:"relationships",label:"Relations",icon:Gm},{key:"communities",label:"Communities",icon:Xm},{key:"embeddings",label:"Embeddings",icon:M0}];function W0({stats:i,loading:s}){return d.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"0.9rem"},children:k0.map(({key:o,label:r,icon:m})=>d.jsxs("div",{className:"card",style:{position:"relative",overflow:"hidden"},children:[d.jsx("div",{style:{position:"absolute",inset:"0 auto auto 0",width:56,height:56,borderRadius:"50%",background:"radial-gradient(circle, var(--accent-glow), transparent 70%)",transform:"translate(-22%, -22%)"}}),d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"1rem"},children:[d.jsx("span",{className:"badge",children:r}),d.jsx(m,{size:15,style:{color:"var(--color-accent)"}})]}),d.jsx("div",{style:{fontSize:"1.8rem",fontWeight:700,lineHeight:1},children:s?"…":si(Number((i==null?void 0:i[o])??0))})]},o))})}function $r({title:i,value:s,defaultOpen:o=!1}){const[r,m]=y.useState(o);return d.jsxs("div",{className:"card",style:{padding:0,overflow:"hidden"},children:[d.jsxs("button",{onClick:()=>m(v=>!v),style:{width:"100%",display:"flex",alignItems:"center",gap:"0.5rem",padding:"0.85rem 1rem",background:"transparent",border:"none",borderBottom:r?"1px solid var(--border)":"none",color:"var(--text-primary)",cursor:"pointer",textAlign:"left"},children:[r?d.jsx(N0,{size:14}):d.jsx(_0,{size:14}),d.jsx("span",{style:{fontSize:"0.78rem",fontWeight:600},children:i})]}),r&&d.jsx("pre",{className:"mc-code",style:{margin:0,padding:"1rem",border:"none",borderRadius:0,overflow:"auto"},dangerouslySetInnerHTML:{__html:ls(s)}})]})}function F0({loading:i,error:s,results:o,onSearch:r}){var M;const[m,v]=y.useState(""),[S,p]=y.useState("local"),[T,h]=y.useState(8),j=(M=o.find(N=>N.answer))==null?void 0:M.answer,A=o.filter(N=>!N.answer);return d.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(320px, 440px) minmax(0, 1fr)",gap:"1rem",minHeight:0,flex:1},children:[d.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",gap:"0.9rem"},children:[d.jsxs("div",{children:[d.jsx("div",{style:{fontSize:"0.74rem",textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--text-dim)",marginBottom:"0.35rem"},children:"Semantic Search"}),d.jsx("div",{style:{fontSize:"0.95rem",fontWeight:700},children:"Local and community-level retrieval"})]}),d.jsxs("div",{className:"search-wrap",style:{maxWidth:"none"},children:[d.jsx(Vm,{size:13}),d.jsx("input",{className:"search-input",value:m,onChange:N=>v(N.target.value),placeholder:"Find claims, entities, and relationships...",spellCheck:!1})]}),d.jsx("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:["local","global"].map(N=>d.jsx("button",{className:`mode-pill${S===N?" active":""}`,onClick:()=>p(N),children:N},N))}),d.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"0.4rem",fontSize:"0.74rem",color:"var(--text-muted)"},children:["Result count",d.jsx("input",{type:"range",min:3,max:20,value:T,onChange:N=>h(Number(N.target.value))}),d.jsxs("span",{className:"badge",children:["Top ",T]})]}),d.jsx("button",{className:"mc-send-btn",disabled:i||!m.trim(),onClick:()=>r(m,S,T),children:i?"Searching…":"Run Search"}),s&&d.jsx("div",{style:{color:"#ef4444",fontSize:"0.74rem"},children:s})]}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",minHeight:0},children:[j&&d.jsx($r,{title:"Synthesized answer",value:{answer:j},defaultOpen:!0}),d.jsxs("div",{className:"card",style:{flex:1,minHeight:0,overflow:"auto"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.8rem"},children:[d.jsx("div",{style:{fontSize:"0.8rem",fontWeight:700},children:"Results"}),d.jsx("span",{className:"badge",children:A.length})]}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.7rem"},children:[A.length===0&&d.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.75rem"},children:"No results yet."}),A.map((N,w)=>{var R;return d.jsxs("article",{style:{border:"1px solid var(--border)",borderRadius:10,padding:"0.85rem",background:"var(--bg-card)"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem",marginBottom:"0.45rem"},children:[d.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600},children:N.title||N.path||`Match ${w+1}`}),typeof N.score=="number"&&d.jsx("span",{className:"badge badge-blue",children:N.score.toFixed(3)})]}),d.jsx("div",{style:{fontSize:"0.74rem",color:"var(--text-secondary)",lineHeight:1.6,whiteSpace:"pre-wrap"},children:N.text||N.chunk_text||"No snippet returned."}),!!((R=N.entities)!=null&&R.length)&&d.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.35rem",marginTop:"0.65rem"},children:N.entities.map(L=>d.jsx("span",{className:"badge",children:L},L))})]},`${N.document_id??"x"}-${w}`)})]})]})]})]})}const $0=["","markdown","pdf","docx","txt","web"];function I0({documents:i,docType:s,loading:o,onFilter:r}){return d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",minHeight:0,flex:1},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",flexWrap:"wrap"},children:[d.jsxs("div",{children:[d.jsx("div",{style:{fontSize:"0.74rem",textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--text-dim)",marginBottom:"0.35rem"},children:"Corpus"}),d.jsx("div",{style:{fontSize:"0.95rem",fontWeight:700},children:"Indexed documents and versions"})]}),d.jsx("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap"},children:$0.map(m=>d.jsx("button",{className:`mode-pill${s===m?" active":""}`,onClick:()=>r(m),children:m||"all"},m||"all"))})]}),d.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:"0.9rem",overflow:"auto"},children:[o&&d.jsx("div",{style:{color:"var(--text-muted)"},children:"Loading documents…"}),!o&&i.map(m=>d.jsxs("article",{className:"card",style:{display:"flex",flexDirection:"column",gap:"0.7rem"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[d.jsx("div",{style:{fontSize:"0.82rem",fontWeight:700},children:m.title||m.path}),d.jsx("span",{className:"badge badge-purple",children:m.doc_type||"unknown"})]}),d.jsx("div",{style:{fontSize:"0.72rem",color:"var(--text-muted)",wordBreak:"break-all"},children:m.path}),d.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:["version"in m&&d.jsxs("span",{className:"badge",children:["v",String(m.version)]}),"is_latest"in m&&m.is_latest&&d.jsx("span",{className:"badge badge-green",children:"latest"})]})]},String(m.id)))]})]})}const xm={Person:"#f59e0b",Organization:"#3b82f6",Concept:"#a78bfa",Location:"#10b981",Event:"#f43f5e",Technology:"#06b6d4",Other:"#64748b"};function P0({graph:i,loading:s,error:o,onLoad:r}){var j,A;const[m,v]=y.useState(""),[S,p]=y.useState(2),T=y.useMemo(()=>{var N;if(!((N=i==null?void 0:i.nodes)!=null&&N.length))return[];const M=170;return i.nodes.map((w,R)=>{const L=Math.PI*2*R/i.nodes.length;return{...w,x:220+Math.cos(L)*M,y:220+Math.sin(L)*M,color:xm[w.type]||xm.Other}})},[i]),h=y.useMemo(()=>{const M=new Map(T.map(N=>[N.id,N]));return((i==null?void 0:i.edges)??[]).map(N=>({edge:N,from:M.get(N.from),to:M.get(N.to)})).filter(N=>N.from&&N.to)},[i,T]);return d.jsxs("div",{style:{display:"grid",gridTemplateColumns:"320px minmax(0, 1fr)",gap:"1rem",minHeight:0,flex:1},children:[d.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",gap:"0.9rem"},children:[d.jsxs("div",{children:[d.jsx("div",{style:{fontSize:"0.74rem",textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--text-dim)",marginBottom:"0.35rem"},children:"Neighborhood Graph"}),d.jsx("div",{style:{fontSize:"0.95rem",fontWeight:700},children:"Inspect entity relationships"})]}),d.jsx("input",{className:"search-input",style:{paddingLeft:"10px"},value:m,onChange:M=>v(M.target.value),placeholder:"Entity name",spellCheck:!1}),d.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"0.35rem",fontSize:"0.74rem",color:"var(--text-muted)"},children:["Depth",d.jsx("input",{type:"range",min:1,max:4,value:S,onChange:M=>p(Number(M.target.value))}),d.jsxs("span",{className:"badge",children:["Depth ",S]})]}),d.jsx("button",{className:"mc-send-btn",disabled:s||!m.trim(),onClick:()=>r(m,S),children:s?"Loading…":"Load Graph"}),o&&d.jsx("div",{style:{color:"#ef4444",fontSize:"0.74rem"},children:o})]}),d.jsxs("div",{className:"card",style:{minHeight:0,overflow:"hidden",display:"grid",gridTemplateRows:"1fr auto",gap:"0.9rem"},children:[d.jsxs("div",{style:{position:"relative",minHeight:420,overflow:"hidden",borderRadius:12,background:"radial-gradient(circle at top, rgba(56,189,248,0.12), transparent 35%), linear-gradient(180deg, var(--bg-card), var(--bg-base))",border:"1px solid var(--border)"},children:[!((j=i==null?void 0:i.nodes)!=null&&j.length)&&d.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)"},children:d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[d.jsx(q0,{size:16})," No graph loaded"]})}),(A=i==null?void 0:i.nodes)!=null&&A.length?d.jsxs("svg",{viewBox:"0 0 440 440",style:{width:"100%",height:"100%"},children:[h.map(({edge:M,from:N,to:w},R)=>d.jsxs("g",{children:[d.jsx("line",{x1:N.x,y1:N.y,x2:w.x,y2:w.y,stroke:"var(--border-hover)",strokeWidth:1.5}),M.label&&d.jsx("text",{x:(N.x+w.x)/2,y:(N.y+w.y)/2-4,fill:"var(--text-muted)",fontSize:"10",textAnchor:"middle",children:M.label})]},`${M.from}-${M.to}-${R}`)),T.map(M=>d.jsxs("g",{children:[d.jsx("circle",{cx:M.x,cy:M.y,r:14,fill:M.color,stroke:"var(--bg-base)",strokeWidth:2}),d.jsx("text",{x:M.x,y:M.y+28,fill:"var(--text-primary)",fontSize:"11",textAnchor:"middle",children:M.label.slice(0,16)})]},M.id))]}):null]}),d.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.45rem"},children:T.map(M=>d.jsx("span",{className:"badge",style:{borderColor:M.color,color:"var(--text-secondary)"},children:M.label},M.id))})]})]})}const eg=[-1,0,1,2,3];function tg(i){const{communities:s,members:o,level:r,loading:m,detailLoading:v,selectedId:S,onLevel:p,onSelect:T}=i;return d.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(320px, 420px) minmax(0, 1fr)",gap:"1rem",minHeight:0,flex:1},children:[d.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",gap:"0.9rem",minHeight:0},children:[d.jsxs("div",{children:[d.jsx("div",{style:{fontSize:"0.74rem",textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--text-dim)",marginBottom:"0.35rem"},children:"Communities"}),d.jsx("div",{style:{fontSize:"0.95rem",fontWeight:700},children:"Cluster summaries by level"})]}),d.jsx("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap"},children:eg.map(h=>d.jsx("button",{className:`mode-pill${r===h?" active":""}`,onClick:()=>p(h),children:h<0?"all":`L${h}`},h))}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.65rem",overflow:"auto"},children:[m&&d.jsx("div",{style:{color:"var(--text-muted)"},children:"Loading communities…"}),s.map(h=>d.jsxs("button",{onClick:()=>T(String(h.id)),className:"card",style:{textAlign:"left",background:S===String(h.id)?"var(--nav-active-bg)":"var(--bg-card)",borderColor:S===String(h.id)?"var(--color-accent)":"var(--border)",padding:"0.9rem",cursor:"pointer"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem",marginBottom:"0.4rem"},children:[d.jsx("div",{style:{fontWeight:700,fontSize:"0.8rem"},children:h.title||`Community ${h.id}`}),d.jsxs("span",{className:"badge",children:["L",h.level]})]}),d.jsx("div",{style:{fontSize:"0.72rem",color:"var(--text-muted)",lineHeight:1.5},children:h.summary||"No summary available."})]},String(h.id)))]})]}),d.jsxs("div",{className:"card",style:{minHeight:0,overflow:"auto"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.9rem"},children:[d.jsx("div",{style:{fontSize:"0.85rem",fontWeight:700},children:"Members"}),v&&d.jsx("span",{className:"badge",children:"Loading…"})]}),d.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"0.75rem"},children:[o.length===0&&d.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.75rem"},children:"Select a community to inspect member entities."}),o.map(h=>d.jsxs("article",{style:{border:"1px solid var(--border)",borderRadius:10,padding:"0.8rem",background:"var(--bg-card)"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.5rem",marginBottom:"0.35rem"},children:[d.jsx("div",{style:{fontWeight:700,fontSize:"0.78rem"},children:h.name}),d.jsx("span",{className:"badge badge-orange",children:h.type})]}),d.jsx("div",{style:{fontSize:"0.72rem",color:"var(--text-muted)",lineHeight:1.5},children:h.description||"No description available."})]},String(h.id)))]})]})]})}function lg({jobId:i,status:s,messages:o,loading:r,onUpload:m}){const v=y.useRef(null);return d.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(320px, 420px) minmax(0, 1fr)",gap:"1rem",minHeight:0,flex:1},children:[d.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",gap:"0.9rem",justifyContent:"space-between"},children:[d.jsxs("div",{children:[d.jsx("div",{style:{fontSize:"0.74rem",textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--text-dim)",marginBottom:"0.35rem"},children:"Ingest"}),d.jsx("div",{style:{fontSize:"0.95rem",fontWeight:700,marginBottom:"0.55rem"},children:"Drop new source material into the graph"}),d.jsx("div",{style:{fontSize:"0.74rem",color:"var(--text-muted)",lineHeight:1.6},children:"Upload markdown, PDFs, DOCX, text, and crawled web exports. The backend will chunk, embed, extract entities, and connect claims."})]}),d.jsxs("button",{onClick:()=>{var S;return(S=v.current)==null?void 0:S.click()},style:{minHeight:180,borderRadius:14,border:"1px dashed var(--border-hover)",background:"linear-gradient(180deg, rgba(56,189,248,0.08), transparent 60%), var(--bg-card)",color:"var(--text-primary)",cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem"},children:[d.jsx(D0,{size:24,style:{color:"var(--color-accent)"}}),d.jsx("span",{style:{fontWeight:700},children:r?"Uploading…":"Select files"}),d.jsx("span",{style:{fontSize:"0.72rem",color:"var(--text-muted)"},children:"Click to browse or replace the current batch"})]}),d.jsx("input",{ref:v,type:"file",multiple:!0,style:{display:"none"},onChange:S=>m(Array.from(S.target.files??[]))})]}),d.jsxs("div",{className:"card",style:{minHeight:0,overflow:"auto"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.85rem"},children:[d.jsx("div",{style:{fontSize:"0.85rem",fontWeight:700},children:"Job Progress"}),d.jsx("span",{className:"badge",children:s})]}),i&&d.jsxs("div",{style:{marginBottom:"0.7rem",fontSize:"0.73rem",color:"var(--text-muted)"},children:["Job: ",d.jsx("code",{children:i})]}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.55rem"},children:[o.length===0&&d.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.75rem"},children:"No upload activity yet."}),o.map((S,p)=>d.jsx("div",{style:{padding:"0.7rem 0.85rem",border:"1px solid var(--border)",borderRadius:10,background:"var(--bg-card)",fontSize:"0.73rem",color:"var(--text-secondary)"},children:S},`${S}-${p}`))]})]})]})}function ag(i,s){var r;if(s.includes("application/json"))return JSON.parse(i);const o=(r=i.split(` -`).find(m=>m.startsWith("data: ")))==null?void 0:r.slice(6);return o?JSON.parse(o):{}}function ng(i="/mcp"){const[s,o]=y.useState("idle"),[r,m]=y.useState([]),[v,S]=y.useState(null),p=y.useRef(null),T=y.useRef(0),h=()=>{const N={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};return p.current&&(N["Mcp-Session-Id"]=p.current),N},j=async N=>{const w=performance.now(),R=await fetch(i,{method:"POST",headers:h(),body:JSON.stringify(N)}),L=R.headers.get("Mcp-Session-Id");L&&(p.current=L);const Y=await R.text();return{data:ag(Y,R.headers.get("content-type")??""),status:R.status,ms:Math.round(performance.now()-w)}},A=async(N,w)=>{var R,L;try{const Y=await j({jsonrpc:"2.0",id:++T.current,method:N,params:w});return{result:(R=Y.data)==null?void 0:R.result,error:(L=Y.data)==null?void 0:L.error,timing:Y.ms}}catch(Y){return{error:{code:-1,message:String(Y)}}}},M=async()=>{var R;o("connecting"),S(null);const N=await A("initialize",{protocolVersion:"2024-11-05",capabilities:{},clientInfo:{name:"docscontext-ui",version:"1.0.0"}});if(N.error){o("error"),S(N.error.message);return}o("connected");const w=await A("tools/list",{});w.error||m(((R=w.result)==null?void 0:R.tools)??[])};return y.useEffect(()=>{M()},[]),{status:s,tools:r,error:v,call:A,connect:M,send:j}}function ug({tool:i,index:s,onCall:o,onRPC:r}){var p,T;const m=((p=i.inputSchema)==null?void 0:p.properties)||{},v=((T=i.inputSchema)==null?void 0:T.required)||[],S=Object.keys(m).length;return d.jsxs("div",{className:"mc-tool-card",children:[d.jsx("div",{style:{position:"absolute",inset:"0 0 auto 0",height:2,background:"linear-gradient(90deg, var(--color-accent), var(--color-accent-hover))"}}),d.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"0.75rem",marginBottom:"0.4rem"},children:[d.jsx("span",{style:{fontFamily:"ui-monospace, monospace",fontSize:"0.8rem",fontWeight:700,color:"var(--text-primary)"},children:i.name}),S>0&&d.jsxs("span",{className:"mc-badge",style:{fontSize:"0.6rem"},children:[S,"p"]})]}),d.jsx("p",{style:{fontSize:"0.72rem",color:"var(--text-muted)",lineHeight:1.55,marginBottom:"0.75rem",minHeight:"3.2em"},children:i.description||"No description provided."}),S>0&&d.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.3rem",marginBottom:"0.8rem"},children:Object.entries(m).map(([h,j])=>d.jsxs("span",{className:`mc-param-tag ${v.includes(h)?"mc-param-req":"mc-param-opt"}`,children:[h,d.jsxs("span",{style:{opacity:.45,marginLeft:2},children:[":",j.type??"any"]})]},h))}),d.jsxs("div",{style:{display:"flex",gap:"0.4rem",marginTop:"auto"},children:[d.jsxs("button",{className:"mc-btn-call",onClick:()=>o(s),style:{display:"flex",alignItems:"center",gap:"0.35rem"},children:[d.jsx(Qm,{size:10})," Call"]}),d.jsxs("button",{className:"mc-btn-rpc",onClick:()=>r(s),style:{display:"flex",alignItems:"center",gap:"0.35rem"},children:[d.jsx(Zm,{size:10})," JSON-RPC"]})]})]})}function Fe(i,s,{checkForDefaultPrevented:o=!0}={}){return function(m){if(i==null||i(m),o===!1||!m.defaultPrevented)return s==null?void 0:s(m)}}function Em(i,s){if(typeof i=="function")return i(s);i!=null&&(i.current=s)}function Jm(...i){return s=>{let o=!1;const r=i.map(m=>{const v=Em(m,s);return!o&&typeof v=="function"&&(o=!0),v});if(o)return()=>{for(let m=0;m{const{children:S,...p}=v,T=y.useMemo(()=>p,Object.values(p));return d.jsx(o.Provider,{value:T,children:S})};r.displayName=i+"Provider";function m(v){const S=y.useContext(o);if(S)return S;if(s!==void 0)return s;throw new Error(`\`${v}\` must be used within \`${i}\``)}return[r,m]}function vi(i,s=[]){let o=[];function r(v,S){const p=y.createContext(S),T=o.length;o=[...o,S];const h=A=>{var Y;const{scope:M,children:N,...w}=A,R=((Y=M==null?void 0:M[i])==null?void 0:Y[T])||p,L=y.useMemo(()=>w,Object.values(w));return d.jsx(R.Provider,{value:L,children:N})};h.displayName=v+"Provider";function j(A,M){var R;const N=((R=M==null?void 0:M[i])==null?void 0:R[T])||p,w=y.useContext(N);if(w)return w;if(S!==void 0)return S;throw new Error(`\`${A}\` must be used within \`${v}\``)}return[h,j]}const m=()=>{const v=o.map(S=>y.createContext(S));return function(p){const T=(p==null?void 0:p[i])||v;return y.useMemo(()=>({[`__scope${i}`]:{...p,[i]:T}}),[p,T])}};return m.scopeName=i,[r,cg(m,...s)]}function cg(...i){const s=i[0];if(i.length===1)return s;const o=()=>{const r=i.map(m=>({useScope:m(),scopeName:m.scopeName}));return function(v){const S=r.reduce((p,{useScope:T,scopeName:h})=>{const A=T(v)[`__scope${h}`];return{...p,...A}},{});return y.useMemo(()=>({[`__scope${s.scopeName}`]:S}),[S])}};return o.scopeName=s.scopeName,o}var qn=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},rg=qm[" useId ".trim().toString()]||(()=>{}),sg=0;function Bn(i){const[s,o]=y.useState(rg());return qn(()=>{o(r=>r??String(sg++))},[i]),i||(s?`radix-${s}`:"")}var og=qm[" useInsertionEffect ".trim().toString()]||qn;function as({prop:i,defaultProp:s,onChange:o=()=>{},caller:r}){const[m,v,S]=fg({defaultProp:s,onChange:o}),p=i!==void 0,T=p?i:m;{const j=y.useRef(i!==void 0);y.useEffect(()=>{const A=j.current;A!==p&&console.warn(`${r} is changing from ${A?"controlled":"uncontrolled"} to ${p?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),j.current=p},[p,r])}const h=y.useCallback(j=>{var A;if(p){const M=dg(j)?j(i):j;M!==i&&((A=S.current)==null||A.call(S,M))}else v(j)},[p,i,v,S]);return[T,h]}function fg({defaultProp:i,onChange:s}){const[o,r]=y.useState(i),m=y.useRef(o),v=y.useRef(s);return og(()=>{v.current=s},[s]),y.useEffect(()=>{var S;m.current!==o&&((S=v.current)==null||S.call(v,o),m.current=o)},[o,m]),[o,r,v]}function dg(i){return typeof i=="function"}var km=Lm();const mg=Bm(km);function di(i){const s=vg(i),o=y.forwardRef((r,m)=>{const{children:v,...S}=r,p=y.Children.toArray(v),T=p.find(yg);if(T){const h=T.props.children,j=p.map(A=>A===T?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:A);return d.jsx(s,{...S,ref:m,children:y.isValidElement(h)?y.cloneElement(h,void 0,j):null})}return d.jsx(s,{...S,ref:m,children:v})});return o.displayName=`${i}.Slot`,o}function vg(i){const s=y.forwardRef((o,r)=>{const{children:m,...v}=o;if(y.isValidElement(m)){const S=pg(m),p=gg(v,m.props);return m.type!==y.Fragment&&(p.ref=r?Jm(r,S):S),y.cloneElement(m,p)}return y.Children.count(m)>1?y.Children.only(null):null});return s.displayName=`${i}.SlotClone`,s}var hg=Symbol("radix.slottable");function yg(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===hg}function gg(i,s){const o={...s};for(const r in s){const m=i[r],v=s[r];/^on[A-Z]/.test(r)?m&&v?o[r]=(...p)=>{const T=v(...p);return m(...p),T}:m&&(o[r]=m):r==="style"?o[r]={...m,...v}:r==="className"&&(o[r]=[m,v].filter(Boolean).join(" "))}return{...i,...o}}function pg(i){var r,m;let s=(r=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:r.get,o=s&&"isReactWarning"in s&&s.isReactWarning;return o?i.ref:(s=(m=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:m.get,o=s&&"isReactWarning"in s&&s.isReactWarning,o?i.props.ref:i.props.ref||i.ref)}var Sg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tt=Sg.reduce((i,s)=>{const o=di(`Primitive.${s}`),r=y.forwardRef((m,v)=>{const{asChild:S,...p}=m,T=S?o:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(T,{...p,ref:v})});return r.displayName=`Primitive.${s}`,{...i,[s]:r}},{});function bg(i,s){i&&km.flushSync(()=>i.dispatchEvent(s))}function wa(i){const s=y.useRef(i);return y.useEffect(()=>{s.current=i}),y.useMemo(()=>(...o)=>{var r;return(r=s.current)==null?void 0:r.call(s,...o)},[])}function xg(i,s=globalThis==null?void 0:globalThis.document){const o=wa(i);y.useEffect(()=>{const r=m=>{m.key==="Escape"&&o(m)};return s.addEventListener("keydown",r,{capture:!0}),()=>s.removeEventListener("keydown",r,{capture:!0})},[o,s])}var Eg="DismissableLayer",Ir="dismissableLayer.update",Tg="dismissableLayer.pointerDownOutside",Ag="dismissableLayer.focusOutside",Tm,Wm=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Fm=y.forwardRef((i,s)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:r,onPointerDownOutside:m,onFocusOutside:v,onInteractOutside:S,onDismiss:p,...T}=i,h=y.useContext(Wm),[j,A]=y.useState(null),M=(j==null?void 0:j.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,N]=y.useState({}),w=wt(s,X=>A(X)),R=Array.from(h.layers),[L]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),Y=R.indexOf(L),K=j?R.indexOf(j):-1,V=h.layersWithOutsidePointerEventsDisabled.size>0,W=K>=Y,ae=jg(X=>{const ue=X.target,Ce=[...h.branches].some(Ve=>Ve.contains(ue));!W||Ce||(m==null||m(X),S==null||S(X),X.defaultPrevented||p==null||p())},M),F=Mg(X=>{const ue=X.target;[...h.branches].some(Ve=>Ve.contains(ue))||(v==null||v(X),S==null||S(X),X.defaultPrevented||p==null||p())},M);return xg(X=>{K===h.layers.size-1&&(r==null||r(X),!X.defaultPrevented&&p&&(X.preventDefault(),p()))},M),y.useEffect(()=>{if(j)return o&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Tm=M.body.style.pointerEvents,M.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(j)),h.layers.add(j),Am(),()=>{o&&h.layersWithOutsidePointerEventsDisabled.size===1&&(M.body.style.pointerEvents=Tm)}},[j,M,o,h]),y.useEffect(()=>()=>{j&&(h.layers.delete(j),h.layersWithOutsidePointerEventsDisabled.delete(j),Am())},[j,h]),y.useEffect(()=>{const X=()=>N({});return document.addEventListener(Ir,X),()=>document.removeEventListener(Ir,X)},[]),d.jsx(tt.div,{...T,ref:w,style:{pointerEvents:V?W?"auto":"none":void 0,...i.style},onFocusCapture:Fe(i.onFocusCapture,F.onFocusCapture),onBlurCapture:Fe(i.onBlurCapture,F.onBlurCapture),onPointerDownCapture:Fe(i.onPointerDownCapture,ae.onPointerDownCapture)})});Fm.displayName=Eg;var zg="DismissableLayerBranch",Cg=y.forwardRef((i,s)=>{const o=y.useContext(Wm),r=y.useRef(null),m=wt(s,r);return y.useEffect(()=>{const v=r.current;if(v)return o.branches.add(v),()=>{o.branches.delete(v)}},[o.branches]),d.jsx(tt.div,{...i,ref:m})});Cg.displayName=zg;function jg(i,s=globalThis==null?void 0:globalThis.document){const o=wa(i),r=y.useRef(!1),m=y.useRef(()=>{});return y.useEffect(()=>{const v=p=>{if(p.target&&!r.current){let T=function(){$m(Tg,o,h,{discrete:!0})};const h={originalEvent:p};p.pointerType==="touch"?(s.removeEventListener("click",m.current),m.current=T,s.addEventListener("click",m.current,{once:!0})):T()}else s.removeEventListener("click",m.current);r.current=!1},S=window.setTimeout(()=>{s.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(S),s.removeEventListener("pointerdown",v),s.removeEventListener("click",m.current)}},[s,o]),{onPointerDownCapture:()=>r.current=!0}}function Mg(i,s=globalThis==null?void 0:globalThis.document){const o=wa(i),r=y.useRef(!1);return y.useEffect(()=>{const m=v=>{v.target&&!r.current&&$m(Ag,o,{originalEvent:v},{discrete:!1})};return s.addEventListener("focusin",m),()=>s.removeEventListener("focusin",m)},[s,o]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Am(){const i=new CustomEvent(Ir);document.dispatchEvent(i)}function $m(i,s,o,{discrete:r}){const m=o.originalEvent.target,v=new CustomEvent(i,{bubbles:!1,cancelable:!0,detail:o});s&&m.addEventListener(i,s,{once:!0}),r?bg(m,v):m.dispatchEvent(v)}var Xr="focusScope.autoFocusOnMount",Qr="focusScope.autoFocusOnUnmount",zm={bubbles:!1,cancelable:!0},Og="FocusScope",Im=y.forwardRef((i,s)=>{const{loop:o=!1,trapped:r=!1,onMountAutoFocus:m,onUnmountAutoFocus:v,...S}=i,[p,T]=y.useState(null),h=wa(m),j=wa(v),A=y.useRef(null),M=wt(s,R=>T(R)),N=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let R=function(V){if(N.paused||!p)return;const W=V.target;p.contains(W)?A.current=W:Nl(A.current,{select:!0})},L=function(V){if(N.paused||!p)return;const W=V.relatedTarget;W!==null&&(p.contains(W)||Nl(A.current,{select:!0}))},Y=function(V){if(document.activeElement===document.body)for(const ae of V)ae.removedNodes.length>0&&Nl(p)};document.addEventListener("focusin",R),document.addEventListener("focusout",L);const K=new MutationObserver(Y);return p&&K.observe(p,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",R),document.removeEventListener("focusout",L),K.disconnect()}}},[r,p,N.paused]),y.useEffect(()=>{if(p){jm.add(N);const R=document.activeElement;if(!p.contains(R)){const Y=new CustomEvent(Xr,zm);p.addEventListener(Xr,h),p.dispatchEvent(Y),Y.defaultPrevented||(Ng(Hg(Pm(p)),{select:!0}),document.activeElement===R&&Nl(p))}return()=>{p.removeEventListener(Xr,h),setTimeout(()=>{const Y=new CustomEvent(Qr,zm);p.addEventListener(Qr,j),p.dispatchEvent(Y),Y.defaultPrevented||Nl(R??document.body,{select:!0}),p.removeEventListener(Qr,j),jm.remove(N)},0)}}},[p,h,j,N]);const w=y.useCallback(R=>{if(!o&&!r||N.paused)return;const L=R.key==="Tab"&&!R.altKey&&!R.ctrlKey&&!R.metaKey,Y=document.activeElement;if(L&&Y){const K=R.currentTarget,[V,W]=_g(K);V&&W?!R.shiftKey&&Y===W?(R.preventDefault(),o&&Nl(V,{select:!0})):R.shiftKey&&Y===V&&(R.preventDefault(),o&&Nl(W,{select:!0})):Y===K&&R.preventDefault()}},[o,r,N.paused]);return d.jsx(tt.div,{tabIndex:-1,...S,ref:M,onKeyDown:w})});Im.displayName=Og;function Ng(i,{select:s=!1}={}){const o=document.activeElement;for(const r of i)if(Nl(r,{select:s}),document.activeElement!==o)return}function _g(i){const s=Pm(i),o=Cm(s,i),r=Cm(s.reverse(),i);return[o,r]}function Pm(i){const s=[],o=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const m=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||m?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)s.push(o.currentNode);return s}function Cm(i,s){for(const o of i)if(!Dg(o,{upTo:s}))return o}function Dg(i,{upTo:s}){if(getComputedStyle(i).visibility==="hidden")return!0;for(;i;){if(s!==void 0&&i===s)return!1;if(getComputedStyle(i).display==="none")return!0;i=i.parentElement}return!1}function Rg(i){return i instanceof HTMLInputElement&&"select"in i}function Nl(i,{select:s=!1}={}){if(i&&i.focus){const o=document.activeElement;i.focus({preventScroll:!0}),i!==o&&Rg(i)&&s&&i.select()}}var jm=Ug();function Ug(){let i=[];return{add(s){const o=i[0];s!==o&&(o==null||o.pause()),i=Mm(i,s),i.unshift(s)},remove(s){var o;i=Mm(i,s),(o=i[0])==null||o.resume()}}}function Mm(i,s){const o=[...i],r=o.indexOf(s);return r!==-1&&o.splice(r,1),o}function Hg(i){return i.filter(s=>s.tagName!=="A")}var Bg="Portal",ev=y.forwardRef((i,s)=>{var p;const{container:o,...r}=i,[m,v]=y.useState(!1);qn(()=>v(!0),[]);const S=o||m&&((p=globalThis==null?void 0:globalThis.document)==null?void 0:p.body);return S?mg.createPortal(d.jsx(tt.div,{...r,ref:s}),S):null});ev.displayName=Bg;function qg(i,s){return y.useReducer((o,r)=>s[o][r]??o,i)}var Ln=i=>{const{present:s,children:o}=i,r=Lg(s),m=typeof o=="function"?o({present:r.isPresent}):y.Children.only(o),v=wt(r.ref,wg(m));return typeof o=="function"||r.isPresent?y.cloneElement(m,{ref:v}):null};Ln.displayName="Presence";function Lg(i){const[s,o]=y.useState(),r=y.useRef(null),m=y.useRef(i),v=y.useRef("none"),S=i?"mounted":"unmounted",[p,T]=qg(S,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const h=ni(r.current);v.current=p==="mounted"?h:"none"},[p]),qn(()=>{const h=r.current,j=m.current;if(j!==i){const M=v.current,N=ni(h);i?T("MOUNT"):N==="none"||(h==null?void 0:h.display)==="none"?T("UNMOUNT"):T(j&&M!==N?"ANIMATION_OUT":"UNMOUNT"),m.current=i}},[i,T]),qn(()=>{if(s){let h;const j=s.ownerDocument.defaultView??window,A=N=>{const R=ni(r.current).includes(CSS.escape(N.animationName));if(N.target===s&&R&&(T("ANIMATION_END"),!m.current)){const L=s.style.animationFillMode;s.style.animationFillMode="forwards",h=j.setTimeout(()=>{s.style.animationFillMode==="forwards"&&(s.style.animationFillMode=L)})}},M=N=>{N.target===s&&(v.current=ni(r.current))};return s.addEventListener("animationstart",M),s.addEventListener("animationcancel",A),s.addEventListener("animationend",A),()=>{j.clearTimeout(h),s.removeEventListener("animationstart",M),s.removeEventListener("animationcancel",A),s.removeEventListener("animationend",A)}}else T("ANIMATION_END")},[s,T]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:y.useCallback(h=>{r.current=h?getComputedStyle(h):null,o(h)},[])}}function ni(i){return(i==null?void 0:i.animationName)||"none"}function wg(i){var r,m;let s=(r=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:r.get,o=s&&"isReactWarning"in s&&s.isReactWarning;return o?i.ref:(s=(m=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:m.get,o=s&&"isReactWarning"in s&&s.isReactWarning,o?i.props.ref:i.props.ref||i.ref)}var Vr=0;function Yg(){y.useEffect(()=>{const i=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",i[0]??Om()),document.body.insertAdjacentElement("beforeend",i[1]??Om()),Vr++,()=>{Vr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(s=>s.remove()),Vr--}},[])}function Om(){const i=document.createElement("span");return i.setAttribute("data-radix-focus-guard",""),i.tabIndex=0,i.style.outline="none",i.style.opacity="0",i.style.position="fixed",i.style.pointerEvents="none",i}var Lt=function(){return Lt=Object.assign||function(s){for(var o,r=1,m=arguments.length;r"u")return a1;var s=n1(i),o=document.documentElement.clientWidth,r=window.innerWidth;return{left:s[0],top:s[1],right:s[2],gap:Math.max(0,r-o+s[2]-s[0])}},i1=nv(),La="data-scroll-locked",c1=function(i,s,o,r){var m=i.left,v=i.top,S=i.right,p=i.gap;return o===void 0&&(o="margin"),` - .`.concat(Xg,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(p,"px ").concat(r,`; - } - body[`).concat(La,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([s&&"position: relative ".concat(r,";"),o==="margin"&&` - padding-left: `.concat(m,`px; - padding-top: `).concat(v,`px; - padding-right: `).concat(S,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(p,"px ").concat(r,`; - `),o==="padding"&&"padding-right: ".concat(p,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(oi,` { - right: `).concat(p,"px ").concat(r,`; - } - - .`).concat(fi,` { - margin-right: `).concat(p,"px ").concat(r,`; - } - - .`).concat(oi," .").concat(oi,` { - right: 0 `).concat(r,`; - } - - .`).concat(fi," .").concat(fi,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(La,`] { - `).concat(Qg,": ").concat(p,`px; - } -`)},_m=function(){var i=parseInt(document.body.getAttribute(La)||"0",10);return isFinite(i)?i:0},r1=function(){y.useEffect(function(){return document.body.setAttribute(La,(_m()+1).toString()),function(){var i=_m()-1;i<=0?document.body.removeAttribute(La):document.body.setAttribute(La,i.toString())}},[])},s1=function(i){var s=i.noRelative,o=i.noImportant,r=i.gapMode,m=r===void 0?"margin":r;r1();var v=y.useMemo(function(){return u1(m)},[m]);return y.createElement(i1,{styles:c1(v,!s,m,o?"":"!important")})},Pr=!1;if(typeof window<"u")try{var ui=Object.defineProperty({},"passive",{get:function(){return Pr=!0,!0}});window.addEventListener("test",ui,ui),window.removeEventListener("test",ui,ui)}catch{Pr=!1}var Ha=Pr?{passive:!1}:!1,o1=function(i){return i.tagName==="TEXTAREA"},uv=function(i,s){if(!(i instanceof Element))return!1;var o=window.getComputedStyle(i);return o[s]!=="hidden"&&!(o.overflowY===o.overflowX&&!o1(i)&&o[s]==="visible")},f1=function(i){return uv(i,"overflowY")},d1=function(i){return uv(i,"overflowX")},Dm=function(i,s){var o=s.ownerDocument,r=s;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var m=iv(i,r);if(m){var v=cv(i,r),S=v[1],p=v[2];if(S>p)return!0}r=r.parentNode}while(r&&r!==o.body);return!1},m1=function(i){var s=i.scrollTop,o=i.scrollHeight,r=i.clientHeight;return[s,o,r]},v1=function(i){var s=i.scrollLeft,o=i.scrollWidth,r=i.clientWidth;return[s,o,r]},iv=function(i,s){return i==="v"?f1(s):d1(s)},cv=function(i,s){return i==="v"?m1(s):v1(s)},h1=function(i,s){return i==="h"&&s==="rtl"?-1:1},y1=function(i,s,o,r,m){var v=h1(i,window.getComputedStyle(s).direction),S=v*r,p=o.target,T=s.contains(p),h=!1,j=S>0,A=0,M=0;do{if(!p)break;var N=cv(i,p),w=N[0],R=N[1],L=N[2],Y=R-L-v*w;(w||Y)&&iv(i,p)&&(A+=Y,M+=w);var K=p.parentNode;p=K&&K.nodeType===Node.DOCUMENT_FRAGMENT_NODE?K.host:K}while(!T&&p!==document.body||T&&(s.contains(p)||s===p));return(j&&Math.abs(A)<1||!j&&Math.abs(M)<1)&&(h=!0),h},ii=function(i){return"changedTouches"in i?[i.changedTouches[0].clientX,i.changedTouches[0].clientY]:[0,0]},Rm=function(i){return[i.deltaX,i.deltaY]},Um=function(i){return i&&"current"in i?i.current:i},g1=function(i,s){return i[0]===s[0]&&i[1]===s[1]},p1=function(i){return` - .block-interactivity-`.concat(i,` {pointer-events: none;} - .allow-interactivity-`).concat(i,` {pointer-events: all;} -`)},S1=0,Ba=[];function b1(i){var s=y.useRef([]),o=y.useRef([0,0]),r=y.useRef(),m=y.useState(S1++)[0],v=y.useState(nv)[0],S=y.useRef(i);y.useEffect(function(){S.current=i},[i]),y.useEffect(function(){if(i.inert){document.body.classList.add("block-interactivity-".concat(m));var R=Gg([i.lockRef.current],(i.shards||[]).map(Um),!0).filter(Boolean);return R.forEach(function(L){return L.classList.add("allow-interactivity-".concat(m))}),function(){document.body.classList.remove("block-interactivity-".concat(m)),R.forEach(function(L){return L.classList.remove("allow-interactivity-".concat(m))})}}},[i.inert,i.lockRef.current,i.shards]);var p=y.useCallback(function(R,L){if("touches"in R&&R.touches.length===2||R.type==="wheel"&&R.ctrlKey)return!S.current.allowPinchZoom;var Y=ii(R),K=o.current,V="deltaX"in R?R.deltaX:K[0]-Y[0],W="deltaY"in R?R.deltaY:K[1]-Y[1],ae,F=R.target,X=Math.abs(V)>Math.abs(W)?"h":"v";if("touches"in R&&X==="h"&&F.type==="range")return!1;var ue=window.getSelection(),Ce=ue&&ue.anchorNode,Ve=Ce?Ce===F||Ce.contains(F):!1;if(Ve)return!1;var _e=Dm(X,F);if(!_e)return!0;if(_e?ae=X:(ae=X==="v"?"h":"v",_e=Dm(X,F)),!_e)return!1;if(!r.current&&"changedTouches"in R&&(V||W)&&(r.current=ae),!ae)return!0;var De=r.current||ae;return y1(De,L,R,De==="h"?V:W)},[]),T=y.useCallback(function(R){var L=R;if(!(!Ba.length||Ba[Ba.length-1]!==v)){var Y="deltaY"in L?Rm(L):ii(L),K=s.current.filter(function(ae){return ae.name===L.type&&(ae.target===L.target||L.target===ae.shadowParent)&&g1(ae.delta,Y)})[0];if(K&&K.should){L.cancelable&&L.preventDefault();return}if(!K){var V=(S.current.shards||[]).map(Um).filter(Boolean).filter(function(ae){return ae.contains(L.target)}),W=V.length>0?p(L,V[0]):!S.current.noIsolation;W&&L.cancelable&&L.preventDefault()}}},[]),h=y.useCallback(function(R,L,Y,K){var V={name:R,delta:L,target:Y,should:K,shadowParent:x1(Y)};s.current.push(V),setTimeout(function(){s.current=s.current.filter(function(W){return W!==V})},1)},[]),j=y.useCallback(function(R){o.current=ii(R),r.current=void 0},[]),A=y.useCallback(function(R){h(R.type,Rm(R),R.target,p(R,i.lockRef.current))},[]),M=y.useCallback(function(R){h(R.type,ii(R),R.target,p(R,i.lockRef.current))},[]);y.useEffect(function(){return Ba.push(v),i.setCallbacks({onScrollCapture:A,onWheelCapture:A,onTouchMoveCapture:M}),document.addEventListener("wheel",T,Ha),document.addEventListener("touchmove",T,Ha),document.addEventListener("touchstart",j,Ha),function(){Ba=Ba.filter(function(R){return R!==v}),document.removeEventListener("wheel",T,Ha),document.removeEventListener("touchmove",T,Ha),document.removeEventListener("touchstart",j,Ha)}},[]);var N=i.removeScrollBar,w=i.inert;return y.createElement(y.Fragment,null,w?y.createElement(v,{styles:p1(m)}):null,N?y.createElement(s1,{noRelative:i.noRelative,gapMode:i.gapMode}):null)}function x1(i){for(var s=null;i!==null;)i instanceof ShadowRoot&&(s=i.host,i=i.host),i=i.parentNode;return s}const E1=Fg(av,b1);var rv=y.forwardRef(function(i,s){return y.createElement(hi,Lt({},i,{ref:s,sideCar:E1}))});rv.classNames=hi.classNames;var T1=function(i){if(typeof document>"u")return null;var s=Array.isArray(i)?i[0]:i;return s.ownerDocument.body},qa=new WeakMap,ci=new WeakMap,ri={},kr=0,sv=function(i){return i&&(i.host||sv(i.parentNode))},A1=function(i,s){return s.map(function(o){if(i.contains(o))return o;var r=sv(o);return r&&i.contains(r)?r:(console.error("aria-hidden",o,"in not contained inside",i,". Doing nothing"),null)}).filter(function(o){return!!o})},z1=function(i,s,o,r){var m=A1(s,Array.isArray(i)?i:[i]);ri[o]||(ri[o]=new WeakMap);var v=ri[o],S=[],p=new Set,T=new Set(m),h=function(A){!A||p.has(A)||(p.add(A),h(A.parentNode))};m.forEach(h);var j=function(A){!A||T.has(A)||Array.prototype.forEach.call(A.children,function(M){if(p.has(M))j(M);else try{var N=M.getAttribute(r),w=N!==null&&N!=="false",R=(qa.get(M)||0)+1,L=(v.get(M)||0)+1;qa.set(M,R),v.set(M,L),S.push(M),R===1&&w&&ci.set(M,!0),L===1&&M.setAttribute(o,"true"),w||M.setAttribute(r,"true")}catch(Y){console.error("aria-hidden: cannot operate on ",M,Y)}})};return j(s),p.clear(),kr++,function(){S.forEach(function(A){var M=qa.get(A)-1,N=v.get(A)-1;qa.set(A,M),v.set(A,N),M||(ci.has(A)||A.removeAttribute(r),ci.delete(A)),N||A.removeAttribute(o)}),kr--,kr||(qa=new WeakMap,qa=new WeakMap,ci=new WeakMap,ri={})}},C1=function(i,s,o){o===void 0&&(o="data-aria-hidden");var r=Array.from(Array.isArray(i)?i:[i]),m=T1(i);return m?(r.push.apply(r,Array.from(m.querySelectorAll("[aria-live], script"))),z1(r,m,o,"aria-hidden")):function(){return null}},yi="Dialog",[ov]=vi(yi),[j1,Rt]=ov(yi),fv=i=>{const{__scopeDialog:s,children:o,open:r,defaultOpen:m,onOpenChange:v,modal:S=!0}=i,p=y.useRef(null),T=y.useRef(null),[h,j]=as({prop:r,defaultProp:m??!1,onChange:v,caller:yi});return d.jsx(j1,{scope:s,triggerRef:p,contentRef:T,contentId:Bn(),titleId:Bn(),descriptionId:Bn(),open:h,onOpenChange:j,onOpenToggle:y.useCallback(()=>j(A=>!A),[j]),modal:S,children:o})};fv.displayName=yi;var dv="DialogTrigger",M1=y.forwardRef((i,s)=>{const{__scopeDialog:o,...r}=i,m=Rt(dv,o),v=wt(s,m.triggerRef);return d.jsx(tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":m.open,"aria-controls":m.contentId,"data-state":is(m.open),...r,ref:v,onClick:Fe(i.onClick,m.onOpenToggle)})});M1.displayName=dv;var ns="DialogPortal",[O1,mv]=ov(ns,{forceMount:void 0}),vv=i=>{const{__scopeDialog:s,forceMount:o,children:r,container:m}=i,v=Rt(ns,s);return d.jsx(O1,{scope:s,forceMount:o,children:y.Children.map(r,S=>d.jsx(Ln,{present:o||v.open,children:d.jsx(ev,{asChild:!0,container:m,children:S})}))})};vv.displayName=ns;var mi="DialogOverlay",hv=y.forwardRef((i,s)=>{const o=mv(mi,i.__scopeDialog),{forceMount:r=o.forceMount,...m}=i,v=Rt(mi,i.__scopeDialog);return v.modal?d.jsx(Ln,{present:r||v.open,children:d.jsx(_1,{...m,ref:s})}):null});hv.displayName=mi;var N1=di("DialogOverlay.RemoveScroll"),_1=y.forwardRef((i,s)=>{const{__scopeDialog:o,...r}=i,m=Rt(mi,o);return d.jsx(rv,{as:N1,allowPinchZoom:!0,shards:[m.contentRef],children:d.jsx(tt.div,{"data-state":is(m.open),...r,ref:s,style:{pointerEvents:"auto",...r.style}})})}),Fl="DialogContent",yv=y.forwardRef((i,s)=>{const o=mv(Fl,i.__scopeDialog),{forceMount:r=o.forceMount,...m}=i,v=Rt(Fl,i.__scopeDialog);return d.jsx(Ln,{present:r||v.open,children:v.modal?d.jsx(D1,{...m,ref:s}):d.jsx(R1,{...m,ref:s})})});yv.displayName=Fl;var D1=y.forwardRef((i,s)=>{const o=Rt(Fl,i.__scopeDialog),r=y.useRef(null),m=wt(s,o.contentRef,r);return y.useEffect(()=>{const v=r.current;if(v)return C1(v)},[]),d.jsx(gv,{...i,ref:m,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Fe(i.onCloseAutoFocus,v=>{var S;v.preventDefault(),(S=o.triggerRef.current)==null||S.focus()}),onPointerDownOutside:Fe(i.onPointerDownOutside,v=>{const S=v.detail.originalEvent,p=S.button===0&&S.ctrlKey===!0;(S.button===2||p)&&v.preventDefault()}),onFocusOutside:Fe(i.onFocusOutside,v=>v.preventDefault())})}),R1=y.forwardRef((i,s)=>{const o=Rt(Fl,i.__scopeDialog),r=y.useRef(!1),m=y.useRef(!1);return d.jsx(gv,{...i,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:v=>{var S,p;(S=i.onCloseAutoFocus)==null||S.call(i,v),v.defaultPrevented||(r.current||(p=o.triggerRef.current)==null||p.focus(),v.preventDefault()),r.current=!1,m.current=!1},onInteractOutside:v=>{var T,h;(T=i.onInteractOutside)==null||T.call(i,v),v.defaultPrevented||(r.current=!0,v.detail.originalEvent.type==="pointerdown"&&(m.current=!0));const S=v.target;((h=o.triggerRef.current)==null?void 0:h.contains(S))&&v.preventDefault(),v.detail.originalEvent.type==="focusin"&&m.current&&v.preventDefault()}})}),gv=y.forwardRef((i,s)=>{const{__scopeDialog:o,trapFocus:r,onOpenAutoFocus:m,onCloseAutoFocus:v,...S}=i,p=Rt(Fl,o),T=y.useRef(null),h=wt(s,T);return Yg(),d.jsxs(d.Fragment,{children:[d.jsx(Im,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:m,onUnmountAutoFocus:v,children:d.jsx(Fm,{role:"dialog",id:p.contentId,"aria-describedby":p.descriptionId,"aria-labelledby":p.titleId,"data-state":is(p.open),...S,ref:h,onDismiss:()=>p.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(H1,{titleId:p.titleId}),d.jsx(q1,{contentRef:T,descriptionId:p.descriptionId})]})]})}),us="DialogTitle",pv=y.forwardRef((i,s)=>{const{__scopeDialog:o,...r}=i,m=Rt(us,o);return d.jsx(tt.h2,{id:m.titleId,...r,ref:s})});pv.displayName=us;var Sv="DialogDescription",U1=y.forwardRef((i,s)=>{const{__scopeDialog:o,...r}=i,m=Rt(Sv,o);return d.jsx(tt.p,{id:m.descriptionId,...r,ref:s})});U1.displayName=Sv;var bv="DialogClose",xv=y.forwardRef((i,s)=>{const{__scopeDialog:o,...r}=i,m=Rt(bv,o);return d.jsx(tt.button,{type:"button",...r,ref:s,onClick:Fe(i.onClick,()=>m.onOpenChange(!1))})});xv.displayName=bv;function is(i){return i?"open":"closed"}var Ev="DialogTitleWarning",[pp,Tv]=ig(Ev,{contentName:Fl,titleName:us,docsSlug:"dialog"}),H1=({titleId:i})=>{const s=Tv(Ev),o=`\`${s.contentName}\` requires a \`${s.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${s.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${s.docsSlug}`;return y.useEffect(()=>{i&&(document.getElementById(i)||console.error(o))},[o,i]),null},B1="DialogDescriptionWarning",q1=({contentRef:i,descriptionId:s})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Tv(B1).contentName}}.`;return y.useEffect(()=>{var v;const m=(v=i.current)==null?void 0:v.getAttribute("aria-describedby");s&&m&&(document.getElementById(s)||console.warn(r))},[r,i,s]),null},Av=fv,zv=vv,Cv=hv,jv=yv,Mv=pv,Ov=xv;function L1(i){var m,v;const s={},o=((m=i.inputSchema)==null?void 0:m.properties)||{},r=((v=i.inputSchema)==null?void 0:v.required)||[];for(const[S,p]of Object.entries(o))s[S]=r.includes(S)?p.type==="number"?0:p.type==="boolean"?!1:"":null;return s}function w1({tool:i,onClose:s,onCall:o}){const[r,m]=y.useState(()=>JSON.stringify(L1(i),null,2)),[v,S]=y.useState(""),[p,T]=y.useState(!1),[h,j]=y.useState(""),[A,M]=y.useState(""),N=async()=>{let w;try{w=JSON.parse(r||"{}")}catch(L){M(`Invalid JSON: ${String(L)}`);return}T(!0),M("");const R=performance.now();try{const L=await o(i.name,w);S(ls(L)),j(`${Math.round(performance.now()-R)}ms`)}catch(L){S(""),M(String(L))}finally{T(!1)}};return d.jsx(Av,{open:!0,onOpenChange:w=>!w&&s(),children:d.jsxs(zv,{children:[d.jsx(Cv,{className:"mc-overlay"}),d.jsxs(jv,{className:"mc-modal",style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"min(880px, calc(100vw - 2rem))",maxHeight:"84vh",display:"flex",flexDirection:"column",zIndex:50},children:[d.jsxs("div",{style:{padding:"0.9rem 1.25rem",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"1rem"},children:[d.jsxs("div",{children:[d.jsx(Mv,{asChild:!0,children:d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.45rem",fontSize:"0.82rem",fontWeight:700},children:[d.jsx(Qm,{size:12,style:{color:"var(--color-accent)"}}),d.jsx("span",{children:"Call"}),d.jsx("code",{style:{background:"transparent",padding:0,color:"var(--color-accent)"},children:i.name})]})}),d.jsx("div",{style:{fontSize:"0.72rem",color:"var(--text-muted)",marginTop:"0.25rem"},children:i.description})]}),d.jsx(Ov,{asChild:!0,children:d.jsx("button",{className:"mc-btn-icon",style:{width:28,padding:0,justifyContent:"center"},children:d.jsx(Km,{size:13})})})]}),A&&d.jsx("div",{style:{padding:"0.6rem 1.25rem",background:"rgba(239,68,68,0.08)",borderBottom:"1px solid rgba(239,68,68,0.2)",color:"#ef4444",fontSize:"0.72rem"},children:A}),d.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",minHeight:0,flex:1},children:[d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.55rem",padding:"1rem",borderRight:"1px solid var(--border)"},children:[d.jsx("label",{style:{fontSize:"0.62rem",textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--text-dim)",fontWeight:700},children:"Arguments"}),d.jsx("textarea",{className:"mc-textarea",style:{flex:1,minHeight:"16rem"},value:r,onChange:w=>m(w.target.value),spellCheck:!1}),d.jsx("button",{className:"mc-send-btn",disabled:p,onClick:N,children:p?"Executing…":"Execute Tool"})]}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.55rem",padding:"1rem",minHeight:0},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[d.jsx("label",{style:{fontSize:"0.62rem",textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--text-dim)",fontWeight:700},children:"Result"}),h&&d.jsx("span",{className:"mc-badge",children:h})]}),d.jsx("pre",{className:"mc-code",style:{flex:1,minHeight:"16rem",overflow:"auto",padding:"0.9rem"},dangerouslySetInnerHTML:{__html:v||''}})]})]})]})]})})}function Y1(i){const s=i+"CollectionProvider",[o,r]=vi(s),[m,v]=o(s,{collectionRef:{current:null},itemMap:new Map}),S=R=>{const{scope:L,children:Y}=R,K=Ol.useRef(null),V=Ol.useRef(new Map).current;return d.jsx(m,{scope:L,itemMap:V,collectionRef:K,children:Y})};S.displayName=s;const p=i+"CollectionSlot",T=di(p),h=Ol.forwardRef((R,L)=>{const{scope:Y,children:K}=R,V=v(p,Y),W=wt(L,V.collectionRef);return d.jsx(T,{ref:W,children:K})});h.displayName=p;const j=i+"CollectionItemSlot",A="data-radix-collection-item",M=di(j),N=Ol.forwardRef((R,L)=>{const{scope:Y,children:K,...V}=R,W=Ol.useRef(null),ae=wt(L,W),F=v(j,Y);return Ol.useEffect(()=>(F.itemMap.set(W,{ref:W,...V}),()=>void F.itemMap.delete(W))),d.jsx(M,{[A]:"",ref:ae,children:K})});N.displayName=j;function w(R){const L=v(i+"CollectionConsumer",R);return Ol.useCallback(()=>{const K=L.collectionRef.current;if(!K)return[];const V=Array.from(K.querySelectorAll(`[${A}]`));return Array.from(L.itemMap.values()).sort((F,X)=>V.indexOf(F.ref.current)-V.indexOf(X.ref.current))},[L.collectionRef,L.itemMap])}return[{Provider:S,Slot:h,ItemSlot:N},w,r]}var G1=y.createContext(void 0);function Nv(i){const s=y.useContext(G1);return i||s||"ltr"}var Wr="rovingFocusGroup.onEntryFocus",X1={bubbles:!1,cancelable:!0},wn="RovingFocusGroup",[es,_v,Q1]=Y1(wn),[V1,Dv]=vi(wn,[Q1]),[Z1,K1]=V1(wn),Rv=y.forwardRef((i,s)=>d.jsx(es.Provider,{scope:i.__scopeRovingFocusGroup,children:d.jsx(es.Slot,{scope:i.__scopeRovingFocusGroup,children:d.jsx(J1,{...i,ref:s})})}));Rv.displayName=wn;var J1=y.forwardRef((i,s)=>{const{__scopeRovingFocusGroup:o,orientation:r,loop:m=!1,dir:v,currentTabStopId:S,defaultCurrentTabStopId:p,onCurrentTabStopIdChange:T,onEntryFocus:h,preventScrollOnEntryFocus:j=!1,...A}=i,M=y.useRef(null),N=wt(s,M),w=Nv(v),[R,L]=as({prop:S,defaultProp:p??null,onChange:T,caller:wn}),[Y,K]=y.useState(!1),V=wa(h),W=_v(o),ae=y.useRef(!1),[F,X]=y.useState(0);return y.useEffect(()=>{const ue=M.current;if(ue)return ue.addEventListener(Wr,V),()=>ue.removeEventListener(Wr,V)},[V]),d.jsx(Z1,{scope:o,orientation:r,dir:w,loop:m,currentTabStopId:R,onItemFocus:y.useCallback(ue=>L(ue),[L]),onItemShiftTab:y.useCallback(()=>K(!0),[]),onFocusableItemAdd:y.useCallback(()=>X(ue=>ue+1),[]),onFocusableItemRemove:y.useCallback(()=>X(ue=>ue-1),[]),children:d.jsx(tt.div,{tabIndex:Y||F===0?-1:0,"data-orientation":r,...A,ref:N,style:{outline:"none",...i.style},onMouseDown:Fe(i.onMouseDown,()=>{ae.current=!0}),onFocus:Fe(i.onFocus,ue=>{const Ce=!ae.current;if(ue.target===ue.currentTarget&&Ce&&!Y){const Ve=new CustomEvent(Wr,X1);if(ue.currentTarget.dispatchEvent(Ve),!Ve.defaultPrevented){const _e=W().filter(_=>_.focusable),De=_e.find(_=>_.active),Ge=_e.find(_=>_.id===R),$e=[De,Ge,..._e].filter(Boolean).map(_=>_.ref.current);Bv($e,j)}}ae.current=!1}),onBlur:Fe(i.onBlur,()=>K(!1))})})}),Uv="RovingFocusGroupItem",Hv=y.forwardRef((i,s)=>{const{__scopeRovingFocusGroup:o,focusable:r=!0,active:m=!1,tabStopId:v,children:S,...p}=i,T=Bn(),h=v||T,j=K1(Uv,o),A=j.currentTabStopId===h,M=_v(o),{onFocusableItemAdd:N,onFocusableItemRemove:w,currentTabStopId:R}=j;return y.useEffect(()=>{if(r)return N(),()=>w()},[r,N,w]),d.jsx(es.ItemSlot,{scope:o,id:h,focusable:r,active:m,children:d.jsx(tt.span,{tabIndex:A?0:-1,"data-orientation":j.orientation,...p,ref:s,onMouseDown:Fe(i.onMouseDown,L=>{r?j.onItemFocus(h):L.preventDefault()}),onFocus:Fe(i.onFocus,()=>j.onItemFocus(h)),onKeyDown:Fe(i.onKeyDown,L=>{if(L.key==="Tab"&&L.shiftKey){j.onItemShiftTab();return}if(L.target!==L.currentTarget)return;const Y=F1(L,j.orientation,j.dir);if(Y!==void 0){if(L.metaKey||L.ctrlKey||L.altKey||L.shiftKey)return;L.preventDefault();let V=M().filter(W=>W.focusable).map(W=>W.ref.current);if(Y==="last")V.reverse();else if(Y==="prev"||Y==="next"){Y==="prev"&&V.reverse();const W=V.indexOf(L.currentTarget);V=j.loop?$1(V,W+1):V.slice(W+1)}setTimeout(()=>Bv(V))}}),children:typeof S=="function"?S({isCurrentTabStop:A,hasTabStop:R!=null}):S})})});Hv.displayName=Uv;var k1={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function W1(i,s){return s!=="rtl"?i:i==="ArrowLeft"?"ArrowRight":i==="ArrowRight"?"ArrowLeft":i}function F1(i,s,o){const r=W1(i.key,o);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return k1[r]}function Bv(i,s=!1){const o=document.activeElement;for(const r of i)if(r===o||(r.focus({preventScroll:s}),document.activeElement!==o))return}function $1(i,s){return i.map((o,r)=>i[(s+r)%i.length])}var I1=Rv,P1=Hv,gi="Tabs",[ep]=vi(gi,[Dv]),qv=Dv(),[tp,cs]=ep(gi),Lv=y.forwardRef((i,s)=>{const{__scopeTabs:o,value:r,onValueChange:m,defaultValue:v,orientation:S="horizontal",dir:p,activationMode:T="automatic",...h}=i,j=Nv(p),[A,M]=as({prop:r,onChange:m,defaultProp:v??"",caller:gi});return d.jsx(tp,{scope:o,baseId:Bn(),value:A,onValueChange:M,orientation:S,dir:j,activationMode:T,children:d.jsx(tt.div,{dir:j,"data-orientation":S,...h,ref:s})})});Lv.displayName=gi;var wv="TabsList",Yv=y.forwardRef((i,s)=>{const{__scopeTabs:o,loop:r=!0,...m}=i,v=cs(wv,o),S=qv(o);return d.jsx(I1,{asChild:!0,...S,orientation:v.orientation,dir:v.dir,loop:r,children:d.jsx(tt.div,{role:"tablist","aria-orientation":v.orientation,...m,ref:s})})});Yv.displayName=wv;var Gv="TabsTrigger",Xv=y.forwardRef((i,s)=>{const{__scopeTabs:o,value:r,disabled:m=!1,...v}=i,S=cs(Gv,o),p=qv(o),T=Vv(S.baseId,r),h=Zv(S.baseId,r),j=r===S.value;return d.jsx(P1,{asChild:!0,...p,focusable:!m,active:j,children:d.jsx(tt.button,{type:"button",role:"tab","aria-selected":j,"aria-controls":h,"data-state":j?"active":"inactive","data-disabled":m?"":void 0,disabled:m,id:T,...v,ref:s,onMouseDown:Fe(i.onMouseDown,A=>{!m&&A.button===0&&A.ctrlKey===!1?S.onValueChange(r):A.preventDefault()}),onKeyDown:Fe(i.onKeyDown,A=>{[" ","Enter"].includes(A.key)&&S.onValueChange(r)}),onFocus:Fe(i.onFocus,()=>{const A=S.activationMode!=="manual";!j&&!m&&A&&S.onValueChange(r)})})})});Xv.displayName=Gv;var Qv="TabsContent",lp=y.forwardRef((i,s)=>{const{__scopeTabs:o,value:r,forceMount:m,children:v,...S}=i,p=cs(Qv,o),T=Vv(p.baseId,r),h=Zv(p.baseId,r),j=r===p.value,A=y.useRef(j);return y.useEffect(()=>{const M=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(M)},[]),d.jsx(Ln,{present:m||j,children:({present:M})=>d.jsx(tt.div,{"data-state":j?"active":"inactive","data-orientation":p.orientation,role:"tabpanel","aria-labelledby":T,hidden:!M,id:h,tabIndex:0,...S,ref:s,style:{...i.style,animationDuration:A.current?"0s":void 0},children:M&&v})})});lp.displayName=Qv;function Vv(i,s){return`${i}-trigger-${s}`}function Zv(i,s){return`${i}-content-${s}`}var ap=Lv,np=Yv,up=Xv;function ip(i){var m,v;const s={},o=((m=i.inputSchema)==null?void 0:m.properties)||{},r=((v=i.inputSchema)==null?void 0:v.required)||[];for(const[S,p]of Object.entries(o))s[S]=r.includes(S)?p.type==="number"?0:p.type==="boolean"?!1:"":null;return s}const Fr={"tools/call":(i,s)=>({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:i,arguments:s}}),"tools/list":()=>({jsonrpc:"2.0",id:1,method:"tools/list"}),initialize:()=>({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2024-11-05",capabilities:{},clientInfo:{name:"docscontext-ui",version:"1.0.0"}}}),ping:()=>({jsonrpc:"2.0",id:1,method:"ping"}),"resources/list":()=>({jsonrpc:"2.0",id:1,method:"resources/list"})};function cp({tool:i,onClose:s,onSend:o}){const r=(i==null?void 0:i.name)??"tool_name",m=i?ip(i):{},[v,S]=y.useState("tools/call"),[p,T]=y.useState(JSON.stringify(Fr["tools/call"](r,m),null,2)),[h,j]=y.useState(""),[A,M]=y.useState(""),[N,w]=y.useState(!1),[R,L]=y.useState(""),Y=y.useRef(null),K=F=>{if(S(F),F==="custom")return;const X=F==="tools/call"?Fr[F](r,m):Fr[F]();T(JSON.stringify(X,null,2))},V=async()=>{let F;try{F=JSON.parse(p)}catch(X){L(`Invalid JSON: ${String(X)}`);return}w(!0),L("");try{const{data:X,status:ue,ms:Ce}=await o(F);j(ls(X)),M(`${Ce}ms · HTTP ${ue}`)}catch(X){j(""),L(String(X))}finally{w(!1)}},W=async()=>{if(await navigator.clipboard.writeText(p),!Y.current)return;const F=Y.current.innerHTML;Y.current.textContent="Copied",window.setTimeout(()=>{Y.current&&(Y.current.innerHTML=F)},1200)},ae=[{value:"tools/call",label:"call"},{value:"tools/list",label:"list"},{value:"initialize",label:"init"},{value:"ping",label:"ping"},{value:"resources/list",label:"resources"},{value:"custom",label:"custom"}];return d.jsx(Av,{open:!0,onOpenChange:F=>!F&&s(),children:d.jsxs(zv,{children:[d.jsx(Cv,{className:"mc-overlay"}),d.jsxs(jv,{className:"mc-modal",style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"min(1040px, calc(100vw - 2rem))",height:"88vh",display:"flex",flexDirection:"column",zIndex:50},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.9rem 1.25rem",borderBottom:"1px solid var(--border)"},children:[d.jsx("div",{style:{width:34,height:34,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:"linear-gradient(135deg, var(--bg-card), var(--bg-panel))",border:"1px solid var(--border-hover)"},children:d.jsx(Zm,{size:14,style:{color:"var(--color-accent)"}})}),d.jsxs("div",{style:{flex:1,minWidth:0},children:[d.jsx(Mv,{asChild:!0,children:d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",flexWrap:"wrap"},children:[d.jsx("span",{style:{fontWeight:700,fontFamily:"ui-monospace, monospace",fontSize:"0.84rem"},children:r}),d.jsx("span",{className:"mc-badge",children:v})]})}),d.jsx("div",{style:{fontSize:"0.72rem",color:"var(--text-muted)",marginTop:"0.15rem"},children:(i==null?void 0:i.description)||"Manual JSON-RPC request builder"})]}),d.jsx(Ov,{asChild:!0,children:d.jsx("button",{className:"mc-btn-icon",style:{width:28,padding:0,justifyContent:"center"},children:d.jsx(Km,{size:13})})})]}),d.jsx(ap,{value:v,onValueChange:F=>K(F),children:d.jsx(np,{style:{display:"flex",gap:"0.1rem",padding:"0 1rem",borderBottom:"1px solid var(--border)",background:"var(--bg-card)"},children:ae.map(F=>d.jsx(up,{value:F.value,style:{background:"none",border:"none",borderBottom:"2px solid transparent",color:"var(--text-muted)",cursor:"pointer",padding:"0.5rem 0.75rem",fontSize:"0.7rem",fontFamily:"ui-monospace, monospace"},children:F.label},F.value))})}),R&&d.jsx("div",{style:{padding:"0.6rem 1.25rem",background:"rgba(239,68,68,0.08)",borderBottom:"1px solid rgba(239,68,68,0.2)",color:"#ef4444",fontSize:"0.72rem"},children:R}),d.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",flex:1,minHeight:0},children:[d.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:0,borderRight:"1px solid var(--border)"},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0.6rem 0.9rem",borderBottom:"1px solid var(--border)"},children:[d.jsx("span",{style:{fontSize:"0.62rem",textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--text-dim)",fontWeight:700},children:"Request"}),d.jsxs("button",{ref:Y,className:"mc-copy-btn",onClick:W,children:[d.jsx(R0,{size:11})," Copy"]})]}),d.jsx("div",{style:{padding:"0.75rem",flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:d.jsx("textarea",{className:"mc-textarea",style:{flex:1,minHeight:0},value:p,onChange:F=>T(F.target.value),spellCheck:!1})}),d.jsx("div",{style:{padding:"0 0.75rem 0.75rem"},children:d.jsxs("button",{className:"mc-send-btn",disabled:N,onClick:V,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.45rem"},children:[d.jsx(Y0,{size:12})," ",N?"Sending…":"Send"]})})]}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0.6rem 0.9rem",borderBottom:"1px solid var(--border)"},children:[d.jsx("span",{style:{fontSize:"0.62rem",textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--text-dim)",fontWeight:700},children:"Response"}),A&&d.jsx("span",{className:"mc-badge",children:A})]}),d.jsx("pre",{className:"mc-code",style:{margin:"0.75rem",flex:1,minHeight:0,overflow:"auto",padding:"0.9rem"},dangerouslySetInnerHTML:{__html:h||''}})]})]})]})]})})}const rp={idle:"#555",connecting:"#eab308",connected:"#22c55e",error:"#ef4444"};function sp(){const{status:i,tools:s,error:o,call:r,connect:m,send:v}=ng(),[S,p]=y.useState(null),[T,h]=y.useState(null),j=rp[i],A=async M=>v(M);return d.jsxs("div",{className:"mcp-view",children:[d.jsxs("div",{className:"mc-status-bar",children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.55rem"},children:[d.jsxs("span",{style:{position:"relative",display:"inline-flex",width:8,height:8},children:[d.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:j,opacity:i==="connected"?.4:0,animation:i==="connected"?"mc-ping 2s cubic-bezier(0,0,0.2,1) infinite":"none"}}),d.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:j}})]}),d.jsx("span",{style:{fontSize:"0.78rem",fontWeight:600,color:j,textTransform:"capitalize"},children:i})]}),d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",fontSize:"0.72rem",color:"var(--text-dim)"},children:[d.jsx(L0,{size:11,style:{opacity:.5}}),d.jsxs("code",{style:{fontFamily:"ui-monospace, monospace",padding:"0.15rem 0.4rem",borderRadius:4,background:"var(--bg-card)",border:"1px solid var(--border)",color:"var(--text-secondary)"},children:[window.location.origin,"/mcp"]})]}),d.jsx("span",{className:"mc-badge",children:"HTTP Streamable MCP · JSON-RPC 2.0"}),d.jsx("div",{style:{marginLeft:"auto"},children:d.jsxs("button",{className:"mc-btn-icon",onClick:()=>void m(),children:[d.jsx(w0,{size:12})," Reconnect"]})})]}),d.jsxs("div",{style:{padding:"0.7rem 1.25rem",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[d.jsx("span",{style:{fontSize:"0.66rem",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.14em",color:"var(--text-dim)"},children:"Available Tools"}),d.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--text-muted)"},children:[s.length," discovered"]})]}),d.jsxs("div",{style:{flex:1,overflow:"auto",padding:"1rem",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"0.8rem",alignContent:"start"},children:[i==="error"&&d.jsxs("div",{className:"card",style:{gridColumn:"1 / -1",textAlign:"center",padding:"2.5rem 1rem"},children:[d.jsx("div",{style:{fontSize:"0.9rem",fontWeight:700,color:"#ef4444",marginBottom:"0.45rem"},children:"Connection failed"}),d.jsx("div",{style:{color:"var(--text-muted)",marginBottom:"0.85rem"},children:o||"Could not reach the MCP endpoint."}),d.jsx("code",{children:"docscontext serve"})]}),i==="connected"&&s.map((M,N)=>d.jsx(ug,{tool:M,index:N,onCall:w=>p(s[w]),onRPC:w=>h(s[w])},M.name))]}),S&&d.jsx(w1,{tool:S,onClose:()=>p(null),onCall:async(M,N)=>(await r("tools/call",{name:M,arguments:N})).result??null}),T&&d.jsx(cp,{tool:T,onClose:()=>h(null),onSend:A})]})}const Hm="dc-theme";function op(){const[i,s]=y.useState(()=>localStorage.getItem(Hm)??"dark");return y.useEffect(()=>{document.documentElement.setAttribute("data-theme",i),localStorage.setItem(Hm,i)},[i]),{theme:i,toggle:()=>s(r=>r==="dark"?"light":"dark")}}function fp(){const[i,s]=y.useState(null),[o,r]=y.useState(!0),[m,v]=y.useState(null),S=()=>{r(!0),fetch("/api/stats").then(p=>p.json()).then(p=>{s(p),v(null)}).catch(p=>v(String(p))).finally(()=>r(!1))};return y.useEffect(()=>{S()},[]),{stats:i,loading:o,error:m,refetch:S}}function dp(){const[i,s]=y.useState([]),[o,r]=y.useState(!1),[m,v]=y.useState(null),S=y.useRef(null),p=y.useCallback(async T=>{var j;(j=S.current)==null||j.abort();const h=new AbortController;S.current=h,r(!0),v(null);try{const M=await(await fetch("/api/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T),signal:h.signal})).json();if(Array.isArray(M))s(M);else{const N=M.results??[];M.answer&&N.unshift({answer:M.answer}),s(N)}}catch(A){A.name!=="AbortError"&&v(String(A))}finally{r(!1)}},[]);return{results:i,loading:o,error:m,search:p}}function mp(){const[i,s]=y.useState([]),[o,r]=y.useState(""),[m,v]=y.useState(!0),[S,p]=y.useState(null),T=y.useCallback(async(j=o)=>{v(!0),p(null);try{const A=new URLSearchParams;j&&A.set("doc_type",j);const N=await(await fetch(`/api/documents${A.toString()?`?${A.toString()}`:""}`)).json();s(Array.isArray(N)?N:[])}catch(A){p(String(A))}finally{v(!1)}},[o]);return y.useEffect(()=>{T()},[T]),{documents:i,docType:o,loading:m,error:S,refetch:T,selectType:j=>{r(j),T(j)}}}function vp(){const[i,s]=y.useState(null),[o,r]=y.useState(""),[m,v]=y.useState(!1),[S,p]=y.useState(null),T=y.useCallback(async(h,j=2)=>{if(h.trim()){r(h),v(!0),p(null);try{const A=new URLSearchParams({entity:h,depth:String(j)}),N=await(await fetch(`/api/graph/neighborhood?${A.toString()}`)).json();s({center:h,nodes:(N.nodes??[]).map(w=>({id:String(w.id),label:w.label??w.name??String(w.id),type:w.type??"Other",description:w.description,rank:w.rank})),edges:(N.edges??[]).map(w=>({id:String(w.id??`${w.from}-${w.to}`),from:String(w.from),to:String(w.to),label:w.label,weight:w.weight}))})}catch(A){p(String(A))}finally{v(!1)}}},[]);return{graph:i,entity:o,loading:m,error:S,loadGraph:T}}function hp(){const[i,s]=y.useState([]),[o,r]=y.useState(-1),[m,v]=y.useState(null),[S,p]=y.useState([]),[T,h]=y.useState(!0),[j,A]=y.useState(!1),[M,N]=y.useState(null),w=y.useCallback(async(Y=o)=>{h(!0),N(null);try{const K=new URLSearchParams;Y>=0&&K.set("level",String(Y));const W=await(await fetch(`/api/communities${K.toString()?`?${K.toString()}`:""}`)).json();s(Array.isArray(W)?W:[])}catch(K){N(String(K))}finally{h(!1)}},[o]);return y.useEffect(()=>{w()},[w]),{communities:i,level:o,members:S,selectedId:m,loading:T,detailLoading:j,error:M,selectLevel:Y=>{r(Y),w(Y)},loadCommunity:async Y=>{v(Y),A(!0);try{const V=await(await fetch(`/api/communities/${Y}`)).json();p(Array.isArray(V.members)?V.members:[])}catch(K){N(String(K)),p([])}finally{A(!1)}}}}function yp(){const[i,s]=y.useState(""),[o,r]=y.useState("idle"),[m,v]=y.useState([]),[S,p]=y.useState(!1),T=y.useRef(null);return{jobId:i,status:o,messages:m,loading:S,upload:async j=>{var M;if(!j.length)return;p(!0),r("uploading"),v([]);const A=new FormData;for(const N of j)A.append("files",N);try{const w=await(await fetch("/api/upload",{method:"POST",body:A})).json();s(w.job_id??""),r(w.status??"queued"),(M=T.current)==null||M.close();const R=new EventSource("/api/upload/progress");R.onmessage=L=>{const Y=L.data;v(K=>[...K,Y]),Y==="done"&&(r("done"),p(!1),R.close()),Y.startsWith("error:")&&(r("error"),p(!1),R.close())},R.onerror=()=>{R.close(),p(!1)},T.current=R}catch(N){v([String(N)]),r("error"),p(!1)}}}}function gp(){var $e;const{toggle:i}=op(),{stats:s,loading:o,error:r}=fp(),{results:m,loading:v,error:S,search:p}=dp(),{documents:T,docType:h,loading:j,selectType:A}=mp(),{graph:M,loading:N,error:w,loadGraph:R}=vp(),{communities:L,level:Y,members:K,selectedId:V,loading:W,detailLoading:ae,selectLevel:F,loadCommunity:X}=hp(),{jobId:ue,status:Ce,messages:Ve,loading:_e,upload:De}=yp(),[Ge,St]=y.useState("overview");return y.useEffect(()=>{!M&&!N&&R("DocsContext",2)},[M,N,R]),d.jsxs(d.Fragment,{children:[d.jsx(J0,{currentView:Ge,onViewChange:St,stats:s,onThemeToggle:i}),d.jsxs("main",{className:"main-content",style:{padding:"1rem",gap:"1rem"},children:[Ge==="overview"&&d.jsxs("div",{style:{display:"grid",gridTemplateRows:"auto auto 1fr",gap:"1rem",minHeight:0},children:[d.jsxs("section",{className:"card",style:{display:"grid",gridTemplateColumns:"1.35fr 0.65fr",gap:"1rem",overflow:"hidden",position:"relative"},children:[d.jsx("div",{style:{position:"absolute",inset:0,background:"radial-gradient(circle at top left, rgba(56,189,248,0.14), transparent 40%), linear-gradient(180deg, transparent, rgba(255,255,255,0.02))",pointerEvents:"none"}}),d.jsxs("div",{style:{position:"relative",zIndex:1},children:[d.jsx("div",{style:{fontSize:"0.74rem",textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--text-dim)",marginBottom:"0.5rem"},children:"MCP Console Dashboard"}),d.jsx("h1",{style:{fontSize:"2rem",lineHeight:1.05,marginBottom:"0.75rem"},children:"Search documents, inspect graph structure, and operate the ingestion pipeline from one surface."}),d.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",lineHeight:1.7,maxWidth:620},children:"DocsContext combines semantic retrieval, entity relationships, community summaries, and MCP tooling. This redesign aligns the product with the shared console pattern used across the other agents while keeping the knowledge graph workflows in the foreground."})]}),d.jsx("div",{style:{position:"relative",zIndex:1,display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0.75rem"},children:[["Retrieval","Local and global search"],["Graph","Neighborhood exploration"],["Communities","Hierarchical summaries"],["Ingest","Drop files into the pipeline"]].map(([_,G])=>d.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:12,padding:"0.9rem",background:"rgba(255,255,255,0.02)"},children:[d.jsx("div",{style:{fontSize:"0.76rem",fontWeight:700,marginBottom:"0.35rem"},children:_}),d.jsx("div",{style:{fontSize:"0.72rem",color:"var(--text-muted)",lineHeight:1.5},children:G})]},_))})]}),d.jsx(W0,{stats:s,loading:o}),d.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"1rem",minHeight:0},children:[d.jsx($r,{title:"Stats response",value:s??{},defaultOpen:!0}),d.jsx($r,{title:"Status",value:{statsError:r,uploadStatus:Ce,graphLoaded:!!(($e=M==null?void 0:M.nodes)!=null&&$e.length)},defaultOpen:!0})]})]}),Ge==="search"&&d.jsx(F0,{loading:v,error:S,results:m,onSearch:(_,G,P)=>void p({query:_,mode:G,top_k:P})}),Ge==="documents"&&d.jsx(I0,{documents:T,docType:h,loading:j,onFilter:A}),Ge==="graph"&&d.jsx(P0,{graph:M,loading:N,error:w,onLoad:(_,G)=>void R(_,G)}),Ge==="communities"&&d.jsx(tg,{communities:L,members:K,level:Y,loading:W,detailLoading:ae,selectedId:V,onLevel:F,onSelect:_=>void X(_)}),Ge==="upload"&&d.jsx(lg,{jobId:ue,status:Ce,messages:Ve,loading:_e,onUpload:_=>void De(_)}),Ge==="mcp"&&d.jsx(sp,{})]}),d.jsxs("footer",{className:"status-bar",children:[d.jsxs("div",{className:"status-item",children:[d.jsx("span",{className:"status-key",children:"Q"})," semantic query surface"]}),d.jsxs("div",{className:"status-item",children:[d.jsx("span",{className:"status-key",children:"G"})," graph neighborhood"]}),d.jsxs("div",{className:"status-item",children:[d.jsx("span",{className:"status-key",children:"M"})," MCP tools"]})]})]})}A0.createRoot(document.getElementById("root")).render(d.jsx(y.StrictMode,{children:d.jsx(gp,{})})); diff --git a/ui/dist/index.html b/ui/dist/index.html deleted file mode 100644 index b9bea89..0000000 --- a/ui/dist/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - DocsContext - - - - -
- - - - diff --git a/ui/package-lock.json b/ui/package-lock.json index 965fa9e..fa82043 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -63,7 +63,6 @@ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", @@ -2100,7 +2099,6 @@ "integrity": "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~6.21.0" } @@ -2111,7 +2109,6 @@ "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", "devOptional": true, "license": "MIT", - "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -2122,7 +2119,6 @@ "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", "devOptional": true, "license": "MIT", - "peer": true, "peerDependencies": { "@types/react": "^19.2.0" } @@ -2172,7 +2168,6 @@ "integrity": "sha512-k4eNDan0EIMTT/dUKc/g+rsJ6wcHYhNPdY19VoX/EOtaAG8DLtKCykhrUnuHPYvinn5jhAPgD2Qw9hXBwrahsw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.57.1", "@typescript-eslint/types": "8.57.1", @@ -2450,7 +2445,6 @@ "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2571,7 +2565,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -2808,7 +2801,6 @@ "integrity": "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -3489,7 +3481,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -3551,7 +3542,6 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -3561,7 +3551,6 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", "license": "MIT", - "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -3833,7 +3822,6 @@ "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -3963,7 +3951,6 @@ "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", diff --git a/ui/src/App.tsx b/ui/src/App.tsx index e98a53f..ddc5577 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -21,7 +21,7 @@ export default function App() { const { stats, loading: statsLoading, error: statsError } = useStats() const { results, loading: searchLoading, error: searchError, search } = useSearch() const { documents, docType, loading: docsLoading, selectType } = useDocuments() - const { graph, loading: graphLoading, error: graphError, loadGraph } = useGraph() + const { graph, loading: graphLoading, error: graphError, status: graphStatus, loadGraph, setNoEntities } = useGraph() const { communities, level, @@ -36,10 +36,20 @@ export default function App() { const [view, setView] = useState('overview') useEffect(() => { - if (!graph && !graphLoading) { - void loadGraph('DocsContext', 2) + if (!graph && !graphLoading && graphStatus === 'idle') { + fetch('/api/entities?limit=1') + .then((res) => res.ok ? res.json() : null) + .then((data) => { + const first = Array.isArray(data) ? data[0] : null + if (first?.name) { + void loadGraph(first.name, 2) + } else { + setNoEntities() + } + }) + .catch(() => setNoEntities()) } - }, [graph, graphLoading, loadGraph]) + }, [graph, graphLoading, graphStatus, loadGraph, setNoEntities]) return ( <> @@ -87,7 +97,7 @@ export default function App() { )} {view === 'graph' && ( - void loadGraph(entity, depth)} /> + void loadGraph(entity, depth)} /> )} {view === 'communities' && ( diff --git a/ui/src/components/docs/GraphView.tsx b/ui/src/components/docs/GraphView.tsx index ec2684f..bb44860 100644 --- a/ui/src/components/docs/GraphView.tsx +++ b/ui/src/components/docs/GraphView.tsx @@ -1,11 +1,13 @@ import { useMemo, useState } from 'react' import { Orbit } from 'lucide-react' import type { GraphNeighborhood } from '@/types/api' +import type { GraphStatus } from '@/hooks/useGraph' interface Props { graph: GraphNeighborhood | null loading: boolean error: string | null + status: GraphStatus onLoad: (entity: string, depth: number) => void } @@ -19,7 +21,7 @@ const typeColors: Record = { Other: '#64748b', } -export default function GraphView({ graph, loading, error, onLoad }: Props) { +export default function GraphView({ graph, loading, error, status, onLoad }: Props) { const [entity, setEntity] = useState('') const [depth, setDepth] = useState(2) @@ -63,8 +65,14 @@ export default function GraphView({ graph, loading, error, onLoad }: Props) {
{!graph?.nodes?.length && ( -
-
No graph loaded
+
+
+ + {status === 'no_entities' && No entities indexed yet. Upload documents to build the graph.} + {status === 'not_found' && Entity not found. Try a different name.} + {status === 'idle' && Enter an entity name to explore its neighborhood.} + {(status === 'loaded' || status === 'error') && !graph?.nodes?.length && No graph loaded} +
)} {graph?.nodes?.length ? ( diff --git a/ui/src/hooks/useGraph.ts b/ui/src/hooks/useGraph.ts index 1ed9e83..a61bca5 100644 --- a/ui/src/hooks/useGraph.ts +++ b/ui/src/hooks/useGraph.ts @@ -1,11 +1,14 @@ import { useCallback, useState } from 'react' import type { GraphNeighborhood } from '../types/api' +export type GraphStatus = 'idle' | 'loaded' | 'not_found' | 'no_entities' | 'error' + export function useGraph() { const [graph, setGraph] = useState(null) const [entity, setEntity] = useState('') const [loading, setLoading] = useState(false) const [error, setError] = useState(null) + const [status, setStatus] = useState('idle') const loadGraph = useCallback(async (nextEntity: string, depth = 2) => { if (!nextEntity.trim()) return @@ -15,30 +18,43 @@ export function useGraph() { try { const params = new URLSearchParams({ entity: nextEntity, depth: String(depth) }) const res = await fetch(`/api/graph/neighborhood?${params.toString()}`) + if (res.status === 404) { + setGraph(null) + setStatus('not_found') + return + } + if (!res.ok) { + const body = await res.text() + throw new Error(body || `HTTP ${res.status}`) + } const data = await res.json() - setGraph({ - center: nextEntity, - nodes: (data.nodes ?? []).map((node: any) => ({ - id: String(node.id), - label: node.label ?? node.name ?? String(node.id), - type: node.type ?? 'Other', - description: node.description, - rank: node.rank, - })), - edges: (data.edges ?? []).map((edge: any) => ({ - id: String(edge.id ?? `${edge.from}-${edge.to}`), - from: String(edge.from), - to: String(edge.to), - label: edge.label, - weight: edge.weight, - })), - }) + const nodes = (data.nodes ?? []).map((node: any) => ({ + id: String(node.id), + label: node.label ?? node.name ?? String(node.id), + type: node.type ?? 'Other', + description: node.description, + rank: node.rank, + })) + const edges = (data.edges ?? []).map((edge: any) => ({ + id: String(edge.id ?? `${edge.from}-${edge.to}`), + from: String(edge.from), + to: String(edge.to), + label: edge.label, + weight: edge.weight, + })) + setGraph({ center: nextEntity, nodes, edges }) + setStatus(nodes.length > 0 ? 'loaded' : 'loaded') } catch (e) { setError(String(e)) + setStatus('error') } finally { setLoading(false) } }, []) - return { graph, entity, loading, error, loadGraph } + const setNoEntities = useCallback(() => { + setStatus('no_entities') + }, []) + + return { graph, entity, loading, error, status, loadGraph, setNoEntities } }