@specship/specship-win32-arm64 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dist/bin/specship.js +48 -12
- package/lib/dist/bin/specship.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +16 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/schema.sql +10 -0
- package/lib/dist/db/spec-queries.d.ts +6 -0
- package/lib/dist/db/spec-queries.d.ts.map +1 -1
- package/lib/dist/db/spec-queries.js +8 -0
- package/lib/dist/db/spec-queries.js.map +1 -1
- package/lib/dist/index.d.ts +8 -0
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +9 -0
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/server/cli.js +9 -7
- package/lib/dist/server/product-version.js +44 -0
- package/lib/dist/server/routes/claude.js +153 -42
- package/lib/dist/server/routes/config.js +35 -0
- package/lib/dist/server/routes/graph.js +22 -1
- package/lib/dist/server/routes/mcp.js +510 -0
- package/lib/dist/server/routes/projects.js +31 -3
- package/lib/dist/server/routes/status.js +3 -0
- package/lib/dist/server/routes/workflow.js +44 -3
- package/lib/dist/server/server-config.js +38 -0
- package/lib/dist/server/server.js +128 -58
- package/lib/dist/statusline/active-run.d.ts +2 -2
- package/lib/dist/statusline/active-run.d.ts.map +1 -1
- package/lib/dist/statusline/active-run.js +2 -2
- package/lib/dist/statusline/active-run.js.map +1 -1
- package/lib/dist/statusline/render.d.ts.map +1 -1
- package/lib/dist/statusline/render.js +41 -5
- package/lib/dist/statusline/render.js.map +1 -1
- package/lib/dist/statusline/types.d.ts +15 -0
- package/lib/dist/statusline/types.d.ts.map +1 -1
- package/lib/dist/ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/lib/dist/ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/lib/dist/ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/lib/dist/ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/lib/dist/ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
- package/lib/dist/ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
- package/lib/dist/ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
- package/lib/dist/ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
- package/lib/dist/ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
- package/lib/dist/ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
- package/lib/dist/ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/lib/dist/ui/assets/index-D8e4LiVb.js +51 -0
- package/lib/dist/ui/assets/index-ezwX2EfG.css +1 -0
- package/lib/dist/ui/favicon-16.png +0 -0
- package/lib/dist/ui/favicon-180.png +0 -0
- package/lib/dist/ui/favicon-32.png +0 -0
- package/lib/dist/ui/favicon.svg +20 -0
- package/lib/dist/ui/index.html +17 -0
- package/lib/dist/update/resolve-latest.d.ts +14 -0
- package/lib/dist/update/resolve-latest.d.ts.map +1 -0
- package/lib/dist/update/resolve-latest.js +29 -0
- package/lib/dist/update/resolve-latest.js.map +1 -0
- package/lib/dist/update/run-installer.d.ts +13 -0
- package/lib/dist/update/run-installer.d.ts.map +1 -0
- package/lib/dist/update/run-installer.js +43 -0
- package/lib/dist/update/run-installer.js.map +1 -0
- package/lib/dist/update/updater.d.ts +53 -0
- package/lib/dist/update/updater.d.ts.map +1 -0
- package/lib/dist/update/updater.js +164 -0
- package/lib/dist/update/updater.js.map +1 -0
- package/lib/dist/workflows/eta.d.ts +42 -0
- package/lib/dist/workflows/eta.d.ts.map +1 -0
- package/lib/dist/workflows/eta.js +146 -0
- package/lib/dist/workflows/eta.js.map +1 -0
- package/lib/dist/workflows/executor.d.ts.map +1 -1
- package/lib/dist/workflows/executor.js +25 -6
- package/lib/dist/workflows/executor.js.map +1 -1
- package/lib/dist/workflows/runners/prompt.d.ts +6 -0
- package/lib/dist/workflows/runners/prompt.d.ts.map +1 -1
- package/lib/dist/workflows/runners/prompt.js +10 -0
- package/lib/dist/workflows/runners/prompt.js.map +1 -1
- package/lib/dist/workflows/runners/types.d.ts +12 -0
- package/lib/dist/workflows/runners/types.d.ts.map +1 -1
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +3 -2
- package/package.json +1 -1
- package/lib/dist/server/ssr/md.mjs +0 -83
- package/lib/dist/server/ssr/public/app.css +0 -1
- package/lib/dist/server/ssr/render.mjs +0 -564
- package/lib/dist/server/ssr/routes.js +0 -73
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();function Op(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yc={exports:{}},ll={},Gc={exports:{}},$={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ir=Symbol.for("react.element"),Ip=Symbol.for("react.portal"),Ap=Symbol.for("react.fragment"),Bp=Symbol.for("react.strict_mode"),Wp=Symbol.for("react.profiler"),$p=Symbol.for("react.provider"),Fp=Symbol.for("react.context"),Hp=Symbol.for("react.forward_ref"),Up=Symbol.for("react.suspense"),Vp=Symbol.for("react.memo"),Kp=Symbol.for("react.lazy"),gi=Symbol.iterator;function Qp(e){return e===null||typeof e!="object"?null:(e=gi&&e[gi]||e["@@iterator"],typeof e=="function"?e:null)}var qc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Xc=Object.assign,Jc={};function Un(e,t,n){this.props=e,this.context=t,this.refs=Jc,this.updater=n||qc}Un.prototype.isReactComponent={};Un.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Un.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Zc(){}Zc.prototype=Un.prototype;function ua(e,t,n){this.props=e,this.context=t,this.refs=Jc,this.updater=n||qc}var pa=ua.prototype=new Zc;pa.constructor=ua;Xc(pa,Un.prototype);pa.isPureReactComponent=!0;var vi=Array.isArray,ed=Object.prototype.hasOwnProperty,fa={current:null},td={key:!0,ref:!0,__self:!0,__source:!0};function nd(e,t,n){var s,l={},o=null,a=null;if(t!=null)for(s in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)ed.call(t,s)&&!td.hasOwnProperty(s)&&(l[s]=t[s]);var i=arguments.length-2;if(i===1)l.children=n;else if(1<i){for(var c=Array(i),d=0;d<i;d++)c[d]=arguments[d+2];l.children=c}if(e&&e.defaultProps)for(s in i=e.defaultProps,i)l[s]===void 0&&(l[s]=i[s]);return{$$typeof:Ir,type:e,key:o,ref:a,props:l,_owner:fa.current}}function Yp(e,t){return{$$typeof:Ir,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ha(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ir}function Gp(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var yi=/\/+/g;function _l(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Gp(""+e.key):t.toString(36)}function ys(e,t,n,s,l){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Ir:case Ip:a=!0}}if(a)return a=e,l=l(a),e=s===""?"."+_l(a,0):s,vi(l)?(n="",e!=null&&(n=e.replace(yi,"$&/")+"/"),ys(l,t,n,"",function(d){return d})):l!=null&&(ha(l)&&(l=Yp(l,n+(!l.key||a&&a.key===l.key?"":(""+l.key).replace(yi,"$&/")+"/")+e)),t.push(l)),1;if(a=0,s=s===""?".":s+":",vi(e))for(var i=0;i<e.length;i++){o=e[i];var c=s+_l(o,i);a+=ys(o,t,n,c,l)}else if(c=Qp(e),typeof c=="function")for(e=c.call(e),i=0;!(o=e.next()).done;)o=o.value,c=s+_l(o,i++),a+=ys(o,t,n,c,l);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Vr(e,t,n){if(e==null)return e;var s=[],l=0;return ys(e,s,"","",function(o){return t.call(n,o,l++)}),s}function qp(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ee={current:null},js={transition:null},Xp={ReactCurrentDispatcher:Ee,ReactCurrentBatchConfig:js,ReactCurrentOwner:fa};function rd(){throw Error("act(...) is not supported in production builds of React.")}$.Children={map:Vr,forEach:function(e,t,n){Vr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Vr(e,function(){t++}),t},toArray:function(e){return Vr(e,function(t){return t})||[]},only:function(e){if(!ha(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};$.Component=Un;$.Fragment=Ap;$.Profiler=Wp;$.PureComponent=ua;$.StrictMode=Bp;$.Suspense=Up;$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Xp;$.act=rd;$.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=Xc({},e.props),l=e.key,o=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,a=fa.current),t.key!==void 0&&(l=""+t.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(c in t)ed.call(t,c)&&!td.hasOwnProperty(c)&&(s[c]=t[c]===void 0&&i!==void 0?i[c]:t[c])}var c=arguments.length-2;if(c===1)s.children=n;else if(1<c){i=Array(c);for(var d=0;d<c;d++)i[d]=arguments[d+2];s.children=i}return{$$typeof:Ir,type:e.type,key:l,ref:o,props:s,_owner:a}};$.createContext=function(e){return e={$$typeof:Fp,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:$p,_context:e},e.Consumer=e};$.createElement=nd;$.createFactory=function(e){var t=nd.bind(null,e);return t.type=e,t};$.createRef=function(){return{current:null}};$.forwardRef=function(e){return{$$typeof:Hp,render:e}};$.isValidElement=ha;$.lazy=function(e){return{$$typeof:Kp,_payload:{_status:-1,_result:e},_init:qp}};$.memo=function(e,t){return{$$typeof:Vp,type:e,compare:t===void 0?null:t}};$.startTransition=function(e){var t=js.transition;js.transition={};try{e()}finally{js.transition=t}};$.unstable_act=rd;$.useCallback=function(e,t){return Ee.current.useCallback(e,t)};$.useContext=function(e){return Ee.current.useContext(e)};$.useDebugValue=function(){};$.useDeferredValue=function(e){return Ee.current.useDeferredValue(e)};$.useEffect=function(e,t){return Ee.current.useEffect(e,t)};$.useId=function(){return Ee.current.useId()};$.useImperativeHandle=function(e,t,n){return Ee.current.useImperativeHandle(e,t,n)};$.useInsertionEffect=function(e,t){return Ee.current.useInsertionEffect(e,t)};$.useLayoutEffect=function(e,t){return Ee.current.useLayoutEffect(e,t)};$.useMemo=function(e,t){return Ee.current.useMemo(e,t)};$.useReducer=function(e,t,n){return Ee.current.useReducer(e,t,n)};$.useRef=function(e){return Ee.current.useRef(e)};$.useState=function(e){return Ee.current.useState(e)};$.useSyncExternalStore=function(e,t,n){return Ee.current.useSyncExternalStore(e,t,n)};$.useTransition=function(){return Ee.current.useTransition()};$.version="18.3.1";Gc.exports=$;var N=Gc.exports;const Jp=Op(N);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Zp=N,ef=Symbol.for("react.element"),tf=Symbol.for("react.fragment"),nf=Object.prototype.hasOwnProperty,rf=Zp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,sf={key:!0,ref:!0,__self:!0,__source:!0};function sd(e,t,n){var s,l={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(s in t)nf.call(t,s)&&!sf.hasOwnProperty(s)&&(l[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)l[s]===void 0&&(l[s]=t[s]);return{$$typeof:ef,type:e,key:o,ref:a,props:l,_owner:rf.current}}ll.Fragment=tf;ll.jsx=sd;ll.jsxs=sd;Yc.exports=ll;var r=Yc.exports,po={},ld={exports:{}},He={},od={exports:{}},ad={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(b,E){var R=b.length;b.push(E);e:for(;0<R;){var I=R-1>>>1,A=b[I];if(0<l(A,E))b[I]=E,b[R]=A,R=I;else break e}}function n(b){return b.length===0?null:b[0]}function s(b){if(b.length===0)return null;var E=b[0],R=b.pop();if(R!==E){b[0]=R;e:for(var I=0,A=b.length,G=A>>>1;I<G;){var Q=2*(I+1)-1,xe=b[Q],je=Q+1,Me=b[je];if(0>l(xe,R))je<A&&0>l(Me,xe)?(b[I]=Me,b[je]=R,I=je):(b[I]=xe,b[Q]=R,I=Q);else if(je<A&&0>l(Me,R))b[I]=Me,b[je]=R,I=je;else break e}}return E}function l(b,E){var R=b.sortIndex-E.sortIndex;return R!==0?R:b.id-E.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,i=a.now();e.unstable_now=function(){return a.now()-i}}var c=[],d=[],u=1,f=null,h=3,g=!1,v=!1,p=!1,j=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(b){for(var E=n(d);E!==null;){if(E.callback===null)s(d);else if(E.startTime<=b)s(d),E.sortIndex=E.expirationTime,t(c,E);else break;E=n(d)}}function w(b){if(p=!1,y(b),!v)if(n(c)!==null)v=!0,K(S);else{var E=n(d);E!==null&&D(w,E.startTime-b)}}function S(b,E){v=!1,p&&(p=!1,m(_),_=-1),g=!0;var R=h;try{for(y(E),f=n(c);f!==null&&(!(f.expirationTime>E)||b&&!ee());){var I=f.callback;if(typeof I=="function"){f.callback=null,h=f.priorityLevel;var A=I(f.expirationTime<=E);E=e.unstable_now(),typeof A=="function"?f.callback=A:f===n(c)&&s(c),y(E)}else s(c);f=n(c)}if(f!==null)var G=!0;else{var Q=n(d);Q!==null&&D(w,Q.startTime-E),G=!1}return G}finally{f=null,h=R,g=!1}}var k=!1,C=null,_=-1,W=5,O=-1;function ee(){return!(e.unstable_now()-O<W)}function _e(){if(C!==null){var b=e.unstable_now();O=b;var E=!0;try{E=C(!0,b)}finally{E?Re():(k=!1,C=null)}}else k=!1}var Re;if(typeof x=="function")Re=function(){x(_e)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,Je=me.port2;me.port1.onmessage=_e,Re=function(){Je.postMessage(null)}}else Re=function(){j(_e,0)};function K(b){C=b,k||(k=!0,Re())}function D(b,E){_=j(function(){b(e.unstable_now())},E)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(b){b.callback=null},e.unstable_continueExecution=function(){v||g||(v=!0,K(S))},e.unstable_forceFrameRate=function(b){0>b||125<b?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<b?Math.floor(1e3/b):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(b){switch(h){case 1:case 2:case 3:var E=3;break;default:E=h}var R=h;h=E;try{return b()}finally{h=R}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(b,E){switch(b){case 1:case 2:case 3:case 4:case 5:break;default:b=3}var R=h;h=b;try{return E()}finally{h=R}},e.unstable_scheduleCallback=function(b,E,R){var I=e.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0<R?I+R:I):R=I,b){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=R+A,b={id:u++,callback:E,priorityLevel:b,startTime:R,expirationTime:A,sortIndex:-1},R>I?(b.sortIndex=R,t(d,b),n(c)===null&&b===n(d)&&(p?(m(_),_=-1):p=!0,D(w,R-I))):(b.sortIndex=A,t(c,b),v||g||(v=!0,K(S))),b},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(b){var E=h;return function(){var R=h;h=E;try{return b.apply(this,arguments)}finally{h=R}}}})(ad);od.exports=ad;var lf=od.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var of=N,Fe=lf;function T(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var id=new Set,vr={};function pn(e,t){Dn(e,t),Dn(e+"Capture",t)}function Dn(e,t){for(vr[e]=t,e=0;e<t.length;e++)id.add(t[e])}var vt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fo=Object.prototype.hasOwnProperty,af=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ji={},wi={};function cf(e){return fo.call(wi,e)?!0:fo.call(ji,e)?!1:af.test(e)?wi[e]=!0:(ji[e]=!0,!1)}function df(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function uf(e,t,n,s){if(t===null||typeof t>"u"||df(e,t,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Te(e,t,n,s,l,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var ye={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ye[e]=new Te(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ye[t]=new Te(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ye[e]=new Te(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ye[e]=new Te(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ye[e]=new Te(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ye[e]=new Te(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ye[e]=new Te(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ye[e]=new Te(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ye[e]=new Te(e,5,!1,e.toLowerCase(),null,!1,!1)});var ma=/[\-:]([a-z])/g;function xa(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ma,xa);ye[t]=new Te(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ma,xa);ye[t]=new Te(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ma,xa);ye[t]=new Te(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ye[e]=new Te(e,1,!1,e.toLowerCase(),null,!1,!1)});ye.xlinkHref=new Te("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ye[e]=new Te(e,1,!1,e.toLowerCase(),null,!0,!0)});function ga(e,t,n,s){var l=ye.hasOwnProperty(t)?ye[t]:null;(l!==null?l.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(uf(t,n,l,s)&&(n=null),s||l===null?cf(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):l.mustUseProperty?e[l.propertyName]=n===null?l.type===3?!1:"":n:(t=l.attributeName,s=l.attributeNamespace,n===null?e.removeAttribute(t):(l=l.type,n=l===3||l===4&&n===!0?"":""+n,s?e.setAttributeNS(s,t,n):e.setAttribute(t,n))))}var St=of.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Kr=Symbol.for("react.element"),xn=Symbol.for("react.portal"),gn=Symbol.for("react.fragment"),va=Symbol.for("react.strict_mode"),ho=Symbol.for("react.profiler"),cd=Symbol.for("react.provider"),dd=Symbol.for("react.context"),ya=Symbol.for("react.forward_ref"),mo=Symbol.for("react.suspense"),xo=Symbol.for("react.suspense_list"),ja=Symbol.for("react.memo"),kt=Symbol.for("react.lazy"),ud=Symbol.for("react.offscreen"),Si=Symbol.iterator;function Qn(e){return e===null||typeof e!="object"?null:(e=Si&&e[Si]||e["@@iterator"],typeof e=="function"?e:null)}var se=Object.assign,Rl;function sr(e){if(Rl===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Rl=t&&t[1]||""}return`
|
|
34
|
+
`+Rl+e}var Ml=!1;function Pl(e,t){if(!e||Ml)return"";Ml=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var s=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){s=d}e.call(t.prototype)}else{try{throw Error()}catch(d){s=d}e()}}catch(d){if(d&&s&&typeof d.stack=="string"){for(var l=d.stack.split(`
|
|
35
|
+
`),o=s.stack.split(`
|
|
36
|
+
`),a=l.length-1,i=o.length-1;1<=a&&0<=i&&l[a]!==o[i];)i--;for(;1<=a&&0<=i;a--,i--)if(l[a]!==o[i]){if(a!==1||i!==1)do if(a--,i--,0>i||l[a]!==o[i]){var c=`
|
|
37
|
+
`+l[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=i);break}}}finally{Ml=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?sr(e):""}function pf(e){switch(e.tag){case 5:return sr(e.type);case 16:return sr("Lazy");case 13:return sr("Suspense");case 19:return sr("SuspenseList");case 0:case 2:case 15:return e=Pl(e.type,!1),e;case 11:return e=Pl(e.type.render,!1),e;case 1:return e=Pl(e.type,!0),e;default:return""}}function go(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case gn:return"Fragment";case xn:return"Portal";case ho:return"Profiler";case va:return"StrictMode";case mo:return"Suspense";case xo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case dd:return(e.displayName||"Context")+".Consumer";case cd:return(e._context.displayName||"Context")+".Provider";case ya:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ja:return t=e.displayName||null,t!==null?t:go(e.type)||"Memo";case kt:t=e._payload,e=e._init;try{return go(e(t))}catch{}}return null}function ff(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return go(t);case 8:return t===va?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Wt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function pd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function hf(e){var t=pd(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(a){s=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(a){s=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Qr(e){e._valueTracker||(e._valueTracker=hf(e))}function fd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=pd(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ms(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function vo(e,t){var n=t.checked;return se({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function bi(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=Wt(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function hd(e,t){t=t.checked,t!=null&&ga(e,"checked",t,!1)}function yo(e,t){hd(e,t);var n=Wt(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?jo(e,t.type,n):t.hasOwnProperty("defaultValue")&&jo(e,t.type,Wt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ki(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function jo(e,t,n){(t!=="number"||Ms(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var lr=Array.isArray;function Tn(e,t,n,s){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Wt(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,s&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function wo(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(T(91));return se({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ni(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(T(92));if(lr(n)){if(1<n.length)throw Error(T(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Wt(n)}}function md(e,t){var n=Wt(t.value),s=Wt(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function zi(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function xd(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function So(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?xd(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Yr,gd=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,l){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,l)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Yr=Yr||document.createElement("div"),Yr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function yr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var cr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},mf=["Webkit","ms","Moz","O"];Object.keys(cr).forEach(function(e){mf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),cr[t]=cr[e]})});function vd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||cr.hasOwnProperty(e)&&cr[e]?(""+t).trim():t+"px"}function yd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,l=vd(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,l):e[n]=l}}var xf=se({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function bo(e,t){if(t){if(xf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(T(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(T(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(T(61))}if(t.style!=null&&typeof t.style!="object")throw Error(T(62))}}function ko(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var No=null;function wa(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var zo=null,_n=null,Rn=null;function Ci(e){if(e=Wr(e)){if(typeof zo!="function")throw Error(T(280));var t=e.stateNode;t&&(t=dl(t),zo(e.stateNode,e.type,t))}}function jd(e){_n?Rn?Rn.push(e):Rn=[e]:_n=e}function wd(){if(_n){var e=_n,t=Rn;if(Rn=_n=null,Ci(e),t)for(e=0;e<t.length;e++)Ci(t[e])}}function Sd(e,t){return e(t)}function bd(){}var Ll=!1;function kd(e,t,n){if(Ll)return e(t,n);Ll=!0;try{return Sd(e,t,n)}finally{Ll=!1,(_n!==null||Rn!==null)&&(bd(),wd())}}function jr(e,t){var n=e.stateNode;if(n===null)return null;var s=dl(n);if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(T(231,t,typeof n));return n}var Co=!1;if(vt)try{var Yn={};Object.defineProperty(Yn,"passive",{get:function(){Co=!0}}),window.addEventListener("test",Yn,Yn),window.removeEventListener("test",Yn,Yn)}catch{Co=!1}function gf(e,t,n,s,l,o,a,i,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var dr=!1,Ps=null,Ls=!1,Eo=null,vf={onError:function(e){dr=!0,Ps=e}};function yf(e,t,n,s,l,o,a,i,c){dr=!1,Ps=null,gf.apply(vf,arguments)}function jf(e,t,n,s,l,o,a,i,c){if(yf.apply(this,arguments),dr){if(dr){var d=Ps;dr=!1,Ps=null}else throw Error(T(198));Ls||(Ls=!0,Eo=d)}}function fn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Nd(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ei(e){if(fn(e)!==e)throw Error(T(188))}function wf(e){var t=e.alternate;if(!t){if(t=fn(e),t===null)throw Error(T(188));return t!==e?null:e}for(var n=e,s=t;;){var l=n.return;if(l===null)break;var o=l.alternate;if(o===null){if(s=l.return,s!==null){n=s;continue}break}if(l.child===o.child){for(o=l.child;o;){if(o===n)return Ei(l),e;if(o===s)return Ei(l),t;o=o.sibling}throw Error(T(188))}if(n.return!==s.return)n=l,s=o;else{for(var a=!1,i=l.child;i;){if(i===n){a=!0,n=l,s=o;break}if(i===s){a=!0,s=l,n=o;break}i=i.sibling}if(!a){for(i=o.child;i;){if(i===n){a=!0,n=o,s=l;break}if(i===s){a=!0,s=o,n=l;break}i=i.sibling}if(!a)throw Error(T(189))}}if(n.alternate!==s)throw Error(T(190))}if(n.tag!==3)throw Error(T(188));return n.stateNode.current===n?e:t}function zd(e){return e=wf(e),e!==null?Cd(e):null}function Cd(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Cd(e);if(t!==null)return t;e=e.sibling}return null}var Ed=Fe.unstable_scheduleCallback,Ti=Fe.unstable_cancelCallback,Sf=Fe.unstable_shouldYield,bf=Fe.unstable_requestPaint,oe=Fe.unstable_now,kf=Fe.unstable_getCurrentPriorityLevel,Sa=Fe.unstable_ImmediatePriority,Td=Fe.unstable_UserBlockingPriority,Ds=Fe.unstable_NormalPriority,Nf=Fe.unstable_LowPriority,_d=Fe.unstable_IdlePriority,ol=null,dt=null;function zf(e){if(dt&&typeof dt.onCommitFiberRoot=="function")try{dt.onCommitFiberRoot(ol,e,void 0,(e.current.flags&128)===128)}catch{}}var st=Math.clz32?Math.clz32:Tf,Cf=Math.log,Ef=Math.LN2;function Tf(e){return e>>>=0,e===0?32:31-(Cf(e)/Ef|0)|0}var Gr=64,qr=4194304;function or(e){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:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Os(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,l=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var i=a&~l;i!==0?s=or(i):(o&=a,o!==0&&(s=or(o)))}else a=n&~l,a!==0?s=or(a):o!==0&&(s=or(o));if(s===0)return 0;if(t!==0&&t!==s&&!(t&l)&&(l=s&-s,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-st(t),l=1<<n,s|=e[n],t&=~l;return s}function _f(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Rf(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,l=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-st(o),i=1<<a,c=l[a];c===-1?(!(i&n)||i&s)&&(l[a]=_f(i,t)):c<=t&&(e.expiredLanes|=i),o&=~i}}function To(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Rd(){var e=Gr;return Gr<<=1,!(Gr&4194240)&&(Gr=64),e}function Dl(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ar(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-st(t),e[t]=n}function Mf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var l=31-st(n),o=1<<l;t[l]=0,s[l]=-1,e[l]=-1,n&=~o}}function ba(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-st(n),l=1<<s;l&t|e[s]&t&&(e[s]|=t),n&=~l}}var V=0;function Md(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Pd,ka,Ld,Dd,Od,_o=!1,Xr=[],Mt=null,Pt=null,Lt=null,wr=new Map,Sr=new Map,zt=[],Pf="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function _i(e,t){switch(e){case"focusin":case"focusout":Mt=null;break;case"dragenter":case"dragleave":Pt=null;break;case"mouseover":case"mouseout":Lt=null;break;case"pointerover":case"pointerout":wr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sr.delete(t.pointerId)}}function Gn(e,t,n,s,l,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:o,targetContainers:[l]},t!==null&&(t=Wr(t),t!==null&&ka(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function Lf(e,t,n,s,l){switch(t){case"focusin":return Mt=Gn(Mt,e,t,n,s,l),!0;case"dragenter":return Pt=Gn(Pt,e,t,n,s,l),!0;case"mouseover":return Lt=Gn(Lt,e,t,n,s,l),!0;case"pointerover":var o=l.pointerId;return wr.set(o,Gn(wr.get(o)||null,e,t,n,s,l)),!0;case"gotpointercapture":return o=l.pointerId,Sr.set(o,Gn(Sr.get(o)||null,e,t,n,s,l)),!0}return!1}function Id(e){var t=tn(e.target);if(t!==null){var n=fn(t);if(n!==null){if(t=n.tag,t===13){if(t=Nd(n),t!==null){e.blockedOn=t,Od(e.priority,function(){Ld(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ws(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ro(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);No=s,n.target.dispatchEvent(s),No=null}else return t=Wr(n),t!==null&&ka(t),e.blockedOn=n,!1;t.shift()}return!0}function Ri(e,t,n){ws(e)&&n.delete(t)}function Df(){_o=!1,Mt!==null&&ws(Mt)&&(Mt=null),Pt!==null&&ws(Pt)&&(Pt=null),Lt!==null&&ws(Lt)&&(Lt=null),wr.forEach(Ri),Sr.forEach(Ri)}function qn(e,t){e.blockedOn===t&&(e.blockedOn=null,_o||(_o=!0,Fe.unstable_scheduleCallback(Fe.unstable_NormalPriority,Df)))}function br(e){function t(l){return qn(l,e)}if(0<Xr.length){qn(Xr[0],e);for(var n=1;n<Xr.length;n++){var s=Xr[n];s.blockedOn===e&&(s.blockedOn=null)}}for(Mt!==null&&qn(Mt,e),Pt!==null&&qn(Pt,e),Lt!==null&&qn(Lt,e),wr.forEach(t),Sr.forEach(t),n=0;n<zt.length;n++)s=zt[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<zt.length&&(n=zt[0],n.blockedOn===null);)Id(n),n.blockedOn===null&&zt.shift()}var Mn=St.ReactCurrentBatchConfig,Is=!0;function Of(e,t,n,s){var l=V,o=Mn.transition;Mn.transition=null;try{V=1,Na(e,t,n,s)}finally{V=l,Mn.transition=o}}function If(e,t,n,s){var l=V,o=Mn.transition;Mn.transition=null;try{V=4,Na(e,t,n,s)}finally{V=l,Mn.transition=o}}function Na(e,t,n,s){if(Is){var l=Ro(e,t,n,s);if(l===null)Vl(e,t,s,As,n),_i(e,s);else if(Lf(l,e,t,n,s))s.stopPropagation();else if(_i(e,s),t&4&&-1<Pf.indexOf(e)){for(;l!==null;){var o=Wr(l);if(o!==null&&Pd(o),o=Ro(e,t,n,s),o===null&&Vl(e,t,s,As,n),o===l)break;l=o}l!==null&&s.stopPropagation()}else Vl(e,t,s,null,n)}}var As=null;function Ro(e,t,n,s){if(As=null,e=wa(s),e=tn(e),e!==null)if(t=fn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Nd(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return As=e,null}function Ad(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(kf()){case Sa:return 1;case Td:return 4;case Ds:case Nf:return 16;case _d:return 536870912;default:return 16}default:return 16}}var Tt=null,za=null,Ss=null;function Bd(){if(Ss)return Ss;var e,t=za,n=t.length,s,l="value"in Tt?Tt.value:Tt.textContent,o=l.length;for(e=0;e<n&&t[e]===l[e];e++);var a=n-e;for(s=1;s<=a&&t[n-s]===l[o-s];s++);return Ss=l.slice(e,1<s?1-s:void 0)}function bs(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Jr(){return!0}function Mi(){return!1}function Ue(e){function t(n,s,l,o,a){this._reactName=n,this._targetInst=l,this.type=s,this.nativeEvent=o,this.target=a,this.currentTarget=null;for(var i in e)e.hasOwnProperty(i)&&(n=e[i],this[i]=n?n(o):o[i]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Jr:Mi,this.isPropagationStopped=Mi,this}return se(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Jr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Jr)},persist:function(){},isPersistent:Jr}),t}var Vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ca=Ue(Vn),Br=se({},Vn,{view:0,detail:0}),Af=Ue(Br),Ol,Il,Xn,al=se({},Br,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ea,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Xn&&(Xn&&e.type==="mousemove"?(Ol=e.screenX-Xn.screenX,Il=e.screenY-Xn.screenY):Il=Ol=0,Xn=e),Ol)},movementY:function(e){return"movementY"in e?e.movementY:Il}}),Pi=Ue(al),Bf=se({},al,{dataTransfer:0}),Wf=Ue(Bf),$f=se({},Br,{relatedTarget:0}),Al=Ue($f),Ff=se({},Vn,{animationName:0,elapsedTime:0,pseudoElement:0}),Hf=Ue(Ff),Uf=se({},Vn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Vf=Ue(Uf),Kf=se({},Vn,{data:0}),Li=Ue(Kf),Qf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Yf={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Gf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qf(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Gf[e])?!!t[e]:!1}function Ea(){return qf}var Xf=se({},Br,{key:function(e){if(e.key){var t=Qf[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=bs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Yf[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ea,charCode:function(e){return e.type==="keypress"?bs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?bs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Jf=Ue(Xf),Zf=se({},al,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Di=Ue(Zf),eh=se({},Br,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ea}),th=Ue(eh),nh=se({},Vn,{propertyName:0,elapsedTime:0,pseudoElement:0}),rh=Ue(nh),sh=se({},al,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),lh=Ue(sh),oh=[9,13,27,32],Ta=vt&&"CompositionEvent"in window,ur=null;vt&&"documentMode"in document&&(ur=document.documentMode);var ah=vt&&"TextEvent"in window&&!ur,Wd=vt&&(!Ta||ur&&8<ur&&11>=ur),Oi=" ",Ii=!1;function $d(e,t){switch(e){case"keyup":return oh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vn=!1;function ih(e,t){switch(e){case"compositionend":return Fd(t);case"keypress":return t.which!==32?null:(Ii=!0,Oi);case"textInput":return e=t.data,e===Oi&&Ii?null:e;default:return null}}function ch(e,t){if(vn)return e==="compositionend"||!Ta&&$d(e,t)?(e=Bd(),Ss=za=Tt=null,vn=!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.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Wd&&t.locale!=="ko"?null:t.data;default:return null}}var dh={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ai(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!dh[e.type]:t==="textarea"}function Hd(e,t,n,s){jd(s),t=Bs(t,"onChange"),0<t.length&&(n=new Ca("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var pr=null,kr=null;function uh(e){eu(e,0)}function il(e){var t=wn(e);if(fd(t))return e}function ph(e,t){if(e==="change")return t}var Ud=!1;if(vt){var Bl;if(vt){var Wl="oninput"in document;if(!Wl){var Bi=document.createElement("div");Bi.setAttribute("oninput","return;"),Wl=typeof Bi.oninput=="function"}Bl=Wl}else Bl=!1;Ud=Bl&&(!document.documentMode||9<document.documentMode)}function Wi(){pr&&(pr.detachEvent("onpropertychange",Vd),kr=pr=null)}function Vd(e){if(e.propertyName==="value"&&il(kr)){var t=[];Hd(t,kr,e,wa(e)),kd(uh,t)}}function fh(e,t,n){e==="focusin"?(Wi(),pr=t,kr=n,pr.attachEvent("onpropertychange",Vd)):e==="focusout"&&Wi()}function hh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return il(kr)}function mh(e,t){if(e==="click")return il(t)}function xh(e,t){if(e==="input"||e==="change")return il(t)}function gh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ot=typeof Object.is=="function"?Object.is:gh;function Nr(e,t){if(ot(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var l=n[s];if(!fo.call(t,l)||!ot(e[l],t[l]))return!1}return!0}function $i(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Fi(e,t){var n=$i(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=$i(n)}}function Kd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qd(){for(var e=window,t=Ms();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ms(e.document)}return t}function _a(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")}function vh(e){var t=Qd(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Kd(n.ownerDocument.documentElement,n)){if(s!==null&&_a(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,o=Math.min(s.start,l);s=s.end===void 0?o:Math.min(s.end,l),!e.extend&&o>s&&(l=s,s=o,o=l),l=Fi(n,o);var a=Fi(n,s);l&&a&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>s?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var yh=vt&&"documentMode"in document&&11>=document.documentMode,yn=null,Mo=null,fr=null,Po=!1;function Hi(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Po||yn==null||yn!==Ms(s)||(s=yn,"selectionStart"in s&&_a(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),fr&&Nr(fr,s)||(fr=s,s=Bs(Mo,"onSelect"),0<s.length&&(t=new Ca("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=yn)))}function Zr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var jn={animationend:Zr("Animation","AnimationEnd"),animationiteration:Zr("Animation","AnimationIteration"),animationstart:Zr("Animation","AnimationStart"),transitionend:Zr("Transition","TransitionEnd")},$l={},Yd={};vt&&(Yd=document.createElement("div").style,"AnimationEvent"in window||(delete jn.animationend.animation,delete jn.animationiteration.animation,delete jn.animationstart.animation),"TransitionEvent"in window||delete jn.transitionend.transition);function cl(e){if($l[e])return $l[e];if(!jn[e])return e;var t=jn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Yd)return $l[e]=t[n];return e}var Gd=cl("animationend"),qd=cl("animationiteration"),Xd=cl("animationstart"),Jd=cl("transitionend"),Zd=new Map,Ui="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ht(e,t){Zd.set(e,t),pn(t,[e])}for(var Fl=0;Fl<Ui.length;Fl++){var Hl=Ui[Fl],jh=Hl.toLowerCase(),wh=Hl[0].toUpperCase()+Hl.slice(1);Ht(jh,"on"+wh)}Ht(Gd,"onAnimationEnd");Ht(qd,"onAnimationIteration");Ht(Xd,"onAnimationStart");Ht("dblclick","onDoubleClick");Ht("focusin","onFocus");Ht("focusout","onBlur");Ht(Jd,"onTransitionEnd");Dn("onMouseEnter",["mouseout","mouseover"]);Dn("onMouseLeave",["mouseout","mouseover"]);Dn("onPointerEnter",["pointerout","pointerover"]);Dn("onPointerLeave",["pointerout","pointerover"]);pn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));pn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));pn("onBeforeInput",["compositionend","keypress","textInput","paste"]);pn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));pn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));pn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ar="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Sh=new Set("cancel close invalid load scroll toggle".split(" ").concat(ar));function Vi(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,jf(s,t,void 0,e),e.currentTarget=null}function eu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],l=s.event;s=s.listeners;e:{var o=void 0;if(t)for(var a=s.length-1;0<=a;a--){var i=s[a],c=i.instance,d=i.currentTarget;if(i=i.listener,c!==o&&l.isPropagationStopped())break e;Vi(l,i,d),o=c}else for(a=0;a<s.length;a++){if(i=s[a],c=i.instance,d=i.currentTarget,i=i.listener,c!==o&&l.isPropagationStopped())break e;Vi(l,i,d),o=c}}}if(Ls)throw e=Eo,Ls=!1,Eo=null,e}function q(e,t){var n=t[Ao];n===void 0&&(n=t[Ao]=new Set);var s=e+"__bubble";n.has(s)||(tu(t,e,2,!1),n.add(s))}function Ul(e,t,n){var s=0;t&&(s|=4),tu(n,e,s,t)}var es="_reactListening"+Math.random().toString(36).slice(2);function zr(e){if(!e[es]){e[es]=!0,id.forEach(function(n){n!=="selectionchange"&&(Sh.has(n)||Ul(n,!1,e),Ul(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[es]||(t[es]=!0,Ul("selectionchange",!1,t))}}function tu(e,t,n,s){switch(Ad(t)){case 1:var l=Of;break;case 4:l=If;break;default:l=Na}n=l.bind(null,t,n,e),l=void 0,!Co||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),s?l!==void 0?e.addEventListener(t,n,{capture:!0,passive:l}):e.addEventListener(t,n,!0):l!==void 0?e.addEventListener(t,n,{passive:l}):e.addEventListener(t,n,!1)}function Vl(e,t,n,s,l){var o=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var a=s.tag;if(a===3||a===4){var i=s.stateNode.containerInfo;if(i===l||i.nodeType===8&&i.parentNode===l)break;if(a===4)for(a=s.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===l||c.nodeType===8&&c.parentNode===l))return;a=a.return}for(;i!==null;){if(a=tn(i),a===null)return;if(c=a.tag,c===5||c===6){s=o=a;continue e}i=i.parentNode}}s=s.return}kd(function(){var d=o,u=wa(n),f=[];e:{var h=Zd.get(e);if(h!==void 0){var g=Ca,v=e;switch(e){case"keypress":if(bs(n)===0)break e;case"keydown":case"keyup":g=Jf;break;case"focusin":v="focus",g=Al;break;case"focusout":v="blur",g=Al;break;case"beforeblur":case"afterblur":g=Al;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=Pi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=Wf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=th;break;case Gd:case qd:case Xd:g=Hf;break;case Jd:g=rh;break;case"scroll":g=Af;break;case"wheel":g=lh;break;case"copy":case"cut":case"paste":g=Vf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=Di}var p=(t&4)!==0,j=!p&&e==="scroll",m=p?h!==null?h+"Capture":null:h;p=[];for(var x=d,y;x!==null;){y=x;var w=y.stateNode;if(y.tag===5&&w!==null&&(y=w,m!==null&&(w=jr(x,m),w!=null&&p.push(Cr(x,w,y)))),j)break;x=x.return}0<p.length&&(h=new g(h,v,null,n,u),f.push({event:h,listeners:p}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",h&&n!==No&&(v=n.relatedTarget||n.fromElement)&&(tn(v)||v[yt]))break e;if((g||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,g?(v=n.relatedTarget||n.toElement,g=d,v=v?tn(v):null,v!==null&&(j=fn(v),v!==j||v.tag!==5&&v.tag!==6)&&(v=null)):(g=null,v=d),g!==v)){if(p=Pi,w="onMouseLeave",m="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(p=Di,w="onPointerLeave",m="onPointerEnter",x="pointer"),j=g==null?h:wn(g),y=v==null?h:wn(v),h=new p(w,x+"leave",g,n,u),h.target=j,h.relatedTarget=y,w=null,tn(u)===d&&(p=new p(m,x+"enter",v,n,u),p.target=y,p.relatedTarget=j,w=p),j=w,g&&v)t:{for(p=g,m=v,x=0,y=p;y;y=hn(y))x++;for(y=0,w=m;w;w=hn(w))y++;for(;0<x-y;)p=hn(p),x--;for(;0<y-x;)m=hn(m),y--;for(;x--;){if(p===m||m!==null&&p===m.alternate)break t;p=hn(p),m=hn(m)}p=null}else p=null;g!==null&&Ki(f,h,g,p,!1),v!==null&&j!==null&&Ki(f,j,v,p,!0)}}e:{if(h=d?wn(d):window,g=h.nodeName&&h.nodeName.toLowerCase(),g==="select"||g==="input"&&h.type==="file")var S=ph;else if(Ai(h))if(Ud)S=xh;else{S=hh;var k=fh}else(g=h.nodeName)&&g.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=mh);if(S&&(S=S(e,d))){Hd(f,S,n,u);break e}k&&k(e,h,d),e==="focusout"&&(k=h._wrapperState)&&k.controlled&&h.type==="number"&&jo(h,"number",h.value)}switch(k=d?wn(d):window,e){case"focusin":(Ai(k)||k.contentEditable==="true")&&(yn=k,Mo=d,fr=null);break;case"focusout":fr=Mo=yn=null;break;case"mousedown":Po=!0;break;case"contextmenu":case"mouseup":case"dragend":Po=!1,Hi(f,n,u);break;case"selectionchange":if(yh)break;case"keydown":case"keyup":Hi(f,n,u)}var C;if(Ta)e:{switch(e){case"compositionstart":var _="onCompositionStart";break e;case"compositionend":_="onCompositionEnd";break e;case"compositionupdate":_="onCompositionUpdate";break e}_=void 0}else vn?$d(e,n)&&(_="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(_="onCompositionStart");_&&(Wd&&n.locale!=="ko"&&(vn||_!=="onCompositionStart"?_==="onCompositionEnd"&&vn&&(C=Bd()):(Tt=u,za="value"in Tt?Tt.value:Tt.textContent,vn=!0)),k=Bs(d,_),0<k.length&&(_=new Li(_,e,null,n,u),f.push({event:_,listeners:k}),C?_.data=C:(C=Fd(n),C!==null&&(_.data=C)))),(C=ah?ih(e,n):ch(e,n))&&(d=Bs(d,"onBeforeInput"),0<d.length&&(u=new Li("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:d}),u.data=C))}eu(f,t)})}function Cr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Bs(e,t){for(var n=t+"Capture",s=[];e!==null;){var l=e,o=l.stateNode;l.tag===5&&o!==null&&(l=o,o=jr(e,n),o!=null&&s.unshift(Cr(e,o,l)),o=jr(e,t),o!=null&&s.push(Cr(e,o,l))),e=e.return}return s}function hn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Ki(e,t,n,s,l){for(var o=t._reactName,a=[];n!==null&&n!==s;){var i=n,c=i.alternate,d=i.stateNode;if(c!==null&&c===s)break;i.tag===5&&d!==null&&(i=d,l?(c=jr(n,o),c!=null&&a.unshift(Cr(n,c,i))):l||(c=jr(n,o),c!=null&&a.push(Cr(n,c,i)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var bh=/\r\n?/g,kh=/\u0000|\uFFFD/g;function Qi(e){return(typeof e=="string"?e:""+e).replace(bh,`
|
|
38
|
+
`).replace(kh,"")}function ts(e,t,n){if(t=Qi(t),Qi(e)!==t&&n)throw Error(T(425))}function Ws(){}var Lo=null,Do=null;function Oo(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Io=typeof setTimeout=="function"?setTimeout:void 0,Nh=typeof clearTimeout=="function"?clearTimeout:void 0,Yi=typeof Promise=="function"?Promise:void 0,zh=typeof queueMicrotask=="function"?queueMicrotask:typeof Yi<"u"?function(e){return Yi.resolve(null).then(e).catch(Ch)}:Io;function Ch(e){setTimeout(function(){throw e})}function Kl(e,t){var n=t,s=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(s===0){e.removeChild(l),br(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=l}while(n);br(t)}function Dt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Gi(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Kn=Math.random().toString(36).slice(2),ct="__reactFiber$"+Kn,Er="__reactProps$"+Kn,yt="__reactContainer$"+Kn,Ao="__reactEvents$"+Kn,Eh="__reactListeners$"+Kn,Th="__reactHandles$"+Kn;function tn(e){var t=e[ct];if(t)return t;for(var n=e.parentNode;n;){if(t=n[yt]||n[ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Gi(e);e!==null;){if(n=e[ct])return n;e=Gi(e)}return t}e=n,n=e.parentNode}return null}function Wr(e){return e=e[ct]||e[yt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function wn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(T(33))}function dl(e){return e[Er]||null}var Bo=[],Sn=-1;function Ut(e){return{current:e}}function X(e){0>Sn||(e.current=Bo[Sn],Bo[Sn]=null,Sn--)}function Y(e,t){Sn++,Bo[Sn]=e.current,e.current=t}var $t={},ke=Ut($t),De=Ut(!1),on=$t;function On(e,t){var n=e.type.contextTypes;if(!n)return $t;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Oe(e){return e=e.childContextTypes,e!=null}function $s(){X(De),X(ke)}function qi(e,t,n){if(ke.current!==$t)throw Error(T(168));Y(ke,t),Y(De,n)}function nu(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var l in s)if(!(l in t))throw Error(T(108,ff(e)||"Unknown",l));return se({},n,s)}function Fs(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$t,on=ke.current,Y(ke,e),Y(De,De.current),!0}function Xi(e,t,n){var s=e.stateNode;if(!s)throw Error(T(169));n?(e=nu(e,t,on),s.__reactInternalMemoizedMergedChildContext=e,X(De),X(ke),Y(ke,e)):X(De),Y(De,n)}var ht=null,ul=!1,Ql=!1;function ru(e){ht===null?ht=[e]:ht.push(e)}function _h(e){ul=!0,ru(e)}function Vt(){if(!Ql&&ht!==null){Ql=!0;var e=0,t=V;try{var n=ht;for(V=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}ht=null,ul=!1}catch(l){throw ht!==null&&(ht=ht.slice(e+1)),Ed(Sa,Vt),l}finally{V=t,Ql=!1}}return null}var bn=[],kn=0,Hs=null,Us=0,Ve=[],Ke=0,an=null,mt=1,xt="";function Jt(e,t){bn[kn++]=Us,bn[kn++]=Hs,Hs=e,Us=t}function su(e,t,n){Ve[Ke++]=mt,Ve[Ke++]=xt,Ve[Ke++]=an,an=e;var s=mt;e=xt;var l=32-st(s)-1;s&=~(1<<l),n+=1;var o=32-st(t)+l;if(30<o){var a=l-l%5;o=(s&(1<<a)-1).toString(32),s>>=a,l-=a,mt=1<<32-st(t)+l|n<<l|s,xt=o+e}else mt=1<<o|n<<l|s,xt=e}function Ra(e){e.return!==null&&(Jt(e,1),su(e,1,0))}function Ma(e){for(;e===Hs;)Hs=bn[--kn],bn[kn]=null,Us=bn[--kn],bn[kn]=null;for(;e===an;)an=Ve[--Ke],Ve[Ke]=null,xt=Ve[--Ke],Ve[Ke]=null,mt=Ve[--Ke],Ve[Ke]=null}var $e=null,We=null,Z=!1,rt=null;function lu(e,t){var n=Qe(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ji(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,$e=e,We=Dt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,$e=e,We=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=an!==null?{id:mt,overflow:xt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Qe(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,$e=e,We=null,!0):!1;default:return!1}}function Wo(e){return(e.mode&1)!==0&&(e.flags&128)===0}function $o(e){if(Z){var t=We;if(t){var n=t;if(!Ji(e,t)){if(Wo(e))throw Error(T(418));t=Dt(n.nextSibling);var s=$e;t&&Ji(e,t)?lu(s,n):(e.flags=e.flags&-4097|2,Z=!1,$e=e)}}else{if(Wo(e))throw Error(T(418));e.flags=e.flags&-4097|2,Z=!1,$e=e}}}function Zi(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;$e=e}function ns(e){if(e!==$e)return!1;if(!Z)return Zi(e),Z=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Oo(e.type,e.memoizedProps)),t&&(t=We)){if(Wo(e))throw ou(),Error(T(418));for(;t;)lu(e,t),t=Dt(t.nextSibling)}if(Zi(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(T(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){We=Dt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}We=null}}else We=$e?Dt(e.stateNode.nextSibling):null;return!0}function ou(){for(var e=We;e;)e=Dt(e.nextSibling)}function In(){We=$e=null,Z=!1}function Pa(e){rt===null?rt=[e]:rt.push(e)}var Rh=St.ReactCurrentBatchConfig;function Jn(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(T(309));var s=n.stateNode}if(!s)throw Error(T(147,e));var l=s,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(a){var i=l.refs;a===null?delete i[o]:i[o]=a},t._stringRef=o,t)}if(typeof e!="string")throw Error(T(284));if(!n._owner)throw Error(T(290,e))}return e}function rs(e,t){throw e=Object.prototype.toString.call(t),Error(T(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ec(e){var t=e._init;return t(e._payload)}function au(e){function t(m,x){if(e){var y=m.deletions;y===null?(m.deletions=[x],m.flags|=16):y.push(x)}}function n(m,x){if(!e)return null;for(;x!==null;)t(m,x),x=x.sibling;return null}function s(m,x){for(m=new Map;x!==null;)x.key!==null?m.set(x.key,x):m.set(x.index,x),x=x.sibling;return m}function l(m,x){return m=Bt(m,x),m.index=0,m.sibling=null,m}function o(m,x,y){return m.index=y,e?(y=m.alternate,y!==null?(y=y.index,y<x?(m.flags|=2,x):y):(m.flags|=2,x)):(m.flags|=1048576,x)}function a(m){return e&&m.alternate===null&&(m.flags|=2),m}function i(m,x,y,w){return x===null||x.tag!==6?(x=eo(y,m.mode,w),x.return=m,x):(x=l(x,y),x.return=m,x)}function c(m,x,y,w){var S=y.type;return S===gn?u(m,x,y.props.children,w,y.key):x!==null&&(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===kt&&ec(S)===x.type)?(w=l(x,y.props),w.ref=Jn(m,x,y),w.return=m,w):(w=_s(y.type,y.key,y.props,null,m.mode,w),w.ref=Jn(m,x,y),w.return=m,w)}function d(m,x,y,w){return x===null||x.tag!==4||x.stateNode.containerInfo!==y.containerInfo||x.stateNode.implementation!==y.implementation?(x=to(y,m.mode,w),x.return=m,x):(x=l(x,y.children||[]),x.return=m,x)}function u(m,x,y,w,S){return x===null||x.tag!==7?(x=ln(y,m.mode,w,S),x.return=m,x):(x=l(x,y),x.return=m,x)}function f(m,x,y){if(typeof x=="string"&&x!==""||typeof x=="number")return x=eo(""+x,m.mode,y),x.return=m,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Kr:return y=_s(x.type,x.key,x.props,null,m.mode,y),y.ref=Jn(m,null,x),y.return=m,y;case xn:return x=to(x,m.mode,y),x.return=m,x;case kt:var w=x._init;return f(m,w(x._payload),y)}if(lr(x)||Qn(x))return x=ln(x,m.mode,y,null),x.return=m,x;rs(m,x)}return null}function h(m,x,y,w){var S=x!==null?x.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return S!==null?null:i(m,x,""+y,w);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Kr:return y.key===S?c(m,x,y,w):null;case xn:return y.key===S?d(m,x,y,w):null;case kt:return S=y._init,h(m,x,S(y._payload),w)}if(lr(y)||Qn(y))return S!==null?null:u(m,x,y,w,null);rs(m,y)}return null}function g(m,x,y,w,S){if(typeof w=="string"&&w!==""||typeof w=="number")return m=m.get(y)||null,i(x,m,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Kr:return m=m.get(w.key===null?y:w.key)||null,c(x,m,w,S);case xn:return m=m.get(w.key===null?y:w.key)||null,d(x,m,w,S);case kt:var k=w._init;return g(m,x,y,k(w._payload),S)}if(lr(w)||Qn(w))return m=m.get(y)||null,u(x,m,w,S,null);rs(x,w)}return null}function v(m,x,y,w){for(var S=null,k=null,C=x,_=x=0,W=null;C!==null&&_<y.length;_++){C.index>_?(W=C,C=null):W=C.sibling;var O=h(m,C,y[_],w);if(O===null){C===null&&(C=W);break}e&&C&&O.alternate===null&&t(m,C),x=o(O,x,_),k===null?S=O:k.sibling=O,k=O,C=W}if(_===y.length)return n(m,C),Z&&Jt(m,_),S;if(C===null){for(;_<y.length;_++)C=f(m,y[_],w),C!==null&&(x=o(C,x,_),k===null?S=C:k.sibling=C,k=C);return Z&&Jt(m,_),S}for(C=s(m,C);_<y.length;_++)W=g(C,m,_,y[_],w),W!==null&&(e&&W.alternate!==null&&C.delete(W.key===null?_:W.key),x=o(W,x,_),k===null?S=W:k.sibling=W,k=W);return e&&C.forEach(function(ee){return t(m,ee)}),Z&&Jt(m,_),S}function p(m,x,y,w){var S=Qn(y);if(typeof S!="function")throw Error(T(150));if(y=S.call(y),y==null)throw Error(T(151));for(var k=S=null,C=x,_=x=0,W=null,O=y.next();C!==null&&!O.done;_++,O=y.next()){C.index>_?(W=C,C=null):W=C.sibling;var ee=h(m,C,O.value,w);if(ee===null){C===null&&(C=W);break}e&&C&&ee.alternate===null&&t(m,C),x=o(ee,x,_),k===null?S=ee:k.sibling=ee,k=ee,C=W}if(O.done)return n(m,C),Z&&Jt(m,_),S;if(C===null){for(;!O.done;_++,O=y.next())O=f(m,O.value,w),O!==null&&(x=o(O,x,_),k===null?S=O:k.sibling=O,k=O);return Z&&Jt(m,_),S}for(C=s(m,C);!O.done;_++,O=y.next())O=g(C,m,_,O.value,w),O!==null&&(e&&O.alternate!==null&&C.delete(O.key===null?_:O.key),x=o(O,x,_),k===null?S=O:k.sibling=O,k=O);return e&&C.forEach(function(_e){return t(m,_e)}),Z&&Jt(m,_),S}function j(m,x,y,w){if(typeof y=="object"&&y!==null&&y.type===gn&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Kr:e:{for(var S=y.key,k=x;k!==null;){if(k.key===S){if(S=y.type,S===gn){if(k.tag===7){n(m,k.sibling),x=l(k,y.props.children),x.return=m,m=x;break e}}else if(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===kt&&ec(S)===k.type){n(m,k.sibling),x=l(k,y.props),x.ref=Jn(m,k,y),x.return=m,m=x;break e}n(m,k);break}else t(m,k);k=k.sibling}y.type===gn?(x=ln(y.props.children,m.mode,w,y.key),x.return=m,m=x):(w=_s(y.type,y.key,y.props,null,m.mode,w),w.ref=Jn(m,x,y),w.return=m,m=w)}return a(m);case xn:e:{for(k=y.key;x!==null;){if(x.key===k)if(x.tag===4&&x.stateNode.containerInfo===y.containerInfo&&x.stateNode.implementation===y.implementation){n(m,x.sibling),x=l(x,y.children||[]),x.return=m,m=x;break e}else{n(m,x);break}else t(m,x);x=x.sibling}x=to(y,m.mode,w),x.return=m,m=x}return a(m);case kt:return k=y._init,j(m,x,k(y._payload),w)}if(lr(y))return v(m,x,y,w);if(Qn(y))return p(m,x,y,w);rs(m,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,x!==null&&x.tag===6?(n(m,x.sibling),x=l(x,y),x.return=m,m=x):(n(m,x),x=eo(y,m.mode,w),x.return=m,m=x),a(m)):n(m,x)}return j}var An=au(!0),iu=au(!1),Vs=Ut(null),Ks=null,Nn=null,La=null;function Da(){La=Nn=Ks=null}function Oa(e){var t=Vs.current;X(Vs),e._currentValue=t}function Fo(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Pn(e,t){Ks=e,La=Nn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Le=!0),e.firstContext=null)}function qe(e){var t=e._currentValue;if(La!==e)if(e={context:e,memoizedValue:t,next:null},Nn===null){if(Ks===null)throw Error(T(308));Nn=e,Ks.dependencies={lanes:0,firstContext:e}}else Nn=Nn.next=e;return t}var nn=null;function Ia(e){nn===null?nn=[e]:nn.push(e)}function cu(e,t,n,s){var l=t.interleaved;return l===null?(n.next=n,Ia(t)):(n.next=l.next,l.next=n),t.interleaved=n,jt(e,s)}function jt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Nt=!1;function Aa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function du(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function gt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ot(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,F&2){var l=s.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),s.pending=t,jt(e,n)}return l=s.interleaved,l===null?(t.next=t,Ia(s)):(t.next=l.next,l.next=t),s.interleaved=t,jt(e,n)}function ks(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,ba(e,n)}}function tc(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=a:o=o.next=a,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:s.baseState,firstBaseUpdate:l,lastBaseUpdate:o,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Qs(e,t,n,s){var l=e.updateQueue;Nt=!1;var o=l.firstBaseUpdate,a=l.lastBaseUpdate,i=l.shared.pending;if(i!==null){l.shared.pending=null;var c=i,d=c.next;c.next=null,a===null?o=d:a.next=d,a=c;var u=e.alternate;u!==null&&(u=u.updateQueue,i=u.lastBaseUpdate,i!==a&&(i===null?u.firstBaseUpdate=d:i.next=d,u.lastBaseUpdate=c))}if(o!==null){var f=l.baseState;a=0,u=d=c=null,i=o;do{var h=i.lane,g=i.eventTime;if((s&h)===h){u!==null&&(u=u.next={eventTime:g,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var v=e,p=i;switch(h=t,g=n,p.tag){case 1:if(v=p.payload,typeof v=="function"){f=v.call(g,f,h);break e}f=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=p.payload,h=typeof v=="function"?v.call(g,f,h):v,h==null)break e;f=se({},f,h);break e;case 2:Nt=!0}}i.callback!==null&&i.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[i]:h.push(i))}else g={eventTime:g,lane:h,tag:i.tag,payload:i.payload,callback:i.callback,next:null},u===null?(d=u=g,c=f):u=u.next=g,a|=h;if(i=i.next,i===null){if(i=l.shared.pending,i===null)break;h=i,i=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(u===null&&(c=f),l.baseState=c,l.firstBaseUpdate=d,l.lastBaseUpdate=u,t=l.shared.interleaved,t!==null){l=t;do a|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);dn|=a,e.lanes=a,e.memoizedState=f}}function nc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],l=s.callback;if(l!==null){if(s.callback=null,s=n,typeof l!="function")throw Error(T(191,l));l.call(s)}}}var $r={},ut=Ut($r),Tr=Ut($r),_r=Ut($r);function rn(e){if(e===$r)throw Error(T(174));return e}function Ba(e,t){switch(Y(_r,t),Y(Tr,e),Y(ut,$r),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:So(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=So(t,e)}X(ut),Y(ut,t)}function Bn(){X(ut),X(Tr),X(_r)}function uu(e){rn(_r.current);var t=rn(ut.current),n=So(t,e.type);t!==n&&(Y(Tr,e),Y(ut,n))}function Wa(e){Tr.current===e&&(X(ut),X(Tr))}var te=Ut(0);function Ys(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Yl=[];function $a(){for(var e=0;e<Yl.length;e++)Yl[e]._workInProgressVersionPrimary=null;Yl.length=0}var Ns=St.ReactCurrentDispatcher,Gl=St.ReactCurrentBatchConfig,cn=0,ne=null,ce=null,pe=null,Gs=!1,hr=!1,Rr=0,Mh=0;function we(){throw Error(T(321))}function Fa(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ot(e[n],t[n]))return!1;return!0}function Ha(e,t,n,s,l,o){if(cn=o,ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ns.current=e===null||e.memoizedState===null?Oh:Ih,e=n(s,l),hr){o=0;do{if(hr=!1,Rr=0,25<=o)throw Error(T(301));o+=1,pe=ce=null,t.updateQueue=null,Ns.current=Ah,e=n(s,l)}while(hr)}if(Ns.current=qs,t=ce!==null&&ce.next!==null,cn=0,pe=ce=ne=null,Gs=!1,t)throw Error(T(300));return e}function Ua(){var e=Rr!==0;return Rr=0,e}function it(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pe===null?ne.memoizedState=pe=e:pe=pe.next=e,pe}function Xe(){if(ce===null){var e=ne.alternate;e=e!==null?e.memoizedState:null}else e=ce.next;var t=pe===null?ne.memoizedState:pe.next;if(t!==null)pe=t,ce=e;else{if(e===null)throw Error(T(310));ce=e,e={memoizedState:ce.memoizedState,baseState:ce.baseState,baseQueue:ce.baseQueue,queue:ce.queue,next:null},pe===null?ne.memoizedState=pe=e:pe=pe.next=e}return pe}function Mr(e,t){return typeof t=="function"?t(e):t}function ql(e){var t=Xe(),n=t.queue;if(n===null)throw Error(T(311));n.lastRenderedReducer=e;var s=ce,l=s.baseQueue,o=n.pending;if(o!==null){if(l!==null){var a=l.next;l.next=o.next,o.next=a}s.baseQueue=l=o,n.pending=null}if(l!==null){o=l.next,s=s.baseState;var i=a=null,c=null,d=o;do{var u=d.lane;if((cn&u)===u)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),s=d.hasEagerState?d.eagerState:e(s,d.action);else{var f={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(i=c=f,a=s):c=c.next=f,ne.lanes|=u,dn|=u}d=d.next}while(d!==null&&d!==o);c===null?a=s:c.next=i,ot(s,t.memoizedState)||(Le=!0),t.memoizedState=s,t.baseState=a,t.baseQueue=c,n.lastRenderedState=s}if(e=n.interleaved,e!==null){l=e;do o=l.lane,ne.lanes|=o,dn|=o,l=l.next;while(l!==e)}else l===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Xl(e){var t=Xe(),n=t.queue;if(n===null)throw Error(T(311));n.lastRenderedReducer=e;var s=n.dispatch,l=n.pending,o=t.memoizedState;if(l!==null){n.pending=null;var a=l=l.next;do o=e(o,a.action),a=a.next;while(a!==l);ot(o,t.memoizedState)||(Le=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,s]}function pu(){}function fu(e,t){var n=ne,s=Xe(),l=t(),o=!ot(s.memoizedState,l);if(o&&(s.memoizedState=l,Le=!0),s=s.queue,Va(xu.bind(null,n,s,e),[e]),s.getSnapshot!==t||o||pe!==null&&pe.memoizedState.tag&1){if(n.flags|=2048,Pr(9,mu.bind(null,n,s,l,t),void 0,null),he===null)throw Error(T(349));cn&30||hu(n,t,l)}return l}function hu(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ne.updateQueue,t===null?(t={lastEffect:null,stores:null},ne.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function mu(e,t,n,s){t.value=n,t.getSnapshot=s,gu(t)&&vu(e)}function xu(e,t,n){return n(function(){gu(t)&&vu(e)})}function gu(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ot(e,n)}catch{return!0}}function vu(e){var t=jt(e,1);t!==null&<(t,e,1,-1)}function rc(e){var t=it();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Mr,lastRenderedState:e},t.queue=e,e=e.dispatch=Dh.bind(null,ne,e),[t.memoizedState,e]}function Pr(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=ne.updateQueue,t===null?(t={lastEffect:null,stores:null},ne.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function yu(){return Xe().memoizedState}function zs(e,t,n,s){var l=it();ne.flags|=e,l.memoizedState=Pr(1|t,n,void 0,s===void 0?null:s)}function pl(e,t,n,s){var l=Xe();s=s===void 0?null:s;var o=void 0;if(ce!==null){var a=ce.memoizedState;if(o=a.destroy,s!==null&&Fa(s,a.deps)){l.memoizedState=Pr(t,n,o,s);return}}ne.flags|=e,l.memoizedState=Pr(1|t,n,o,s)}function sc(e,t){return zs(8390656,8,e,t)}function Va(e,t){return pl(2048,8,e,t)}function ju(e,t){return pl(4,2,e,t)}function wu(e,t){return pl(4,4,e,t)}function Su(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function bu(e,t,n){return n=n!=null?n.concat([e]):null,pl(4,4,Su.bind(null,t,e),n)}function Ka(){}function ku(e,t){var n=Xe();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Fa(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Nu(e,t){var n=Xe();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&Fa(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function zu(e,t,n){return cn&21?(ot(n,t)||(n=Rd(),ne.lanes|=n,dn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Le=!0),e.memoizedState=n)}function Ph(e,t){var n=V;V=n!==0&&4>n?n:4,e(!0);var s=Gl.transition;Gl.transition={};try{e(!1),t()}finally{V=n,Gl.transition=s}}function Cu(){return Xe().memoizedState}function Lh(e,t,n){var s=At(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},Eu(e))Tu(t,n);else if(n=cu(e,t,n,s),n!==null){var l=ze();lt(n,e,s,l),_u(n,t,s)}}function Dh(e,t,n){var s=At(e),l={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(Eu(e))Tu(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,i=o(a,n);if(l.hasEagerState=!0,l.eagerState=i,ot(i,a)){var c=t.interleaved;c===null?(l.next=l,Ia(t)):(l.next=c.next,c.next=l),t.interleaved=l;return}}catch{}finally{}n=cu(e,t,l,s),n!==null&&(l=ze(),lt(n,e,s,l),_u(n,t,s))}}function Eu(e){var t=e.alternate;return e===ne||t!==null&&t===ne}function Tu(e,t){hr=Gs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _u(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,ba(e,n)}}var qs={readContext:qe,useCallback:we,useContext:we,useEffect:we,useImperativeHandle:we,useInsertionEffect:we,useLayoutEffect:we,useMemo:we,useReducer:we,useRef:we,useState:we,useDebugValue:we,useDeferredValue:we,useTransition:we,useMutableSource:we,useSyncExternalStore:we,useId:we,unstable_isNewReconciler:!1},Oh={readContext:qe,useCallback:function(e,t){return it().memoizedState=[e,t===void 0?null:t],e},useContext:qe,useEffect:sc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,zs(4194308,4,Su.bind(null,t,e),n)},useLayoutEffect:function(e,t){return zs(4194308,4,e,t)},useInsertionEffect:function(e,t){return zs(4,2,e,t)},useMemo:function(e,t){var n=it();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=it();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=Lh.bind(null,ne,e),[s.memoizedState,e]},useRef:function(e){var t=it();return e={current:e},t.memoizedState=e},useState:rc,useDebugValue:Ka,useDeferredValue:function(e){return it().memoizedState=e},useTransition:function(){var e=rc(!1),t=e[0];return e=Ph.bind(null,e[1]),it().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=ne,l=it();if(Z){if(n===void 0)throw Error(T(407));n=n()}else{if(n=t(),he===null)throw Error(T(349));cn&30||hu(s,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,sc(xu.bind(null,s,o,e),[e]),s.flags|=2048,Pr(9,mu.bind(null,s,o,n,t),void 0,null),n},useId:function(){var e=it(),t=he.identifierPrefix;if(Z){var n=xt,s=mt;n=(s&~(1<<32-st(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=Rr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Mh++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Ih={readContext:qe,useCallback:ku,useContext:qe,useEffect:Va,useImperativeHandle:bu,useInsertionEffect:ju,useLayoutEffect:wu,useMemo:Nu,useReducer:ql,useRef:yu,useState:function(){return ql(Mr)},useDebugValue:Ka,useDeferredValue:function(e){var t=Xe();return zu(t,ce.memoizedState,e)},useTransition:function(){var e=ql(Mr)[0],t=Xe().memoizedState;return[e,t]},useMutableSource:pu,useSyncExternalStore:fu,useId:Cu,unstable_isNewReconciler:!1},Ah={readContext:qe,useCallback:ku,useContext:qe,useEffect:Va,useImperativeHandle:bu,useInsertionEffect:ju,useLayoutEffect:wu,useMemo:Nu,useReducer:Xl,useRef:yu,useState:function(){return Xl(Mr)},useDebugValue:Ka,useDeferredValue:function(e){var t=Xe();return ce===null?t.memoizedState=e:zu(t,ce.memoizedState,e)},useTransition:function(){var e=Xl(Mr)[0],t=Xe().memoizedState;return[e,t]},useMutableSource:pu,useSyncExternalStore:fu,useId:Cu,unstable_isNewReconciler:!1};function tt(e,t){if(e&&e.defaultProps){t=se({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ho(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:se({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var fl={isMounted:function(e){return(e=e._reactInternals)?fn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=ze(),l=At(e),o=gt(s,l);o.payload=t,n!=null&&(o.callback=n),t=Ot(e,o,l),t!==null&&(lt(t,e,l,s),ks(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=ze(),l=At(e),o=gt(s,l);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=Ot(e,o,l),t!==null&&(lt(t,e,l,s),ks(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ze(),s=At(e),l=gt(n,s);l.tag=2,t!=null&&(l.callback=t),t=Ot(e,l,s),t!==null&&(lt(t,e,s,n),ks(t,e,s))}};function lc(e,t,n,s,l,o,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,o,a):t.prototype&&t.prototype.isPureReactComponent?!Nr(n,s)||!Nr(l,o):!0}function Ru(e,t,n){var s=!1,l=$t,o=t.contextType;return typeof o=="object"&&o!==null?o=qe(o):(l=Oe(t)?on:ke.current,s=t.contextTypes,o=(s=s!=null)?On(e,l):$t),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=fl,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=o),t}function oc(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&fl.enqueueReplaceState(t,t.state,null)}function Uo(e,t,n,s){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs={},Aa(e);var o=t.contextType;typeof o=="object"&&o!==null?l.context=qe(o):(o=Oe(t)?on:ke.current,l.context=On(e,o)),l.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Ho(e,t,o,n),l.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(t=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),t!==l.state&&fl.enqueueReplaceState(l,l.state,null),Qs(e,n,l,s),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308)}function Wn(e,t){try{var n="",s=t;do n+=pf(s),s=s.return;while(s);var l=n}catch(o){l=`
|
|
39
|
+
Error generating stack: `+o.message+`
|
|
40
|
+
`+o.stack}return{value:e,source:t,stack:l,digest:null}}function Jl(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Vo(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Bh=typeof WeakMap=="function"?WeakMap:Map;function Mu(e,t,n){n=gt(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){Js||(Js=!0,ta=s),Vo(e,t)},n}function Pu(e,t,n){n=gt(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var l=t.value;n.payload=function(){return s(l)},n.callback=function(){Vo(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Vo(e,t),typeof s!="function"&&(It===null?It=new Set([this]):It.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function ac(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Bh;var l=new Set;s.set(t,l)}else l=s.get(t),l===void 0&&(l=new Set,s.set(t,l));l.has(n)||(l.add(n),e=Zh.bind(null,e,t,n),t.then(e,e))}function ic(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function cc(e,t,n,s,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=gt(-1,1),t.tag=2,Ot(n,t,1))),n.lanes|=1),e)}var Wh=St.ReactCurrentOwner,Le=!1;function Ne(e,t,n,s){t.child=e===null?iu(t,null,n,s):An(t,e.child,n,s)}function dc(e,t,n,s,l){n=n.render;var o=t.ref;return Pn(t,l),s=Ha(e,t,n,s,o,l),n=Ua(),e!==null&&!Le?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,wt(e,t,l)):(Z&&n&&Ra(t),t.flags|=1,Ne(e,t,s,l),t.child)}function uc(e,t,n,s,l){if(e===null){var o=n.type;return typeof o=="function"&&!ei(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Lu(e,t,o,s,l)):(e=_s(n.type,null,s,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&l)){var a=o.memoizedProps;if(n=n.compare,n=n!==null?n:Nr,n(a,s)&&e.ref===t.ref)return wt(e,t,l)}return t.flags|=1,e=Bt(o,s),e.ref=t.ref,e.return=t,t.child=e}function Lu(e,t,n,s,l){if(e!==null){var o=e.memoizedProps;if(Nr(o,s)&&e.ref===t.ref)if(Le=!1,t.pendingProps=s=o,(e.lanes&l)!==0)e.flags&131072&&(Le=!0);else return t.lanes=e.lanes,wt(e,t,l)}return Ko(e,t,n,s,l)}function Du(e,t,n){var s=t.pendingProps,l=s.children,o=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Y(Cn,Be),Be|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Y(Cn,Be),Be|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=o!==null?o.baseLanes:n,Y(Cn,Be),Be|=s}else o!==null?(s=o.baseLanes|n,t.memoizedState=null):s=n,Y(Cn,Be),Be|=s;return Ne(e,t,l,n),t.child}function Ou(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ko(e,t,n,s,l){var o=Oe(n)?on:ke.current;return o=On(t,o),Pn(t,l),n=Ha(e,t,n,s,o,l),s=Ua(),e!==null&&!Le?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,wt(e,t,l)):(Z&&s&&Ra(t),t.flags|=1,Ne(e,t,n,l),t.child)}function pc(e,t,n,s,l){if(Oe(n)){var o=!0;Fs(t)}else o=!1;if(Pn(t,l),t.stateNode===null)Cs(e,t),Ru(t,n,s),Uo(t,n,s,l),s=!0;else if(e===null){var a=t.stateNode,i=t.memoizedProps;a.props=i;var c=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=qe(d):(d=Oe(n)?on:ke.current,d=On(t,d));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(i!==s||c!==d)&&oc(t,a,s,d),Nt=!1;var h=t.memoizedState;a.state=h,Qs(t,s,a,l),c=t.memoizedState,i!==s||h!==c||De.current||Nt?(typeof u=="function"&&(Ho(t,n,u,s),c=t.memoizedState),(i=Nt||lc(t,n,i,s,h,c,d))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),a.props=s,a.state=c,a.context=d,s=i):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{a=t.stateNode,du(e,t),i=t.memoizedProps,d=t.type===t.elementType?i:tt(t.type,i),a.props=d,f=t.pendingProps,h=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=qe(c):(c=Oe(n)?on:ke.current,c=On(t,c));var g=n.getDerivedStateFromProps;(u=typeof g=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(i!==f||h!==c)&&oc(t,a,s,c),Nt=!1,h=t.memoizedState,a.state=h,Qs(t,s,a,l);var v=t.memoizedState;i!==f||h!==v||De.current||Nt?(typeof g=="function"&&(Ho(t,n,g,s),v=t.memoizedState),(d=Nt||lc(t,n,d,s,h,v,c)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(s,v,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(s,v,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=v),a.props=s,a.state=v,a.context=c,s=d):(typeof a.componentDidUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),s=!1)}return Qo(e,t,n,s,o,l)}function Qo(e,t,n,s,l,o){Ou(e,t);var a=(t.flags&128)!==0;if(!s&&!a)return l&&Xi(t,n,!1),wt(e,t,o);s=t.stateNode,Wh.current=t;var i=a&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&a?(t.child=An(t,e.child,null,o),t.child=An(t,null,i,o)):Ne(e,t,i,o),t.memoizedState=s.state,l&&Xi(t,n,!0),t.child}function Iu(e){var t=e.stateNode;t.pendingContext?qi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&qi(e,t.context,!1),Ba(e,t.containerInfo)}function fc(e,t,n,s,l){return In(),Pa(l),t.flags|=256,Ne(e,t,n,s),t.child}var Yo={dehydrated:null,treeContext:null,retryLane:0};function Go(e){return{baseLanes:e,cachePool:null,transitions:null}}function Au(e,t,n){var s=t.pendingProps,l=te.current,o=!1,a=(t.flags&128)!==0,i;if((i=a)||(i=e!==null&&e.memoizedState===null?!1:(l&2)!==0),i?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),Y(te,l&1),e===null)return $o(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=s.children,e=s.fallback,o?(s=t.mode,o=t.child,a={mode:"hidden",children:a},!(s&1)&&o!==null?(o.childLanes=0,o.pendingProps=a):o=xl(a,s,0,null),e=ln(e,s,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Go(n),t.memoizedState=Yo,e):Qa(t,a));if(l=e.memoizedState,l!==null&&(i=l.dehydrated,i!==null))return $h(e,t,a,s,i,l,n);if(o){o=s.fallback,a=t.mode,l=e.child,i=l.sibling;var c={mode:"hidden",children:s.children};return!(a&1)&&t.child!==l?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=Bt(l,c),s.subtreeFlags=l.subtreeFlags&14680064),i!==null?o=Bt(i,o):(o=ln(o,a,n,null),o.flags|=2),o.return=t,s.return=t,s.sibling=o,t.child=s,s=o,o=t.child,a=e.child.memoizedState,a=a===null?Go(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=Yo,s}return o=e.child,e=o.sibling,s=Bt(o,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function Qa(e,t){return t=xl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ss(e,t,n,s){return s!==null&&Pa(s),An(t,e.child,null,n),e=Qa(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function $h(e,t,n,s,l,o,a){if(n)return t.flags&256?(t.flags&=-257,s=Jl(Error(T(422))),ss(e,t,a,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=s.fallback,l=t.mode,s=xl({mode:"visible",children:s.children},l,0,null),o=ln(o,l,a,null),o.flags|=2,s.return=t,o.return=t,s.sibling=o,t.child=s,t.mode&1&&An(t,e.child,null,a),t.child.memoizedState=Go(a),t.memoizedState=Yo,o);if(!(t.mode&1))return ss(e,t,a,null);if(l.data==="$!"){if(s=l.nextSibling&&l.nextSibling.dataset,s)var i=s.dgst;return s=i,o=Error(T(419)),s=Jl(o,s,void 0),ss(e,t,a,s)}if(i=(a&e.childLanes)!==0,Le||i){if(s=he,s!==null){switch(a&-a){case 4:l=2;break;case 16:l=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(s.suspendedLanes|a)?0:l,l!==0&&l!==o.retryLane&&(o.retryLane=l,jt(e,l),lt(s,e,l,-1))}return Za(),s=Jl(Error(T(421))),ss(e,t,a,s)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=em.bind(null,e),l._reactRetry=t,null):(e=o.treeContext,We=Dt(l.nextSibling),$e=t,Z=!0,rt=null,e!==null&&(Ve[Ke++]=mt,Ve[Ke++]=xt,Ve[Ke++]=an,mt=e.id,xt=e.overflow,an=t),t=Qa(t,s.children),t.flags|=4096,t)}function hc(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Fo(e.return,t,n)}function Zl(e,t,n,s,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=s,o.tail=n,o.tailMode=l)}function Bu(e,t,n){var s=t.pendingProps,l=s.revealOrder,o=s.tail;if(Ne(e,t,s.children,n),s=te.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&hc(e,n,t);else if(e.tag===19)hc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(Y(te,s),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Ys(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Zl(t,!1,l,n,o);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Ys(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Zl(t,!0,n,null,o);break;case"together":Zl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Cs(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function wt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),dn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(T(153));if(t.child!==null){for(e=t.child,n=Bt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Bt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Fh(e,t,n){switch(t.tag){case 3:Iu(t),In();break;case 5:uu(t);break;case 1:Oe(t.type)&&Fs(t);break;case 4:Ba(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,l=t.memoizedProps.value;Y(Vs,s._currentValue),s._currentValue=l;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(Y(te,te.current&1),t.flags|=128,null):n&t.child.childLanes?Au(e,t,n):(Y(te,te.current&1),e=wt(e,t,n),e!==null?e.sibling:null);Y(te,te.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return Bu(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),Y(te,te.current),s)break;return null;case 22:case 23:return t.lanes=0,Du(e,t,n)}return wt(e,t,n)}var Wu,qo,$u,Fu;Wu=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};qo=function(){};$u=function(e,t,n,s){var l=e.memoizedProps;if(l!==s){e=t.stateNode,rn(ut.current);var o=null;switch(n){case"input":l=vo(e,l),s=vo(e,s),o=[];break;case"select":l=se({},l,{value:void 0}),s=se({},s,{value:void 0}),o=[];break;case"textarea":l=wo(e,l),s=wo(e,s),o=[];break;default:typeof l.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=Ws)}bo(n,s);var a;n=null;for(d in l)if(!s.hasOwnProperty(d)&&l.hasOwnProperty(d)&&l[d]!=null)if(d==="style"){var i=l[d];for(a in i)i.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(vr.hasOwnProperty(d)?o||(o=[]):(o=o||[]).push(d,null));for(d in s){var c=s[d];if(i=l?.[d],s.hasOwnProperty(d)&&c!==i&&(c!=null||i!=null))if(d==="style")if(i){for(a in i)!i.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&i[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(o||(o=[]),o.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,i=i?i.__html:void 0,c!=null&&i!==c&&(o=o||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(vr.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&q("scroll",e),o||i===c||(o=[])):(o=o||[]).push(d,c))}n&&(o=o||[]).push("style",n);var d=o;(t.updateQueue=d)&&(t.flags|=4)}};Fu=function(e,t,n,s){n!==s&&(t.flags|=4)};function Zn(e,t){if(!Z)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Se(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,s|=l.subtreeFlags&14680064,s|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,s|=l.subtreeFlags,s|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function Hh(e,t,n){var s=t.pendingProps;switch(Ma(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Se(t),null;case 1:return Oe(t.type)&&$s(),Se(t),null;case 3:return s=t.stateNode,Bn(),X(De),X(ke),$a(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(ns(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,rt!==null&&(sa(rt),rt=null))),qo(e,t),Se(t),null;case 5:Wa(t);var l=rn(_r.current);if(n=t.type,e!==null&&t.stateNode!=null)$u(e,t,n,s,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(T(166));return Se(t),null}if(e=rn(ut.current),ns(t)){s=t.stateNode,n=t.type;var o=t.memoizedProps;switch(s[ct]=t,s[Er]=o,e=(t.mode&1)!==0,n){case"dialog":q("cancel",s),q("close",s);break;case"iframe":case"object":case"embed":q("load",s);break;case"video":case"audio":for(l=0;l<ar.length;l++)q(ar[l],s);break;case"source":q("error",s);break;case"img":case"image":case"link":q("error",s),q("load",s);break;case"details":q("toggle",s);break;case"input":bi(s,o),q("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!o.multiple},q("invalid",s);break;case"textarea":Ni(s,o),q("invalid",s)}bo(n,o),l=null;for(var a in o)if(o.hasOwnProperty(a)){var i=o[a];a==="children"?typeof i=="string"?s.textContent!==i&&(o.suppressHydrationWarning!==!0&&ts(s.textContent,i,e),l=["children",i]):typeof i=="number"&&s.textContent!==""+i&&(o.suppressHydrationWarning!==!0&&ts(s.textContent,i,e),l=["children",""+i]):vr.hasOwnProperty(a)&&i!=null&&a==="onScroll"&&q("scroll",s)}switch(n){case"input":Qr(s),ki(s,o,!0);break;case"textarea":Qr(s),zi(s);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(s.onclick=Ws)}s=l,t.updateQueue=s,s!==null&&(t.flags|=4)}else{a=l.nodeType===9?l:l.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=xd(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=a.createElement(n,{is:s.is}):(e=a.createElement(n),n==="select"&&(a=e,s.multiple?a.multiple=!0:s.size&&(a.size=s.size))):e=a.createElementNS(e,n),e[ct]=t,e[Er]=s,Wu(e,t,!1,!1),t.stateNode=e;e:{switch(a=ko(n,s),n){case"dialog":q("cancel",e),q("close",e),l=s;break;case"iframe":case"object":case"embed":q("load",e),l=s;break;case"video":case"audio":for(l=0;l<ar.length;l++)q(ar[l],e);l=s;break;case"source":q("error",e),l=s;break;case"img":case"image":case"link":q("error",e),q("load",e),l=s;break;case"details":q("toggle",e),l=s;break;case"input":bi(e,s),l=vo(e,s),q("invalid",e);break;case"option":l=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},l=se({},s,{value:void 0}),q("invalid",e);break;case"textarea":Ni(e,s),l=wo(e,s),q("invalid",e);break;default:l=s}bo(n,l),i=l;for(o in i)if(i.hasOwnProperty(o)){var c=i[o];o==="style"?yd(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&gd(e,c)):o==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&yr(e,c):typeof c=="number"&&yr(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(vr.hasOwnProperty(o)?c!=null&&o==="onScroll"&&q("scroll",e):c!=null&&ga(e,o,c,a))}switch(n){case"input":Qr(e),ki(e,s,!1);break;case"textarea":Qr(e),zi(e);break;case"option":s.value!=null&&e.setAttribute("value",""+Wt(s.value));break;case"select":e.multiple=!!s.multiple,o=s.value,o!=null?Tn(e,!!s.multiple,o,!1):s.defaultValue!=null&&Tn(e,!!s.multiple,s.defaultValue,!0);break;default:typeof l.onClick=="function"&&(e.onclick=Ws)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Se(t),null;case 6:if(e&&t.stateNode!=null)Fu(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(T(166));if(n=rn(_r.current),rn(ut.current),ns(t)){if(s=t.stateNode,n=t.memoizedProps,s[ct]=t,(o=s.nodeValue!==n)&&(e=$e,e!==null))switch(e.tag){case 3:ts(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ts(s.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[ct]=t,t.stateNode=s}return Se(t),null;case 13:if(X(te),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Z&&We!==null&&t.mode&1&&!(t.flags&128))ou(),In(),t.flags|=98560,o=!1;else if(o=ns(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(T(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(T(317));o[ct]=t}else In(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Se(t),o=!1}else rt!==null&&(sa(rt),rt=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||te.current&1?de===0&&(de=3):Za())),t.updateQueue!==null&&(t.flags|=4),Se(t),null);case 4:return Bn(),qo(e,t),e===null&&zr(t.stateNode.containerInfo),Se(t),null;case 10:return Oa(t.type._context),Se(t),null;case 17:return Oe(t.type)&&$s(),Se(t),null;case 19:if(X(te),o=t.memoizedState,o===null)return Se(t),null;if(s=(t.flags&128)!==0,a=o.rendering,a===null)if(s)Zn(o,!1);else{if(de!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ys(e),a!==null){for(t.flags|=128,Zn(o,!1),s=a.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)o=n,e=s,o.flags&=14680066,a=o.alternate,a===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,e=a.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Y(te,te.current&1|2),t.child}e=e.sibling}o.tail!==null&&oe()>$n&&(t.flags|=128,s=!0,Zn(o,!1),t.lanes=4194304)}else{if(!s)if(e=Ys(a),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Zn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!Z)return Se(t),null}else 2*oe()-o.renderingStartTime>$n&&n!==1073741824&&(t.flags|=128,s=!0,Zn(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=oe(),t.sibling=null,n=te.current,Y(te,s?n&1|2:n&1),t):(Se(t),null);case 22:case 23:return Ja(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?Be&1073741824&&(Se(t),t.subtreeFlags&6&&(t.flags|=8192)):Se(t),null;case 24:return null;case 25:return null}throw Error(T(156,t.tag))}function Uh(e,t){switch(Ma(t),t.tag){case 1:return Oe(t.type)&&$s(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bn(),X(De),X(ke),$a(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Wa(t),null;case 13:if(X(te),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(T(340));In()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return X(te),null;case 4:return Bn(),null;case 10:return Oa(t.type._context),null;case 22:case 23:return Ja(),null;case 24:return null;default:return null}}var ls=!1,be=!1,Vh=typeof WeakSet=="function"?WeakSet:Set,M=null;function zn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){le(e,t,s)}else n.current=null}function Xo(e,t,n){try{n()}catch(s){le(e,t,s)}}var mc=!1;function Kh(e,t){if(Lo=Is,e=Qd(),_a(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var l=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,i=-1,c=-1,d=0,u=0,f=e,h=null;t:for(;;){for(var g;f!==n||l!==0&&f.nodeType!==3||(i=a+l),f!==o||s!==0&&f.nodeType!==3||(c=a+s),f.nodeType===3&&(a+=f.nodeValue.length),(g=f.firstChild)!==null;)h=f,f=g;for(;;){if(f===e)break t;if(h===n&&++d===l&&(i=a),h===o&&++u===s&&(c=a),(g=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=g}n=i===-1||c===-1?null:{start:i,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Do={focusedElem:e,selectionRange:n},Is=!1,M=t;M!==null;)if(t=M,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,M=e;else for(;M!==null;){t=M;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var p=v.memoizedProps,j=v.memoizedState,m=t.stateNode,x=m.getSnapshotBeforeUpdate(t.elementType===t.type?p:tt(t.type,p),j);m.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(T(163))}}catch(w){le(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,M=e;break}M=t.return}return v=mc,mc=!1,v}function mr(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Xo(t,n,o)}l=l.next}while(l!==s)}}function hl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function Jo(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Hu(e){var t=e.alternate;t!==null&&(e.alternate=null,Hu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ct],delete t[Er],delete t[Ao],delete t[Eh],delete t[Th])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Uu(e){return e.tag===5||e.tag===3||e.tag===4}function xc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Uu(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.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 Zo(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ws));else if(s!==4&&(e=e.child,e!==null))for(Zo(e,t,n),e=e.sibling;e!==null;)Zo(e,t,n),e=e.sibling}function ea(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(ea(e,t,n),e=e.sibling;e!==null;)ea(e,t,n),e=e.sibling}var ge=null,nt=!1;function bt(e,t,n){for(n=n.child;n!==null;)Vu(e,t,n),n=n.sibling}function Vu(e,t,n){if(dt&&typeof dt.onCommitFiberUnmount=="function")try{dt.onCommitFiberUnmount(ol,n)}catch{}switch(n.tag){case 5:be||zn(n,t);case 6:var s=ge,l=nt;ge=null,bt(e,t,n),ge=s,nt=l,ge!==null&&(nt?(e=ge,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ge.removeChild(n.stateNode));break;case 18:ge!==null&&(nt?(e=ge,n=n.stateNode,e.nodeType===8?Kl(e.parentNode,n):e.nodeType===1&&Kl(e,n),br(e)):Kl(ge,n.stateNode));break;case 4:s=ge,l=nt,ge=n.stateNode.containerInfo,nt=!0,bt(e,t,n),ge=s,nt=l;break;case 0:case 11:case 14:case 15:if(!be&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){l=s=s.next;do{var o=l,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&Xo(n,t,a),l=l.next}while(l!==s)}bt(e,t,n);break;case 1:if(!be&&(zn(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(i){le(n,t,i)}bt(e,t,n);break;case 21:bt(e,t,n);break;case 22:n.mode&1?(be=(s=be)||n.memoizedState!==null,bt(e,t,n),be=s):bt(e,t,n);break;default:bt(e,t,n)}}function gc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Vh),t.forEach(function(s){var l=tm.bind(null,e,s);n.has(s)||(n.add(s),s.then(l,l))})}}function et(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var l=n[s];try{var o=e,a=t,i=a;e:for(;i!==null;){switch(i.tag){case 5:ge=i.stateNode,nt=!1;break e;case 3:ge=i.stateNode.containerInfo,nt=!0;break e;case 4:ge=i.stateNode.containerInfo,nt=!0;break e}i=i.return}if(ge===null)throw Error(T(160));Vu(o,a,l),ge=null,nt=!1;var c=l.alternate;c!==null&&(c.return=null),l.return=null}catch(d){le(l,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ku(t,e),t=t.sibling}function Ku(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(et(t,e),at(e),s&4){try{mr(3,e,e.return),hl(3,e)}catch(p){le(e,e.return,p)}try{mr(5,e,e.return)}catch(p){le(e,e.return,p)}}break;case 1:et(t,e),at(e),s&512&&n!==null&&zn(n,n.return);break;case 5:if(et(t,e),at(e),s&512&&n!==null&&zn(n,n.return),e.flags&32){var l=e.stateNode;try{yr(l,"")}catch(p){le(e,e.return,p)}}if(s&4&&(l=e.stateNode,l!=null)){var o=e.memoizedProps,a=n!==null?n.memoizedProps:o,i=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{i==="input"&&o.type==="radio"&&o.name!=null&&hd(l,o),ko(i,a);var d=ko(i,o);for(a=0;a<c.length;a+=2){var u=c[a],f=c[a+1];u==="style"?yd(l,f):u==="dangerouslySetInnerHTML"?gd(l,f):u==="children"?yr(l,f):ga(l,u,f,d)}switch(i){case"input":yo(l,o);break;case"textarea":md(l,o);break;case"select":var h=l._wrapperState.wasMultiple;l._wrapperState.wasMultiple=!!o.multiple;var g=o.value;g!=null?Tn(l,!!o.multiple,g,!1):h!==!!o.multiple&&(o.defaultValue!=null?Tn(l,!!o.multiple,o.defaultValue,!0):Tn(l,!!o.multiple,o.multiple?[]:"",!1))}l[Er]=o}catch(p){le(e,e.return,p)}}break;case 6:if(et(t,e),at(e),s&4){if(e.stateNode===null)throw Error(T(162));l=e.stateNode,o=e.memoizedProps;try{l.nodeValue=o}catch(p){le(e,e.return,p)}}break;case 3:if(et(t,e),at(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{br(t.containerInfo)}catch(p){le(e,e.return,p)}break;case 4:et(t,e),at(e);break;case 13:et(t,e),at(e),l=e.child,l.flags&8192&&(o=l.memoizedState!==null,l.stateNode.isHidden=o,!o||l.alternate!==null&&l.alternate.memoizedState!==null||(qa=oe())),s&4&&gc(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(be=(d=be)||u,et(t,e),be=d):et(t,e),at(e),s&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(M=e,u=e.child;u!==null;){for(f=M=u;M!==null;){switch(h=M,g=h.child,h.tag){case 0:case 11:case 14:case 15:mr(4,h,h.return);break;case 1:zn(h,h.return);var v=h.stateNode;if(typeof v.componentWillUnmount=="function"){s=h,n=h.return;try{t=s,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(p){le(s,n,p)}}break;case 5:zn(h,h.return);break;case 22:if(h.memoizedState!==null){yc(f);continue}}g!==null?(g.return=h,M=g):yc(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{l=f.stateNode,d?(o=l.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(i=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,i.style.display=vd("display",a))}catch(p){le(e,e.return,p)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(p){le(e,e.return,p)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:et(t,e),at(e),s&4&&gc(e);break;case 21:break;default:et(t,e),at(e)}}function at(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Uu(n)){var s=n;break e}n=n.return}throw Error(T(160))}switch(s.tag){case 5:var l=s.stateNode;s.flags&32&&(yr(l,""),s.flags&=-33);var o=xc(e);ea(e,o,l);break;case 3:case 4:var a=s.stateNode.containerInfo,i=xc(e);Zo(e,i,a);break;default:throw Error(T(161))}}catch(c){le(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Qh(e,t,n){M=e,Qu(e)}function Qu(e,t,n){for(var s=(e.mode&1)!==0;M!==null;){var l=M,o=l.child;if(l.tag===22&&s){var a=l.memoizedState!==null||ls;if(!a){var i=l.alternate,c=i!==null&&i.memoizedState!==null||be;i=ls;var d=be;if(ls=a,(be=c)&&!d)for(M=l;M!==null;)a=M,c=a.child,a.tag===22&&a.memoizedState!==null?jc(l):c!==null?(c.return=a,M=c):jc(l);for(;o!==null;)M=o,Qu(o),o=o.sibling;M=l,ls=i,be=d}vc(e)}else l.subtreeFlags&8772&&o!==null?(o.return=l,M=o):vc(e)}}function vc(e){for(;M!==null;){var t=M;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:be||hl(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!be)if(n===null)s.componentDidMount();else{var l=t.elementType===t.type?n.memoizedProps:tt(t.type,n.memoizedProps);s.componentDidUpdate(l,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&nc(t,o,s);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}nc(t,a,n)}break;case 5:var i=t.stateNode;if(n===null&&t.flags&4){n=i;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&br(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(T(163))}be||t.flags&512&&Jo(t)}catch(h){le(t,t.return,h)}}if(t===e){M=null;break}if(n=t.sibling,n!==null){n.return=t.return,M=n;break}M=t.return}}function yc(e){for(;M!==null;){var t=M;if(t===e){M=null;break}var n=t.sibling;if(n!==null){n.return=t.return,M=n;break}M=t.return}}function jc(e){for(;M!==null;){var t=M;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{hl(4,t)}catch(c){le(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var l=t.return;try{s.componentDidMount()}catch(c){le(t,l,c)}}var o=t.return;try{Jo(t)}catch(c){le(t,o,c)}break;case 5:var a=t.return;try{Jo(t)}catch(c){le(t,a,c)}}}catch(c){le(t,t.return,c)}if(t===e){M=null;break}var i=t.sibling;if(i!==null){i.return=t.return,M=i;break}M=t.return}}var Yh=Math.ceil,Xs=St.ReactCurrentDispatcher,Ya=St.ReactCurrentOwner,Ye=St.ReactCurrentBatchConfig,F=0,he=null,ie=null,ve=0,Be=0,Cn=Ut(0),de=0,Lr=null,dn=0,ml=0,Ga=0,xr=null,Pe=null,qa=0,$n=1/0,ft=null,Js=!1,ta=null,It=null,os=!1,_t=null,Zs=0,gr=0,na=null,Es=-1,Ts=0;function ze(){return F&6?oe():Es!==-1?Es:Es=oe()}function At(e){return e.mode&1?F&2&&ve!==0?ve&-ve:Rh.transition!==null?(Ts===0&&(Ts=Rd()),Ts):(e=V,e!==0||(e=window.event,e=e===void 0?16:Ad(e.type)),e):1}function lt(e,t,n,s){if(50<gr)throw gr=0,na=null,Error(T(185));Ar(e,n,s),(!(F&2)||e!==he)&&(e===he&&(!(F&2)&&(ml|=n),de===4&&Ct(e,ve)),Ie(e,s),n===1&&F===0&&!(t.mode&1)&&($n=oe()+500,ul&&Vt()))}function Ie(e,t){var n=e.callbackNode;Rf(e,t);var s=Os(e,e===he?ve:0);if(s===0)n!==null&&Ti(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&Ti(n),t===1)e.tag===0?_h(wc.bind(null,e)):ru(wc.bind(null,e)),zh(function(){!(F&6)&&Vt()}),n=null;else{switch(Md(s)){case 1:n=Sa;break;case 4:n=Td;break;case 16:n=Ds;break;case 536870912:n=_d;break;default:n=Ds}n=tp(n,Yu.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Yu(e,t){if(Es=-1,Ts=0,F&6)throw Error(T(327));var n=e.callbackNode;if(Ln()&&e.callbackNode!==n)return null;var s=Os(e,e===he?ve:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=el(e,s);else{t=s;var l=F;F|=2;var o=qu();(he!==e||ve!==t)&&(ft=null,$n=oe()+500,sn(e,t));do try{Xh();break}catch(i){Gu(e,i)}while(!0);Da(),Xs.current=o,F=l,ie!==null?t=0:(he=null,ve=0,t=de)}if(t!==0){if(t===2&&(l=To(e),l!==0&&(s=l,t=ra(e,l))),t===1)throw n=Lr,sn(e,0),Ct(e,s),Ie(e,oe()),n;if(t===6)Ct(e,s);else{if(l=e.current.alternate,!(s&30)&&!Gh(l)&&(t=el(e,s),t===2&&(o=To(e),o!==0&&(s=o,t=ra(e,o))),t===1))throw n=Lr,sn(e,0),Ct(e,s),Ie(e,oe()),n;switch(e.finishedWork=l,e.finishedLanes=s,t){case 0:case 1:throw Error(T(345));case 2:Zt(e,Pe,ft);break;case 3:if(Ct(e,s),(s&130023424)===s&&(t=qa+500-oe(),10<t)){if(Os(e,0)!==0)break;if(l=e.suspendedLanes,(l&s)!==s){ze(),e.pingedLanes|=e.suspendedLanes&l;break}e.timeoutHandle=Io(Zt.bind(null,e,Pe,ft),t);break}Zt(e,Pe,ft);break;case 4:if(Ct(e,s),(s&4194240)===s)break;for(t=e.eventTimes,l=-1;0<s;){var a=31-st(s);o=1<<a,a=t[a],a>l&&(l=a),s&=~o}if(s=l,s=oe()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Yh(s/1960))-s,10<s){e.timeoutHandle=Io(Zt.bind(null,e,Pe,ft),s);break}Zt(e,Pe,ft);break;case 5:Zt(e,Pe,ft);break;default:throw Error(T(329))}}}return Ie(e,oe()),e.callbackNode===n?Yu.bind(null,e):null}function ra(e,t){var n=xr;return e.current.memoizedState.isDehydrated&&(sn(e,t).flags|=256),e=el(e,t),e!==2&&(t=Pe,Pe=n,t!==null&&sa(t)),e}function sa(e){Pe===null?Pe=e:Pe.push.apply(Pe,e)}function Gh(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var l=n[s],o=l.getSnapshot;l=l.value;try{if(!ot(o(),l))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ct(e,t){for(t&=~Ga,t&=~ml,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-st(t),s=1<<n;e[n]=-1,t&=~s}}function wc(e){if(F&6)throw Error(T(327));Ln();var t=Os(e,0);if(!(t&1))return Ie(e,oe()),null;var n=el(e,t);if(e.tag!==0&&n===2){var s=To(e);s!==0&&(t=s,n=ra(e,s))}if(n===1)throw n=Lr,sn(e,0),Ct(e,t),Ie(e,oe()),n;if(n===6)throw Error(T(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Zt(e,Pe,ft),Ie(e,oe()),null}function Xa(e,t){var n=F;F|=1;try{return e(t)}finally{F=n,F===0&&($n=oe()+500,ul&&Vt())}}function un(e){_t!==null&&_t.tag===0&&!(F&6)&&Ln();var t=F;F|=1;var n=Ye.transition,s=V;try{if(Ye.transition=null,V=1,e)return e()}finally{V=s,Ye.transition=n,F=t,!(F&6)&&Vt()}}function Ja(){Be=Cn.current,X(Cn)}function sn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Nh(n)),ie!==null)for(n=ie.return;n!==null;){var s=n;switch(Ma(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&$s();break;case 3:Bn(),X(De),X(ke),$a();break;case 5:Wa(s);break;case 4:Bn();break;case 13:X(te);break;case 19:X(te);break;case 10:Oa(s.type._context);break;case 22:case 23:Ja()}n=n.return}if(he=e,ie=e=Bt(e.current,null),ve=Be=t,de=0,Lr=null,Ga=ml=dn=0,Pe=xr=null,nn!==null){for(t=0;t<nn.length;t++)if(n=nn[t],s=n.interleaved,s!==null){n.interleaved=null;var l=s.next,o=n.pending;if(o!==null){var a=o.next;o.next=l,s.next=a}n.pending=s}nn=null}return e}function Gu(e,t){do{var n=ie;try{if(Da(),Ns.current=qs,Gs){for(var s=ne.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}Gs=!1}if(cn=0,pe=ce=ne=null,hr=!1,Rr=0,Ya.current=null,n===null||n.return===null){de=1,Lr=t,ie=null;break}e:{var o=e,a=n.return,i=n,c=t;if(t=ve,i.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=i,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var h=u.alternate;h?(u.updateQueue=h.updateQueue,u.memoizedState=h.memoizedState,u.lanes=h.lanes):(u.updateQueue=null,u.memoizedState=null)}var g=ic(a);if(g!==null){g.flags&=-257,cc(g,a,i,o,t),g.mode&1&&ac(o,d,t),t=g,c=d;var v=t.updateQueue;if(v===null){var p=new Set;p.add(c),t.updateQueue=p}else v.add(c);break e}else{if(!(t&1)){ac(o,d,t),Za();break e}c=Error(T(426))}}else if(Z&&i.mode&1){var j=ic(a);if(j!==null){!(j.flags&65536)&&(j.flags|=256),cc(j,a,i,o,t),Pa(Wn(c,i));break e}}o=c=Wn(c,i),de!==4&&(de=2),xr===null?xr=[o]:xr.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var m=Mu(o,c,t);tc(o,m);break e;case 1:i=c;var x=o.type,y=o.stateNode;if(!(o.flags&128)&&(typeof x.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(It===null||!It.has(y)))){o.flags|=65536,t&=-t,o.lanes|=t;var w=Pu(o,i,t);tc(o,w);break e}}o=o.return}while(o!==null)}Ju(n)}catch(S){t=S,ie===n&&n!==null&&(ie=n=n.return);continue}break}while(!0)}function qu(){var e=Xs.current;return Xs.current=qs,e===null?qs:e}function Za(){(de===0||de===3||de===2)&&(de=4),he===null||!(dn&268435455)&&!(ml&268435455)||Ct(he,ve)}function el(e,t){var n=F;F|=2;var s=qu();(he!==e||ve!==t)&&(ft=null,sn(e,t));do try{qh();break}catch(l){Gu(e,l)}while(!0);if(Da(),F=n,Xs.current=s,ie!==null)throw Error(T(261));return he=null,ve=0,de}function qh(){for(;ie!==null;)Xu(ie)}function Xh(){for(;ie!==null&&!Sf();)Xu(ie)}function Xu(e){var t=ep(e.alternate,e,Be);e.memoizedProps=e.pendingProps,t===null?Ju(e):ie=t,Ya.current=null}function Ju(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Uh(n,t),n!==null){n.flags&=32767,ie=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{de=6,ie=null;return}}else if(n=Hh(n,t,Be),n!==null){ie=n;return}if(t=t.sibling,t!==null){ie=t;return}ie=t=e}while(t!==null);de===0&&(de=5)}function Zt(e,t,n){var s=V,l=Ye.transition;try{Ye.transition=null,V=1,Jh(e,t,n,s)}finally{Ye.transition=l,V=s}return null}function Jh(e,t,n,s){do Ln();while(_t!==null);if(F&6)throw Error(T(327));n=e.finishedWork;var l=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(T(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Mf(e,o),e===he&&(ie=he=null,ve=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||os||(os=!0,tp(Ds,function(){return Ln(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Ye.transition,Ye.transition=null;var a=V;V=1;var i=F;F|=4,Ya.current=null,Kh(e,n),Ku(n,e),vh(Do),Is=!!Lo,Do=Lo=null,e.current=n,Qh(n),bf(),F=i,V=a,Ye.transition=o}else e.current=n;if(os&&(os=!1,_t=e,Zs=l),o=e.pendingLanes,o===0&&(It=null),zf(n.stateNode),Ie(e,oe()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)l=t[n],s(l.value,{componentStack:l.stack,digest:l.digest});if(Js)throw Js=!1,e=ta,ta=null,e;return Zs&1&&e.tag!==0&&Ln(),o=e.pendingLanes,o&1?e===na?gr++:(gr=0,na=e):gr=0,Vt(),null}function Ln(){if(_t!==null){var e=Md(Zs),t=Ye.transition,n=V;try{if(Ye.transition=null,V=16>e?16:e,_t===null)var s=!1;else{if(e=_t,_t=null,Zs=0,F&6)throw Error(T(331));var l=F;for(F|=4,M=e.current;M!==null;){var o=M,a=o.child;if(M.flags&16){var i=o.deletions;if(i!==null){for(var c=0;c<i.length;c++){var d=i[c];for(M=d;M!==null;){var u=M;switch(u.tag){case 0:case 11:case 15:mr(8,u,o)}var f=u.child;if(f!==null)f.return=u,M=f;else for(;M!==null;){u=M;var h=u.sibling,g=u.return;if(Hu(u),u===d){M=null;break}if(h!==null){h.return=g,M=h;break}M=g}}}var v=o.alternate;if(v!==null){var p=v.child;if(p!==null){v.child=null;do{var j=p.sibling;p.sibling=null,p=j}while(p!==null)}}M=o}}if(o.subtreeFlags&2064&&a!==null)a.return=o,M=a;else e:for(;M!==null;){if(o=M,o.flags&2048)switch(o.tag){case 0:case 11:case 15:mr(9,o,o.return)}var m=o.sibling;if(m!==null){m.return=o.return,M=m;break e}M=o.return}}var x=e.current;for(M=x;M!==null;){a=M;var y=a.child;if(a.subtreeFlags&2064&&y!==null)y.return=a,M=y;else e:for(a=x;M!==null;){if(i=M,i.flags&2048)try{switch(i.tag){case 0:case 11:case 15:hl(9,i)}}catch(S){le(i,i.return,S)}if(i===a){M=null;break e}var w=i.sibling;if(w!==null){w.return=i.return,M=w;break e}M=i.return}}if(F=l,Vt(),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(ol,e)}catch{}s=!0}return s}finally{V=n,Ye.transition=t}}return!1}function Sc(e,t,n){t=Wn(n,t),t=Mu(e,t,1),e=Ot(e,t,1),t=ze(),e!==null&&(Ar(e,1,t),Ie(e,t))}function le(e,t,n){if(e.tag===3)Sc(e,e,n);else for(;t!==null;){if(t.tag===3){Sc(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(It===null||!It.has(s))){e=Wn(n,e),e=Pu(t,e,1),t=Ot(t,e,1),e=ze(),t!==null&&(Ar(t,1,e),Ie(t,e));break}}t=t.return}}function Zh(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=ze(),e.pingedLanes|=e.suspendedLanes&n,he===e&&(ve&n)===n&&(de===4||de===3&&(ve&130023424)===ve&&500>oe()-qa?sn(e,0):Ga|=n),Ie(e,t)}function Zu(e,t){t===0&&(e.mode&1?(t=qr,qr<<=1,!(qr&130023424)&&(qr=4194304)):t=1);var n=ze();e=jt(e,t),e!==null&&(Ar(e,t,n),Ie(e,n))}function em(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zu(e,n)}function tm(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(T(314))}s!==null&&s.delete(t),Zu(e,n)}var ep;ep=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||De.current)Le=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Le=!1,Fh(e,t,n);Le=!!(e.flags&131072)}else Le=!1,Z&&t.flags&1048576&&su(t,Us,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;Cs(e,t),e=t.pendingProps;var l=On(t,ke.current);Pn(t,n),l=Ha(null,t,s,e,l,n);var o=Ua();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Oe(s)?(o=!0,Fs(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Aa(t),l.updater=fl,t.stateNode=l,l._reactInternals=t,Uo(t,s,e,n),t=Qo(null,t,s,!0,o,n)):(t.tag=0,Z&&o&&Ra(t),Ne(null,t,l,n),t=t.child),t;case 16:s=t.elementType;e:{switch(Cs(e,t),e=t.pendingProps,l=s._init,s=l(s._payload),t.type=s,l=t.tag=rm(s),e=tt(s,e),l){case 0:t=Ko(null,t,s,e,n);break e;case 1:t=pc(null,t,s,e,n);break e;case 11:t=dc(null,t,s,e,n);break e;case 14:t=uc(null,t,s,tt(s.type,e),n);break e}throw Error(T(306,s,""))}return t;case 0:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:tt(s,l),Ko(e,t,s,l,n);case 1:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:tt(s,l),pc(e,t,s,l,n);case 3:e:{if(Iu(t),e===null)throw Error(T(387));s=t.pendingProps,o=t.memoizedState,l=o.element,du(e,t),Qs(t,s,null,n);var a=t.memoizedState;if(s=a.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Wn(Error(T(423)),t),t=fc(e,t,s,n,l);break e}else if(s!==l){l=Wn(Error(T(424)),t),t=fc(e,t,s,n,l);break e}else for(We=Dt(t.stateNode.containerInfo.firstChild),$e=t,Z=!0,rt=null,n=iu(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(In(),s===l){t=wt(e,t,n);break e}Ne(e,t,s,n)}t=t.child}return t;case 5:return uu(t),e===null&&$o(t),s=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,a=l.children,Oo(s,l)?a=null:o!==null&&Oo(s,o)&&(t.flags|=32),Ou(e,t),Ne(e,t,a,n),t.child;case 6:return e===null&&$o(t),null;case 13:return Au(e,t,n);case 4:return Ba(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=An(t,null,s,n):Ne(e,t,s,n),t.child;case 11:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:tt(s,l),dc(e,t,s,l,n);case 7:return Ne(e,t,t.pendingProps,n),t.child;case 8:return Ne(e,t,t.pendingProps.children,n),t.child;case 12:return Ne(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,l=t.pendingProps,o=t.memoizedProps,a=l.value,Y(Vs,s._currentValue),s._currentValue=a,o!==null)if(ot(o.value,a)){if(o.children===l.children&&!De.current){t=wt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var i=o.dependencies;if(i!==null){a=o.child;for(var c=i.firstContext;c!==null;){if(c.context===s){if(o.tag===1){c=gt(-1,n&-n),c.tag=2;var d=o.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Fo(o.return,n,t),i.lanes|=n;break}c=c.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(T(341));a.lanes|=n,i=a.alternate,i!==null&&(i.lanes|=n),Fo(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Ne(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,s=t.pendingProps.children,Pn(t,n),l=qe(l),s=s(l),t.flags|=1,Ne(e,t,s,n),t.child;case 14:return s=t.type,l=tt(s,t.pendingProps),l=tt(s.type,l),uc(e,t,s,l,n);case 15:return Lu(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:tt(s,l),Cs(e,t),t.tag=1,Oe(s)?(e=!0,Fs(t)):e=!1,Pn(t,n),Ru(t,s,l),Uo(t,s,l,n),Qo(null,t,s,!0,e,n);case 19:return Bu(e,t,n);case 22:return Du(e,t,n)}throw Error(T(156,t.tag))};function tp(e,t){return Ed(e,t)}function nm(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qe(e,t,n,s){return new nm(e,t,n,s)}function ei(e){return e=e.prototype,!(!e||!e.isReactComponent)}function rm(e){if(typeof e=="function")return ei(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ya)return 11;if(e===ja)return 14}return 2}function Bt(e,t){var n=e.alternate;return n===null?(n=Qe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function _s(e,t,n,s,l,o){var a=2;if(s=e,typeof e=="function")ei(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case gn:return ln(n.children,l,o,t);case va:a=8,l|=8;break;case ho:return e=Qe(12,n,t,l|2),e.elementType=ho,e.lanes=o,e;case mo:return e=Qe(13,n,t,l),e.elementType=mo,e.lanes=o,e;case xo:return e=Qe(19,n,t,l),e.elementType=xo,e.lanes=o,e;case ud:return xl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case cd:a=10;break e;case dd:a=9;break e;case ya:a=11;break e;case ja:a=14;break e;case kt:a=16,s=null;break e}throw Error(T(130,e==null?e:typeof e,""))}return t=Qe(a,n,t,l),t.elementType=e,t.type=s,t.lanes=o,t}function ln(e,t,n,s){return e=Qe(7,e,s,t),e.lanes=n,e}function xl(e,t,n,s){return e=Qe(22,e,s,t),e.elementType=ud,e.lanes=n,e.stateNode={isHidden:!1},e}function eo(e,t,n){return e=Qe(6,e,null,t),e.lanes=n,e}function to(e,t,n){return t=Qe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sm(e,t,n,s,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Dl(0),this.expirationTimes=Dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dl(0),this.identifierPrefix=s,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function ti(e,t,n,s,l,o,a,i,c){return e=new sm(e,t,n,i,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Qe(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Aa(o),e}function lm(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:xn,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function np(e){if(!e)return $t;e=e._reactInternals;e:{if(fn(e)!==e||e.tag!==1)throw Error(T(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Oe(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(T(171))}if(e.tag===1){var n=e.type;if(Oe(n))return nu(e,n,t)}return t}function rp(e,t,n,s,l,o,a,i,c){return e=ti(n,s,!0,e,l,o,a,i,c),e.context=np(null),n=e.current,s=ze(),l=At(n),o=gt(s,l),o.callback=t??null,Ot(n,o,l),e.current.lanes=l,Ar(e,l,s),Ie(e,s),e}function gl(e,t,n,s){var l=t.current,o=ze(),a=At(l);return n=np(n),t.context===null?t.context=n:t.pendingContext=n,t=gt(o,a),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=Ot(l,t,a),e!==null&&(lt(e,l,a,o),ks(e,l,a)),a}function tl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function bc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ni(e,t){bc(e,t),(e=e.alternate)&&bc(e,t)}function om(){return null}var sp=typeof reportError=="function"?reportError:function(e){console.error(e)};function ri(e){this._internalRoot=e}vl.prototype.render=ri.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(T(409));gl(e,t,null,null)};vl.prototype.unmount=ri.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;un(function(){gl(null,e,null,null)}),t[yt]=null}};function vl(e){this._internalRoot=e}vl.prototype.unstable_scheduleHydration=function(e){if(e){var t=Dd();e={blockedOn:null,target:e,priority:t};for(var n=0;n<zt.length&&t!==0&&t<zt[n].priority;n++);zt.splice(n,0,e),n===0&&Id(e)}};function si(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function yl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function kc(){}function am(e,t,n,s,l){if(l){if(typeof s=="function"){var o=s;s=function(){var d=tl(a);o.call(d)}}var a=rp(t,s,e,0,null,!1,!1,"",kc);return e._reactRootContainer=a,e[yt]=a.current,zr(e.nodeType===8?e.parentNode:e),un(),a}for(;l=e.lastChild;)e.removeChild(l);if(typeof s=="function"){var i=s;s=function(){var d=tl(c);i.call(d)}}var c=ti(e,0,!1,null,null,!1,!1,"",kc);return e._reactRootContainer=c,e[yt]=c.current,zr(e.nodeType===8?e.parentNode:e),un(function(){gl(t,c,n,s)}),c}function jl(e,t,n,s,l){var o=n._reactRootContainer;if(o){var a=o;if(typeof l=="function"){var i=l;l=function(){var c=tl(a);i.call(c)}}gl(t,a,e,l)}else a=am(n,t,e,l,s);return tl(a)}Pd=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=or(t.pendingLanes);n!==0&&(ba(t,n|1),Ie(t,oe()),!(F&6)&&($n=oe()+500,Vt()))}break;case 13:un(function(){var s=jt(e,1);if(s!==null){var l=ze();lt(s,e,1,l)}}),ni(e,1)}};ka=function(e){if(e.tag===13){var t=jt(e,134217728);if(t!==null){var n=ze();lt(t,e,134217728,n)}ni(e,134217728)}};Ld=function(e){if(e.tag===13){var t=At(e),n=jt(e,t);if(n!==null){var s=ze();lt(n,e,t,s)}ni(e,t)}};Dd=function(){return V};Od=function(e,t){var n=V;try{return V=e,t()}finally{V=n}};zo=function(e,t,n){switch(t){case"input":if(yo(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var l=dl(s);if(!l)throw Error(T(90));fd(s),yo(s,l)}}}break;case"textarea":md(e,n);break;case"select":t=n.value,t!=null&&Tn(e,!!n.multiple,t,!1)}};Sd=Xa;bd=un;var im={usingClientEntryPoint:!1,Events:[Wr,wn,dl,jd,wd,Xa]},er={findFiberByHostInstance:tn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},cm={bundleType:er.bundleType,version:er.version,rendererPackageName:er.rendererPackageName,rendererConfig:er.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:St.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=zd(e),e===null?null:e.stateNode},findFiberByHostInstance:er.findFiberByHostInstance||om,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var as=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!as.isDisabled&&as.supportsFiber)try{ol=as.inject(cm),dt=as}catch{}}He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=im;He.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!si(t))throw Error(T(200));return lm(e,t,null,n)};He.createRoot=function(e,t){if(!si(e))throw Error(T(299));var n=!1,s="",l=sp;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=ti(e,1,!1,null,null,n,!1,s,l),e[yt]=t.current,zr(e.nodeType===8?e.parentNode:e),new ri(t)};He.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(T(188)):(e=Object.keys(e).join(","),Error(T(268,e)));return e=zd(t),e=e===null?null:e.stateNode,e};He.flushSync=function(e){return un(e)};He.hydrate=function(e,t,n){if(!yl(t))throw Error(T(200));return jl(null,e,t,!0,n)};He.hydrateRoot=function(e,t,n){if(!si(e))throw Error(T(405));var s=n!=null&&n.hydratedSources||null,l=!1,o="",a=sp;if(n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=rp(t,null,e,1,n??null,l,!1,o,a),e[yt]=t.current,zr(e),s)for(e=0;e<s.length;e++)n=s[e],l=n._getVersion,l=l(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,l]:t.mutableSourceEagerHydrationData.push(n,l);return new vl(t)};He.render=function(e,t,n){if(!yl(t))throw Error(T(200));return jl(null,e,t,!1,n)};He.unmountComponentAtNode=function(e){if(!yl(e))throw Error(T(40));return e._reactRootContainer?(un(function(){jl(null,null,e,!1,function(){e._reactRootContainer=null,e[yt]=null})}),!0):!1};He.unstable_batchedUpdates=Xa;He.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!yl(n))throw Error(T(200));if(e==null||e._reactInternals===void 0)throw Error(T(38));return jl(e,t,n,!1,s)};He.version="18.3.1-next-f1338f8080-20240426";function lp(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lp)}catch(e){console.error(e)}}lp(),ld.exports=He;var dm=ld.exports,Nc=dm;po.createRoot=Nc.createRoot,po.hydrateRoot=Nc.hydrateRoot;class op extends Error{constructor(t,n,s){super(s),this.status=t,this.code=n}}function Kt(e){return e instanceof op&&e.status===409&&e.code==="no_project"}async function wl(e,t){const n=await fetch(e,t);if(!n.ok){let s=null,l=`${n.status} ${n.statusText}`;try{const o=await n.json();o.code&&(s=o.code),o.error&&(l=o.error)}catch{}throw new op(n.status,s,l)}return n.json()}const H=e=>wl(e),Gt=(e,t)=>wl(e,t===void 0?{method:"POST"}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),zc=(e,t)=>wl(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),um=(e,t)=>wl(e,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});function J(e,t){return t?e+(e.includes("?")?"&":"?")+"project="+encodeURIComponent(t):e}const P={status:e=>H(J("/api/status",e)),refresh:e=>Gt(J("/api/refresh",e)),graphFull:(e,t=250)=>H(J(`/api/graph/full?limit=${t}`,e)),graphNode:(e,t)=>H(J(`/api/graph/node?id=${encodeURIComponent(e)}`,t)),graphHealth:e=>H(J("/api/graph/health",e)),specs:e=>H(J("/api/specs",e)),spec:(e,t)=>H(J(`/api/spec/${encodeURIComponent(e)}`,t)),specSave:(e,t,n)=>zc(J(`/api/spec/${encodeURIComponent(e)}`,n),{content:t}),drift:e=>H(J("/api/drift",e)),runs:e=>H(J("/api/workflows/runs",e)),workflows:e=>H(J("/api/workflows",e)),launchRun:(e,t,n)=>Gt(J("/api/workflows/runs",n),{workflowName:e,inputs:t}),run:(e,t)=>H(J(`/api/workflows/runs/${encodeURIComponent(e)}`,t)),runArtifacts:(e,t)=>H(J(`/api/workflows/runs/${encodeURIComponent(e)}/artifacts`,t)),runAction:(e,t,n,s)=>Gt(J(`/api/workflows/runs/${encodeURIComponent(e)}/${t}`,s),n),projects:()=>H("/api/projects"),graphSearch:(e,t,n=10)=>H(J(`/api/graph/search?q=${encodeURIComponent(e)}&limit=${n}`,t)),recentPrompts:(e,t=20)=>H(J(`/api/claude/prompts/recent?limit=${t}`,e)),claudeStats:(e="week")=>H(`/api/claude/stats?range=${e}`),claudeCosts:(e="week",t,n)=>H(J(`/api/claude/costs?range=${e}${n?`&model=${encodeURIComponent(n)}`:""}`,t)),claudeCache:(e="week")=>H(`/api/claude/cache?range=${e}`),claudeHeatmap:(e="week",t)=>H(J(`/api/claude/heatmap?range=${e}`,t)),claudeHeatmapFile:(e,t="week")=>H(`/api/claude/heatmap/file?path=${encodeURIComponent(e)}&range=${t}`),claudeHeatmapTool:(e,t="week")=>H(`/api/claude/heatmap/tool?name=${encodeURIComponent(e)}&range=${t}`),claudeHeatmapSubagent:(e,t="week")=>H(`/api/claude/heatmap/subagent?type=${encodeURIComponent(e)}&range=${t}`),claudeTips:()=>H("/api/claude/tips"),setTipState:(e,t)=>Gt("/api/claude/tips/state",{id:e,state:t}),claudeSessions:(e,t=10,n="week",s)=>H(J(`/api/claude/sessions?limit=${t}&range=${n}${s?`&model=${encodeURIComponent(s)}`:""}`,e)),claudeSession:e=>H(`/api/claude/session/${encodeURIComponent(e)}`),claudeSessionSummary:e=>H(`/api/claude/session/${encodeURIComponent(e)}/summary`),claudeProjects:()=>H("/api/claude/projects"),claudeCompare:()=>H("/api/claude/compare"),specshipImpact:(e="week")=>H(`/api/claude/specship-impact?range=${e}`),ingestNow:()=>Gt("/api/claude/ingest"),memory:e=>H(J("/api/memory",e)),mcpServers:()=>H("/api/mcp/servers"),setMcpServerEnabled:(e,t)=>um(`/api/mcp/servers/${encodeURIComponent(e)}`,{enabled:t}),addMcpServer:e=>Gt("/api/mcp/servers",e),chat:(e,t)=>Gt(J("/api/chat",t),{question:e}),config:{get:()=>H("/api/config"),set:e=>zc("/api/config",e)}};function pm(e,t,n){const s=`/api/workflows/runs/${encodeURIComponent(e)}/events${t?`?since=${t}`:""}`;return J(s,n)}function fm(e,t){return J(`/api/chat/stream?question=${encodeURIComponent(e)}`,t)}const la="ss-navigate";function Cc(){const e=location.pathname.split("/").filter(Boolean);return{route:e[0]||"dashboard",param:e.slice(1).join("/")||void 0,query:Object.fromEntries(new URLSearchParams(location.search))}}function B(e,t={}){let n="/"+e;t.param&&(n+="/"+t.param),t.query&&Object.keys(t.query).length&&(n+="?"+new URLSearchParams(t.query).toString()),n!==location.pathname+location.search&&history.pushState(null,"",n),window.dispatchEvent(new Event(la))}function hm(){const[e,t]=N.useState(Cc);return N.useEffect(()=>{const n=()=>t(Cc());return window.addEventListener("popstate",n),window.addEventListener(la,n),()=>{window.removeEventListener("popstate",n),window.removeEventListener(la,n)}},[]),e}const mm={dashboard:'<rect x="3" y="3" width="7" height="9"/><rect x="14" y="3" width="7" height="5"/><rect x="14" y="12" width="7" height="9"/><rect x="3" y="16" width="7" height="5"/>',graph:'<circle cx="5" cy="6" r="2.5"/><circle cx="19" cy="6" r="2.5"/><circle cx="12" cy="18" r="2.5"/><path d="M7 7.5 10.5 16M16.5 7.5 13.5 16M7 6h10"/>',book:'<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/>',drift:'<path d="M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h16.9a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/><path d="M12 9v4M12 17h.01"/>',workflow:'<rect x="3" y="3" width="6" height="6" rx="1"/><rect x="15" y="15" width="6" height="6" rx="1"/><path d="M6 9v3a3 3 0 0 0 3 3h6"/>',play:'<polygon points="6 3 20 12 6 21 6 3"/>',wrench:'<path d="M14.7 6.3a4 4 0 0 0-5.4 5.3L3 18v3h3l6.4-6.3a4 4 0 0 0 5.3-5.4l-2.9 2.9-2.1-2.1z"/>',database:'<ellipse cx="12" cy="5" rx="8" ry="3"/><path d="M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"/><path d="M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"/>',bot:'<rect x="4" y="8" width="16" height="12" rx="2"/><path d="M12 4v4M9 14h.01M15 14h.01M2 13h2M20 13h2"/>',folder:'<path d="M20 10V7a2 2 0 0 0-2-2h-6l-2-2H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h7"/><path d="M12 10v11M16 14l-4-4-4 4M21 19h-6"/>',chat:'<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>',sessions:'<path d="M3 3v18h18"/><path d="M7 14l3-4 3 3 4-6"/>',heatmap:'<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/>',dollar:'<line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/>',compare:'<path d="M16 3h5v5M21 3l-7 7M8 21H3v-5M3 21l7-7"/>',tips:'<path d="M9 18h6M10 22h4M12 2a7 7 0 0 0-4 12.7c.6.5 1 1.3 1 2.1V18h6v-1.2c0-.8.4-1.6 1-2.1A7 7 0 0 0 12 2z"/>',settings:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.6 1.6 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.6 1.6 0 0 0-1.8-.3 1.6 1.6 0 0 0-1 1.5V21a2 2 0 0 1-4 0v-.1a1.6 1.6 0 0 0-1-1.5 1.6 1.6 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.6 1.6 0 0 0 .3-1.8 1.6 1.6 0 0 0-1.5-1H3a2 2 0 0 1 0-4h.1a1.6 1.6 0 0 0 1.5-1 1.6 1.6 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.6 1.6 0 0 0 1.8.3H9a1.6 1.6 0 0 0 1-1.5V3a2 2 0 0 1 4 0v.1a1.6 1.6 0 0 0 1 1.5 1.6 1.6 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.6 1.6 0 0 0-.3 1.8V9a1.6 1.6 0 0 0 1.5 1H21a2 2 0 0 1 0 4h-.1a1.6 1.6 0 0 0-1.5 1z"/>',box:'<path d="M21 16V8a2 2 0 0 0-1-1.7l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.7l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><path d="m3.3 7 8.7 5 8.7-5M12 22V12"/>',search:'<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.7" y2="16.7"/>',command:'<path d="M15 6a3 3 0 1 1 3 3h-3V6zM9 6a3 3 0 1 0-3 3h3V6zM15 18a3 3 0 1 0 3-3h-3v3zM9 18a3 3 0 1 1-3-3h3v3zM9 9h6v6H9z"/>',chevronRight:'<polyline points="9 6 15 12 9 18"/>',chevronDown:'<polyline points="6 9 12 15 18 9"/>',chevronLeft:'<polyline points="15 6 9 12 15 18"/>',x:'<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>',check:'<polyline points="20 6 9 17 4 12"/>',copy:'<rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>',arrowRight:'<line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/>',plus:'<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>',grip:'<circle cx="9" cy="6" r="1.4"/><circle cx="15" cy="6" r="1.4"/><circle cx="9" cy="12" r="1.4"/><circle cx="15" cy="12" r="1.4"/><circle cx="9" cy="18" r="1.4"/><circle cx="15" cy="18" r="1.4"/>',trash:'<polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/>',minus:'<line x1="5" y1="12" x2="19" y2="12"/>',maximize:'<path d="M8 3H5a2 2 0 0 0-2 2v3M21 8V5a2 2 0 0 0-2-2h-3M16 21h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/>',recenter:'<circle cx="12" cy="12" r="3"/><path d="M12 2v4M12 18v4M2 12h4M18 12h4"/>',refresh:'<path d="M21 2v6h-6M3 22v-6h6"/><path d="M3.5 9a9 9 0 0 1 14.8-3.4L21 8M21 15a9 9 0 0 1-14.8 3.4L3 16"/>',filter:'<polygon points="22 3 2 3 10 12.5 10 19 14 21 14 12.5 22 3"/>',pause:'<rect x="6" y="4" width="4" height="16"/><rect x="14" y="4" width="4" height="16"/>',external:'<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/>',zap:'<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>',clock:'<circle cx="12" cy="12" r="9"/><polyline points="12 7 12 12 15 14"/>',trendUp:'<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/>',trendDown:'<polyline points="22 17 13.5 8.5 8.5 13.5 2 7"/><polyline points="16 17 22 17 22 11"/>',circle:'<circle cx="12" cy="12" r="9"/>',dot:'<circle cx="12" cy="12" r="5"/>',reveal:'<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"/><circle cx="12" cy="12" r="3"/>',sparkles:'<path d="M12 3v4M12 17v4M3 12h4M17 12h4"/><path d="m6 6 2.5 2.5M15.5 15.5 18 18M18 6l-2.5 2.5M8.5 15.5 6 18"/>',menu:'<line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/>',send:'<line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/>',paperclip:'<path d="M21.4 11.05 12.25 20.2a5 5 0 0 1-7.07-7.07l9.19-9.19a3 3 0 0 1 4.24 4.24l-9.2 9.19a1 1 0 0 1-1.41-1.41l8.48-8.49"/>',sortAsc:'<path d="M11 5h10M11 9h7M11 13h4M3 17l3 3 3-3M6 6v14"/>',flame:'<path d="M12 2c1 4 5 5 5 9a5 5 0 0 1-10 0c0-1.5.5-2.5 1.2-3.4C9 9 9.5 8 9.5 6.5c1 .5 2 1.5 2.5 2.5C13 7 12.5 4 12 2z"/>',coins:'<circle cx="8" cy="8" r="5"/><path d="M18.1 6.3a5 5 0 0 1 0 9.4M14.4 18.6a5 5 0 0 1-3.4 0"/>',cancel:'<circle cx="12" cy="12" r="9"/><line x1="9" y1="9" x2="15" y2="15"/><line x1="15" y1="9" x2="9" y2="15"/>',skip:'<polyline points="13 17 18 12 13 7"/><polyline points="6 17 11 12 6 7"/>',layers:'<polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 12 12 17 22 12"/><polyline points="2 17 12 22 22 17"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/>',moon:'<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/>',monitor:'<rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>',memory:'<rect x="4" y="6" width="16" height="12" rx="2"/><path d="M8 6V3M12 6V3M16 6V3M8 21v-3M12 21v-3M16 21v-3M2 10h2M2 14h2M20 10h2M20 14h2"/><rect x="8.5" y="10" width="7" height="4" rx="1"/>',lock:'<rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',plug:'<path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8z"/>',server:'<rect x="3" y="4" width="18" height="6" rx="2"/><rect x="3" y="14" width="18" height="6" rx="2"/><path d="M7 7h.01M7 17h.01"/>'};function z({name:e,size:t=16,stroke:n=2,fill:s="none",style:l,className:o}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:s,stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round",style:l,className:o,dangerouslySetInnerHTML:{__html:mm[e]||""}})}function ap({size:e=24,tile:t=!0,glow:n=!0}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 32 32",fill:"none",style:{filter:n?"drop-shadow(0 0 9px rgba(91,147,242,0.35))":"none",flexShrink:0},children:[r.jsxs("defs",{children:[r.jsxs("linearGradient",{id:"ssTile",x1:0,y1:0,x2:32,y2:32,gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#12161E"}),r.jsx("stop",{offset:1,stopColor:"#0B0D11"})]}),r.jsxs("linearGradient",{id:"ssLead",x1:18,y1:11,x2:26,y2:21,gradientUnits:"userSpaceOnUse",children:[r.jsx("stop",{stopColor:"#6FA0F6"}),r.jsx("stop",{offset:1,stopColor:"#5B93F2"})]})]}),t&&r.jsx("rect",{width:32,height:32,rx:7.2,fill:"url(#ssTile)"}),t&&r.jsx("rect",{x:.5,y:.5,width:31,height:31,rx:6.7,fill:"none",stroke:"rgba(255,255,255,0.08)"}),r.jsxs("g",{transform:"translate(4.6 4.6) scale(0.715)",children:[r.jsx("path",{d:"M5 16 H11 M11 9 L23 16 L11 23",stroke:"rgba(150,165,200,0.5)",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),r.jsx("line",{x1:11,y1:9,x2:11,y2:23,stroke:"rgba(150,165,200,0.4)",strokeWidth:1.9,strokeLinecap:"round"}),r.jsx("circle",{cx:23,cy:16,r:3.6,fill:"url(#ssLead)"}),r.jsx("circle",{cx:11,cy:9,r:2.9,fill:"#A586F5"}),r.jsx("circle",{cx:11,cy:23,r:2.9,fill:"#46C26B"}),r.jsx("circle",{cx:5,cy:16,r:2.1,fill:"#29D2BE"})]})]})}const xm=8,gm=6,vm=6,ym=150,jm={page:"Page",node:"Node",spec:"Spec",prompt:"Prompt"},wm={fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-muted)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:4,padding:"2px 6px"};function Sm({open:e,onClose:t,pages:n,project:s=null}){const[l,o]=N.useState(""),[a,i]=N.useState(0),[c,d]=N.useState([]),[u,f]=N.useState([]),[h,g]=N.useState([]),v=N.useRef(null),p=N.useRef(0);N.useEffect(()=>{e&&(o(""),i(0),g([]),setTimeout(()=>v.current?.focus(),30))},[e]),N.useEffect(()=>{e&&(P.specs(s).then(S=>d(S.specs??[]),()=>d([])),P.recentPrompts(s).then(S=>f(S.prompts??[]),()=>f([])))},[e,s]),N.useEffect(()=>{if(!e)return;const S=l.trim(),k=++p.current;if(S.length<2){g([]);return}const C=setTimeout(()=>{P.graphSearch(S,s,xm).then(_=>{p.current===k&&g((_.results??[]).map(({node:W})=>({key:"node:"+W.id,label:W.name,sublabel:W.filePath,icon:"graph",type:"node",nav:()=>B("graph",{query:{focus:W.id}})})))},()=>{p.current===k&&g([])})},ym);return()=>clearTimeout(C)},[l,e,s]);const j=l.trim().toLowerCase(),m=(j?n.filter(S=>(S.label+" "+S.id).toLowerCase().includes(j)):n).map(S=>({key:"page:"+S.id,label:S.label,sublabel:"/"+S.id,icon:S.icon,type:"page",nav:()=>B(S.id)})),x=j?c.filter(S=>(S.id+" "+S.title).toLowerCase().includes(j)).slice(0,gm).map(S=>({key:"spec:"+S.id,label:S.id,sublabel:S.title,icon:"book",type:"spec",nav:()=>B("specs",{param:S.id})})):[],y=j?u.filter(S=>S.text.toLowerCase().includes(j)).slice(0,vm).map(S=>({key:"prompt:"+S.id,label:S.text,sublabel:new Date(S.ts).toLocaleString(),icon:"chat",type:"prompt",nav:()=>B("sessions",{param:S.session_id})})):[],w=[...m,...j?h:[],...x,...y];return N.useEffect(()=>{if(!e)return;const S=k=>{if(k.key==="ArrowDown")k.preventDefault(),i(C=>Math.min(w.length-1,C+1));else if(k.key==="ArrowUp")k.preventDefault(),i(C=>Math.max(0,C-1));else if(k.key==="Enter"){k.preventDefault();const C=w[a];C&&(C.nav(),t())}else k.key==="Escape"&&(k.preventDefault(),t())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[e,w,a,t]),e?r.jsx("div",{onMouseDown:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",backdropFilter:"blur(2px)",zIndex:100,display:"grid",placeItems:"start center",paddingTop:"12vh",animation:"fadeIn 100ms"},children:r.jsxs("div",{onMouseDown:S=>S.stopPropagation(),style:{width:560,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)",overflow:"hidden"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"12px 14px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(z,{name:"search",size:16,style:{color:"var(--text-muted)"}}),r.jsx("input",{ref:v,value:l,onChange:S=>{o(S.target.value),i(0)},placeholder:"Search pages, nodes, specs, prompts…",style:{flex:1,background:"transparent",border:"none",outline:"none",color:"var(--text-primary)",fontSize:15,fontFamily:"var(--font-ui)"}}),r.jsx("kbd",{style:wm,children:"esc"})]}),r.jsxs("div",{className:"scroll-y",role:"listbox",style:{maxHeight:380,padding:6},children:[w.length===0&&r.jsx("div",{className:"muted",style:{padding:24,textAlign:"center"},children:"No matches"}),w.map((S,k)=>r.jsxs("div",{role:"option","aria-selected":k===a,onMouseEnter:()=>i(k),onClick:()=>{S.nav(),t()},className:"row gap-10 list-row",style:{padding:"8px 10px",borderRadius:7,cursor:"pointer"},children:[r.jsx(z,{name:S.icon,size:15,style:{color:k===a?"var(--accent)":"var(--text-muted)",flexShrink:0}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.label}),r.jsx("div",{className:"mono muted",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.sublabel})]}),r.jsx("span",{className:"pill",style:{fontSize:9.5,color:"var(--text-muted)",background:"rgba(255,255,255,0.05)",flexShrink:0},children:jm[S.type]})]},S.key))]})]})}):null}const no=new Map,bm=3e4;function L(e,t=[],n={}){const{cacheKey:s,ttlMs:l=bm}=n,o=s?no.get(s):void 0,[a,i]=N.useState(o?o.data:null),[c,d]=N.useState(null),[u,f]=N.useState(!o),h=N.useRef(0),g=N.useCallback(v=>{const p=++h.current;if(s){const j=no.get(s);if(j){if(i(j.data),d(null),f(!1),!v&&Date.now()-j.ts<l)return}else f(!0)}else f(!0);e().then(j=>{s&&no.set(s,{data:j,ts:Date.now()}),h.current===p&&(i(j),d(null),f(!1))},j=>{h.current===p&&(d(j),f(!1))})},t);return N.useEffect(()=>{g(!1)},[g]),{data:a,error:c,loading:u,reload:()=>g(!0)}}function km(){const e=L(()=>P.config.get(),[]),{reload:t}=e;return N.useEffect(()=>(window.addEventListener("specship-config",t),()=>window.removeEventListener("specship-config",t)),[t]),e}function Ec(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;if(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)return!0;const n=e.getAttribute("contenteditable");return n===""||n==="true"}const Nm=1e3,zm={g:"graph",s:"specs",d:"drift"};function Cm({onTogglePalette:e,pageIds:t}){const n=N.useRef(!1),s=N.useRef(null);N.useEffect(()=>{const l=()=>{n.current=!1,s.current!==null&&(clearTimeout(s.current),s.current=null)},o=a=>{if((a.metaKey||a.ctrlKey)&&a.key.toLowerCase()==="k"){a.preventDefault(),e();return}if((a.metaKey||a.ctrlKey)&&!a.altKey&&/^[1-7]$/.test(a.key)){if(Ec(a.target))return;const i=t[parseInt(a.key,10)-1];i&&(a.preventDefault(),B(i));return}if(a.metaKey||a.ctrlKey||a.altKey){l();return}if(Ec(a.target)){l();return}if(n.current){l();const i=zm[a.key.toLowerCase()];i&&(a.preventDefault(),B(i));return}a.key==="g"&&(n.current=!0,s.current=window.setTimeout(l,Nm))};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),l()}},[e,t])}const ip="specship-theme";function Sl(){try{const e=localStorage.getItem(ip);if(e==="dark"||e==="light"||e==="system")return e}catch{}return"dark"}function Em(e){return e==="system"?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":e}function bl(e){document.documentElement.setAttribute("data-theme",Em(e));try{localStorage.setItem(ip,e)}catch{}window.dispatchEvent(new Event("specship-theme"))}function Tm(){window.matchMedia("(prefers-color-scheme: light)").addEventListener("change",()=>{Sl()==="system"&&bl("system")})}const fe={pending:{label:"Pending",color:"var(--text-muted)",bg:"rgba(255,255,255,0.05)"},running:{label:"Running",color:"var(--info)",bg:"var(--info-soft)"},paused:{label:"Paused",color:"var(--warn)",bg:"var(--warn-soft)"},completed:{label:"Completed",color:"var(--success)",bg:"var(--success-soft)"},failed:{label:"Failed",color:"var(--error)",bg:"var(--error-soft)"},cancelled:{label:"Cancelled",color:"var(--text-muted)",bg:"rgba(255,255,255,0.05)"},skipped:{label:"Skipped",color:"var(--text-muted)",bg:"rgba(255,255,255,0.05)"},drafted:{label:"Drafted",color:"var(--text-secondary)",bg:"rgba(255,255,255,0.05)"},implementing:{label:"Implementing",color:"var(--info)",bg:"var(--info-soft)"},implemented:{label:"Implemented",color:"var(--node-spec)",bg:"var(--node-spec-soft)"},verified:{label:"Verified",color:"var(--success)",bg:"var(--success-soft)"},drifted:{label:"Drifted",color:"var(--warn)",bg:"var(--warn-soft)"},broken:{label:"Broken",color:"var(--error)",bg:"var(--error-soft)"},orphaned:{label:"Orphaned",color:"var(--error)",bg:"var(--error-soft)"},success:{label:"Success",color:"var(--success)",bg:"var(--success-soft)"},warn:{label:"Warn",color:"var(--warn)",bg:"var(--warn-soft)"},error:{label:"Error",color:"var(--error)",bg:"var(--error-soft)"},info:{label:"Info",color:"var(--info)",bg:"var(--info-soft)"}},_m={drifted:"drift",broken:"cancel",orphaned:"drift",failed:"cancel",verified:"check",completed:"check",paused:"pause",running:"circle"};function Ge({state:e,pulse:t,withDot:n}){const s=fe[e]??fe.info,l=_m[e];return r.jsxs("span",{className:"pill",style:{color:s.color,background:s.bg,animation:t?"pulsePill 600ms ease-out":void 0},children:[n&&r.jsx("span",{className:"pill-dot",style:{background:s.color}}),l&&!n&&r.jsx(z,{name:l,size:11}),s.label]})}function re({children:e,color:t,bg:n,dot:s}){return r.jsxs("span",{className:"pill",style:{color:t||"var(--text-secondary)",background:n||"rgba(255,255,255,0.05)"},children:[s&&r.jsx("span",{className:"pill-dot",style:{background:t}}),e]})}function Rm({title:e}){return r.jsx("span",{className:"pill","data-sample-badge":!0,title:e??"Illustrative reference data — not from your project",style:{color:"var(--warn)",background:"var(--warn-soft)",fontWeight:700,letterSpacing:"0.04em"},children:"SAMPLE"})}function pt({text:e,label:t,ariaLabel:n}){const[s,l]=N.useState(!1);return r.jsxs("button",{className:"btn btn-ghost btn-xs",title:"Copy","aria-label":n??(t?void 0:"Copy "+e),onClick:o=>{o.stopPropagation(),navigator.clipboard?.writeText(e),l(!0),setTimeout(()=>l(!1),1100)},style:{color:s?"var(--success)":void 0},children:[r.jsx(z,{name:s?"check":"copy",size:12}),t||""]})}function li({value:e,suffix:t,invert:n}){const s=e>=0,l=n?!s:s;return r.jsxs("span",{className:"row gap-2 tabular",style:{color:l?"var(--success)":"var(--error)",fontSize:"var(--fs-xs)",fontWeight:600},children:[r.jsx(z,{name:s?"trendUp":"trendDown",size:12}),(s?"+":"")+(Math.abs(e)<1&&e!==0?Math.round(e*100)+"%":e)+(t||"")]})}function Ae({icon:e,title:t,sub:n,actions:s}){return r.jsxs("div",{className:"row",style:{gap:12,marginBottom:18,alignItems:"flex-start"},children:[e&&r.jsx("div",{style:{width:34,height:34,borderRadius:9,background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",display:"grid",placeItems:"center",color:"var(--accent)",flexShrink:0},children:r.jsx(z,{name:e,size:18})}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:"var(--fs-title)",fontWeight:600,letterSpacing:"-0.01em"},children:t}),n&&r.jsx("div",{className:"secondary",style:{marginTop:2},children:n})]}),s&&r.jsx("div",{className:"row gap-8",children:s})]})}function ue({icon:e,title:t,body:n,action:s}){return r.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%",minHeight:280,textAlign:"center",padding:40},children:r.jsxs("div",{style:{maxWidth:360},children:[r.jsx("div",{style:{width:52,height:52,borderRadius:14,background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",display:"grid",placeItems:"center",color:"var(--text-muted)",margin:"0 auto 16px"},children:r.jsx(z,{name:e||"box",size:24})}),r.jsx("div",{style:{fontSize:15,fontWeight:600,marginBottom:6},children:t}),n&&r.jsx("div",{className:"secondary",style:{lineHeight:1.55},children:n}),s&&r.jsx("div",{style:{marginTop:16},children:s})]})})}function Ce({options:e,value:t,onChange:n,size:s,label:l,disabled:o}){const a=e.map(d=>typeof d=="string"?d:d.value),i=a.indexOf(t),c=(d,u)=>{const f=d.key==="ArrowRight"||d.key==="ArrowDown"?1:d.key==="ArrowLeft"||d.key==="ArrowUp"?-1:0;if(!f)return;d.preventDefault();const h=(u+f+a.length)%a.length;n(a[h]),d.currentTarget.parentElement?.children[h]?.focus()};return r.jsx("div",{className:"seg",role:"radiogroup","aria-label":l,children:e.map((d,u)=>{const f=typeof d=="string"?d:d.value,h=typeof d=="string"?d:d.label,g=f===t;return r.jsx("button",{role:"radio","aria-checked":g,tabIndex:g||i===-1&&u===0?0:-1,disabled:o,className:"seg-btn"+(s==="sm"?" sm":"")+(g?" active":""),onClick:()=>n(f),onKeyDown:v=>c(v,u),children:h},f)})})}function kl({value:e,onChange:t}){return r.jsx(Ce,{options:[{value:"today",label:"Today"},{value:"week",label:"This week"},{value:"month",label:"This month"},{value:"all",label:"All time"}],value:e,onChange:t,size:"sm",label:"Time range"})}function Fr({frac:e,color:t,height:n}){return r.jsx("div",{style:{height:n||4,background:"rgba(255,255,255,0.06)",borderRadius:999,overflow:"hidden",width:"100%"},children:r.jsx("div",{style:{width:Math.max(2,e*100)+"%",height:"100%",background:t||"var(--accent)",borderRadius:999}})})}function Dr(e){if(!e)return null;const t=Math.max(0,Math.floor((Date.now()-e)/1e3));return t<60?"now":t<3600?Math.floor(t/60)+"m":t<86400?Math.floor(t/3600)+"h":Math.floor(t/86400)+"d"}function Ft(e,t){return e==="spec"?t==="drifted"?"var(--warn)":t==="broken"||t==="orphaned"?"var(--error)":"var(--node-spec)":e==="test"?"var(--node-test)":e==="route"?"var(--node-route)":"var(--node-code)"}const cp=e=>`color-mix(in srgb, ${e} 14%, transparent)`;function Tc(e){return e.split(`
|
|
41
|
+
`).map((t,n)=>r.jsxs(N.Fragment,{children:[n>0&&r.jsx("br",{}),t.split(/(\*\*[^*]+\*\*|`[^`]+`)/g).map((s,l)=>s.startsWith("**")&&s.endsWith("**")&&s.length>4?r.jsx("strong",{style:{color:"var(--text-primary)"},children:s.slice(2,-2)},l):s.startsWith("`")&&s.endsWith("`")&&s.length>2?r.jsx("code",{className:"mono",style:{fontSize:12,background:"var(--bg-canvas)",padding:"1px 5px",borderRadius:4,border:"1px solid var(--border-subtle)",color:"var(--node-spec)"},children:s.slice(1,-1)},l):s)]},n))}function dp({refId:e,onRemove:t}){const n=/^REQ-/i.test(e);return r.jsxs("span",{className:"pill mono",style:{fontSize:10.5,color:n?"var(--node-spec)":"var(--text-secondary)",background:n?cp("var(--node-spec)"):"rgba(255,255,255,0.06)",maxWidth:240},children:[r.jsx(z,{name:n?"book":"paperclip",size:10,style:{flexShrink:0}}),r.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t&&r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:t,"aria-label":`Remove ${e}`,style:{padding:0,minWidth:0},children:r.jsx(z,{name:"x",size:10})})]})}function Mm({tool:e}){const[t,n]=N.useState(!1);return r.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:7,marginTop:8,overflow:"hidden",background:"var(--bg-canvas)"},children:[r.jsxs("button",{className:"row gap-8",onClick:()=>n(s=>!s),style:{width:"100%",padding:"6px 10px",cursor:"pointer",background:"none",border:"none",textAlign:"left"},children:[r.jsx(z,{name:t?"chevronDown":"chevronRight",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx(z,{name:"wrench",size:12,style:{color:"var(--node-code)",flexShrink:0}}),r.jsxs("span",{className:"mono grow",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.name,r.jsxs("span",{className:"muted",children:["(",e.input,")"]})]}),r.jsxs("span",{className:"pill",style:{fontSize:9.5,color:"var(--success)",background:"var(--success-soft)",flexShrink:0},children:[r.jsx(z,{name:"check",size:9}),"ok"]})]}),t&&r.jsxs("div",{style:{padding:"8px 10px 10px 30px",borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"mono muted",style:{fontSize:10.5,marginBottom:3},children:"input"}),r.jsx("div",{className:"mono",style:{fontSize:11.5,color:"var(--text-secondary)",overflowWrap:"anywhere"},children:e.input||"—"})]})]})}const Pm={symbol:{icon:"graph",color:"var(--node-code)",label:"Symbol"},spec:{icon:"book",color:"var(--node-spec)",label:"Spec"},domain:{icon:"sparkles",color:"var(--node-route)",label:"Domain fact"}},ro={margin:"8px 0 0",fontSize:11,lineHeight:1.6,color:"var(--text-secondary)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:"9px 11px",overflow:"auto",maxHeight:220,whiteSpace:"pre-wrap",overflowWrap:"anywhere"};function Lm({src:e}){const t=Pm[e.kind],n=e.detail;return r.jsxs("div",{className:"card",style:{padding:"10px 12px"},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(z,{name:t.icon,size:13,style:{color:t.color,flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:12,fontWeight:600,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),r.jsx(re,{color:t.color,bg:cp(t.color),children:t.label})]}),e.filePath&&r.jsxs("div",{className:"mono muted",style:{fontSize:10.5,marginTop:3},children:[e.filePath,e.line?":"+e.line:""]}),n!=null&&e.kind==="symbol"&&"callers"in n&&r.jsxs(r.Fragment,{children:[n.signature&&r.jsx("div",{className:"mono",style:{fontSize:11,marginTop:6,color:"var(--text-secondary)"},children:n.signature}),r.jsx("pre",{className:"mono",style:ro,children:n.body}),r.jsxs("div",{className:"mono muted",style:{fontSize:10.5,marginTop:6},children:[n.callers.length," callers · ",n.callees.length," callees"]})]}),n!=null&&e.kind==="spec"&&"links"in n&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:"mono",style:ro,children:n.body}),n.links.map(s=>r.jsxs("div",{className:"row gap-8",style:{marginTop:6},children:[r.jsx("span",{className:"mono grow",style:{fontSize:11,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.target}),r.jsx("span",{className:"pill",style:{fontSize:9.5,color:s.state==="verified"?"var(--success)":"var(--warn)",background:s.state==="verified"?"var(--success-soft)":"var(--warn-soft)"},children:s.state})]},s.target))]}),n!=null&&e.kind==="domain"&&r.jsx("pre",{className:"mono",style:ro,children:n.body})]})}function Dm({sources:e}){const[t,n]=N.useState(!1);return r.jsxs("div",{style:{marginTop:10},children:[r.jsxs("button",{className:"btn btn-ghost btn-xs",onClick:()=>n(s=>!s),children:[r.jsx(z,{name:t?"chevronDown":"chevronRight",size:12}),t?"Hide context":`Show context · ${e.length} source${e.length===1?"":"s"}`]}),t&&r.jsx("div",{className:"col gap-8",style:{marginTop:8},children:e.map((s,l)=>r.jsx(Lm,{src:s},s.kind+":"+s.ref+":"+l))})]})}function Om({m:e}){return e.role==="user"?r.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:18},children:r.jsxs("div",{style:{maxWidth:"76%",background:"var(--bg-elevated)",border:"1px solid var(--border-subtle)",borderRadius:"12px 12px 4px 12px",padding:"9px 13px",fontSize:13.5,lineHeight:1.55},children:[r.jsx("div",{children:Tc(e.text)}),e.refs&&r.jsx("div",{className:"row gap-6",style:{marginTop:7,flexWrap:"wrap",justifyContent:"flex-end"},children:e.refs.map(t=>r.jsx(dp,{refId:t},t))})]})}):r.jsxs("div",{style:{marginBottom:22},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:8},children:[r.jsx(ap,{size:22}),r.jsx("span",{style:{fontSize:12,fontWeight:600},children:"specship"}),r.jsx("span",{className:"mono muted",style:{fontSize:10.5},children:"knowledge base"})]}),r.jsxs("div",{style:{paddingLeft:30},children:[e.streaming&&!e.text&&r.jsxs("div",{className:"row gap-8 muted",style:{fontSize:12},children:[r.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--accent)",animation:"skeleton 1s infinite"}}),"thinking with specship context…"]}),e.text&&r.jsx("div",{style:{fontSize:13.5,lineHeight:1.62,color:"var(--text-secondary)",textWrap:"pretty"},children:Tc(e.text)}),e.tool&&r.jsx(Mm,{tool:e.tool}),e.error&&r.jsxs("div",{className:"row gap-8",style:{marginTop:e.text||e.tool?8:0,padding:"8px 11px",background:"var(--error-soft)",border:"1px solid rgba(242,85,90,0.25)",borderRadius:7},children:[r.jsx(z,{name:"cancel",size:14,style:{color:"var(--error)",flexShrink:0}}),r.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:"The chat backend didn't answer — the send failed or the stream dropped. Your draft is preserved; try again."})]}),!!e.sources?.length&&r.jsx(Dm,{sources:e.sources})]})]})}function Im(e){return[{icon:"drift",q:"Summarize the drift queue"},{icon:"book",q:e?`What is the link state of ${e}?`:"What specs does this project have?"},{icon:"play",q:e?`Kick off the spec-implement workflow for ${e}`:"Kick off the spec-implement workflow"}]}function Am({suggestions:e,onPick:t}){return r.jsx("div",{style:{display:"grid",placeItems:"center",minHeight:320,textAlign:"center",padding:"40px 20px"},children:r.jsxs("div",{style:{maxWidth:460},children:[r.jsx("div",{style:{width:52,height:52,borderRadius:14,background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",display:"grid",placeItems:"center",color:"var(--accent)",margin:"0 auto 16px"},children:r.jsx(z,{name:"sparkles",size:24})}),r.jsx("div",{style:{fontSize:15,fontWeight:600,marginBottom:6},children:"Ask with specship context"}),r.jsx("div",{className:"secondary",style:{lineHeight:1.55,marginBottom:18},children:"Answers come from this project's own knowledge base — the code graph, specs, and domain facts. No model, no network."}),r.jsx("div",{className:"col gap-8",children:e.map(n=>r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>t(n.q),style:{justifyContent:"flex-start"},children:[r.jsx(z,{name:n.icon,size:13}),n.q]},n.q))})]})})}function Bm({specs:e,project:t,onPick:n}){const[s,l]=N.useState(""),[o,a]=N.useState([]),i=N.useRef(0);N.useEffect(()=>{const f=s.trim(),h=++i.current;if(f.length<2){a([]);return}const g=setTimeout(()=>{P.graphSearch(f,t).then(v=>{i.current===h&&a([...new Set(v.results.map(p=>p.node.filePath))].slice(0,6))},()=>{i.current===h&&a([])})},150);return()=>clearTimeout(g)},[s,t]);const c=s.trim().toLowerCase(),d=e.filter(f=>!c||(f.id+" "+f.title).toLowerCase().includes(c)).slice(0,6),u=(f,h,g,v)=>r.jsxs("button",{className:"row gap-8",onClick:()=>n(f),style:{width:"100%",padding:"6px 9px",borderRadius:5,cursor:"pointer",border:"none",background:"transparent",textAlign:"left"},onMouseEnter:p=>{p.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[r.jsx(z,{name:h,size:12,style:{color:g,flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:11.5,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v})]},f);return r.jsxs("div",{style:{position:"absolute",bottom:"100%",left:0,marginBottom:8,width:340,background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:8,boxShadow:"var(--shadow-pop)",padding:5,zIndex:10},children:[r.jsx("input",{className:"input mono",autoFocus:!0,style:{width:"100%",marginBottom:5},placeholder:"Filter specs, search files…","aria-label":"Filter attachments",value:s,onChange:f=>l(f.target.value)}),d.length>0&&r.jsx("div",{className:"eyebrow",style:{padding:"4px 9px 2px"},children:"Specs"}),d.map(f=>u(f.id,"book","var(--node-spec)",`${f.id} · ${f.title}`)),o.length>0&&r.jsx("div",{className:"eyebrow",style:{padding:"6px 9px 2px"},children:"Files"}),o.map(f=>u(f,"paperclip","var(--text-muted)",f)),!d.length&&!o.length&&r.jsx("div",{className:"muted",style:{padding:"6px 9px",fontSize:11.5},children:c.length<2?"No specs indexed yet — type to search files.":"No matches."})]})}function Wm({draft:e,setDraft:t,refs:n,onRemoveRef:s,onAttach:l,busy:o,onSend:a,specs:i,project:c,contextChips:d}){const[u,f]=N.useState(!1);return N.useEffect(()=>{if(!u)return;const h=g=>{g.target.closest("[data-chat-attach]")||f(!1)};return window.addEventListener("mousedown",h),()=>window.removeEventListener("mousedown",h)},[u]),r.jsx("div",{style:{padding:"12px 24px 14px",borderTop:"1px solid var(--border-subtle)",flexShrink:0},children:r.jsxs("div",{"data-chat-attach":"1",style:{maxWidth:760,margin:"0 auto",position:"relative"},children:[u&&r.jsx(Bm,{specs:i,project:c,onPick:h=>{l(h),f(!1)}}),n.length>0&&r.jsx("div",{className:"row gap-6",style:{marginBottom:7,flexWrap:"wrap"},children:n.map(h=>r.jsx(dp,{refId:h,onRemove:()=>s(h)},h))}),r.jsxs("div",{className:"row",style:{gap:8,alignItems:"flex-end",background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",borderRadius:12,padding:8},children:[r.jsx("button",{className:"btn btn-ghost btn-sm",title:"Attach files or spec IDs","aria-label":"Attach files or spec IDs",onClick:()=>f(h=>!h),style:{padding:7},children:r.jsx(z,{name:"paperclip",size:15})}),r.jsx("textarea",{value:e,onChange:h=>t(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),a())},placeholder:"Ask with specship context…","aria-label":"Chat message",rows:1,style:{flex:1,resize:"none",background:"transparent",border:"none",outline:"none",color:"var(--text-primary)",fontSize:13.5,fontFamily:"var(--font-ui)",lineHeight:1.5,padding:"5px 2px",maxHeight:120}}),r.jsx("button",{className:"btn btn-primary btn-sm",title:"Send","aria-label":"Send",onClick:a,disabled:o||!e.trim(),style:{padding:"7px 10px"},children:r.jsx(z,{name:"send",size:14})})]}),r.jsxs("div",{className:"row gap-8",style:{marginTop:8,justifyContent:"space-between",flexWrap:"wrap"},children:[d,r.jsx("span",{className:"muted",style:{fontSize:10.5,flexShrink:0},children:"Enter to send · Shift+Enter for newline"})]})]})})}function $m({project:e}){const[t,n]=N.useState([]),[s,l]=N.useState(""),[o,a]=N.useState([]),[i,c]=N.useState(!1),[d,u]=N.useState("safe"),f=N.useRef(null),h=N.useRef(null),g=L(()=>P.status(e),[e]),v=L(()=>P.specs(e),[e]),p=L(()=>P.mcpServers(),[]);N.useEffect(()=>()=>h.current?.close(),[]),N.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[t]);const j=N.useCallback((k,C,_)=>{const W=k.trim();if(!W||i)return;const O=[W,...C].join(" ");n(K=>[...K,{role:"user",text:W,refs:C.length?C:void 0},{role:"assistant",text:"",streaming:!0}]),c(!0);const ee=K=>n(D=>D.map((b,E)=>E===D.length-1?K(b):b)),_e=()=>{_&&(l(""),a([]))},Re=()=>{c(!1),ee(K=>({...K,streaming:!1,error:!0}))};if(typeof EventSource>"u"){P.chat(O,e).then(K=>{_e(),c(!1),ee(D=>({...D,streaming:!1,text:K.answer,sources:K.sources}))},Re);return}const me=new EventSource(fm(O,e));h.current=me;const Je=(K,D)=>me.addEventListener(K,b=>{try{D(JSON.parse(b.data))}catch{}});me.addEventListener("thinking",_e),Je("tool",K=>ee(D=>({...D,tool:K}))),Je("chunk",K=>{_e(),ee(D=>({...D,text:D.text+K.text}))}),Je("done",K=>{me.close(),c(!1),ee(D=>({...D,streaming:!1,sources:K.sources}))}),me.onerror=()=>{me.close(),Re()}},[i,e]),m=v.data?.specs??[],x=Im(m[0]?.id),y=p.data?p.data.servers.reduce((k,C)=>k+C.tools.length,0):null,w=(k,C,_)=>r.jsxs("span",{className:"row gap-6",title:_,style:{flexShrink:0},children:[r.jsx(z,{name:k,size:11,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"mono muted",style:{fontSize:10.5,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C})]}),S=r.jsxs("div",{className:"row gap-10",style:{flexWrap:"wrap",minWidth:0},children:[g.data&&w("folder",g.data.projectPath,"Project"),g.data&&w("box",`${g.data.fileCount.toLocaleString()} files indexed`),y!=null&&w("plug",`${y} MCP tools`),r.jsx(Ce,{size:"sm",label:"Tool access",value:d,onChange:u,options:[{value:"ask",label:"Ask"},{value:"safe",label:"Auto-safe"},{value:"all",label:"All"}]})]});return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{ref:f,className:"scroll-y",style:{flex:1,padding:"20px 24px"},children:r.jsx("div",{style:{maxWidth:760,margin:"0 auto"},children:t.length===0?r.jsx(Am,{suggestions:x,onPick:k=>j(k,[],!1)}):t.map((k,C)=>r.jsx(Om,{m:k},C))})}),r.jsx(Wm,{draft:s,setDraft:l,refs:o,onRemoveRef:k=>a(C=>C.filter(_=>_!==k)),onAttach:k=>a(C=>C.includes(k)?C:[...C,k]),busy:i,onSend:()=>j(s,o,!0),specs:m,project:e,contextChips:S})]})}function Fn({onIngested:e}){const[t,n]=N.useState(!1),s=()=>{n(!0),P.ingestNow().catch(()=>{}).finally(()=>{n(!1),e?.()})};return r.jsx(ue,{icon:"database",title:"No Claude Code data ingested yet",body:"This screen lights up once SpecShip ingests your transcripts from ~/.claude/projects. Turn on transcript ingest in Settings, or run a one-shot pass now.",action:r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:s,disabled:t,children:t?"Ingesting…":"Run ingest now"})})}function Hr(e){return e>=.7?"var(--success)":e>=.5?"var(--warn)":"var(--error)"}function up(e){const t=(e.total_input_tokens??0)+(e.total_cache_creation_tokens??0)+(e.total_cache_read_tokens??0);return t>0?(e.total_cache_read_tokens??0)/t:0}function Nl(e){return e.replace(/^claude-/,"")}const _c=["var(--node-spec)","var(--node-code)","var(--node-route)","var(--node-test)","var(--accent)","var(--warn)"];function oa(e){return _c[e%_c.length]}function oi(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"—"}function pp(e){return e?new Date(e).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function Fm(e){const t=Math.round(e/1e3);if(t<60)return t+"s";const n=Math.floor(t/60);return n<60?n+"m":Math.floor(n/60)+"h "+n%60+"m"}function tr({label:e,value:t,color:n}){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono tabular",style:{fontSize:16,fontWeight:600,marginTop:2,color:n||"var(--text-primary)"},children:t})]})}function ai({data:e,color:t,w:n=80,h:s=24,fill:l}){if(!e||!e.length)return null;const o=Math.max(...e),a=Math.min(...e),i=o-a||1,d=e.map((f,h)=>[h/(e.length-1)*n,s-(f-a)/i*(s-4)-2]).map((f,h)=>(h?"L":"M")+f[0].toFixed(1)+" "+f[1].toFixed(1)).join(" "),u=d+` L${n} ${s} L0 ${s} Z`;return r.jsxs("svg",{width:n,height:s,style:{display:"block",overflow:"visible"},children:[l&&r.jsx("path",{d:u,fill:t,opacity:.12}),r.jsx("path",{d,fill:"none",stroke:t||"var(--accent)",strokeWidth:1.6,strokeLinejoin:"round",strokeLinecap:"round"})]})}function fp({series:e,w:t=640,h:n=200,color:s="var(--accent)",xTicks:l=6,onHover:o}){const[a,i]=N.useState(null),c={l:44,r:12,t:14,b:24},d=t-c.l-c.r,u=n-c.t-c.b,f=e.map(w=>w.cost),h=Math.max(...f)*1.12||1,g=0,v=w=>c.l+w/(e.length-1)*d,p=w=>c.t+u-(w-g)/(h-g)*u,j=e.map((w,S)=>(S?"L":"M")+v(S).toFixed(1)+" "+p(w.cost).toFixed(1)).join(" "),m=j+` L${v(e.length-1)} ${c.t+u} L${c.l} ${c.t+u} Z`,x=4,y=a!=null?e[a]:void 0;return r.jsxs("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,style:{display:"block"},onMouseLeave:()=>{i(null),o?.(null)},onMouseMove:w=>{const S=w.currentTarget.getBoundingClientRect(),k=(w.clientX-S.left)/S.width*t;let C=Math.round((k-c.l)/d*(e.length-1));C=Math.max(0,Math.min(e.length-1,C)),i(C),o?.(e[C]??null)},children:[Array.from({length:x+1}).map((w,S)=>{const k=h/x*S,C=p(k);return r.jsxs("g",{children:[r.jsx("line",{x1:c.l,x2:t-c.r,y1:C,y2:C,stroke:"rgba(255,255,255,0.05)"}),r.jsx("text",{x:c.l-8,y:C+3,textAnchor:"end",fontSize:10,fill:"var(--text-muted)",fontFamily:"var(--font-mono)",children:"$"+k.toFixed(0)})]},S)}),r.jsx("path",{d:m,fill:s,opacity:.1}),r.jsx("path",{d:j,fill:"none",stroke:s,strokeWidth:2,strokeLinejoin:"round"}),e.filter((w,S)=>S%Math.ceil(e.length/l)===0).map(w=>{const S=e.indexOf(w);return r.jsx("text",{x:v(S),y:n-6,textAnchor:"middle",fontSize:10,fill:"var(--text-muted)",fontFamily:"var(--font-mono)",children:w.day+"d"},S)}),a!=null&&y&&r.jsxs("g",{children:[r.jsx("line",{x1:v(a),x2:v(a),y1:c.t,y2:c.t+u,stroke:s,opacity:.4,strokeDasharray:"3 3"}),r.jsx("circle",{cx:v(a),cy:p(y.cost),r:4,fill:s,stroke:"var(--bg-canvas)",strokeWidth:2})]})]})}function hp({data:e,size:t=140,thickness:n=22,centerLabel:s,centerSub:l}){const o=e.reduce((f,h)=>f+h.cost,0)||1,a=(t-n)/2,i=t/2,c=t/2,d=2*Math.PI*a;let u=0;return r.jsxs("div",{style:{position:"relative",width:t,height:t},children:[r.jsxs("svg",{width:t,height:t,style:{transform:"rotate(-90deg)"},children:[r.jsx("circle",{cx:i,cy:c,r:a,fill:"none",stroke:"rgba(255,255,255,0.05)",strokeWidth:n}),e.map((f,h)=>{const v=f.cost/o*d,p=r.jsx("circle",{cx:i,cy:c,r:a,fill:"none",stroke:f.color,strokeWidth:n,strokeDasharray:`${v} ${d-v}`,strokeDashoffset:-u,strokeLinecap:"butt"},h);return u+=v,p})]}),s&&r.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",textAlign:"center"},children:r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums"},children:s}),l&&r.jsx("div",{className:"muted",style:{fontSize:10},children:l})]})})]})}function mp({rows:e,segments:t,fmt:n}){const s=Math.max(...e.map(l=>t.reduce((o,a)=>o+(l.values[a.key]||0),0)))||1;return r.jsx("div",{className:"col gap-10",children:e.map(l=>{const o=t.reduce((a,i)=>a+(l.values[i.key]||0),0);return r.jsxs("div",{className:"row gap-10",children:[r.jsx("div",{style:{width:110,fontSize:12,color:"var(--text-secondary)",textAlign:"right",flexShrink:0,fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.label}),r.jsx("div",{className:"row",style:{flex:1,height:18,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:t.map(a=>{const i=l.values[a.key]||0;return i?r.jsx("div",{title:`${a.label}: ${n?n(i):i}`,style:{width:i/s*100+"%",height:"100%",background:a.color}},a.key):null})}),r.jsx("div",{className:"tabular",style:{width:64,fontSize:12,textAlign:"right",flexShrink:0,fontFamily:"var(--font-mono)"},children:n?n(o):o})]},l.label)})})}function ii({items:e,max:t,color:n,fmt:s,labelKey:l="name",valueKey:o="calls",onItemClick:a,selectedKey:i}){const c=t||Math.max(...e.map(d=>Number(d[o])||0))||1;return r.jsx("div",{className:"col gap-6",children:e.map(d=>{const u=String(d[l]),f=Number(d[o])||0,h=i!=null&&u===i;return r.jsxs("div",{className:"row gap-10",onClick:a?()=>a(d):void 0,style:{cursor:a?"pointer":"default",borderRadius:5,padding:a?"2px 4px":0,margin:a?"0 -4px":0,background:h?"var(--accent-soft)":"transparent"},onMouseEnter:a?g=>{h||(g.currentTarget.style.background="var(--bg-hover)")}:void 0,onMouseLeave:a?g=>{h||(g.currentTarget.style.background="transparent")}:void 0,children:[r.jsx("div",{style:{width:116,fontSize:12,fontFamily:"var(--font-mono)",color:h?"var(--accent)":"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:0},children:u}),r.jsx("div",{className:"grow",style:{height:16,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:r.jsx("div",{style:{width:f/c*100+"%",height:"100%",background:typeof n=="function"?n(d):n||"var(--accent)",borderRadius:4}})}),r.jsx("div",{className:"tabular",style:{width:52,textAlign:"right",fontSize:12,fontFamily:"var(--font-mono)",flexShrink:0},children:s?s(f):f}),a&&r.jsx(z,{name:"chevronRight",size:12,style:{color:h?"var(--accent)":"var(--text-faint)",flexShrink:0}})]},u)})})}function Hm(e,t,n,s,l){const o=e.reduce((g,v)=>g+v.value,0)||1,a=e.map(g=>({d:g,area:g.value/o*(s*l)})),i=[];let c={x:t,y:n,w:s,h:l},d=[];const u=g=>g.reduce((v,p)=>v+p.area,0),f=(g,v)=>{if(!g.length)return 1/0;const p=u(g),j=Math.max(...g.map(x=>x.area)),m=Math.min(...g.map(x=>x.area));return Math.max(v*v*j/(p*p),p*p/(v*v*m))},h=()=>{const g=Math.min(c.w,c.h),p=u(d)/(g||1);let j=0;const m=c.w>=c.h;d.forEach(x=>{const y=x.area/(p||1);m?i.push({...x.d,x:c.x,y:c.y+j,w:p,h:y}):i.push({...x.d,x:c.x+j,y:c.y,w:y,h:p}),j+=y}),m?c={x:c.x+p,y:c.y,w:c.w-p,h:c.h}:c={x:c.x,y:c.y+p,w:c.w,h:c.h-p},d=[]};return a.forEach(g=>{const v=Math.min(c.w,c.h);d.length&&f([...d,g],v)>f(d,v)&&h(),d.push(g)}),d.length&&h(),i}function ci({items:e,height:t=120,onPick:n,selKey:s}){const l=N.useRef(null),[o,a]=N.useState(0);N.useEffect(()=>{if(!l.current||typeof ResizeObserver>"u")return;const u=new ResizeObserver(f=>a(f[0].contentRect.width));return u.observe(l.current),()=>u.disconnect()},[]);const i=o||600,c=[...e].sort((u,f)=>f.value-u.value),d=Hm(c,0,0,i,t);return r.jsx("div",{ref:l,style:{position:"relative",width:"100%",height:t,borderRadius:7,overflow:"hidden",background:"var(--bg-canvas)"},children:d.map(u=>{const f=Math.max(0,Math.min(1,u.intensity||0)),g=`color-mix(in srgb, ${f>.66?"var(--error)":f>.33?"var(--warn)":"var(--node-route)"} ${Math.round(20+f*58)}%, var(--bg-elevated))`,v=s===u.key,p=u.w>52&&u.h>26,j=u.w>36&&u.h>15,m={position:"absolute",left:u.x+1.5,top:u.y+1.5,width:Math.max(0,u.w-3),height:Math.max(0,u.h-3),background:g,borderRadius:4,cursor:n?"pointer":"default",overflow:"hidden",padding:p?"5px 7px":"0 5px",display:"flex",flexDirection:"column",justifyContent:p?"flex-start":"center",border:v?"1.5px solid var(--accent)":"1px solid rgba(0,0,0,0.26)"};return r.jsxs("div",{onClick:n?()=>n(u):void 0,title:u.title||u.label,style:m,children:[j&&r.jsx("span",{className:"mono",style:{fontSize:p?10:9,fontWeight:500,color:f>.45?"#fff":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.25},children:u.label}),p&&u.sub&&r.jsx("span",{className:"mono tabular",style:{fontSize:9,color:f>.45?"rgba(255,255,255,0.8)":"var(--text-muted)",marginTop:1},children:u.sub})]},u.key)})})}function Ur(e,t){return e==="route"?"route":/\.(test|spec)\.|__tests__\//.test(t)?"test":"code"}function xp(e){return e.map((t,n)=>{const s=46*Math.sqrt(n+.6),l=n*2.399963229728653;return{id:t.id,label:t.name,kind:Ur(t.kind,t.filePath),x:Math.round(s*Math.cos(l)*2.2),y:Math.round(s*Math.sin(l)),file:t.filePath}})}const Rc=120,Um=600;function Vm(e,t){const n=xp(e),s=n.length;if(s<2)return n;const l=new Map;n.forEach((d,u)=>l.set(d.id,u));const o=n.map(d=>d.x),a=n.map(d=>d.y),i=110,c=s<=Um;for(let d=0;d<Rc;d++){const f=3+26*(1-d/Rc),h=new Array(s).fill(0),g=new Array(s).fill(0);if(c)for(let v=0;v<s;v++)for(let p=v+1;p<s;p++){let j=o[v]-o[p],m=a[v]-a[p];if(j===0&&m===0){const w=(v*7+p)%12*(Math.PI/6);j=Math.cos(w),m=Math.sin(w)}const x=j*j+m*m,y=i*i/x;h[v]+=j*y,g[v]+=m*y,h[p]-=j*y,g[p]-=m*y}for(const v of t){const p=l.get(v.from),j=l.get(v.to);if(p===void 0||j===void 0||p===j)continue;const m=o[p]-o[j],x=a[p]-a[j],y=(Math.hypot(m,x)||1)/i;h[p]-=m*y,g[p]-=x*y,h[j]+=m*y,g[j]+=x*y}for(let v=0;v<s;v++){const p=Math.hypot(h[v],g[v]);if(!p)continue;const j=Math.min(p,f);o[v]+=h[v]/p*j,a[v]+=g[v]/p*j}}return n.map((d,u)=>({...d,x:Math.round(o[u]*1.35),y:Math.round(a[u])}))}function Km(e,t){const n=new Set(e.map(p=>p.id)),s=new Map,l=new Map;e.forEach(p=>{s.set(p.id,0),l.set(p.id,[])}),t.forEach(p=>{p.from===p.to||!n.has(p.from)||!n.has(p.to)||(l.get(p.from).push(p.to),s.set(p.to,(s.get(p.to)??0)+1))});const o=new Map,a=[];let i=0;const c=()=>{for(;i<a.length;){const p=a[i++],j=o.get(p);for(const m of l.get(p)??[])o.has(m)||(o.set(m,j+1),a.push(m))}};e.forEach(p=>{s.get(p.id)===0&&(o.set(p.id,0),a.push(p.id))}),c();for(const p of e)o.has(p.id)||(o.set(p.id,0),a.push(p.id),c());const d=new Map;e.forEach(p=>{const j=o.get(p.id);d.has(j)||d.set(j,[]),d.get(j).push(p.id)});const u=250,f=58,h=20,g=new Map;let v=0;for(const[,p]of[...d.entries()].sort((j,m)=>j[0]-m[0])){const j=Math.ceil(p.length/h),m=Math.ceil(p.length/j);p.forEach((x,y)=>{const w=Math.floor(y/m),S=y%m;g.set(x,{x:v+w*u,y:Math.round((S-(m-1)/2)*f)})}),v+=j*u+40}return e.map(p=>({id:p.id,label:p.name,kind:Ur(p.kind,p.filePath),x:g.get(p.id).x,y:g.get(p.id).y,file:p.filePath}))}function Qm(e,t,n){return n==="synth"?"synth":e.kind==="spec"||t.kind==="spec"?"implements":e.kind==="test"||t.kind==="test"?"tests":"calls"}const Mc={position:"absolute",top:34,left:"50%",transform:"translateX(-50%)",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:5,padding:"3px 7px",fontSize:10.5,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",whiteSpace:"nowrap",pointerEvents:"none",boxShadow:"var(--shadow-pop)",zIndex:5};function di({nodes:e,edges:t,selectedId:n,onSelect:s,hiddenIds:l,hiddenEdgeKinds:o,height:a="100%",interactive:i=!0,fitKey:c,focusId:d,dotGrid:u=!0}){const[f,h]=N.useState(e),[g,v]=N.useState({tx:0,ty:0,k:1}),[p,j]=N.useState(null),[m,x]=N.useState({w:0,h:0}),y=N.useRef(null),w=N.useRef(null),S=N.useRef(!1);N.useEffect(()=>{const b=y.current;if(!b||typeof ResizeObserver>"u")return;const E=new ResizeObserver(R=>x({w:R[0].contentRect.width,h:R[0].contentRect.height}));return E.observe(b),()=>E.disconnect()},[]),N.useEffect(()=>{h(e),S.current=!1},[e]);const k=N.useCallback(()=>{const b=y.current;if(!b||!f.length)return;const E=b.clientWidth,R=b.clientHeight,I=f.map(Yt=>Yt.x),A=f.map(Yt=>Yt.y),G=Math.min(...I)-60,Q=Math.max(...I)+140,xe=Math.min(...A)-40,je=Math.max(...A)+80,Me=Q-G,Qt=je-xe,Ze=Math.min(E/Me,R/Qt,1.4)*.92;v({k:Ze,tx:(E-Me*Ze)/2-G*Ze,ty:(R-Qt*Ze)/2-xe*Ze})},[f]);N.useEffect(()=>{!S.current&&y.current&&(k(),S.current=!0)},[f,k]),N.useEffect(()=>{c!==void 0&&k()},[c]);const C=N.useRef(null);N.useEffect(()=>{if(!d){C.current=null;return}if(C.current===d)return;const b=f.find(Q=>Q.id===d),E=y.current;if(!b||!E)return;C.current=d;const{cx:R,cy:I}=K(b),A=E.clientWidth,G=E.clientHeight;v(Q=>{const xe=Math.min(1.4,Math.max(.6,Q.k));return{k:xe,tx:A/2-R*xe,ty:G/2-I*xe}})},[d,f]);const _=b=>{if(!i)return;b.preventDefault();const E=y.current.getBoundingClientRect(),R=b.clientX-E.left,I=b.clientY-E.top,A=-b.deltaY*.0016;v(G=>{const Q=Math.min(2.4,Math.max(.25,G.k*(1+A))),xe=Q/G.k;return{k:Q,tx:R-(R-G.tx)*xe,ty:I-(I-G.ty)*xe}})},W=b=>{i&&(b.target.closest("[data-node]")||(w.current={type:"pan",sx:b.clientX,sy:b.clientY,ox:g.tx,oy:g.ty},b.currentTarget.style.cursor="grabbing"))},O=(b,E)=>{i&&(b.stopPropagation(),w.current={type:"node",id:E.id,sx:b.clientX,sy:b.clientY,ox:E.x,oy:E.y,moved:!1})},ee=b=>{const E=w.current;if(E)if(E.type==="pan")v(R=>({...R,tx:E.ox+(b.clientX-E.sx),ty:E.oy+(b.clientY-E.sy)}));else{const R=(b.clientX-E.sx)/g.k,I=(b.clientY-E.sy)/g.k;Math.abs(b.clientX-E.sx)+Math.abs(b.clientY-E.sy)>3&&(E.moved=!0),h(A=>A.map(G=>G.id===E.id?{...G,x:E.ox+R,y:E.oy+I}:G))}},_e=()=>{const b=w.current;b&&b.type==="node"&&!b.moved&&s?.(b.id),y.current&&(y.current.style.cursor="grab"),w.current=null},Re={};f.forEach(b=>Re[b.id]=b);const me={};t.forEach(b=>{me[b.from]=(me[b.from]||0)+1,me[b.to]=(me[b.to]||0)+1});function Je(b){return b.kind==="route"?{w:18,h:18,shape:"dot"}:{w:Math.max(64,b.label.length*(b.kind==="spec"?7.6:7.2)+26),h:30,shape:b.kind==="spec"?"rect":"pill"}}function K(b){const E=Je(b);return{cx:b.x+E.w/2,cy:b.y+E.h/2,b:E}}const D=new Set;return n&&t.forEach(b=>{b.from===n&&D.add(b.to),b.to===n&&D.add(b.from)}),r.jsxs("div",{ref:y,onWheel:_,onMouseDown:W,onMouseMove:ee,onMouseUp:_e,onMouseLeave:_e,style:{position:"relative",width:"100%",height:a,overflow:"hidden",cursor:"grab",background:u?"var(--bg-canvas-2)":"transparent",backgroundImage:u?"radial-gradient(circle, var(--dot-grid) 1px, transparent 1px)":"none",backgroundSize:`${22*g.k}px ${22*g.k}px`,backgroundPosition:`${g.tx}px ${g.ty}px`,userSelect:"none"},children:[r.jsxs("svg",{width:"100%",height:"100%",style:{position:"absolute",inset:0,pointerEvents:"none"},children:[r.jsxs("defs",{children:[r.jsx("marker",{id:"arrow",viewBox:"0 0 10 10",refX:8,refY:5,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",children:r.jsx("path",{d:"M0 0 L10 5 L0 10 z",fill:"rgba(160,170,190,0.5)"})}),r.jsx("marker",{id:"arrowHi",viewBox:"0 0 10 10",refX:8,refY:5,markerWidth:7,markerHeight:7,orient:"auto-start-reverse",children:r.jsx("path",{d:"M0 0 L10 5 L0 10 z",fill:"var(--accent)"})})]}),r.jsx("g",{transform:`translate(${g.tx} ${g.ty}) scale(${g.k})`,children:t.map((b,E)=>{const R=Re[b.from],I=Re[b.to];if(!R||!I)return null;const A=Qm(R,I,b.kind);if(o?.has(A))return null;const G=K(R),Q=K(I),xe=l&&(l.has(b.from)||l.has(b.to)),je=n&&(b.from===n||b.to===n),Me=A==="implements"?"var(--node-spec)":A==="tests"?"var(--node-test)":null,Qt=Me?`color-mix(in srgb, ${Me} 62%, transparent)`:"rgba(150,160,180,0.32)",Ze=(G.cx+Q.cx)/2,Yt=`M ${G.cx} ${G.cy} C ${Ze} ${G.cy}, ${Ze} ${Q.cy}, ${Q.cx} ${Q.cy}`;return r.jsx("path",{d:Yt,fill:"none",stroke:je?"var(--accent)":Qt,strokeWidth:je?2:Me?1.5:1.2,opacity:xe?.12:je?.95:.72,strokeDasharray:b.kind==="synth"?"5 4":"none",markerEnd:je?"url(#arrowHi)":"url(#arrow)"},E)})})]}),r.jsx("div",{style:{position:"absolute",inset:0,transform:`translate(${g.tx}px, ${g.ty}px) scale(${g.k})`,transformOrigin:"0 0",pointerEvents:"none"},children:f.map(b=>{const E=Je(b),R=Ft(b.kind,b.state),I=l&&l.has(b.id),A=b.id===n,G=D.has(b.id),Q=p===b.id,xe=I?.2:n&&!A&&!G?.55:1,je=me[b.id]||0,Me=1+Math.min(.24,je*.045),Qt={"data-node":b.id,onMouseDown:Yt=>O(Yt,b),onMouseEnter:()=>j(b.id),onMouseLeave:()=>j(null),style:{position:"absolute",left:b.x,top:b.y,pointerEvents:"auto",cursor:"pointer",opacity:xe,transition:"opacity 120ms"}};if(E.shape==="dot")return r.jsxs("div",{...Qt,children:[r.jsx("div",{style:{width:18,height:18,borderRadius:"50%",background:R,transform:`scale(${Me})`,boxShadow:A?`0 0 0 4px ${R}44, 0 0 14px ${R}`:Q?`0 0 0 3px ${R}33`:`0 0 8px ${R}66`,border:"2px solid var(--bg-canvas-2)"}}),(Q||A)&&r.jsx("div",{style:Mc,children:b.label})]},b.id);const Ze=b.kind==="spec"&&(b.state==="drifted"||b.state==="broken"||b.state==="orphaned");return r.jsxs("div",{...Qt,children:[r.jsxs("div",{style:{minWidth:E.w,height:E.h,padding:"0 12px",display:"flex",alignItems:"center",gap:7,borderRadius:E.shape==="rect"?7:999,transform:`scale(${Me})`,transformOrigin:"center",background:`color-mix(in srgb, ${R} 16%, var(--bg-panel))`,border:`1.5px solid ${A||Ze?R:`color-mix(in srgb, ${R} 45%, transparent)`}`,color:"var(--node-text)",fontSize:12.5,fontWeight:500,whiteSpace:"nowrap",fontFamily:"var(--font-mono)",boxShadow:A?`0 0 0 4px ${R}33, 0 4px 16px ${R}44`:Q?`0 0 0 3px ${R}22`:"0 2px 8px rgba(0,0,0,0.4)"},children:[r.jsx("span",{style:{width:7,height:7,borderRadius:E.shape==="rect"?2:"50%",background:R,flexShrink:0,boxShadow:`0 0 6px ${R}`}}),b.label,Ze&&r.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:b.state==="drifted"?"var(--warn)":"var(--error)",marginLeft:2}})]}),Q&&r.jsx("div",{style:{...Mc,top:-22},children:b.file||b.sub})]},b.id)})}),i&&r.jsxs("div",{style:{position:"absolute",right:14,bottom:14,display:"flex",flexDirection:"column",gap:6},children:[r.jsx(so,{icon:"plus",onClick:()=>v(b=>({...b,k:Math.min(2.4,b.k*1.2)}))}),r.jsx(so,{icon:"minus",onClick:()=>v(b=>({...b,k:Math.max(.25,b.k/1.2)}))}),r.jsx(so,{icon:"maximize",onClick:k,title:"Fit"})]}),i&&r.jsxs("div",{style:{position:"absolute",left:14,bottom:14,display:"flex",flexDirection:"column",gap:6},children:[r.jsx(Ym,{nodes:f,view:g,size:m}),r.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-muted)",background:"rgba(0,0,0,0.4)",padding:"2px 7px",borderRadius:5,alignSelf:"flex-start"},children:Math.round(g.k*100)+"%"})]})]})}function Ym({nodes:e,view:t,size:n}){if(!e.length)return null;const s=138,l=88,o=6,a=e.map(C=>C.x),i=e.map(C=>C.y),c=Math.min(...a)-30,d=Math.max(...a)+120,u=Math.min(...i)-20,f=Math.max(...i)+50,h=d-c||1,g=f-u||1,v=Math.min((s-o*2)/h,(l-o*2)/g),p=o+(s-o*2-h*v)/2,j=o+(l-o*2-g*v)/2,m=C=>p+(C-c)*v,x=C=>j+(C-u)*v,y=-t.tx/t.k,w=-t.ty/t.k,S=n.w/t.k,k=n.h/t.k;return r.jsxs("svg",{width:s,height:l,style:{background:"color-mix(in srgb, var(--bg-canvas-2) 92%, transparent)",border:"1px solid var(--border-subtle)",borderRadius:7,boxShadow:"0 4px 12px rgba(0,0,0,0.4)",backdropFilter:"blur(4px)"},children:[e.map(C=>r.jsx("circle",{cx:m(C.x),cy:x(C.y),r:C.kind==="route"?1.6:2.1,fill:Ft(C.kind,C.state),opacity:.9},C.id)),n.w>0&&r.jsx("rect",{x:Math.max(0,m(y)),y:Math.max(0,x(w)),width:Math.min(s,S*v),height:Math.min(l,k*v),fill:"var(--accent)",fillOpacity:.12,stroke:"var(--accent)",strokeWidth:1,rx:2})]})}function so({icon:e,onClick:t,title:n}){return r.jsx("button",{onClick:t,title:n,className:"btn btn-secondary",style:{width:30,height:30,padding:0,justifyContent:"center",borderRadius:7},children:r.jsx(z,{name:e,size:15})})}const U=e=>e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":String(e),Gm=e=>e.split("/").filter(Boolean).slice(-2).join("/"),zl=e=>e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();function ae({state:e,label:t,minHeight:n,children:s}){if(e.data==null&&e.loading)return r.jsx("div",{className:"skel",style:{minHeight:n,borderRadius:10},"aria-label":`Loading ${t}`});if(e.data==null&&e.error!=null){const l=e.error instanceof Error?e.error.message:String(e.error);return r.jsx("div",{className:"card card-pad",style:{minHeight:n,display:"grid",placeItems:"center"},children:r.jsxs("div",{style:{textAlign:"center",maxWidth:300},children:[r.jsxs("div",{className:"row gap-8",style:{justifyContent:"center",color:"var(--error)"},children:[r.jsx(z,{name:"cancel",size:14}),r.jsxs("span",{style:{fontSize:12.5,fontWeight:600},children:["Couldn't load ",t]})]}),r.jsx("div",{className:"muted",style:{fontSize:11.5,marginTop:4,overflowWrap:"anywhere"},children:l}),r.jsx("button",{className:"btn btn-secondary btn-xs",style:{marginTop:10},onClick:e.reload,children:"Retry"})]})})}return e.data==null?null:r.jsx(r.Fragment,{children:s(e.data)})}function Cl({onIngested:e}){const[t,n]=N.useState(!1),s=()=>{n(!0),P.ingestNow().catch(()=>{}).finally(()=>{n(!1),e?.()})};return r.jsx("div",{style:{flex:1,display:"grid",placeItems:"center",padding:18,textAlign:"center"},children:r.jsxs("div",{style:{maxWidth:320},children:[r.jsx("div",{style:{color:"var(--text-muted)",marginBottom:8},children:r.jsx(z,{name:"database",size:18})}),r.jsx("div",{style:{fontSize:12.5,fontWeight:600,marginBottom:4},children:"No Claude Code data ingested yet"}),r.jsx("div",{className:"muted",style:{fontSize:11.5,lineHeight:1.5},children:"Usage modules light up once SpecShip ingests your transcripts from ~/.claude/projects — run an ingest pass now, or use Refresh in the status strip."}),r.jsx("button",{className:"btn btn-secondary btn-xs",style:{marginTop:10},onClick:s,disabled:t,children:t?"Ingesting…":"Run ingest now"})]})})}function El({label:e,page:t,arrow:n}){return r.jsxs("a",{href:"/"+t,className:"btn btn-ghost btn-xs",onClick:s=>{s.metaKey||s.ctrlKey||s.shiftKey||(s.preventDefault(),B(t))},children:[e,n&&r.jsx(z,{name:"arrowRight",size:11})]})}function ui({icon:e,iconColor:t,title:n,sub:s,action:l,pad:o}){return r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:o?"11px 13px":void 0,marginBottom:o?0:10,borderBottom:o?"1px solid var(--border-subtle)":void 0},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(z,{name:e,size:14,style:{color:t}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:n}),s&&r.jsx("span",{className:"muted",style:{fontSize:11},children:s})]}),l]})}function is({icon:e,label:t,value:n,delta:s,deltaInvert:l,spark:o,sparkColor:a,color:i,note:c,onClick:d}){return r.jsxs("button",{onClick:d,className:"card card-btn",style:{textAlign:"left",padding:"11px 13px",display:"flex",flexDirection:"column",gap:6},children:[r.jsxs("div",{className:"row gap-8",style:{color:"var(--text-muted)"},children:[r.jsx(z,{name:e,size:13,style:{color:i||"var(--text-muted)"}}),r.jsx("span",{className:"eyebrow",style:{letterSpacing:"0.04em"},children:t})]}),r.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"flex-end",gap:8},children:[r.jsx("div",{className:"tabular",style:{fontSize:23,fontWeight:650,letterSpacing:"-0.02em",lineHeight:1},children:n}),o&&o.length>1&&r.jsx(ai,{data:o,color:a||i||"var(--accent)",fill:!0,w:64,h:22})]}),c?r.jsx("div",{className:"muted",style:{fontSize:10.5},children:c}):s!==void 0&&r.jsx(li,{value:s,invert:l})]})}function qm(e,t){if(!e.nodes.length)return{nodes:[],edges:[]};const n=12,s=[],l=new Set;for(const c of t){for(const d of e.nodes){if(s.length>=n)break;l.has(d.id)||(c.path===d.filePath||c.path.endsWith("/"+d.filePath))&&(s.push(d),l.add(d.id))}if(s.length>=n)break}const o=s.length>=3?s:e.nodes.slice(0,n),a=new Set(o.map(c=>c.id)),i=e.edges.filter(c=>a.has(c.from)&&a.has(c.to)).map(c=>({from:c.from,to:c.to,kind:c.provenance==="heuristic"?"synth":c.kind}));return{nodes:xp(o),edges:i}}function Xm({graph:e,heatFiles:t}){const{nodes:n,edges:s}=N.useMemo(()=>qm(e,t),[e,t]);return r.jsxs("div",{className:"card",style:{overflow:"hidden",height:340,display:"flex",flexDirection:"column"},children:[r.jsx(ui,{icon:"graph",iconColor:"var(--accent)",title:"Recent neighborhood",sub:"· last edited files",pad:!0,action:r.jsx(El,{label:"Open graph",page:"graph",arrow:!0})}),r.jsx("div",{style:{flex:1,minHeight:0},children:n.length?r.jsx(di,{nodes:n,edges:s,onSelect:l=>B("graph",{query:{focus:l}}),interactive:!0}):r.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%"},children:r.jsx("div",{className:"muted",style:{fontSize:12},children:"Nothing indexed yet — run specship index."})})})]})}function Jm({tip:e,onApply:t,onDismiss:n}){const s=e.severity==="error"?"var(--error)":e.severity==="warn"?"var(--warn)":"var(--info)",l=e.state==="applied";return r.jsxs("div",{onClick:()=>B("tips",{query:{sel:e.id}}),title:"View in Tips",onAnimationEnd:o=>{o.currentTarget.style.animation="none"},style:{display:"flex",gap:10,padding:"10px 12px",borderRadius:8,background:"var(--bg-panel-2)",border:"1px solid var(--border-subtle)",borderLeft:`2.5px solid ${s}`,animation:"slideInRight 200ms ease",cursor:"pointer",opacity:l?.65:1},children:[r.jsx("div",{style:{color:s,flexShrink:0,marginTop:1},children:r.jsx(z,{name:e.icon,size:14})}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:12.5,fontWeight:550,lineHeight:1.35,textWrap:"pretty"},children:e.title}),r.jsxs("div",{className:"row gap-8",style:{marginTop:7},children:[r.jsx("code",{className:"mono",style:{fontSize:10.5,color:"var(--text-secondary)",background:"var(--bg-canvas)",padding:"2px 6px",borderRadius:4,border:"1px solid var(--border-subtle)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:220},children:e.fix}),r.jsx("span",{className:"grow"}),r.jsx("span",{className:"pill",style:{fontSize:10,color:s,background:"transparent"},children:e.saving})]})]}),r.jsxs("div",{className:"row gap-4",style:{flexShrink:0},children:[l?r.jsxs("span",{className:"pill",style:{color:"var(--success)",background:"var(--success-soft)"},children:[r.jsx(z,{name:"check",size:11}),"Applied"]}):r.jsx("button",{className:"btn btn-secondary btn-xs",onClick:o=>{o.stopPropagation(),t()},title:"Mark applied",children:"Apply"}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:o=>{o.stopPropagation(),n()},title:"Dismiss",children:r.jsx(z,{name:"x",size:12})})]})]})}function Zm({tips:e,onSetState:t,noIngest:n,onIngested:s}){const l=e.filter(o=>o.severity==="error"&&o.state!=="applied").length;return r.jsxs("div",{className:"card",style:{display:"flex",flexDirection:"column",height:340},children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:"11px 13px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(z,{name:"tips",size:14,style:{color:"var(--warn)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Tips"}),l>0&&r.jsxs("span",{className:"pill",style:{fontSize:10,background:"var(--error-soft)",color:"var(--error)"},children:[l," urgent"]})]}),r.jsx(El,{label:"All",page:"tips"})]}),n&&!e.length?r.jsx(Cl,{onIngested:s}):r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:10,display:"flex",flexDirection:"column",gap:8},children:[e.slice(0,4).map(o=>r.jsx(Jm,{tip:o,onApply:()=>t(o.id,"applied"),onDismiss:()=>t(o.id,"dismissed")},o.id)),!e.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:8},children:"No tips — nothing wasteful in your recent sessions."})]})]})}function ex({files:e,noIngest:t,onIngested:n}){const s=e.slice(0,14).map(a=>{const i=a.resultBytes??0;return{path:a.path,calls:a.calls,tokens:i,tpc:a.calls>0?i/a.calls:0}}),l=Math.max(...s.map(a=>a.tpc),0)||1,o=s.map(a=>({key:a.path,label:Gm(a.path),value:a.calls,intensity:a.tpc/l,sub:a.calls+" calls",title:`${a.path}
|
|
42
|
+
${a.calls} calls · ${U(a.tokens)} tokens · ${U(Math.round(a.tpc))}/call`}));return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column"},children:[r.jsx(ui,{icon:"flame",iconColor:"var(--warn)",title:"Tool-call heatmap",sub:"· area = calls, color = tokens / call",action:r.jsx(El,{label:"Open heatmap",page:"heatmap",arrow:!0})}),t||!o.length?t?r.jsx(Cl,{onIngested:n}):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"18px 4px"},children:"No file-touching tool calls in this range."}):r.jsxs(r.Fragment,{children:[r.jsx(ci,{items:o,height:116,selKey:null,onPick:()=>B("heatmap")}),r.jsxs("div",{className:"row gap-10",style:{marginTop:9,alignItems:"center"},children:[r.jsx("span",{className:"muted",style:{fontSize:10},children:"tokens / call"}),r.jsx("div",{style:{width:96,height:6,borderRadius:999,background:"linear-gradient(90deg, var(--node-route), var(--warn), var(--error))"}}),r.jsx("span",{className:"muted",style:{fontSize:9.5},children:"efficient → wasteful"})]})]})]})}function tx({p:e,max:t}){const n=e.input_tokens+e.output_tokens+e.cache_creation_tokens+e.cache_read_tokens,s=e.input_tokens+e.cache_creation_tokens+e.cache_read_tokens,l=s>0?e.cache_read_tokens/s:0,o=e.cost_usd/t;return r.jsxs("div",{onClick:()=>B("sessions",{query:{sel:e.session_id}}),role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),B("sessions",{query:{sel:e.session_id}}))},className:"row gap-10 list-row",style:{padding:"7px 4px",borderRadius:6,cursor:"pointer"},children:[r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[!!e.is_sidechain&&r.jsx(z,{name:"bot",size:11,style:{color:"var(--node-code)",marginRight:5,verticalAlign:"-1px"}}),zl(e.text)]}),r.jsx("div",{style:{marginTop:4,width:"70%"},children:r.jsx(Fr,{frac:o,color:o>.7?"var(--error)":"var(--accent)"})})]}),r.jsxs("div",{style:{textAlign:"right",flexShrink:0},children:[r.jsxs("div",{className:"mono tabular",style:{fontSize:12,fontWeight:600,color:o>.7?"var(--error)":"var(--text-primary)"},children:["$",e.cost_usd.toFixed(2)]}),r.jsxs("div",{className:"mono muted",style:{fontSize:10},children:[U(n)," · ",Math.round(l*100),"%"]})]})]})}function nx({prompts:e,noIngest:t,onIngested:n}){const s=[...e].sort((o,a)=>a.ts-o.ts).slice(0,8),l=Math.max(...s.map(o=>o.cost_usd),0)||1;return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column"},children:[r.jsx(ui,{icon:"coins",iconColor:"var(--accent)",title:"Recent prompts",sub:"· by cost",action:r.jsx(El,{label:"Cost ranking",page:"costs"})}),t?r.jsx(Cl,{onIngested:n}):r.jsxs("div",{className:"col",children:[s.map(o=>r.jsx(tx,{p:o,max:l},o.id)),!s.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"10px 4px"},children:"No prompt spend in this range."})]})]})}function cs(e,t,n,s){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono tabular",style:{fontSize:15,fontWeight:600,color:s||"var(--text-primary)"},children:t}),n&&r.jsx("div",{className:"mono muted",style:{fontSize:9.5},children:n})]})}const rx={today:"Saved today",week:"Saved this week",month:"Saved this month",all:"Saved all time"};function gp({cache:e,range:t,noIngest:n,onIngested:s}){const l=Math.round(e.wowDelta*100);return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column",gap:12},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(z,{name:"database",size:14,style:{color:"var(--node-route)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Cache analytics"})]}),n?r.jsx(Cl,{onIngested:s}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{alignItems:"flex-end",gap:10},children:[r.jsxs("div",{className:"tabular",style:{fontSize:38,fontWeight:700,letterSpacing:"-0.03em",lineHeight:.9,color:"var(--node-route)"},children:[Math.round(e.readRate*100),"%"]}),r.jsxs("div",{style:{paddingBottom:3},children:[r.jsx("div",{className:"muted",style:{fontSize:11},children:"cache read rate"}),r.jsx(li,{value:e.wowDelta})]})]}),r.jsx("div",{style:{height:1,background:"var(--border-subtle)"}}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px 14px"},children:[cs("Creation tokens",U(e.creationTokens),"written to cache"),cs("Read tokens",U(e.readTokens),"charged at ~10%"),cs(rx[t]??"Saved this week","$"+e.dollarsSaved.toFixed(0),"vs no cache — est.","var(--success)"),cs("WoW",(l>=0?"+":"")+l+"%",l>=0?"more reuse":"less reuse",l>=0?"var(--success)":"var(--error)")]})]})]})}const ds=e=>{const t=e.name||e.path;return t.split("/").filter(Boolean).pop()??t};function sx(e){const t=L(()=>P.claudeStats(),[]),n=L(()=>P.claudeCompare(),[]),[s,l]=N.useState(new Set),o=t.data?.sessionCount===0,a=()=>{t.reload(),n.reload()},i=c=>l(d=>{const u=new Set(d);return u.has(c)?u.delete(c):u.add(c),u});return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Ae,{icon:"compare",title:"Compare projects",sub:"Which projects are cost-efficient vs hungry"}),o?r.jsx(Fn,{onIngested:a}):r.jsx(ae,{state:n,label:"project comparison",minHeight:280,children:c=>c.projects.length?r.jsx(lx,{projects:c.projects,off:s,onToggle:i}):r.jsx(Fn,{onIngested:a})})]})}function lx({projects:e,off:t,onToggle:n}){const s=e.filter(u=>!t.has(u.path)),l=[...s].sort((u,f)=>f.cacheHit-f.avgCost/100-(u.cacheHit-u.avgCost/100))[0],o=new Map;for(const u of s)for(const f of u.byModel)o.set(f.model,(o.get(f.model)??0)+f.cost);const a=[...o.entries()].sort((u,f)=>f[1]-u[1]).slice(0,5).map(([u],f)=>({key:u,label:Nl(u),color:oa(f)})),i=s.map(u=>({label:ds(u),values:Object.fromEntries(u.byModel.map(f=>[f.model,f.cost]))})),c=(u,f=70)=>r.jsx("span",{style:{width:f,textAlign:"right"},children:u}),d=(u,f=70)=>r.jsx("span",{className:"mono tabular",style:{width:f,textAlign:"right",fontSize:12},children:u});return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"row gap-6",style:{marginBottom:14,flexWrap:"wrap"},children:e.map(u=>{const f=!t.has(u.path);return r.jsx("button",{onClick:()=>n(u.path),"aria-pressed":f,title:u.path,style:{height:28,padding:"0 12px",borderRadius:999,fontSize:12,cursor:"pointer",fontFamily:"var(--font-mono)",border:"1px solid "+(f?"transparent":"var(--border-subtle)"),background:f?"var(--accent-soft)":"var(--bg-panel)",color:f?"var(--accent)":"var(--text-muted)"},children:ds(u)},u.path)})}),l&&r.jsxs("div",{className:"card card-pad",style:{marginBottom:14,borderColor:"rgba(70,194,107,0.3)",background:"var(--success-soft)",display:"flex",gap:12,alignItems:"center"},children:[r.jsx("div",{style:{color:"var(--success)"},children:r.jsx(z,{name:"sparkles",size:18})}),r.jsxs("div",{className:"grow",children:[r.jsx("span",{style:{fontWeight:600,fontSize:13},children:"Most efficient: "}),r.jsx("span",{className:"mono",style:{color:"var(--success)"},children:ds(l)}),r.jsxs("span",{className:"secondary",style:{fontSize:12.5},children:[" ","— ",Math.round(l.cacheHit*100),"% cache hit, $",l.avgCost.toFixed(2)," avg/session",l.drift?`, ${l.drift} drifted links`:", no drifted links","."]})]})]}),r.jsxs("div",{className:"card",style:{overflow:"hidden",marginBottom:14},children:[r.jsxs("div",{className:"row",style:{padding:"9px 14px",fontSize:10.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"grow",children:"Project"}),c("Cost"),c("Sessions"),c("Avg"),c("Cache"),r.jsx("span",{style:{width:60,textAlign:"right"},children:"Drift"}),r.jsx("span",{style:{width:150,textAlign:"right"},children:"Top tools"})]}),s.map(u=>r.jsxs("div",{className:"row",style:{padding:"11px 14px",borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"mono grow",style:{fontSize:12.5,color:l&&u.path===l.path?"var(--success)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},title:u.path,children:ds(u)}),d("$"+u.cost.toFixed(0)),d(u.sessions),d("$"+u.avgCost.toFixed(2)),r.jsxs("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12,color:Hr(u.cacheHit)},children:[Math.round(u.cacheHit*100),"%"]}),r.jsx("span",{className:"mono tabular",style:{width:60,textAlign:"right",fontSize:12,color:u.drift>10?"var(--warn)":"var(--text-secondary)"},children:u.drift}),r.jsx("span",{className:"row gap-4",style:{width:150,justifyContent:"flex-end",overflow:"hidden"},children:u.topTools.map(f=>r.jsx("code",{className:"mono",style:{fontSize:9.5,background:"var(--bg-canvas)",padding:"1px 5px",borderRadius:3,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:f},f))})]},u.path)),!s.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px"},children:"Every project is toggled off — pick at least one above."})]}),s.length>0&&a.length>0&&r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",marginBottom:14},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(z,{name:"dollar",size:14,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Cost by model per project"})]}),r.jsx("div",{className:"row gap-12",children:a.map(u=>r.jsxs("span",{className:"row gap-4 muted",style:{fontSize:10.5},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:3,background:u.color}}),u.label]},u.key))})]}),r.jsx(mp,{rows:i,segments:a,fmt:u=>"$"+u.toFixed(0)})]})]})}const ox={today:"today",week:"7 days",month:"30 days",all:"all time"};function ax(e){const[t,n]=N.useState("month"),[s,l]=N.useState(""),[o,a]=N.useState(null),i=L(()=>P.claudeStats(),[]),c=L(()=>P.claudeCosts(t,null,s||null),[t,s]),d=L(()=>P.claudeCache(t),[t]),[u,f]=N.useState([]);N.useEffect(()=>{s||!c.data||f(c.data.byModel.map(v=>v.model).filter(v=>!!v))},[s,c.data]);const h=i.data?.sessionCount===0,g=()=>{i.reload(),c.reload(),d.reload()};return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Ae,{icon:"dollar",title:"Costs",sub:"Where the money goes",actions:r.jsxs(r.Fragment,{children:[!h&&r.jsxs("select",{className:"input","aria-label":"Model filter",value:s,onChange:v=>l(v.target.value),style:{fontSize:12,padding:"4px 8px"},children:[r.jsx("option",{value:"",children:"All models"}),u.map(v=>r.jsx("option",{value:v,children:Nl(v)},v))]}),r.jsx(kl,{value:t,onChange:n})]})}),h?r.jsx(Fn,{onIngested:g}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.3fr 1fr",gap:14,marginBottom:14},children:[r.jsx(ae,{state:c,label:"cost series",minHeight:280,children:v=>r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"flex-start",marginBottom:10},children:[r.jsxs("div",{children:[r.jsxs("div",{className:"tabular",style:{fontSize:34,fontWeight:700,letterSpacing:"-0.02em"},children:["$",v.total.toFixed(2)]}),r.jsxs("div",{className:"row gap-8",style:{marginTop:2},children:[r.jsxs("span",{className:"muted",style:{fontSize:11.5},children:["total · ",ox[t]??t]}),r.jsx(li,{value:v.wowDelta,invert:!0})]})]}),o&&r.jsxs("div",{style:{textAlign:"right"},children:[r.jsxs("div",{className:"mono",style:{fontSize:13,fontWeight:600},children:["$",o.cost.toFixed(2)]}),r.jsxs("div",{className:"muted",style:{fontSize:10.5},children:[String(o.prompts??0)," prompts · ",o.day,"d ago"]})]})]}),r.jsx(fp,{series:v.series,color:"var(--accent)",onHover:a,h:200})]})}),r.jsx(ae,{state:c,label:"cost by model",minHeight:280,children:v=>r.jsx(ix,{c:v})})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.4fr 1fr",gap:14},children:[r.jsx(ae,{state:c,label:"expensive prompts",minHeight:280,children:v=>r.jsx(cx,{prompts:v.topPrompts})}),r.jsx(ae,{state:d,label:"cache analytics",minHeight:280,children:v=>r.jsx(gp,{cache:v,range:t,noIngest:!1,onIngested:g})})]})]})]})}function ix({c:e}){const t=e.byModel.reduce((s,l)=>s+(l.cost??0),0),n=e.byModel.map((s,l)=>({label:Nl(s.model??"unknown"),cost:s.cost??0,color:oa(l)}));return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[r.jsxs("div",{className:"row gap-8",style:{alignSelf:"flex-start",marginBottom:8},children:[r.jsx(z,{name:"layers",size:14,style:{color:"var(--node-code)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"By model"})]}),n.length?r.jsxs(r.Fragment,{children:[r.jsx(hp,{data:n,size:150,centerLabel:"$"+t.toFixed(0),centerSub:"in range"}),r.jsx("div",{className:"col gap-6",style:{marginTop:14,width:"100%"},children:n.map((s,l)=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{style:{width:9,height:9,borderRadius:3,background:oa(l),flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.label}),r.jsxs("span",{className:"mono tabular",style:{fontSize:11.5},children:["$",s.cost.toFixed(1)]}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10.5,width:38,textAlign:"right"},children:[t>0?Math.round(s.cost/t*100):0,"%"]})]},s.label))})]}):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"18px 0"},children:"No model-attributed spend in this range."})]})}function cx({prompts:e}){const t=e.slice(0,8),n=Math.max(...t.map(s=>s.cost_usd),0)||1;return r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(z,{name:"sortAsc",size:14,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Most expensive prompts"}),r.jsxs("span",{className:"muted",style:{fontSize:11},children:["· top ",t.length]})]}),t.map((s,l)=>{const o=s.input_tokens+s.output_tokens+s.cache_creation_tokens+s.cache_read_tokens,a=s.input_tokens+s.cache_creation_tokens+s.cache_read_tokens,i=a>0?s.cache_read_tokens/a:0,c=s.cost_usd/n;return r.jsxs("div",{className:"row gap-12 list-row",role:"button",tabIndex:0,onClick:()=>B("sessions",{query:{sel:s.session_id}}),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),B("sessions",{query:{sel:s.session_id}}))},style:{padding:"9px 0",borderTop:l?"1px solid var(--border-subtle)":"none",cursor:"pointer"},children:[r.jsx("span",{className:"mono muted tabular",style:{width:16,fontSize:11},children:l+1}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[!!s.is_sidechain&&r.jsx(z,{name:"bot",size:11,style:{color:"var(--node-code)",marginRight:5,verticalAlign:"-1px"}}),zl(s.text)]}),r.jsx("div",{style:{marginTop:4,maxWidth:280},children:r.jsx(Fr,{frac:c,color:c>.66?"var(--error)":"var(--accent)"})})]}),r.jsx("span",{className:"mono muted",style:{fontSize:10.5,width:84,textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.model?Nl(s.model):"—"}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11,width:56,textAlign:"right"},children:U(o)}),r.jsxs("span",{className:"mono tabular",style:{fontSize:11,width:40,textAlign:"right",color:Hr(i)},children:[Math.round(i*100),"%"]}),r.jsxs("span",{className:"mono tabular",style:{fontSize:13,fontWeight:600,width:52,textAlign:"right"},children:["$",s.cost_usd.toFixed(2)]})]},s.id)}),!t.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"10px 0"},children:"No prompt spend in this range."})]})}const lo=e=>e.toLocaleString();function dx({project:e}){const[t,n]=N.useState("week"),s=e??"_",l=L(()=>P.status(e),[e],{cacheKey:`status:${s}`}),o=L(()=>P.claudeStats(t),[t],{cacheKey:`stats:${s}:${t}`}),a=L(()=>P.claudeCosts(t),[t],{cacheKey:`costs:${s}:${t}`}),i=L(()=>P.claudeCache(t),[t],{cacheKey:`cache:${s}:${t}`}),c=L(()=>P.claudeHeatmap(t),[t],{cacheKey:`heatmap:${s}:${t}`}),d=L(()=>P.claudeTips(),[],{cacheKey:`tips:${s}`}),u=L(()=>P.graphFull(e),[e],{cacheKey:`graphfull:${s}`});if(Kt(l.error))return r.jsx(ue,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const f=o.data?.sessionCount===0,h=()=>{o.reload(),a.reload(),i.reload(),c.reload(),d.reload()},g=(x,y)=>{P.setTipState(x,y).catch(()=>{}).finally(()=>d.reload())},v=l.data,p=v?v.projectPath.split("/").filter(Boolean).pop()??v.projectPath:"",j=!f&&o.data?" · last session $"+o.data.lastSessionCost.value.toFixed(2):"",m=v?`${p} · ${lo(v.nodeCount)} nodes${j}`:"Loading project status…";return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Ae,{icon:"dashboard",title:"Dashboard",sub:m,actions:r.jsx(kl,{value:t,onChange:n})}),r.jsx("div",{style:{marginBottom:14},children:r.jsx(ae,{state:o,label:"usage stats",minHeight:86,children:x=>r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10},children:[r.jsx(is,{icon:"coins",color:"var(--accent)",label:"Last session cost",value:f?"—":"$"+x.lastSessionCost.value.toFixed(2),delta:f?void 0:x.lastSessionCost.delta,deltaInvert:!0,spark:f?void 0:x.lastSessionCost.series,sparkColor:"var(--accent)",note:f?"no transcript data — enable ingest":void 0,onClick:()=>B("sessions")}),r.jsx(is,{icon:"wrench",color:"var(--node-spec)",label:"Tool calls · 7d",value:f?"—":lo(x.toolCalls.value),delta:f?void 0:x.toolCalls.delta,deltaInvert:!0,spark:f?void 0:x.toolCalls.series,sparkColor:"var(--node-spec)",note:f?"no transcript data — enable ingest":void 0,onClick:()=>B("heatmap")}),r.jsx(is,{icon:"bot",color:"var(--node-code)",label:"Subagent spend",value:f?"—":x.subagentPct.value+"%",delta:f?void 0:x.subagentPct.delta,deltaInvert:!0,spark:f?void 0:x.subagentPct.series,sparkColor:"var(--node-code)",note:f?"no transcript data — enable ingest":void 0,onClick:()=>B("heatmap")}),r.jsx(is,{icon:"drift",color:"var(--warn)",label:"Drift queue",value:lo(x.drift.value),delta:x.drift.delta,deltaInvert:!0,sparkColor:"var(--warn)",onClick:()=>B("drift")})]})})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr",gap:12,marginBottom:14},children:[r.jsx(ae,{state:u,label:"recent neighborhood",minHeight:340,children:x=>r.jsx(Xm,{graph:x,heatFiles:c.data?.files??[]})}),r.jsx(ae,{state:d,label:"tips",minHeight:340,children:x=>r.jsx(Zm,{tips:x.tips,onSetState:g,noIngest:f,onIngested:h})})]}),r.jsx("div",{style:{marginBottom:14},children:r.jsx(ae,{state:c,label:"tool-call heatmap",minHeight:180,children:x=>r.jsx(ex,{files:x.files,noIngest:f,onIngested:h})})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.4fr 1fr",gap:12},children:[r.jsx(ae,{state:a,label:"recent prompts",minHeight:300,children:x=>r.jsx(nx,{prompts:x.topPrompts,noIngest:f,onIngested:h})}),r.jsx(ae,{state:i,label:"cache analytics",minHeight:300,children:x=>r.jsx(gp,{cache:x,range:t,noIngest:f,onIngested:h})})]})]})}const ux=[{name:"bg/canvas",varName:"--bg-canvas"},{name:"bg/panel",varName:"--bg-panel"},{name:"bg/elevated",varName:"--bg-elevated"},{name:"text/primary",varName:"--text-primary"},{name:"text/secondary",varName:"--text-secondary"},{name:"text/muted",varName:"--text-muted"},{name:"accent/primary",varName:"--accent"}],px=[{name:"node/code",varName:"--node-code"},{name:"node/spec",varName:"--node-spec"},{name:"node/test",varName:"--node-test"},{name:"node/route",varName:"--node-route"}],fx=[{state:"success",varName:"--success",softVar:"--success-soft"},{state:"warn",varName:"--warn",softVar:"--warn-soft"},{state:"error",varName:"--error",softVar:"--error-soft"},{state:"info",varName:"--info",softVar:"--info-soft"}],hx=[{label:"Big number",varName:"--fs-big",sample:"$1,184.42"},{label:"Page title",varName:"--fs-title",sample:"Page title"},{label:"Body & labels",varName:"--fs-base",sample:"Body & labels — Geist"},{label:"Secondary",varName:"--fs-sm",sample:"Secondary text"},{label:"Caption / pills",varName:"--fs-xs",sample:"CAPTIONS & PILLS"},{label:"Mono",varName:"--fs-sm",sample:"validateSession()",mono:!0}],mx=[{label:"Primary",className:"btn-primary",states:["default","hover","disabled","loading"]},{label:"Secondary",className:"btn-secondary",states:["default","hover","pressed","disabled","loading"]},{label:"Ghost",className:"btn-ghost",states:["default","hover","pressed","disabled"]},{label:"Destructive",className:"btn-destructive",states:["default","hover","disabled"]}],xx={hover:"is-hover",pressed:"is-active"},gx=[{label:"Spec link states",states:["drafted","implementing","implemented","verified","drifted","broken","orphaned"]},{label:"Run states",states:["pending","running","paused","completed","failed","cancelled","skipped"]},{label:"Semantic",states:["success","warn","error","info"]}];function qt({title:e,children:t,span:n}){return r.jsxs("div",{className:"card card-pad",style:n?{gridColumn:"1 / -1"}:void 0,children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:e}),t]})}function Pc({tok:e}){return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:96},children:[r.jsx("div",{style:{height:40,borderRadius:8,background:`var(${e.varName})`,border:"1px solid var(--border-subtle)"}}),r.jsx("div",{style:{fontSize:11,fontWeight:500},children:e.name}),r.jsx("div",{className:"mono muted",style:{fontSize:10},children:e.varName})]})}function vx(){return r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:12},children:[r.jsx(qt,{title:"Surfaces & text",children:r.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:ux.map(e=>r.jsx(Pc,{tok:e},e.varName))})}),r.jsx(qt,{title:"Node colors · distinct at 4px",children:r.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:px.map(e=>r.jsx(Pc,{tok:e},e.varName))})}),r.jsx(qt,{title:"Semantic states",children:r.jsx("div",{className:"row gap-10",style:{flexWrap:"wrap"},children:fx.map(e=>r.jsxs("div",{style:{minWidth:96},children:[r.jsxs("div",{style:{display:"flex",gap:4},children:[r.jsx("div",{style:{flex:1,height:40,borderRadius:"8px 0 0 8px",background:`var(${e.varName})`}}),r.jsx("div",{style:{flex:1,height:40,borderRadius:"0 8px 8px 0",background:`var(${e.softVar})`}})]}),r.jsx("div",{style:{fontSize:11,fontWeight:500,marginTop:4},children:e.state}),r.jsx("div",{className:"mono muted",style:{fontSize:10},children:e.varName})]},e.varName))})}),r.jsx(qt,{title:"Typography",children:r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:hx.map(e=>r.jsxs("div",{children:[r.jsx("span",{className:e.mono?"mono":void 0,style:{fontSize:`var(${e.varName})`,fontWeight:500},children:e.sample}),r.jsx("span",{className:"muted",style:{fontSize:10.5,marginLeft:8},children:e.label})]},e.label+e.sample))})}),r.jsx(qt,{title:"Buttons · every state",children:r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:mx.map(e=>r.jsx("div",{className:"row gap-6",style:{flexWrap:"wrap"},children:e.states.map(t=>{const n=xx[t];return r.jsxs("button",{className:`btn ${e.className} btn-sm${n?" "+n:""}`,disabled:t==="disabled"||t==="loading","aria-busy":t==="loading","aria-label":`${e.label} ${t}`,children:[e.label," · ",t]},t)})},e.className))})}),gx.map(e=>r.jsx(qt,{title:e.label,children:r.jsx("div",{className:"row gap-8",style:{flexWrap:"wrap"},children:e.states.map(t=>r.jsx(Ge,{state:t},t))})},e.label)),r.jsx(qt,{title:"Pills & badges",children:r.jsxs("div",{className:"row gap-8",style:{flexWrap:"wrap"},children:[r.jsx(re,{color:"var(--accent)",bg:"var(--accent-soft)",dot:!0,children:"custom"}),r.jsx(re,{color:"var(--node-code)",bg:"var(--node-code-soft)",children:"code"}),r.jsx(re,{color:"var(--text-secondary)",bg:"var(--bg-elevated)",children:"neutral"})]})})]})}const yx=[4,6,5,8,7,10,9,12,11,14],jx=Array.from({length:14},(e,t)=>({day:t+1,cost:4+Math.sin(t/2)*2+t*.6})),wx=[{label:"verified",cost:12,color:"var(--success)"},{label:"implemented",cost:7,color:"var(--node-spec)"},{label:"drifted",cost:2,color:"var(--warn)"}],Sx=[{label:"specship",values:{a:14,b:6}},{label:"web-ng",values:{a:9,b:3}}],bx=[{key:"a",label:"Fable",color:"var(--accent)"},{key:"b",label:"Haiku",color:"var(--node-route)"}],kx=[{name:"specship_explore",calls:42},{name:"specship_node",calls:17},{name:"specship_search",calls:9}],Nx=[{key:"a",label:"server.ts",value:42,intensity:.8,sub:"42 edits"},{key:"b",label:"tools.ts",value:28,intensity:.5,sub:"28 edits"},{key:"c",label:"index.ts",value:12,intensity:.2,sub:"12 edits"},{key:"d",label:"schema.sql",value:8,intensity:.1,sub:"8 edits"}],zx=[{id:"spec",label:"REQ-DESKTOP-017",kind:"spec",x:0,y:40},{id:"fn",label:"createServer",kind:"code",x:260,y:0},{id:"test",label:"ui-build-guard",kind:"test",x:260,y:90},{id:"route",label:"/api/status",kind:"route",x:520,y:40}],Cx=[{from:"spec",to:"fn"},{from:"spec",to:"test"},{from:"fn",to:"route",kind:"synth"}];function Ex(){const[e,t]=N.useState("week");return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row gap-8",style:{margin:"20px 0 8px"},children:[r.jsx("div",{className:"eyebrow",children:"Chart & graph primitives"}),r.jsx(Rm,{title:"Illustrative reference data — these primitives have no backend; every data screen binds to your live project."})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:12},children:[r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Segmented"}),r.jsx(Ce,{options:[{value:"today",label:"Today"},{value:"week",label:"This week"},{value:"month",label:"This month"}],value:e,onChange:t,size:"sm"})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Sparkline + line"}),r.jsx(ai,{data:yx,fill:!0}),r.jsx("div",{style:{marginTop:10},children:r.jsx(fp,{series:jx,h:140})})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Donut + stacked bars"}),r.jsxs("div",{className:"row gap-16",children:[r.jsx(hp,{data:wx,centerLabel:"21",centerSub:"links"}),r.jsx("div",{className:"grow",children:r.jsx(mp,{rows:Sx,segments:bx,fmt:n=>"$"+n.toFixed(0)})})]})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:12},children:"Bars + treemap"}),r.jsx(ii,{items:kx}),r.jsx("div",{style:{marginTop:12},children:r.jsx(ci,{items:Nx,height:110})})]}),r.jsxs("div",{className:"card",style:{gridColumn:"1 / -1",overflow:"hidden"},children:[r.jsx("div",{className:"eyebrow",style:{padding:"12px 14px 0"},children:"Graph canvas"}),r.jsx("div",{style:{height:220},children:r.jsx(di,{nodes:zx,edges:Cx})})]})]})]})}function Tx(){return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:22},children:[r.jsx(Ae,{icon:"layers",title:"Design system",sub:"Tokens, components and states — rendered live in both themes, WCAG AA."}),["dark","light"].map(e=>r.jsxs("div",{"data-theme":e,style:{marginBottom:20,borderRadius:12,background:"var(--bg-canvas)",padding:16,border:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"eyebrow","data-testid":`theme-${e}`,style:{marginBottom:12,color:"var(--text-secondary)"},children:[e," theme"]}),r.jsx(vx,{})]},e)),r.jsx(Ex,{})]})}const _x=["drifted","broken","orphaned"];function Rx({project:e}){const t=L(()=>P.drift(e),[e]),[n,s]=N.useState(new Set);if(Kt(t.error))return r.jsx(ue,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const l=t.data?.links??[],o={};for(const c of l)o[c.state]=(o[c.state]??0)+1;const a=l.filter(c=>!n.has(c.state)),i=c=>s(d=>{const u=new Set(d);return u.has(c)?u.delete(c):u.add(c),u});return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 0"},children:r.jsx(Ae,{icon:"drift",title:"Drift queue",sub:t.data?`${l.length} links need attention`:"Loading drift…"})}),r.jsxs("div",{className:"row gap-8",style:{padding:"0 18px 12px",flexWrap:"wrap"},children:[r.jsx(z,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),_x.map(c=>{const d=!n.has(c),u=fe[c];return r.jsxs("button",{onClick:()=>i(c),className:"row gap-6",style:{height:26,padding:"0 10px",borderRadius:999,fontSize:11.5,fontWeight:500,cursor:"pointer",textTransform:"capitalize",border:"1px solid "+(d?"transparent":"var(--border-subtle)"),background:d?u.bg:"var(--bg-panel)",color:d?u.color:"var(--text-muted)"},children:[c,r.jsx("span",{className:"tabular",style:{opacity:.7},children:o[c]??0})]},c)})]}),t.data&&!l.length?r.jsx(ue,{icon:"check",title:"Nothing drifted",body:"Every spec link is intact — the graph matches the specs."}):r.jsx("div",{className:"scroll-y",style:{flex:1,borderTop:"1px solid var(--border-subtle)"},children:a.map((c,d)=>r.jsx(Mx,{link:c},c.id!=null?String(c.id):d))})]})}function nr(e,t){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono",style:{fontSize:12.5,marginTop:1},children:t})]})}function Mx({link:e}){const[t,n]=N.useState(!1),s=[e.targetFilePath,e.targetQualifiedName].filter(Boolean).join(":")||"—",l=e.provenance||"—",o=Dr(e.updatedAt)??"—";return r.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[r.jsxs("div",{className:"row gap-10 list-row",role:"button","aria-expanded":t,tabIndex:0,onClick:()=>n(!t),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n(!t))},style:{padding:"10px 14px",cursor:"pointer"},children:[r.jsx("div",{style:{width:92,flexShrink:0},children:r.jsx(Ge,{state:e.state})}),r.jsx("span",{className:"mono",style:{fontSize:12,color:"var(--node-spec)",flexShrink:0,width:130,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.specId}),r.jsx("span",{className:"secondary",style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 220px"},children:e.specTitle}),r.jsx(z,{name:"arrowRight",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:11.5,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),e.driftAxis&&r.jsx(re,{color:"var(--warn)",bg:"var(--warn-soft)",children:e.driftAxis}),r.jsx("span",{className:"mono muted",style:{fontSize:11,flexShrink:0,maxWidth:96,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"right"},children:e.provenance||""}),r.jsx("span",{className:"mono muted tabular",style:{fontSize:11,flexShrink:0,width:32,textAlign:"right"},children:o}),r.jsx(z,{name:t?"chevronDown":"chevronRight",size:13,style:{color:"var(--text-muted)",flexShrink:0}})]}),t&&r.jsxs("div",{style:{padding:"0 14px 14px 36px",background:"var(--bg-canvas)"},children:[r.jsxs("div",{className:"row",style:{gap:22,padding:"10px 0",flexWrap:"wrap"},children:[nr("Spec",e.specId),nr("Target",s),nr("Provenance",l),nr("Drift axis",e.driftAxis??"—"),nr("Age",o)]}),r.jsxs("div",{className:"row gap-8",children:[e.state==="drifted"&&r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!0,title:"Run automatically by the drift-repair workflow — fixes are workflow-owned",children:[r.jsx(z,{name:"wrench",size:12}),"Fix"]}),e.state==="broken"&&r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!0,title:"Run automatically by the verification workflow",children:[r.jsx(z,{name:"refresh",size:12}),"Re-verify"]}),e.state==="orphaned"&&r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!0,title:"Run automatically by the relink workflow — re-attach is workflow-owned",children:[r.jsx(z,{name:"graph",size:12}),"Re-attach"]}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>B("specs",{query:{sel:e.specId}}),children:"Open spec"}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>B("graph",{query:{focus:"spec:"+e.specId}}),children:"Show in graph"})]})]})]})}const aa={height:"100%",display:"flex",flexDirection:"column"},ia={gap:8,padding:"13px 14px",borderBottom:"1px solid var(--border-subtle)"},vp={flex:1,padding:14,display:"flex",flexDirection:"column",gap:16},En={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function nl({onClick:e,children:t,bordered:n}){return r.jsx("div",{onClick:e,role:e?"button":void 0,tabIndex:e?0:void 0,onKeyDown:e?s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),e())}:void 0,className:"row gap-8"+(e?" list-row":""),style:{padding:n?"6px 8px":"5px 8px",borderRadius:6,cursor:e?"pointer":"default",fontSize:12,border:n?"1px solid var(--border-subtle)":"none",marginBottom:n?5:0},children:t})}function Et({children:e}){return r.jsx("div",{className:"eyebrow",style:{marginBottom:6},children:e})}function Lc({n:e,onSelect:t}){const n=Ur(e.kind,e.filePath);return r.jsxs(nl,{onClick:()=>t(e.id),children:[r.jsx("span",{style:{width:7,height:7,borderRadius:n==="spec"?2:"50%",background:Ft(n),flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:12,...En},children:e.name}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10.5},children:[e.degree," edges"]}),r.jsx(z,{name:"chevronRight",size:12,style:{color:"var(--text-faint)"}})]})}function us({color:e,label:t,count:n,dashed:s}){return r.jsxs("div",{className:"row gap-8",style:{padding:"4px 0"},children:[r.jsx("svg",{width:20,height:8,style:{flexShrink:0},children:r.jsx("line",{x1:0,y1:4,x2:20,y2:4,stroke:e,strokeWidth:1.8,strokeDasharray:s?"4 3":"none"})}),r.jsx("span",{className:"grow secondary",style:{fontSize:12},children:t}),n!=null&&r.jsx("span",{className:"mono tabular muted",style:{fontSize:11},children:n})]})}const Px=[{kind:"code",label:"Code"},{kind:"spec",label:"Spec"},{kind:"test",label:"Test"},{kind:"route",label:"Route"}],Dc=["verified","drifted","broken"];function Lx({project:e,counts:t,shown:n,onSelect:s}){const l=L(()=>P.graphHealth(e),[e]),o=l.data?.linkHealth??{},a=l.data?.edgeKinds??{},i={verified:o.verified??0,drifted:o.drifted??0,broken:(o.broken??0)+(o.orphaned??0)},c=Dc.some(d=>i[d]>0);return r.jsxs("div",{style:aa,children:[r.jsxs("div",{className:"row",style:ia,children:[r.jsx(z,{name:"graph",size:15,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:13.5},children:"Graph overview"}),r.jsx("span",{className:"grow"}),r.jsxs("span",{className:"mono muted",style:{fontSize:11},children:[n," shown"]})]}),r.jsxs("div",{className:"scroll-y",style:vp,children:[r.jsx("div",{className:"secondary",style:{fontSize:12,lineHeight:1.55},children:"Click any node to inspect its signature, links, callers and callees — without leaving this view."}),r.jsxs("div",{children:[r.jsx(Et,{children:"Nodes by kind"}),Px.filter(d=>t[d.kind]).map(d=>r.jsxs("div",{className:"row gap-8",style:{padding:"5px 0"},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:d.kind==="spec"?2:"50%",background:Ft(d.kind),flexShrink:0,boxShadow:`0 0 6px ${Ft(d.kind)}`}}),r.jsx("span",{className:"grow",style:{fontSize:12.5},children:d.label}),r.jsx("span",{className:"mono tabular",style:{fontSize:12.5,fontWeight:600},children:t[d.kind]})]},d.kind))]}),r.jsxs("div",{children:[r.jsx(Et,{children:"Spec link health"}),c?r.jsx("div",{className:"row gap-6",style:{flexWrap:"wrap"},children:Dc.filter(d=>i[d]>0).map(d=>r.jsxs("span",{className:"row gap-6",children:[r.jsx(Ge,{state:d}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11,alignSelf:"center"},children:i[d]})]},d))}):r.jsx("div",{className:"muted",style:{fontSize:12},children:"No spec links yet"})]}),r.jsxs("div",{children:[r.jsx(Et,{children:"Edge types"}),r.jsx(us,{color:"var(--text-muted)",label:"calls",count:a.calls??0}),r.jsx(us,{color:"var(--node-spec)",label:"implements / documents",count:a.implements??0}),r.jsx(us,{color:"var(--node-test)",label:"tests",count:a.tests??0}),r.jsx(us,{color:"var(--text-muted)",label:"synthesized (heuristic)",count:a.synth??0,dashed:!0})]}),r.jsxs("div",{children:[r.jsx(Et,{children:"Most connected"}),(l.data?.hubs??[]).map(d=>r.jsx(Lc,{n:d,onSelect:s},d.id)),l.data&&!l.data.hubs.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No connected nodes yet"})]}),r.jsxs("div",{children:[r.jsx(Et,{children:"Anchored"}),(l.data?.anchored??[]).map(d=>r.jsx(Lc,{n:d,onSelect:s},d.id)),l.data&&!l.data.anchored.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No spec-linked code yet"})]})]})]})}function Oc({title:e,items:t,empty:n,onSelect:s}){return r.jsxs("div",{children:[r.jsxs("div",{className:"eyebrow",style:{marginBottom:4},children:[e,r.jsx("span",{className:"muted",style:{marginLeft:6,fontWeight:400},children:t.length})]}),t.length?t.slice(0,10).map(l=>r.jsxs(nl,{onClick:()=>s(l.id),children:[r.jsx(z,{name:"box",size:12,style:{color:Ft(Ur(l.kind,l.filePath)),flexShrink:0}}),r.jsx("span",{className:"mono grow",style:En,children:l.name}),r.jsx("span",{className:"mono muted",style:{fontSize:10,flexShrink:0},children:l.filePath.split("/").pop()})]},l.id)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:n})]})}function Dx({id:e,project:t,onSelect:n,onClose:s}){const l=L(()=>P.graphNode(e,t),[e,t]),o=l.data?.matches[0];if(!o)return r.jsxs("div",{style:aa,children:[r.jsxs("div",{className:"row",style:ia,children:[r.jsx("span",{className:"grow",style:{fontWeight:600,fontSize:13.5},children:"Node"}),r.jsx("button",{className:"btn btn-ghost btn-xs","aria-label":"Close node detail",onClick:s,children:r.jsx(z,{name:"x",size:14})})]}),r.jsx("div",{className:"muted",style:{padding:14,fontSize:12},children:l.loading?"Loading node…":"Node not found — it may have been re-indexed away."})]});const a=Ur(o.kind,o.filePath),i=a==="spec"||o.kind==="spec",c=Ft(a);return r.jsxs("div",{style:aa,children:[r.jsxs("div",{className:"row",style:{...ia,padding:"12px 14px"},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:i?2:"50%",background:c,flexShrink:0,marginTop:5,boxShadow:`0 0 8px ${c}`,alignSelf:"flex-start"}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{className:"mono",style:{fontSize:14,fontWeight:600,...En},children:o.name}),r.jsx("div",{className:"row gap-6",style:{marginTop:3},children:r.jsx(re,{color:c,bg:`color-mix(in srgb, ${c} 14%, transparent)`,children:o.kind})})]}),r.jsx("button",{className:"btn btn-ghost btn-xs","aria-label":"Close node detail",onClick:s,children:r.jsx(z,{name:"x",size:14})})]}),r.jsxs("div",{className:"scroll-y",style:vp,children:[r.jsxs("div",{className:"row gap-6",style:{fontSize:11.5},children:[r.jsx(z,{name:"folder",size:12,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"mono secondary",style:En,children:o.filePath}),r.jsx(pt,{text:o.filePath,ariaLabel:"Copy file path"})]}),!i&&o.signature&&r.jsxs("div",{children:[r.jsx(Et,{children:"Signature"}),r.jsx("pre",{className:"mono",style:{margin:0,fontSize:11.5,lineHeight:1.6,color:"var(--text-secondary)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:10,overflowX:"auto",whiteSpace:"pre-wrap"},children:o.signature})]}),!i&&r.jsxs("div",{children:[r.jsx(Et,{children:"Linked specs"}),o.linkedSpecs.length?o.linkedSpecs.map((d,u)=>r.jsxs(nl,{bordered:!0,onClick:()=>B("specs",{param:d.specId}),children:[r.jsx("span",{className:"mono grow",style:{fontSize:11.5,...En},children:d.specId}),r.jsx(Ge,{state:d.state})]},u)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"4px 8px"},children:"No linked specs"})]}),!i&&r.jsx(Oc,{title:"Callers",items:o.callers,empty:"No callers",onSelect:n}),!i&&r.jsx(Oc,{title:"Callees",items:o.callees,empty:"No callees",onSelect:n}),i&&r.jsxs("div",{children:[r.jsx(Et,{children:"Linked code"}),o.linkedSpecs.length?o.linkedSpecs.map((d,u)=>r.jsxs(nl,{bordered:!0,children:[r.jsx(Ge,{state:d.state}),r.jsx("span",{className:"mono grow",style:{fontSize:11,...En},children:d.targetQualifiedName??d.targetFilePath})]},u)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:8,border:"1px dashed var(--border-subtle)",borderRadius:6,textAlign:"center"},children:"No linked code — orphaned"})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:12,borderTop:"1px solid var(--border-subtle)"},children:[r.jsxs("button",{className:"btn btn-primary btn-sm grow",style:{justifyContent:"center"},disabled:!0,title:"Run automatically by the implementation workflow once Drafted",children:[r.jsx(z,{name:"play",size:13}),"Implement"]}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>B("drift"),children:"View drift"})]})]})}function Ic({label:e,count:t,active:n,onClick:s,color:l}){return r.jsxs("button",{onClick:s,className:"row gap-6",style:{height:26,padding:"0 10px",borderRadius:999,fontSize:11.5,fontWeight:500,cursor:"pointer",border:"1px solid "+(n?"transparent":"var(--border-subtle)"),background:n?l?`color-mix(in srgb, ${l} 22%, var(--bg-panel))`:"var(--accent-soft)":"var(--bg-panel)",color:n?l||"var(--accent)":"var(--text-secondary)",transition:"background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast)"},children:[l&&r.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:l}}),e,t!=null&&r.jsx("span",{className:"tabular muted",style:{fontSize:10.5},children:t})]})}const Ox=[{kind:"code",label:"Code"},{kind:"spec",label:"Spec"},{kind:"test",label:"Test"},{kind:"route",label:"Route"}],Ix=[{key:"calls",label:"calls"},{key:"implements",label:"implements"},{key:"tests",label:"tests"},{key:"synth",label:"synth"}];function Ax({project:e,query:t}){const n=L(()=>P.graphFull(e),[e]),s=t.focus??null,[l,o]=N.useState(s),[a,i]=N.useState("hierarchical"),[c,d]=N.useState(new Set),[u,f]=N.useState(new Set),[h,g]=N.useState(0);N.useEffect(()=>{s&&o(s)},[s]);const v=N.useMemo(()=>[...n.data?.nodes??[]].sort((w,S)=>S.degree-w.degree),[n.data]),p=N.useMemo(()=>(n.data?.edges??[]).map(w=>({from:w.from,to:w.to,kind:w.provenance==="heuristic"?"synth":w.kind})),[n.data]),j=N.useMemo(()=>a==="force"?Vm(v,p):Km(v,p),[v,p,a]),m=N.useMemo(()=>{const w={};return j.forEach(S=>{w[S.kind]=(w[S.kind]??0)+1}),w},[j]),x=N.useMemo(()=>{const w=new Set;return c.size&&j.forEach(S=>{c.has(S.kind)&&w.add(S.id)}),w},[j,c]),y=(w,S,k)=>{const C=new Set(w);C.has(S)?C.delete(S):C.add(S),k(C)};return Kt(n.error)?r.jsx(ue,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."}):r.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[r.jsxs("div",{className:"col",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column"},children:[r.jsxs("div",{className:"row",style:{gap:10,padding:"9px 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel-2)",flexWrap:"wrap"},children:[r.jsx(Ce,{size:"sm",value:a,onChange:w=>{i(w),g(S=>S+1)},options:[{value:"hierarchical",label:"Hierarchical"},{value:"force",label:"Force"}],label:"Graph layout"}),r.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)"}}),Ox.filter(w=>m[w.kind]).map(w=>r.jsx(Ic,{label:w.label,count:m[w.kind],color:Ft(w.kind),active:!c.has(w.kind),onClick:()=>y(c,w.kind,d)},w.kind)),r.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)"}}),Ix.map(w=>r.jsx(Ic,{label:w.label,active:!u.has(w.key),onClick:()=>y(u,w.key,f)},w.key)),r.jsx("div",{className:"grow"}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>g(w=>w+1),children:[r.jsx(z,{name:"recenter",size:13}),"Recenter"]})]}),r.jsxs("div",{style:{flex:1,minHeight:0,position:"relative"},children:[j.length>0&&r.jsx(di,{nodes:j,edges:p,selectedId:l,onSelect:o,hiddenIds:x,hiddenEdgeKinds:u,fitKey:h,focusId:s}),n.data&&!j.length&&r.jsx(ue,{icon:"graph",title:"Nothing indexed yet",body:"Run specship index to populate the graph."})]})]}),r.jsx("div",{style:{width:360,flexShrink:0,borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-panel)",minHeight:0},children:l?r.jsx(Dx,{id:l,project:e,onSelect:o,onClose:()=>o(null)}):r.jsx(Lx,{project:e,counts:m,shown:n.data?.shown??0,onSelect:o})})]})}const Ac=e=>e.split("/").filter(Boolean).slice(-2).join("/");function Bx(e){const[t,n]=N.useState("week"),[s,l]=N.useState("calls"),[o,a]=N.useState(null),i=L(()=>P.claudeStats(),[]),c=L(()=>P.claudeHeatmap(t),[t]),d=i.data?.sessionCount===0,u=()=>{i.reload(),c.reload()},f=(h,g)=>a(v=>v&&v.type===h&&v.key===g?null:{type:h,key:g});return d?r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Ae,{icon:"heatmap",title:"Heatmap",sub:"Where tool calls land — files, tools, subagents"}),r.jsx(Fn,{onIngested:u})]}):r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18,minWidth:0},children:[r.jsx(Ae,{icon:"heatmap",title:"Heatmap",sub:"Where tool calls land — files, tools, subagents",actions:r.jsx(kl,{value:t,onChange:n})}),r.jsx(ae,{state:c,label:"heatmap",minHeight:320,children:h=>r.jsx(Wx,{h,range:t,metric:s,onMetric:l,sel:o,pick:f})})]}),o?.type==="file"&&r.jsx("div",{style:ao,children:r.jsx(Fx,{path:o.key,range:t,files:c.data?.files??[],onClose:()=>a(null)})}),o?.type==="tool"&&r.jsx("div",{style:ao,children:r.jsx(Hx,{name:o.key,range:t,onClose:()=>a(null)})}),o?.type==="subagent"&&r.jsx("div",{style:ao,children:r.jsx(Ux,{type:o.key,range:t,onClose:()=>a(null)})})]})}function Wx({h:e,range:t,metric:n,onMetric:s,sel:l,pick:o}){const a=e.tools.reduce((p,j)=>p+j.calls,0),i=e.tools.reduce((p,j)=>p+(j.resultBytes??0),0);if(!a)return r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px 4px"},children:"No tool calls in this range."});const c=[...e.files].sort((p,j)=>j.calls-p.calls)[0],d=[...e.tools].sort((p,j)=>(j.resultBytes??0)-(p.resultBytes??0))[0],u=[...e.tools].sort((p,j)=>(j.resultBytes??0)-(p.resultBytes??0)),f=Math.max(...e.tools.map(p=>p.resultBytes??0),0)||1,h=e.files.map(p=>{const j=p.resultBytes??0;return{...p,tokens:j,tpc:p.calls>0?j/p.calls:0}}),g=Math.max(...h.map(p=>p.tpc),0)||1,v=h.map(p=>({key:p.path,label:Ac(p.path),value:n==="tokens"?p.tokens:p.calls,intensity:p.tpc/g,sub:n==="tokens"?U(p.tokens):p.calls+" calls",title:`${p.path}
|
|
43
|
+
${p.calls} calls · ${U(p.tokens)} result tokens · ${U(Math.round(p.tpc))}/call`}));return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:10,marginBottom:14},children:[r.jsx(ps,{label:"Tool calls",value:a.toLocaleString(),icon:"wrench",color:"var(--node-spec)",sub:"this "+t}),r.jsx(ps,{label:"Result tokens",value:U(i),icon:"database",color:"var(--node-route)",sub:"returned to context"}),r.jsx(ps,{label:"Busiest file",value:c?Ac(c.path):"—",icon:"box",color:"var(--warn)",sub:c?c.calls+" calls":""}),r.jsx(ps,{label:"Heaviest tool",value:d?.name??"—",icon:"flame",color:"var(--error)",sub:d?U(d.resultBytes??0)+" tokens":""})]}),r.jsxs("div",{className:"card card-pad",style:{marginBottom:14},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(z,{name:"box",size:14,style:{color:"var(--warn)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Files"}),r.jsxs("span",{className:"muted",style:{fontSize:11},children:["· area = ",n==="tokens"?"result tokens":"tool calls",", color = tokens / call"]}),r.jsx("div",{className:"grow"}),r.jsx(Ce,{size:"sm",label:"Treemap metric",value:n,onChange:s,options:[{value:"calls",label:"Calls"},{value:"tokens",label:"Tokens"}]})]}),v.length?r.jsx(ci,{items:v,height:268,selKey:l?.type==="file"?l.key:null,onPick:p=>o("file",p.key)}):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px 4px"},children:"No file-touching tool calls in this range."}),r.jsxs("div",{className:"row gap-12",style:{marginTop:10,alignItems:"center"},children:[r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"tokens / call"}),r.jsx("div",{style:{width:120,height:7,borderRadius:999,overflow:"hidden",background:"linear-gradient(90deg, var(--node-route), var(--warn), var(--error))"}}),r.jsx("span",{className:"muted",style:{fontSize:10},children:"efficient → wasteful"}),r.jsx("div",{className:"grow"}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"click a tile to drill in"})]})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},children:[r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:4},children:[r.jsx(z,{name:"wrench",size:14,style:{color:"var(--node-code)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Tools"}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"· by result tokens, ranked"})]}),r.jsxs("div",{className:"row",style:{padding:"8px 0 4px",fontSize:9.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:[r.jsx("span",{style:{width:116},children:"Tool"}),r.jsx("span",{className:"grow",children:"Result tokens"}),r.jsx("span",{style:{width:36,textAlign:"right"},children:"Calls"}),r.jsx("span",{style:{width:64,textAlign:"right"},children:"Per call"}),r.jsx("span",{style:{width:48,textAlign:"right"},children:"Total"}),r.jsx("span",{style:{width:14}})]}),r.jsx("div",{className:"col gap-2",children:u.map(p=>r.jsx($x,{name:p.name,calls:p.calls,tokens:p.resultBytes??0,maxTok:f,selected:l?.type==="tool"&&l.key===p.name,onClick:()=>o("tool",p.name)},p.name))}),r.jsxs("div",{className:"muted",style:{fontSize:10.5,marginTop:10,display:"flex",gap:12},children:[r.jsx(oo,{color:"var(--error)",label:">20k / call"}),r.jsx(oo,{color:"var(--warn)",label:">8k"}),r.jsx(oo,{color:"var(--success)",label:"lean"})]})]}),r.jsxs("div",{className:"card card-pad",children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:14},children:[r.jsx(z,{name:"bot",size:14,style:{color:"var(--node-route)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Subagents"}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"· Task calls by subagent_type"})]}),e.subagentByName.length?r.jsx(ii,{items:e.subagentByName,valueKey:"calls",labelKey:"name",color:"var(--node-route)",onItemClick:p=>o("subagent",String(p.name)),selectedKey:l?.type==="subagent"?l.key:null}):r.jsx("div",{className:"muted",style:{fontSize:12},children:"No subagent invocations in this range."})]})]})]})}function ps({label:e,value:t,icon:n,color:s,sub:l}){return r.jsxs("div",{className:"card",style:{padding:"10px 13px",display:"flex",flexDirection:"column",gap:3},children:[r.jsxs("div",{className:"row gap-6",style:{color:"var(--text-muted)",whiteSpace:"nowrap"},children:[r.jsx(z,{name:n,size:12,style:{color:s,flexShrink:0}}),r.jsx("span",{className:"eyebrow",style:{letterSpacing:"0.03em",overflow:"hidden",textOverflow:"ellipsis"},children:e})]}),r.jsx("div",{className:"mono tabular",style:{fontSize:18,fontWeight:650,letterSpacing:"-0.01em",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),l&&r.jsx("div",{className:"mono muted",style:{fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]})}function $x({name:e,calls:t,tokens:n,maxTok:s,selected:l,onClick:o}){const a=n/Math.max(1,t),i=a>2e4?"var(--error)":a>8e3?"var(--warn)":"var(--success)";return r.jsxs("div",{onClick:o,role:"button",tabIndex:0,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),o())},className:"row gap-8 list-row",style:{padding:"6px 8px",margin:"0 -8px",borderRadius:6,cursor:"pointer",background:l?"var(--accent-soft)":void 0},children:[r.jsx("span",{className:"mono",style:{width:116,flexShrink:0,fontSize:11.5,color:l?"var(--accent)":"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),r.jsx("div",{className:"grow",style:{height:16,background:"var(--bg-hover)",borderRadius:4,overflow:"hidden"},children:r.jsx("div",{style:{width:n/s*100+"%",height:"100%",background:i,borderRadius:4}})}),r.jsxs("span",{className:"mono tabular muted",style:{width:36,textAlign:"right",fontSize:10.5,flexShrink:0},children:["×",t]}),r.jsxs("span",{className:"mono tabular",style:{width:64,textAlign:"right",fontSize:10.5,color:i,flexShrink:0},children:[U(Math.round(a)),"/call"]}),r.jsx("span",{className:"mono tabular",style:{width:48,textAlign:"right",fontSize:11.5,fontWeight:600,flexShrink:0},children:U(n)}),r.jsx(z,{name:"chevronRight",size:12,style:{color:"var(--text-faint)",flexShrink:0}})]})}function oo({color:e,label:t}){return r.jsxs("span",{className:"row gap-4",children:[r.jsx("span",{style:{width:8,height:8,borderRadius:2,background:e}}),t]})}const ao={width:360,flexShrink:0,borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-panel)",overflow:"hidden",display:"flex",flexDirection:"column",height:"100%"};function pi({icon:e,color:t,title:n,copy:s,onClose:l}){return r.jsxs("div",{className:"row gap-8",style:{padding:"12px 14px",borderBottom:"1px solid var(--border-subtle)",flexShrink:0},children:[r.jsx(z,{name:e,size:14,style:{color:t,flexShrink:0}}),r.jsx("span",{className:"mono grow",style:{fontSize:13,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),s&&r.jsx(pt,{text:s}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:l,"aria-label":"Close drill-down",children:r.jsx(z,{name:"x",size:14})})]})}function yp({id:e,meta:t}){return r.jsxs("div",{onClick:()=>B("sessions",{query:{sel:e}}),role:"button",tabIndex:0,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),B("sessions",{query:{sel:e}}))},className:"row gap-8 list-row",style:{padding:"7px 9px",borderRadius:7,border:"1px solid var(--border-subtle)",cursor:"pointer"},children:[r.jsx("span",{className:"mono",style:{fontSize:11.5,flexShrink:0},children:e.slice(0,8)}),r.jsx("span",{className:"muted grow",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),r.jsx(z,{name:"chevronRight",size:12,style:{color:"var(--text-muted)",flexShrink:0}})]})}function fi({state:e,children:t}){return r.jsx("div",{className:"scroll-y",style:{flex:1,padding:14},children:r.jsx(ae,{state:e,label:"drill-down",minHeight:120,children:t})})}function Fx({path:e,range:t,files:n,onClose:s}){const l=L(()=>P.claudeHeatmapFile(e,t),[e,t]),o=n.find(a=>a.path===e);return r.jsxs("div",{className:"col",style:{height:"100%"},children:[r.jsx(pi,{icon:"box",color:"var(--warn)",title:e,copy:e,onClose:s}),r.jsx(fi,{state:l,children:a=>{const i=a.byTool.reduce((d,u)=>d+u.bytes,0)||1,c=a.byTool.find(d=>d.bytes>4e4);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{gap:20,marginBottom:16},children:[r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Tool calls"}),r.jsx("div",{className:"tabular",style:{fontSize:26,fontWeight:700,lineHeight:1},children:o?.calls??a.byTool.reduce((d,u)=>d+u.calls,0)})]}),o&&o.trend.some(d=>d>0)&&r.jsxs("div",{className:"grow",children:[r.jsx("div",{className:"muted",style:{fontSize:10.5,marginBottom:4},children:"7-day trend"}),r.jsx(ai,{data:o.trend,color:"var(--warn)",fill:!0,w:150,h:30})]})]}),c&&r.jsxs("div",{style:{background:"var(--warn-soft)",border:"1px solid rgba(229,165,10,0.25)",borderRadius:8,padding:"9px 11px",marginBottom:16,display:"flex",gap:9},children:[r.jsx(z,{name:"flame",size:14,style:{color:"var(--warn)",flexShrink:0,marginTop:1}}),r.jsxs("div",{style:{fontSize:11.5,lineHeight:1.5},children:[r.jsx("span",{className:"mono",style:{color:"var(--warn)"},children:c.name})," returned ",r.jsx("span",{className:"mono",children:U(c.bytes)})," tokens here. A structural query would cover it in a fraction."]})]}),r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Tool breakdown"}),r.jsxs("div",{className:"col gap-8",style:{marginBottom:18},children:[a.byTool.map(d=>r.jsxs("div",{className:"row gap-10",children:[r.jsx("span",{className:"mono",style:{fontSize:11.5,width:92,flexShrink:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),r.jsx("div",{className:"grow",children:r.jsx(Fr,{frac:d.bytes/i,color:d.bytes>4e4?"var(--error)":d.bytes>12e3?"var(--warn)":"var(--node-code)"})}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10.5,width:22,textAlign:"right"},children:["×",d.calls]}),r.jsx("span",{className:"mono tabular",style:{fontSize:10.5,width:44,textAlign:"right"},children:U(d.bytes)})]},d.name)),r.jsx("div",{className:"muted",style:{fontSize:10},children:"bar = result tokens · × = call count"})]}),r.jsxs("div",{className:"eyebrow",style:{marginBottom:8},children:["Touched in ",a.sessions.length," session",a.sessions.length===1?"":"s"]}),r.jsx("div",{className:"col gap-6",children:a.sessions.map(d=>r.jsx(yp,{id:d.session_id,meta:`${d.calls} calls · ${U(d.bytes)} tokens${d.last_model?" · "+d.last_model:""}`},d.session_id))})]})}})]})}function Hx({name:e,range:t,onClose:n}){const s=L(()=>P.claudeHeatmapTool(e,t),[e,t]);return r.jsxs("div",{className:"col",style:{height:"100%"},children:[r.jsx(pi,{icon:"wrench",color:"var(--node-code)",title:e,copy:e,onClose:n}),r.jsx(fi,{state:s,children:l=>{const o=l.totals.calls>0?Math.round(l.totals.bytes/l.totals.calls):0,a=Math.max(...l.inputs.map(i=>i.bytes),0)||1;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{gap:16,marginBottom:16},children:[r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Calls"}),r.jsx("div",{className:"tabular",style:{fontSize:24,fontWeight:700,lineHeight:1},children:l.totals.calls})]}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Result tokens"}),r.jsx("div",{className:"tabular",style:{fontSize:24,fontWeight:700,lineHeight:1,color:l.totals.bytes>1e6?"var(--error)":"var(--text-primary)"},children:U(l.totals.bytes)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Sessions"}),r.jsx("div",{className:"tabular",style:{fontSize:24,fontWeight:700,lineHeight:1},children:l.totals.sessions})]})]}),r.jsxs("div",{className:"row gap-8",style:{marginBottom:16},children:[r.jsx("span",{className:"muted",style:{fontSize:11},children:"avg per call"}),r.jsxs("span",{className:"mono tabular",style:{fontSize:12,color:o>3e4?"var(--error)":o>8e3?"var(--warn)":"var(--text-secondary)"},children:[U(o)," tokens"]})]}),r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Top inputs"}),r.jsxs("div",{className:"col gap-7",style:{marginBottom:18},children:[l.inputs.slice(0,8).map(i=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:11,width:150,flexShrink:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-secondary)"},title:i.input,children:i.input}),r.jsx("div",{className:"grow",children:r.jsx(Fr,{frac:i.bytes/a,color:i.bytes>4e4?"var(--error)":"var(--node-code)"})}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10,width:20,textAlign:"right"},children:["×",i.calls]}),r.jsx("span",{className:"mono tabular",style:{fontSize:10,width:40,textAlign:"right"},children:U(i.bytes)})]},i.input)),!l.inputs.length&&r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No recorded inputs."})]}),r.jsxs("div",{className:"eyebrow",style:{marginBottom:8},children:["Used in ",l.totals.sessions," session",l.totals.sessions===1?"":"s"]}),r.jsx("div",{className:"col gap-6",children:l.recentSessions.map(i=>r.jsx(yp,{id:i.session_id,meta:`${i.calls} calls${i.last_model?" · "+i.last_model:""}`},i.session_id))})]})}})]})}function Ux({type:e,range:t,onClose:n}){const s=L(()=>P.claudeHeatmapSubagent(e,t),[e,t]);return r.jsxs("div",{className:"col",style:{height:"100%"},children:[r.jsx(pi,{icon:"bot",color:"var(--node-route)",title:e,copy:e,onClose:n}),r.jsx(fi,{state:s,children:l=>r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{gap:16,marginBottom:16},children:[r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Invocations"}),r.jsx("div",{className:"tabular",style:{fontSize:22,fontWeight:700,lineHeight:1},children:l.totals.calls})]}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Sessions"}),r.jsx("div",{className:"tabular",style:{fontSize:22,fontWeight:700,lineHeight:1},children:l.totals.sessions})]})]}),r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Recent invocations"}),r.jsxs("div",{className:"col gap-6",style:{marginBottom:16},children:[l.invocations.slice(0,12).map((o,a)=>r.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:7,padding:"8px 10px"},children:[r.jsx("div",{style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.description||o.prompt.slice(0,90)||"(no description)"}),r.jsxs("div",{className:"row gap-8",style:{marginTop:5},children:[r.jsx("button",{className:"btn btn-ghost btn-xs mono",onClick:()=>B("sessions",{query:{sel:o.session_id}}),children:o.session_id.slice(0,8)}),o.last_model&&r.jsx("span",{className:"mono muted",style:{fontSize:10},children:o.last_model})]})]},o.session_id+":"+o.ts+":"+a)),!l.invocations.length&&r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No invocations in this range."})]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",style:{width:"100%",justifyContent:"center"},onClick:()=>B("tips"),children:[r.jsx(z,{name:"tips",size:13}),"See related tips"]})]})})]})}const hi={active:{color:"var(--success)",label:"Active",dot:!0,pulse:!0},connected:{color:"var(--node-spec)",label:"Connected",dot:!0},idle:{color:"var(--text-muted)",label:"Idle",dot:!1},failed:{color:"var(--error)",label:"Failed",dot:!0},disabled:{color:"var(--text-muted)",label:"Disabled",dot:!1}},Or={user:{color:"var(--node-route)",label:"Global",hint:"~/.claude.json",icon:"database"},project:{color:"var(--accent)",label:"Project",hint:".mcp.json",icon:"folder"},unknown:{color:"var(--text-muted)",label:"Usage only",hint:"seen in transcripts, not configured",icon:"sessions"}},mi=e=>`color-mix(in srgb, ${e} 14%, transparent)`;function Vx({state:e}){const t=hi[e];return r.jsxs("span",{className:"pill",style:{color:t.color,background:mi(t.color),width:92,justifyContent:"center"},children:[t.dot&&r.jsx("span",{className:"pill-dot",style:{background:t.color,animation:t.pulse?"pulsePill 1.6s ease-out infinite":void 0}}),t.label]})}function jp({scope:e}){const t=Or[e];return r.jsxs(re,{color:t.color,bg:mi(t.color),children:[r.jsx(z,{name:t.icon,size:10}),t.label]})}function Kx(e){return e.exampleCall?`${e.exampleCall.tool} ${JSON.stringify(e.exampleCall.args)}`:null}function Rt(e,t,n,s,l){return r.jsxs("div",{className:"card",style:{padding:"11px 13px",display:"flex",flexDirection:"column",gap:3},children:[r.jsxs("div",{className:"row gap-6",style:{color:"var(--text-muted)"},children:[r.jsx(z,{name:e,size:12,style:{color:l||"var(--accent)",flexShrink:0}}),r.jsx("span",{className:"eyebrow",style:{letterSpacing:"0.03em"},children:t})]}),r.jsx("div",{className:"mono tabular",style:{fontSize:19,fontWeight:650,letterSpacing:"-0.01em"},children:n}),r.jsx("div",{className:"mono muted",style:{fontSize:10},children:s})]})}function fs(e,t){return r.jsxs("div",{className:"row gap-6",style:{flexShrink:0},children:[r.jsx("span",{className:"muted",style:{fontSize:11},children:e}),r.jsx("span",{className:"mono tabular",style:{fontSize:12,color:"var(--text-secondary)"},children:t})]})}function Qx({srv:e,onOpen:t}){const n=hi[e.state];return r.jsxs("div",{onClick:()=>t(e.id),className:"card",style:{padding:"12px 14px",cursor:"pointer",display:"flex",alignItems:"center",gap:12,transition:"background var(--motion-fast), border-color var(--motion-fast)"},onMouseEnter:s=>{s.currentTarget.style.background="var(--bg-panel-2)",s.currentTarget.style.borderColor="var(--border-strong)"},onMouseLeave:s=>{s.currentTarget.style.background="var(--bg-panel)",s.currentTarget.style.borderColor="var(--border-subtle)"},children:[r.jsxs("div",{style:{position:"relative",width:36,height:36,borderRadius:9,background:mi(Or[e.scope].color),color:Or[e.scope].color,display:"grid",placeItems:"center",flexShrink:0},children:[r.jsx(z,{name:"plug",size:18}),r.jsx("span",{style:{position:"absolute",right:-2,bottom:-2,width:11,height:11,borderRadius:"50%",background:n.color,border:"2px solid var(--bg-panel)",boxShadow:e.state==="active"?`0 0 6px ${n.color}`:"none"}})]}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:13.5,fontWeight:600},children:e.name}),r.jsx(jp,{scope:e.scope})]}),r.jsx("div",{className:"mono muted",style:{fontSize:11,marginTop:3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.command||"no config entry — usage only"})]}),r.jsxs("div",{className:"row gap-16",style:{flexShrink:0},children:[r.jsxs("div",{style:{textAlign:"right",width:56},children:[r.jsx("div",{className:"mono tabular",style:{fontSize:14,fontWeight:600,color:e.calls?"var(--text-primary)":"var(--text-muted)"},children:e.calls.toLocaleString()}),r.jsx("div",{className:"muted",style:{fontSize:10},children:"calls"})]}),r.jsx(Vx,{state:e.state}),r.jsx(z,{name:"chevronRight",size:15,style:{color:"var(--text-muted)"}})]})]})}function Yx({servers:e,onOpen:t,onReload:n,onAdd:s}){const l=e.filter(c=>c.state==="active"||c.state==="connected").length,o=e.reduce((c,d)=>c+d.tools.length,0),a=e.filter(c=>c.state==="failed"),i=["user","project","unknown"].map(c=>[c,e.filter(d=>d.scope===c)]);return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Ae,{icon:"plug",title:"MCP servers",sub:"Model Context Protocol servers Claude Code is configured to load",actions:r.jsxs("div",{className:"row gap-6",children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:n,children:[r.jsx(z,{name:"refresh",size:13}),"Reload"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:s,children:[r.jsx(z,{name:"plus",size:13}),"Add server"]})]})}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:10,marginBottom:18},children:[Rt("plug","Servers",String(e.length),"global + project"),Rt("circle","Connected",`${l} / ${e.length}`,"answering now","var(--success)"),Rt("wrench","Tools",String(o),"seen in transcripts","var(--node-code)"),Rt("drift","Needs attention",String(a.length),a.length?a.map(c=>c.name).join(", "):"all healthy",a.length?"var(--error)":"var(--success)")]}),i.map(([c,d])=>{if(!d.length)return null;const u=Or[c];return r.jsxs("div",{style:{marginBottom:18},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:9},children:[r.jsx(z,{name:u.icon,size:13,style:{color:u.color}}),r.jsx("span",{className:"eyebrow",children:u.label}),r.jsx("span",{className:"mono muted",style:{fontSize:11},children:u.hint}),r.jsxs("span",{className:"muted",style:{fontSize:11},children:["· ",d.length]})]}),r.jsx("div",{className:"col gap-8",children:d.map(f=>r.jsx(Qx,{srv:f,onOpen:t},f.id))})]},c)}),r.jsx("div",{style:{height:20}})]})}function Gx({tool:e}){const t=e.calls?Math.round(e.resultBytes/e.calls):0;return r.jsxs("div",{className:"card row gap-10",style:{padding:"11px 13px"},children:[r.jsx("div",{style:{width:30,height:30,borderRadius:8,background:"var(--node-code-soft)",color:"var(--node-code)",display:"grid",placeItems:"center",flexShrink:0},children:r.jsx(z,{name:"wrench",size:15})}),r.jsx("span",{className:"mono grow",style:{fontSize:13,fontWeight:600,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),r.jsxs("div",{style:{textAlign:"right",flexShrink:0},children:[r.jsxs("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600},children:["×",e.calls.toLocaleString()]}),r.jsx("div",{className:"mono tabular muted",style:{fontSize:10},children:"calls"})]}),r.jsxs("div",{style:{textAlign:"right",width:64,flexShrink:0},children:[r.jsx("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600,color:t>8e3?"var(--warn)":"var(--success)"},children:U(t)}),r.jsx("div",{className:"mono tabular muted",style:{fontSize:10},children:"bytes / call"})]})]})}function qx({srv:e,onBack:t,onChanged:n}){const[s,l]=N.useState(!1),o=hi[e.state],a=Or[e.scope],i=Kx(e),c=e.lastUsed?Date.parse(e.lastUsed):0,d=e.entry?JSON.stringify({mcpServers:{[e.name]:e.entry}},null,2):null,u=e.configFile!=null;return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsxs("div",{className:"row gap-10",style:{marginBottom:14},children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:t,children:[r.jsx(z,{name:"chevronLeft",size:14}),"MCP servers"]}),r.jsx("span",{className:"mono",style:{fontSize:16,fontWeight:600},children:e.name}),r.jsx(jp,{scope:e.scope}),e.configFile&&r.jsx("span",{className:"mono muted",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.configFile})]}),r.jsxs("div",{className:"card",style:{padding:0,overflow:"hidden",marginBottom:14,display:"flex"},children:[r.jsx("div",{style:{width:3,background:o.color,flexShrink:0}}),r.jsxs("div",{style:{flex:1,padding:"13px 16px"},children:[r.jsxs("div",{className:"row gap-16",style:{flexWrap:"wrap"},children:[r.jsxs("div",{className:"row gap-8",style:{flexShrink:0},children:[r.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:o.color,boxShadow:e.state==="active"?`0 0 8px ${o.color}`:"none",animation:e.state==="active"?"pulsePill 1.6s ease-out infinite":void 0}}),r.jsx("span",{style:{fontWeight:600,fontSize:13.5},children:o.label})]}),fs("Transport",e.transport),fs("Calls",e.calls.toLocaleString()),fs("Last used",c?Dr(c)??"—":"never"),fs("Tools",String(e.tools.length)),r.jsx("div",{className:"grow"}),e.command&&r.jsxs("div",{className:"row gap-8",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:"6px 10px",maxWidth:360},children:[r.jsx(z,{name:"command",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"mono",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.command}),r.jsx(pt,{text:e.command})]}),u&&r.jsxs("button",{className:e.disabled?"btn btn-primary btn-sm":"btn btn-secondary btn-sm",onClick:()=>l(!0),children:[r.jsx(z,{name:e.disabled?"play":"pause",size:12}),e.disabled?"Enable server":"Disable server"]})]}),e.state==="failed"&&r.jsxs("div",{className:"row gap-8",style:{marginTop:11,padding:"8px 11px",background:"var(--error-soft)",border:"1px solid rgba(242,85,90,0.25)",borderRadius:7},children:[r.jsx(z,{name:"drift",size:14,style:{color:"var(--error)",flexShrink:0}}),r.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)",flex:1},children:"The server didn't answer an MCP initialize — it may be crashing, unreachable, or mis-configured. Check the command and credentials, then reload."})]}),e.disabled&&r.jsxs("div",{className:"muted",style:{marginTop:11,fontSize:11.5},children:["Disabled in ",e.configFile," — Claude Code won't load this server until it's enabled again."]})]})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:10,marginBottom:16},children:[Rt("wrench","Tools",String(e.tools.length),"seen in transcripts"),Rt("plug","Calls",e.calls.toLocaleString(),"all time","var(--node-code)"),Rt("database","Result bytes",U(e.resultBytes),"returned to context","var(--node-route)"),Rt("clock","Last used",c?Dr(c)??"—":"never",c?new Date(c).toLocaleString():"no calls recorded","var(--success)")]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:16,alignItems:"start"},children:[r.jsxs("div",{style:{minWidth:0,gridColumn:"1 / -1"},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:10},children:[r.jsxs("span",{className:"eyebrow",children:["Tools · ",e.tools.length]}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"call counts from ingested transcripts"})]}),e.tools.length?r.jsx("div",{className:"col gap-8",children:e.tools.map(f=>r.jsx(Gx,{tool:f},f.name))}):r.jsx("div",{className:"card card-pad muted",style:{fontSize:12},children:"No tool calls recorded yet — statistics appear after Claude Code uses this server."})]}),r.jsxs("div",{className:"card card-pad",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(z,{name:"command",size:14,style:{color:"var(--node-code)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:12.5},children:"Example call"}),i&&r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"latest recorded input"})]}),i?r.jsxs("div",{className:"row gap-8",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:"8px 11px"},children:[r.jsx("span",{className:"mono grow",style:{fontSize:11.5,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),r.jsx(pt,{text:i})]}):r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No calls recorded yet."})]}),r.jsxs("div",{className:"card card-pad",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(z,{name:"settings",size:14,style:{color:"var(--accent)"}}),r.jsx("span",{className:"grow",style:{fontWeight:600,fontSize:12.5},children:"Configuration"}),r.jsx("span",{className:"mono muted",style:{fontSize:10.5},children:e.configFile??a.hint}),d&&r.jsx(pt,{text:d})]}),d?r.jsx("pre",{className:"mono scroll-y",style:{margin:0,fontSize:11.5,lineHeight:1.65,color:"var(--text-secondary)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"11px 13px",overflowX:"auto",whiteSpace:"pre"},children:d}):r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"This server appears in transcripts but isn't in any config file — it was likely removed, or belongs to another machine's setup."})]})]}),s&&r.jsx(Xx,{srv:e,onClose:()=>l(!1),onDone:()=>{l(!1),n()}}),r.jsx("div",{style:{height:24}})]})}function Xx({srv:e,onClose:t,onDone:n}){const s=e.disabled,[l,o]=N.useState(!1),[a,i]=N.useState(null),c=s?"Enable":"Disable",d=()=>{l||(o(!0),i(null),P.setMcpServerEnabled(e.name,s).then(()=>n(),u=>{i(u instanceof Error?u.message:String(u)),o(!1)}))};return r.jsx("div",{onMouseDown:t,role:"dialog","aria-label":`${c} ${e.name}`,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:90,display:"grid",placeItems:"center"},children:r.jsxs("div",{onMouseDown:u=>u.stopPropagation(),style:{width:440,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"14px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(z,{name:s?"play":"pause",size:16,style:{color:s?"var(--success)":"var(--warn)"}}),r.jsxs("span",{className:"grow",style:{fontWeight:600},children:[c," ",e.name,"?"]}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:t,"aria-label":"Close",children:r.jsx(z,{name:"x",size:14})})]}),r.jsxs("div",{style:{padding:16},children:[r.jsxs("div",{className:"secondary",style:{fontSize:12.5,lineHeight:1.55},children:["This writes to ",r.jsx("code",{className:"mono",style:{fontSize:11.5},children:e.configFile}),"."," ",s?"Claude Code loads the server again on its next start.":"Claude Code stops loading the server (and its tools) on its next start."]}),a&&r.jsxs("div",{className:"row gap-8",style:{marginTop:10,padding:"8px 10px",borderRadius:7,background:"var(--error-soft)",color:"var(--error)",fontSize:12},children:[r.jsx(z,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:a})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:t,children:"Cancel"}),r.jsx("button",{className:"btn btn-primary btn-sm",onClick:d,disabled:l,children:l?`${c.slice(0,-1)}ing…`:`${c} server`})]})]})})}function Jx({onClose:e,onAdded:t}){const[n,s]=N.useState(""),[l,o]=N.useState("user"),[a,i]=N.useState("stdio"),[c,d]=N.useState(""),[u,f]=N.useState(""),[h,g]=N.useState(!1),[v,p]=N.useState(null),j=!!n.trim()&&!/\s/.test(n.trim()),m=a==="stdio"?!!c.trim():!!u.trim(),x=j&&m,y=()=>{if(h||!x)return;g(!0),p(null);const w={name:n.trim(),scope:l};if(a==="stdio"){const[S,...k]=c.trim().split(/\s+/);w.command=S,k.length&&(w.args=k)}else w.url=u.trim();P.addMcpServer(w).then(()=>t(),S=>{p(S instanceof Error?S.message:String(S)),g(!1)})};return r.jsx("div",{onMouseDown:e,role:"dialog","aria-label":"Add MCP server",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:90,display:"grid",placeItems:"center"},children:r.jsxs("div",{onMouseDown:w=>w.stopPropagation(),style:{width:460,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"14px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(z,{name:"plus",size:16,style:{color:"var(--accent)"}}),r.jsx("span",{className:"grow",style:{fontWeight:600},children:"Add MCP server"}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:e,"aria-label":"Close",children:r.jsx(z,{name:"x",size:14})})]}),r.jsxs("div",{style:{padding:16},children:[r.jsxs("div",{style:{marginBottom:12},children:[r.jsx("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"mcp-add-name",children:"Name"}),r.jsx("input",{id:"mcp-add-name",className:"input mono",style:{width:"100%"},placeholder:"github",value:n,onChange:w=>s(w.target.value),onKeyDown:w=>{w.key==="Enter"&&y()}})]}),r.jsxs("div",{style:{marginBottom:12},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:5},children:"Scope"}),r.jsx(Ce,{value:l,onChange:w=>o(w),size:"sm",label:"Server scope",options:[{value:"user",label:"Global · ~/.claude.json"},{value:"project",label:"Project · .mcp.json"}]})]}),r.jsxs("div",{style:{marginBottom:12},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:5},children:"Transport"}),r.jsx(Ce,{value:a,onChange:i,size:"sm",label:"Server transport",options:[{value:"stdio",label:"stdio · command"},{value:"http",label:"http · url"}]})]}),a==="stdio"?r.jsxs("div",{style:{marginBottom:4},children:[r.jsx("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"mcp-add-command",children:"Command"}),r.jsx("input",{id:"mcp-add-command",className:"input mono",style:{width:"100%"},placeholder:"npx -y @modelcontextprotocol/server-github",value:c,onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Enter"&&y()}})]}):r.jsxs("div",{style:{marginBottom:4},children:[r.jsx("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"mcp-add-url",children:"URL"}),r.jsx("input",{id:"mcp-add-url",className:"input mono",style:{width:"100%"},placeholder:"https://<host>/sse",value:u,onChange:w=>f(w.target.value),onKeyDown:w=>{w.key==="Enter"&&y()}})]}),v&&r.jsxs("div",{className:"row gap-8",style:{marginTop:10,padding:"8px 10px",borderRadius:7,background:"var(--error-soft)",color:"var(--error)",fontSize:12},children:[r.jsx(z,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:v})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:e,children:"Cancel"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:y,disabled:h||!x,children:[r.jsx(z,{name:"plus",size:13}),h?"Adding…":"Add server"]})]})]})})}function Zx({onAdd:e,onReload:t}){return r.jsx(ue,{icon:"plug",title:"No MCP servers configured",body:r.jsxs(r.Fragment,{children:["Claude Code loads MCP servers from ",r.jsx("code",{className:"mono",children:"~/.claude.json"})," and the project's ",r.jsx("code",{className:"mono",children:".mcp.json"}),". Add one here, or run"," ",r.jsx("code",{className:"mono",children:"specship install"})," to register SpecShip's own server."]}),action:r.jsxs("div",{className:"row gap-8",style:{justifyContent:"center"},children:[r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:e,children:[r.jsx(z,{name:"plus",size:13}),"Add server"]}),r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:t,children:[r.jsx(z,{name:"refresh",size:13}),"Reload"]})]})})}function eg({query:e}){const t=L(()=>P.mcpServers(),[]),[n,s]=N.useState(e?.server??null),[l,o]=N.useState(!1);return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx(ae,{state:t,label:"MCP servers",minHeight:320,children:a=>{const i=n?a.servers.find(c=>c.id===n):void 0;return i?r.jsx(qx,{srv:i,onBack:()=>s(null),onChanged:t.reload}):a.servers.length?r.jsx(Yx,{servers:a.servers,onOpen:s,onReload:t.reload,onAdd:()=>o(!0)}):r.jsx(Zx,{onAdd:()=>o(!0),onReload:t.reload})}}),l&&r.jsx(Jx,{onClose:()=>o(!1),onAdded:()=>{o(!1),t.reload()}})]})}const Hn={enterprise:{label:"Managed",color:"#E5A50A",soft:"rgba(229,165,10,0.14)",desc:"Organization policy · cannot be overridden"},user:{label:"User",color:"#29D2BE",soft:"rgba(41,210,190,0.14)",desc:"Personal · applies to every project"},project:{label:"Project",color:"#5B93F2",soft:"rgba(91,147,242,0.14)",desc:"Team-shared · checked into the repo"},subdir:{label:"Directory",color:"#A586F5",soft:"rgba(165,134,245,0.14)",desc:"Scoped to a subtree · loaded when cwd is inside"},import:{label:"Import",color:"#7B8696",soft:"rgba(123,134,150,0.12)",desc:"Pulled in via @path reference"},note:{label:"Notes",color:"#46C26B",soft:"rgba(70,194,107,0.14)",desc:"Agent-written · memory tool"}},ca={instruction:{label:"Instructions",color:"#5B93F2",soft:"rgba(91,147,242,0.14)",icon:"memory",desc:"Directives & rules from CLAUDE.md"},note:{label:"Notes",color:"#46C26B",soft:"rgba(70,194,107,0.14)",icon:"tips",desc:"Facts the agent saved via the memory tool"},import:{label:"Imports",color:"#29D2BE",soft:"rgba(41,210,190,0.14)",icon:"external",desc:"Files pulled in via @path"}};function wp(e){const t=l=>l.replace(/&/g,"&").replace(/</g,"<"),n=l=>t(l).replace(/\*\*(.+?)\*\*/g,"<strong style='color:var(--text-primary)'>$1</strong>").replace(/`(.+?)`/g,"<code class='mono' style='font-size:11.5px;background:var(--bg-canvas);padding:1px 5px;border-radius:4px;border:1px solid var(--border-subtle);color:var(--node-spec)'>$1</code>"),s=[];return e.split(`
|
|
44
|
+
`).forEach(l=>{l.startsWith("## ")?s.push(`<div style='font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:0.06em;color:var(--text-muted);margin:14px 0 6px'>${n(l.slice(3))}</div>`):l.startsWith("# ")?s.push(`<div style='font-size:14px;font-weight:650;margin:0 0 8px'>${n(l.slice(2))}</div>`):l.startsWith("@")?s.push(`<div class='mono' style='font-size:12px;color:var(--node-route);background:var(--node-route-soft);display:block;width:fit-content;padding:2px 8px;border-radius:5px;margin:3px 0'>${t(l)}</div>`):/^\s*- /.test(l)?s.push(`<div style='display:flex;gap:8px;font-size:12.5px;line-height:1.6;color:var(--text-secondary);padding:1px 0'><span style='color:var(--text-faint)'>•</span><span>${n(l.replace(/^\s*- /,""))}</span></div>`):l.trim()===""?s.push("<div style='height:6px'></div>"):s.push(`<div style='font-size:12.5px;line-height:1.6;color:var(--text-secondary)'>${n(l)}</div>`)}),s.join("")}function Sp({level:e}){const t=Hn[e];return r.jsx(re,{color:t.color,bg:t.soft,children:t.label})}function tg({type:e}){const t=ca[e];return r.jsxs(re,{color:t.color,bg:t.soft,children:[r.jsx(z,{name:t.icon,size:10}),t.label]})}function ng({text:e}){const[t,n]=N.useState(!1);return r.jsxs("button",{className:"btn btn-secondary btn-sm",title:"Copy file contents",onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1100)},style:{color:t?"var(--success)":void 0},children:[r.jsx(z,{name:t?"check":"copy",size:13}),t?"Copied":"Copy contents"]})}function Bc({file:e,selId:t,onSel:n,indent:s}){const l=t===e.id,o=e.level==="import"||e.level==="note",a=e.level==="import"?"external":e.level==="note"?"tips":"memory";return r.jsxs("div",{onClick:()=>n(e.id),className:"row gap-8",style:{padding:"8px 10px",paddingLeft:s?26:10,borderRadius:7,cursor:"pointer",background:l?"var(--accent-soft)":"transparent"},onMouseEnter:i=>{l||(i.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:i=>{l||(i.currentTarget.style.background="transparent")},children:[r.jsx("span",{className:"pill-dot",style:{background:Hn[e.level].color,flexShrink:0}}),r.jsx(z,{name:a,size:13,style:{color:l?"var(--accent)":"var(--text-muted)",flexShrink:0}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsxs("div",{className:"row gap-6",children:[r.jsx("span",{className:"mono",style:{fontSize:12,color:l?"var(--accent)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o?e.name:e.scope}),e.readOnly&&r.jsx(z,{name:"lock",size:10,style:{color:"var(--warn)"}})]}),r.jsx("div",{className:"mono muted",style:{fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5,flexShrink:0},children:U(e.tokens)})]})}function hs(e,t){return r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:e}),r.jsx("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600,marginTop:1,whiteSpace:"nowrap"},children:t})]})}function rg({file:e,files:t}){const n=Hn[e.level],s=e.type==="note",l=(e.imports??[]).map(o=>t.find(a=>a.id===o)).filter(o=>!!o);return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:20},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:6},children:[r.jsx(tg,{type:e.type}),r.jsx(Sp,{level:e.level}),r.jsx("span",{className:"secondary",style:{fontSize:11.5},children:n.desc}),r.jsx("div",{className:"grow"}),e.readOnly&&r.jsxs(re,{color:"var(--warn)",bg:"var(--warn-soft)",children:[r.jsx(z,{name:"lock",size:10}),"read-only"]})]}),r.jsxs("div",{className:"row gap-8",style:{marginBottom:14},children:[r.jsx("span",{className:"mono",style:{fontSize:13.5,fontWeight:600},children:e.path}),r.jsx(pt,{text:e.path})]}),r.jsxs("div",{className:"row",style:{gap:22,padding:"10px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)",marginBottom:16,flexWrap:"wrap"},children:[hs("Tokens",U(e.tokens)),hs("Lines",String(e.lines)),hs("Scope",n.label),hs("Modified",e.modified),s&&e.session&&r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10.5},children:"Saved in"}),r.jsx("button",{onClick:()=>B("sessions",{query:{sel:e.session}}),className:"mono",style:{fontSize:13,fontWeight:600,marginTop:1,color:"var(--accent)",background:"none",border:"none",padding:0,cursor:"pointer"},children:e.session})]})]}),s&&e.tags&&r.jsx("div",{className:"row gap-6",style:{marginBottom:14,flexWrap:"wrap"},children:e.tags.map(o=>r.jsxs("span",{className:"mono",style:{fontSize:10.5,color:"var(--node-test)",background:"var(--node-test-soft)",padding:"2px 8px",borderRadius:5,whiteSpace:"nowrap"},children:["#",o]},o))}),r.jsx("div",{className:"card card-pad",style:{background:"var(--bg-panel)",marginBottom:16},dangerouslySetInnerHTML:{__html:wp(e.body)}}),l.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"eyebrow",style:{marginBottom:8},children:["Imports · ",l.length]}),r.jsx("div",{className:"col gap-6",children:l.map(o=>r.jsxs("div",{className:"row gap-8",style:{padding:"7px 10px",borderRadius:7,border:"1px solid var(--border-subtle)"},children:[r.jsx(z,{name:"external",size:12,style:{color:"var(--node-route)"}}),r.jsx("span",{className:"mono grow",style:{fontSize:11.5},children:o.path}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5},children:U(o.tokens)})]},o.id))})]}),r.jsx("div",{className:"row gap-8",style:{marginTop:16},children:r.jsx(ng,{text:e.body})})]})}function sg({files:e,typeF:t}){const n=e.filter(a=>a.type!=="note"&&(t==="all"||a.type===t)),s=e.filter(a=>a.type==="note"&&(t==="all"||t==="note")),l=[...n,...s].map(a=>a.body).join(`
|
|
45
|
+
|
|
46
|
+
`),o=(a,i)=>{const c=Hn[a.level];return r.jsxs("div",{className:"card",style:{overflow:"hidden",display:"flex"},children:[r.jsx("div",{style:{width:3,background:c.color,flexShrink:0}}),r.jsxs("div",{style:{flex:1,minWidth:0,padding:"12px 14px"},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:8},children:[i!=null&&r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5,width:16},children:i+1}),r.jsx(Sp,{level:a.level}),r.jsx("span",{className:"mono",style:{fontSize:11.5,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.path}),r.jsx("div",{className:"grow"}),a.readOnly&&r.jsx(z,{name:"lock",size:11,style:{color:"var(--warn)"}}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:10.5},children:U(a.tokens)})]}),r.jsx("div",{style:{paddingLeft:i!=null?24:0},dangerouslySetInnerHTML:{__html:wp(a.body)}})]})]},a.id)};return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:20},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:6},children:[r.jsx(z,{name:"layers",size:15,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Effective memory"}),r.jsx("span",{className:"secondary",style:{fontSize:12},children:"· everything the agent loads"}),r.jsx("div",{className:"grow"}),r.jsx(pt,{text:l,label:"Copy all",ariaLabel:"Copy effective memory"})]}),r.jsx("div",{className:"secondary",style:{fontSize:12,lineHeight:1.55,marginBottom:16},children:"Instructions compose in load order — later files layer onto earlier ones, and @imports load with the file that references them. Saved notes are appended as retrieved context."}),n.length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:8},children:"Instructions · load order"}),r.jsx("div",{className:"col gap-10",children:n.map((a,i)=>o(a,i))})]}),s.length>0&&r.jsxs("div",{style:{marginTop:n.length?20:0},children:[r.jsxs("div",{className:"row gap-6",style:{marginBottom:8},children:[r.jsx("span",{className:"eyebrow",children:"Notes · memory tool"}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"retrieved facts, not precedence-ranked"})]}),r.jsx("div",{className:"col gap-10",children:s.map(a=>o(a,null))})]})]})}function ms(e,t,n,s){return r.jsxs("div",{className:"row gap-8",style:{padding:"8px 12px",background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",borderRadius:9,flexShrink:0},children:[r.jsx(z,{name:e,size:14,style:{color:s,flexShrink:0}}),r.jsxs("div",{children:[r.jsx("div",{className:"muted",style:{fontSize:10},children:t}),r.jsx("div",{className:"mono tabular",style:{fontSize:13,fontWeight:600,whiteSpace:"nowrap"},children:n})]})]})}function lg({onReload:e}){return r.jsx(ue,{icon:"memory",title:"No memory files found",body:r.jsxs(r.Fragment,{children:["Claude Code reads ",r.jsx("code",{className:"mono",children:"~/.claude/CLAUDE.md"}),", a"," ",r.jsx("code",{className:"mono",children:"CLAUDE.md"})," at the project root (and one level of subdirectories), and saved notes under ",r.jsx("code",{className:"mono",children:"~/.claude/memory/"}),". Create one, then reload."]}),action:r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:e,children:[r.jsx(z,{name:"refresh",size:13}),"Reload memory"]})})}function og({data:e,view:t,typeF:n,onTypeF:s,sel:l,onSel:o,onReload:a}){const i=e.files,c=i.find(p=>p.id===l)??i.find(p=>p.level==="project")??i[0],d=p=>i.find(j=>j.id===p),u=p=>n==="all"||p.type===n,f=p=>(p.imports??[]).map(d).filter(j=>!!j&&u(j)),h=[{key:"enterprise",items:i.filter(p=>p.level==="enterprise")},{key:"user",items:i.filter(p=>p.level==="user")},{key:"project",items:i.filter(p=>p.level==="project"||p.level==="subdir")},{key:"note",items:i.filter(p=>p.level==="note")}],g=p=>p.items.some(j=>u(j)||f(j).length>0),v=(p,j)=>{const m=n===p,x=p==="all"?{label:"All",color:"var(--text-secondary)",soft:""}:ca[p];return r.jsxs("button",{onClick:()=>s(p),className:"row gap-6",style:{height:26,padding:"0 11px",borderRadius:999,fontSize:11.5,fontWeight:500,cursor:"pointer",border:"1px solid "+(m?"transparent":"var(--border-subtle)"),background:m?p==="all"?"var(--bg-active)":x.soft:"var(--bg-panel)",color:m?p==="all"?"var(--text-primary)":x.color:"var(--text-muted)"},children:[p!=="all"&&r.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:x.color}}),x.label,j!=null&&r.jsx("span",{className:"tabular",style:{opacity:.7},children:j})]})};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row gap-10",style:{padding:"0 18px 12px",flexWrap:"wrap"},children:[ms("memory","Loaded",U(e.totalTokens)+" tokens","var(--accent)"),ms("memory","Instructions",String(e.instructionCount),"var(--node-spec)"),ms("tips","Notes",String(e.noteCount),"var(--node-test)"),ms("external","Imports",String(e.importCount),"var(--node-route)"),r.jsx("div",{className:"grow"}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:a,title:"Re-read memory files from disk",children:[r.jsx(z,{name:"refresh",size:13}),"Reload memory"]})]}),r.jsxs("div",{className:"row gap-6",style:{padding:"0 18px 14px",flexWrap:"wrap"},children:[r.jsx(z,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),v("all"),v("instruction",e.instructionCount),v("note",e.noteCount),v("import",e.importCount),r.jsx("span",{className:"grow"}),r.jsx("span",{className:"muted",style:{fontSize:11},children:n!=="all"?ca[n].desc:""})]}),t==="effective"?r.jsx(sg,{files:i,typeF:n}):r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0,borderTop:"1px solid var(--border-subtle)"},children:[r.jsx("div",{className:"col",style:{width:300,flexShrink:0,borderRight:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:r.jsx("div",{className:"scroll-y",style:{flex:1,padding:8},children:h.filter(g).map(p=>r.jsxs("div",{style:{marginBottom:10},children:[r.jsxs("div",{className:"row gap-6",style:{padding:"8px 8px 4px"},children:[r.jsx("span",{className:"eyebrow",children:Hn[p.key].label}),r.jsx("span",{className:"muted",style:{fontSize:10},children:Hn[p.key].desc})]}),p.items.filter(j=>u(j)||f(j).length>0).map(j=>r.jsxs(N.Fragment,{children:[u(j)&&r.jsx(Bc,{file:j,selId:c?.id??"",onSel:o}),f(j).map(m=>r.jsx(Bc,{file:m,selId:c?.id??"",onSel:o,indent:!0},m.id))]},j.id))]},p.key))})}),r.jsx("div",{className:"col",style:{flex:1,minWidth:0},children:c&&r.jsx(rg,{file:c,files:i})})]})]})}function ag({project:e}){const t=L(()=>P.memory(e),[e]),[n,s]=N.useState("sources"),[l,o]=N.useState("all"),[a,i]=N.useState(null);return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 0"},children:r.jsx(Ae,{icon:"memory",title:"Memory",sub:"Everything the agent remembers — across levels and types",actions:r.jsx(Ce,{value:n,onChange:s,size:"sm",label:"Memory view",options:[{value:"sources",label:"Sources"},{value:"effective",label:"Effective"}]})})}),r.jsx(ae,{state:t,label:"memory",minHeight:320,children:c=>c.files.length===0?r.jsx(lg,{onReload:t.reload}):r.jsx(og,{data:c,view:n,typeF:l,onTypeF:o,sel:a,onSel:i,onReload:t.reload})})]})}function ig({title:e,req:t}){return r.jsx(ue,{icon:"box",title:e,body:t?`This screen lands with ${t}. The SSR dashboard still serves it today.`:"This screen is not wired yet."})}const cg=new Set(["completed","failed","cancelled"]);function da(e){return e.stepId??(typeof e.data?.stepId=="string"?e.data.stepId:void 0)}function dg(e){const t=new Set(e.map(i=>i.id)),n=new Map(e.map(i=>[i.id,(i.depends_on??[]).filter(c=>t.has(c)).length])),s=new Map;for(const i of e)for(const c of i.depends_on??[])t.has(c)&&s.set(c,[...s.get(c)??[],i.id]);const l=new Map(e.map(i=>[i.id,i])),o=e.filter(i=>n.get(i.id)===0).map(i=>i.id),a=[];for(;o.length;){const i=o.shift();a.push(l.get(i));for(const c of s.get(i)??[]){const d=n.get(c)-1;n.set(c,d),d===0&&o.push(c)}}return a.length===e.length?a:e}function ug(e,t,n){const s=t?.metadata?.nodeStates??{},l=new Map,o=[],a=new Set,i=(f,h)=>{a.has(f)||(a.add(f),o.push(f)),h&&!l.get(f)&&l.set(f,h)};if(e?.length)for(const f of dg(e))i(f.id,f.kind);else{for(const f of Object.keys(s))i(f);for(const f of n){const h=da(f);h&&i(h,typeof f.data?.stepKind=="string"?f.data.stepKind:void 0)}}const c=new Map(o.map(f=>[f,s[f]??"pending"])),d=new Map;for(const f of n){const h=da(f);if(!(!h||!a.has(h))&&(f.eventType==="step_started"?c.set(h,"running"):f.eventType==="step_completed"?c.set(h,"completed"):f.eventType==="step_failed"?c.set(h,"failed"):f.eventType==="step_skipped"&&c.set(h,"skipped"),f.eventType==="step_completed")){const g=f.data?.stats;typeof g?.costUsd=="number"&&d.set(h,g.costUsd)}}const u=t?.metadata?.approval;return t?.status==="paused"&&u?.nodeId&&c.get(u.nodeId)!=="completed"&&c.set(u.nodeId,"paused"),o.map(f=>({id:f,kind:l.get(f)??"prompt",state:c.get(f)??"pending",costUsd:d.get(f)}))}function pg(e){let t=null,n=null;for(const s of e){if(s.eventType!=="step_completed")continue;const l=s.data?.stats;typeof l?.costUsd=="number"&&(t=(t??0)+l.costUsd),typeof l?.model=="string"&&!n&&(n=l.model)}return{costUsd:t,model:n}}function bp(e){if(e==null||!Number.isFinite(e)||e<0)return"—";const t=Math.round(e/1e3);return t<60?t+"s":t<3600?Math.floor(t/60)+"m "+t%60+"s":Math.floor(t/3600)+"h "+Math.floor(t%3600/60)+"m"}function Tl(e){return typeof e=="number"?"$"+e.toFixed(2):"—"}const fg={pending:"var(--text-muted)",running:"var(--info)",completed:"var(--success)",failed:"var(--error)",paused:"var(--warn)",skipped:"var(--text-muted)"};function hg({nodes:e}){return r.jsx("div",{className:"row",style:{gap:6,padding:"14px 16px",flexWrap:"wrap",alignItems:"center",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-canvas-2)"},children:e.map((t,n)=>{const s=fg[t.state]??"var(--text-muted)";return r.jsxs("div",{className:"row",style:{gap:6,alignItems:"center"},children:[n>0&&r.jsx(z,{name:"arrowRight",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsxs("div",{"data-node-id":t.id,"data-node-state":t.state,className:"row gap-8",style:{padding:"5px 11px",borderRadius:8,background:t.state==="running"?"var(--info-soft)":"var(--bg-panel)",border:`1.5px ${t.state==="skipped"?"dotted":"solid"} ${t.state==="pending"?"var(--border-subtle)":s}`,opacity:t.state==="pending"?.65:1},children:[r.jsxs("span",{style:{width:16,height:16,borderRadius:"50%",display:"grid",placeItems:"center",flexShrink:0,background:t.state==="completed"?"var(--success)":t.state==="failed"?"var(--error)":t.state==="paused"?"var(--warn)":"transparent",border:t.state==="completed"||t.state==="failed"||t.state==="paused"?"none":`1.5px solid ${s}`,animation:t.state==="running"?"spin 1.4s linear infinite":"none",borderTopColor:t.state==="running"?"transparent":void 0},children:[t.state==="completed"&&r.jsx(z,{name:"check",size:10,style:{color:"#fff"}}),t.state==="failed"&&r.jsx(z,{name:"x",size:10,style:{color:"#fff"}}),t.state==="paused"&&r.jsx(z,{name:"pause",size:9,style:{color:"#fff"}})]}),r.jsxs("div",{style:{minWidth:0},children:[r.jsx("div",{style:{fontSize:12,fontWeight:500,whiteSpace:"nowrap"},children:t.id}),r.jsxs("div",{className:"mono muted",style:{fontSize:9},children:[t.kind,t.costUsd!==void 0&&r.jsxs("span",{className:"tabular",children:[" · ",Tl(t.costUsd)]})]})]})]})]},t.id)})})}const kp={step_started:"var(--info)",step_completed:"var(--success)",step_failed:"var(--error)",step_skipped:"var(--text-muted)",tool_called:"var(--node-code)",agent_message:"var(--text-secondary)",artifact_created:"var(--node-route)",approval_requested:"var(--warn)",approval_granted:"var(--success)",approval_rejected:"var(--error)",run_started:"var(--info)",run_completed:"var(--success)",run_failed:"var(--error)",run_cancelled:"var(--text-muted)",run_paused:"var(--warn)"};function mg(e){const t=e.data??{};if(typeof t.name=="string")return t.name+(typeof t.input=="string"&&t.input?` · ${t.input}`:"");if(typeof t.text=="string")return t.text;if(typeof t.error=="string")return t.error;if(typeof t.message=="string")return t.message;if(typeof t.reason=="string")return t.reason;if(e.eventType==="step_completed"){const n=t.stats;return typeof n?.costUsd=="number"?Tl(n.costUsd):""}return""}function xg(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleTimeString()}function gg({events:e,live:t}){const n=N.useRef(null),[s,l]=N.useState(!0);return N.useEffect(()=>{s&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,s]),r.jsxs("div",{ref:n,className:"scroll-y","aria-live":"polite",onScroll:o=>{const a=o.currentTarget;l(a.scrollHeight-a.scrollTop-a.clientHeight<30)},style:{flex:1,padding:"8px 14px",fontFamily:"var(--font-mono)",fontSize:11.5},children:[e.map(o=>r.jsxs("div",{className:"row gap-10",style:{padding:"4px 0",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"muted tabular",style:{flexShrink:0,width:70},children:xg(o.createdAt)}),r.jsx("span",{style:{color:kp[o.eventType]??"var(--text-secondary)",width:140,flexShrink:0},children:o.eventType}),r.jsx("span",{className:"muted",style:{flexShrink:0,width:90,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:da(o)??""}),r.jsx("span",{className:"secondary",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:mg(o)})]},o.id)),!e.length&&r.jsx("div",{className:"muted",style:{padding:"8px 0"},children:"No events yet."}),t&&r.jsxs("div",{className:"row gap-6 muted",style:{padding:"6px 0"},children:[r.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--info)",animation:"skeleton 1s infinite"}}),"streaming…"]})]})}function vg({artifacts:e,loading:t}){const[n,s]=N.useState(0),l=e[Math.min(n,e.length-1)];return t?r.jsx("div",{className:"muted",style:{padding:16,fontSize:12},children:"Loading artifacts…"}):e.length?r.jsxs("div",{className:"row",style:{flex:1,minHeight:0},children:[r.jsx("div",{className:"scroll-y",style:{width:190,borderRight:"1px solid var(--border-subtle)",padding:8,flexShrink:0},children:e.map((o,a)=>r.jsxs("div",{role:"button",tabIndex:0,onClick:()=>s(a),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),s(a))},className:"row gap-8 list-row",style:{padding:"7px 9px",borderRadius:6,cursor:"pointer",background:n===a?"var(--bg-hover)":"transparent"},children:[r.jsx(z,{name:"box",size:13,style:{color:"var(--node-route)",flexShrink:0}}),r.jsxs("div",{style:{minWidth:0},children:[r.jsx("div",{className:"mono",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.name}),r.jsxs("div",{className:"muted",style:{fontSize:9.5},children:[o.nodeId,o.outputType?" · "+o.outputType:""]})]})]},o.name))}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:16},children:r.jsx("pre",{className:"mono",style:{margin:0,fontSize:12,lineHeight:1.65,color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:l?.body})})]}):r.jsx("div",{className:"muted",style:{padding:16,fontSize:12},children:"No artifacts — only completed nodes write output files."})}function yg({id:e,project:t}){const n=L(()=>P.run(e,t),[e,t]),s=L(()=>P.workflows(t),[t]),[l,o]=N.useState([]),[a,i]=N.useState("events"),[c,d]=N.useState(!1),[u,f]=N.useState(""),[h,g]=N.useState(!1),[v,p]=N.useState(null),j=n.data?.run??null,m=j?.status??"",x=!!j&&!cg.has(m),y=N.useMemo(()=>{const D=n.data?.events??[],b=new Set(D.map(E=>E.id));return[...D,...l.filter(E=>!b.has(E.id))]},[n.data,l]),w=n.data?.events.length?n.data.events[n.data.events.length-1].id:0,S=n.reload;N.useEffect(()=>{if(!x||typeof EventSource>"u")return;const D=new EventSource(pm(e,w,t)),b=E=>{try{const R=JSON.parse(E.data);o(I=>I.some(A=>A.id===R.id)?I:[...I,R])}catch{}};for(const E of Object.keys(kp))D.addEventListener(E,b);return D.addEventListener("done",()=>{D.close(),S()}),D.onerror=()=>{},()=>D.close()},[e,t,x,w,S]);const k=N.useMemo(()=>{const D=s.data?.workflows.find(b=>b.workflow.name===j?.workflowName)?.workflow;return ug(D?.nodes,j,y)},[s.data,j,y]),C=N.useMemo(()=>pg(y),[y]),_=typeof j?.startedAt=="number"?j.startedAt:null,W=typeof j?.completedAt=="number"?j.completedAt:typeof j?.lastActivityAt=="number"?j.lastActivityAt:null,O=_&&W?W-_:null,ee=D=>{g(!0),p(null),D().then(()=>{g(!1),d(!1),o([]),n.reload()},b=>{g(!1),p(b instanceof Error?b.message:String(b))})},_e=()=>ee(async()=>{await P.runAction(e,"approve",void 0,t),await P.runAction(e,"resume",void 0,t)}),Re=()=>ee(()=>P.runAction(e,"reject",u.trim()?{reason:u.trim()}:void 0,t)),me=()=>ee(()=>P.runAction(e,"cancel",void 0,t)),Je=L(()=>a==="artifacts"?P.runArtifacts(e,t):Promise.resolve({artifacts:[]}),[e,t,a,m]),K=j?.metadata?.approval;return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"12px 16px",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:()=>B("runs"),children:[r.jsx(z,{name:"chevronLeft",size:14}),"Runs"]}),r.jsx("span",{className:"mono",style:{fontWeight:600,fontSize:14},children:j?.workflowName??"…"}),r.jsx("span",{className:"mono muted",style:{fontSize:11.5},children:e}),j&&r.jsx(Ge,{state:m}),r.jsx("span",{className:"grow"}),r.jsxs("span",{className:"mono muted tabular",style:{fontSize:11.5},title:"Duration",children:[r.jsx(z,{name:"clock",size:11,style:{verticalAlign:-1,marginRight:4}}),bp(O)]}),C.costUsd!==null&&r.jsx("span",{className:"mono tabular",style:{fontSize:11.5},title:"Run-total cost",children:Tl(C.costUsd)}),C.model&&r.jsx("span",{className:"mono muted",style:{fontSize:11.5},title:"Model",children:C.model}),(m==="running"||m==="paused")&&r.jsxs("button",{className:"btn btn-destructive btn-sm",onClick:me,disabled:h,children:[r.jsx(z,{name:"cancel",size:12}),"Cancel"]}),m==="completed"&&r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>i("artifacts"),children:[r.jsx(z,{name:"box",size:12}),"Inspect artifacts"]})]}),m==="failed"&&j?.errorMessage&&r.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--error-soft)",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx("span",{style:{color:"var(--error)",flexShrink:0},children:r.jsx(z,{name:"cancel",size:16})}),r.jsxs("div",{className:"grow",children:[r.jsx("div",{style:{fontWeight:600,fontSize:13,color:"var(--error)"},children:"Run failed"}),r.jsx("div",{className:"secondary mono",style:{fontSize:12,marginTop:1,whiteSpace:"pre-wrap"},children:j.errorMessage})]})]}),m==="paused"&&r.jsxs("div",{className:"row gap-12",style:{padding:"12px 16px",background:"var(--warn-soft)",borderBottom:"1px solid var(--border-subtle)",flexWrap:"wrap"},children:[r.jsx("span",{style:{color:"var(--warn)",flexShrink:0},children:r.jsx(z,{name:"pause",size:18})}),r.jsxs("div",{className:"grow",style:{minWidth:220},children:[r.jsx("div",{style:{fontWeight:600,fontSize:13},children:"Approval required"}),r.jsx("div",{className:"secondary",style:{fontSize:12,marginTop:1},children:K?.message??"The run paused at an approval gate."})]}),c?r.jsxs(r.Fragment,{children:[r.jsx("input",{className:"input",autoFocus:!0,placeholder:"Reason (optional)…","aria-label":"Rejection reason",value:u,onChange:D=>f(D.target.value),style:{width:200}}),r.jsx("button",{className:"btn btn-destructive btn-sm",onClick:Re,disabled:h,children:"Confirm reject"}),r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>d(!1),children:"Back"})]}):r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>i("artifacts"),children:"Inspect artifacts"}),r.jsx("button",{className:"btn btn-destructive btn-sm",onClick:()=>d(!0),disabled:h,children:"Reject"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:_e,disabled:h,children:[r.jsx(z,{name:"check",size:13}),"Approve"]})]})]}),v&&r.jsxs("div",{className:"row gap-8",style:{padding:"8px 16px",background:"var(--error-soft)",color:"var(--error)",fontSize:12,borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(z,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:v})]}),k.length>0&&r.jsx(hg,{nodes:k}),r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{className:"row gap-2",style:{padding:"8px 14px 0",borderBottom:"1px solid var(--border-subtle)"},children:["events","artifacts"].map(D=>r.jsxs("button",{onClick:()=>i(D),style:{padding:"7px 13px",border:"none",background:"transparent",cursor:"pointer",fontSize:12.5,fontWeight:500,textTransform:"capitalize",color:a===D?"var(--text-primary)":"var(--text-muted)",borderBottom:`2px solid ${a===D?"var(--accent)":"transparent"}`,marginBottom:-1},children:[D,D==="events"&&x&&r.jsx("span",{className:"pill",style:{marginLeft:6,fontSize:9,background:"var(--info-soft)",color:"var(--info)"},children:"live"})]},D))}),a==="events"&&r.jsx(gg,{events:y,live:x}),a==="artifacts"&&r.jsx(vg,{artifacts:Je.data?.artifacts??[],loading:Je.loading})]})]})}const jg=["running","paused","completed","failed","cancelled"];function ir(e){if(e==null)return null;const t=typeof e=="number"?e:new Date(String(e)).getTime();return Number.isFinite(t)?t:null}function wg(e){const t=ir(e.startedAt);if(!t)return"—";const n=ir(e.completedAt)??ir(e.finishedAt)??ir(e.lastActivityAt);return bp(n!==null?n-t:null)}function Sg({project:e,param:t}){return t?r.jsx(yg,{id:t,project:e}):r.jsx(bg,{project:e})}function bg({project:e}){const t=L(()=>P.runs(e),[e]),[n,s]=N.useState(null);if(Kt(t.error))return r.jsx(ue,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const l=t.data?.runs??[],o=n?l.filter(a=>a.status===n):l;return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 0"},children:r.jsx(Ae,{icon:"play",title:"Runs",sub:t.data?`${l.length} workflow runs`:"Loading runs…",actions:r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>B("workflows"),children:[r.jsx(z,{name:"play",size:13}),"Launch run"]})})}),r.jsx("div",{className:"row gap-6",style:{padding:"0 18px 12px"},children:r.jsx(Ce,{size:"sm",label:"Run status filter",value:n??"all",onChange:a=>s(a==="all"?null:a),options:[{value:"all",label:"All"},...jg.map(a=>({value:a,label:a[0].toUpperCase()+a.slice(1)}))]})}),t.data&&!l.length?r.jsx(ue,{icon:"play",title:"No runs yet",body:"Workflow runs started from the CLI or dashboard land here.",action:r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>B("workflows"),children:"Browse workflows"})}):r.jsx("div",{className:"scroll-y",style:{padding:"0 18px 18px"},children:r.jsxs("div",{className:"card",style:{overflow:"hidden"},children:[r.jsxs("div",{className:"row",style:{padding:"8px 14px",fontSize:10.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:[r.jsx("span",{style:{width:100},children:"Status"}),r.jsx("span",{className:"grow",children:"Workflow"}),r.jsx("span",{style:{width:90},children:"Duration"}),r.jsx("span",{style:{width:130},children:"Model"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Cost"}),r.jsx("span",{style:{width:60,textAlign:"right"},children:"When"})]}),o.map(a=>r.jsxs("div",{role:"button",tabIndex:0,className:"row list-row",onClick:()=>B("runs",{param:a.id}),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),B("runs",{param:a.id}))},style:{padding:"11px 14px",borderTop:"1px solid var(--border-subtle)",cursor:"pointer"},children:[r.jsx("span",{style:{width:100,flexShrink:0},children:r.jsx(Ge,{state:a.status})}),r.jsxs("div",{className:"grow row gap-8",style:{minWidth:0},children:[r.jsx("span",{className:"mono",style:{fontSize:12.5},children:String(a.workflowName??a.workflowId??"—")}),r.jsx("span",{className:"mono muted",style:{fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.id})]}),r.jsx("span",{className:"mono tabular muted",style:{width:90,flexShrink:0,fontSize:11.5},children:wg(a)}),r.jsx("span",{className:"mono muted",style:{width:130,flexShrink:0,fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.model??"—"}),r.jsx("span",{className:"mono tabular",style:{width:70,flexShrink:0,textAlign:"right",fontSize:12},children:Tl(a.totalCostUsd)}),r.jsx("span",{className:"mono muted tabular",style:{width:60,flexShrink:0,textAlign:"right",fontSize:11},children:Dr(ir(a.startedAt)??void 0)??"—"})]},a.id)),t.data&&!o.length&&r.jsx("div",{className:"muted",style:{padding:"14px",fontSize:12,borderTop:"1px solid var(--border-subtle)"},children:"No runs match this filter."})]})})]})}const rl=e=>e.split("/").filter(Boolean).pop()??e;function Np(e){return e>=85?{label:"Excellent",color:"var(--success)"}:e>=70?{label:"Good",color:"var(--node-route)"}:e>=50?{label:"Fair",color:"var(--warn)"}:{label:"Needs work",color:"var(--error)"}}function zp(e,t){const n=zl(e.text??""),s=/REQ-[A-Z]+-\d+|[a-z][a-zA-Z]+[A-Z][a-zA-Z]+|[\w/]+\.(ts|tsx|js|jsx|md|py|rs|go)/.test(n),l=/^(read |grep |look |check |explain |tell me|why |what )/i.test(n.trim()),o=n.length>=45&&!l||n.length>=72,a=e.input_tokens+e.cache_creation_tokens+e.cache_read_tokens,i=a>0&&e.cache_read_tokens/a>=.5,c=t.some(f=>["Bash","Grep","Read"].includes(f.tool_name)&&(f.result_length??0)>3e4),d=t.some(f=>f.tool_name.includes("specship_"));let u=62;return u+=s?12:-10,u+=o?10:-9,u+=i?8:-10,u+=d||!c?9:-13,u=Math.max(14,Math.min(98,Math.round(u))),{score:u,...Np(u)}}const xs=[{key:"input",label:"Input",color:"var(--node-spec)"},{key:"output",label:"Output",color:"var(--node-code)"},{key:"cacheCreate",label:"Cache write",color:"var(--warn)"},{key:"cacheRead",label:"Cache read",color:"var(--node-route)"}],kg=e=>({input:e.input_tokens,output:e.output_tokens,cacheCreate:e.cache_creation_tokens,cacheRead:e.cache_read_tokens});function Ng({query:e}){const[t,n]=N.useState(e.sel||null);return t?r.jsx(Eg,{id:t,onBack:()=>n(null)}):r.jsx(zg,{onOpen:n})}function zg({onOpen:e}){const[t,n]=N.useState("week"),[s,l]=N.useState(""),[o,a]=N.useState(""),[i,c]=N.useState("cost"),d=L(()=>P.claudeStats(),[]),u=L(()=>P.claudeProjects(),[]),f=L(()=>P.claudeSessions(s||null,200,t,o||null),[s,o,t]),[h,g]=N.useState([]);N.useEffect(()=>{if(o||!f.data)return;const j=new Set;for(const m of f.data.sessions)m.last_model&&j.add(m.last_model);g([...j].sort())},[o,f.data]);const v=d.data?.sessionCount===0,p=()=>{d.reload(),f.reload(),u.reload()};return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsx("div",{style:{padding:"16px 18px 12px"},children:r.jsx(Ae,{icon:"sessions",title:"Sessions",sub:f.data?`${f.data.sessions.length} sessions · ${s?rl(s):"across all projects"}`:"Loading sessions…",actions:r.jsx(kl,{value:t,onChange:n})})}),v?r.jsx(Fn,{onIngested:p}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row gap-8",style:{padding:"0 18px 12px"},children:[r.jsx(z,{name:"filter",size:13,style:{color:"var(--text-muted)"}}),r.jsxs("select",{className:"input","aria-label":"Project filter",value:s,onChange:j=>l(j.target.value),style:{fontSize:12,padding:"4px 8px"},children:[r.jsx("option",{value:"",children:"All projects"}),(u.data?.projects??[]).map(j=>r.jsx("option",{value:j.path,children:j.name||rl(j.path)},j.path))]}),r.jsxs("select",{className:"input","aria-label":"Model filter",value:o,onChange:j=>a(j.target.value),style:{fontSize:12,padding:"4px 8px"},children:[r.jsx("option",{value:"",children:"All models"}),h.map(j=>r.jsx("option",{value:j,children:j},j))]}),r.jsx("div",{className:"grow"}),r.jsx("span",{className:"muted",style:{fontSize:11.5},children:"sort"}),r.jsx(Ce,{size:"sm",label:"Sort sessions",value:i,onChange:c,options:[{value:"cost",label:"Cost"},{value:"prompts",label:"Prompts"}]})]}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"0 18px 18px"},children:r.jsx(ae,{state:f,label:"sessions",minHeight:220,children:j=>r.jsx(Cg,{sessions:j.sessions,sort:i,onOpen:e})})})]})]})}function Cg({sessions:e,sort:t,onOpen:n}){const s=[...e].sort((o,a)=>t==="prompts"?(a.prompt_count??0)-(o.prompt_count??0):(a.total_cost_usd??0)-(o.total_cost_usd??0));if(!s.length)return r.jsx("div",{className:"muted",style:{fontSize:12,padding:"14px 4px"},children:"No sessions in this range for these filters."});const l={fontSize:10.5,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600};return r.jsxs("div",{className:"card",style:{overflow:"hidden"},children:[r.jsxs("div",{className:"row",style:{padding:"8px 14px",borderBottom:"1px solid var(--border-subtle)",...l},children:[r.jsx("span",{style:{width:90},children:"Session"}),r.jsx("span",{style:{width:110},children:"Project"}),r.jsx("span",{className:"grow",children:"Window"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Prompts"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Cache"}),r.jsx("span",{style:{width:70,textAlign:"right"},children:"Cost"})]}),s.map(o=>{const a=up(o);return r.jsxs("div",{className:"row list-row",role:"button",tabIndex:0,onClick:()=>n(o.id),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),n(o.id))},style:{padding:"11px 14px",borderTop:"1px solid var(--border-subtle)",cursor:"pointer"},children:[r.jsx("span",{className:"mono",style:{width:90,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingRight:8},children:o.id.slice(0,8)}),r.jsx("span",{style:{width:110,overflow:"hidden"},children:r.jsx(re,{children:rl(o.project_path)})}),r.jsxs("span",{className:"mono muted grow",style:{fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[pp(o.started_at)," – ",oi(o.ended_at)," · ",o.last_model?o.last_model:"—"]}),r.jsx("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12},children:o.prompt_count??0}),r.jsxs("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12,color:Hr(a)},children:[Math.round(a*100),"%"]}),r.jsxs("span",{className:"mono tabular",style:{width:70,textAlign:"right",fontSize:12.5,fontWeight:600},children:["$",(o.total_cost_usd??0).toFixed(2)]})]},o.id)})]})}function Eg({id:e,onBack:t}){const n=L(()=>P.claudeSession(e),[e]),s=L(()=>P.claudeSessionSummary(e),[e]);return r.jsx(ae,{state:n,label:"session detail",minHeight:320,children:l=>{const o=l.session,a=new Map;for(const p of l.toolCalls){if(!p.prompt_id)continue;const j=a.get(p.prompt_id)??[];j.push(p),a.set(p.prompt_id,j)}const i=up(o),c=l.prompts.filter(p=>p.is_sidechain).reduce((p,j)=>p+(j.cost_usd??0),0);Math.max(...l.prompts.map(p=>p.cost_usd??0),0);const d={input:0,output:0,cacheCreate:0,cacheRead:0};for(const p of l.prompts){const j=kg(p);for(const m of xs)d[m.key]+=j[m.key]}const u=xs.reduce((p,j)=>p+d[j.key],0)||1,f=l.prompts.map(p=>zp(p,a.get(p.id)??[]).score),h=f.length?Math.round(f.reduce((p,j)=>p+j,0)/f.length):0,g=Np(h),v=f.filter(p=>p<60).length;return r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18,minWidth:0},children:[r.jsxs("div",{className:"row gap-10",style:{marginBottom:14},children:[r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:t,children:[r.jsx(z,{name:"chevronLeft",size:14}),"Sessions"]}),r.jsx("span",{className:"mono",style:{fontSize:16,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.id.slice(0,12)}),r.jsx(re,{color:"var(--node-spec)",bg:"var(--node-spec-soft)",children:rl(o.project_path)}),o.last_model&&r.jsx(re,{children:o.last_model})]}),r.jsxs("div",{className:"row",style:{gap:24,padding:"12px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)",marginBottom:16,flexWrap:"wrap"},children:[r.jsx(tr,{label:"Cost",value:"$"+(o.total_cost_usd??0).toFixed(2)}),r.jsx(tr,{label:"Prompts",value:o.prompt_count??l.prompts.length}),r.jsx(tr,{label:"Cache hit",value:Math.round(i*100)+"%",color:Hr(i)}),r.jsx(tr,{label:"Subagent $",value:"$"+c.toFixed(2),color:"var(--node-code)"}),r.jsx(tr,{label:"Window",value:pp(o.started_at)+" – "+oi(o.ended_at)})]}),r.jsxs("div",{className:"row",style:{justifyContent:"space-between",marginBottom:8},children:[r.jsxs("div",{className:"eyebrow",children:["Prompt timeline · ",l.prompts.length]}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"dot = prompt quality"})]}),r.jsxs("div",{className:"col gap-6",children:[l.prompts.map(p=>r.jsx(Tg,{p,tools:a.get(p.id)??[]},p.id)),!l.prompts.length&&r.jsx("div",{className:"muted",style:{fontSize:12,padding:8},children:"No prompts recorded for this session."})]}),r.jsx("div",{style:{height:20}})]}),r.jsxs("div",{className:"scroll-y",style:{width:290,flexShrink:0,borderLeft:"1px solid var(--border-subtle)",background:"var(--bg-panel)",padding:16},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:10},children:"Token mix"}),r.jsx("div",{className:"row",style:{height:10,borderRadius:999,overflow:"hidden",marginBottom:10},children:xs.map(p=>r.jsx("div",{style:{width:d[p.key]/u*100+"%",height:"100%",background:p.color}},p.key))}),r.jsx("div",{className:"col gap-6",style:{marginBottom:20},children:xs.map(p=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{style:{width:9,height:9,borderRadius:2,background:p.color,flexShrink:0}}),r.jsx("span",{className:"muted grow",style:{fontSize:11.5},children:p.label}),r.jsx("span",{className:"mono tabular",style:{fontSize:11.5},children:U(d[p.key])}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10,width:32,textAlign:"right"},children:[Math.round(d[p.key]/u*100),"%"]})]},p.key))}),r.jsxs("div",{style:{background:"var(--success-soft)",border:"1px solid rgba(70,194,107,0.25)",borderRadius:8,padding:"10px 12px",marginBottom:20},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx(z,{name:"database",size:13,style:{color:"var(--success)"}}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"Cache effectiveness"})]}),r.jsxs("div",{className:"row",style:{alignItems:"baseline",gap:8,marginTop:4},children:[r.jsxs("span",{className:"tabular",style:{fontSize:24,fontWeight:700,color:"var(--success)"},children:[Math.round(i*100),"%"]}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"of input served from cache"})]})]}),f.length>0&&r.jsxs("div",{style:{background:`color-mix(in srgb, ${g.color} 7%, var(--bg-canvas))`,border:`1px solid color-mix(in srgb, ${g.color} 30%, transparent)`,borderRadius:8,padding:"10px 12px",marginBottom:20},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:8},children:[r.jsx(z,{name:"sparkles",size:13,style:{color:g.color}}),r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"Avg prompt quality"})]}),r.jsxs("div",{className:"row",style:{alignItems:"baseline",gap:8},children:[r.jsx("span",{className:"tabular",style:{fontSize:24,fontWeight:700,color:g.color},children:h}),r.jsxs("span",{className:"muted",style:{fontSize:10.5},children:["/100 · ",g.label]})]}),r.jsx("div",{style:{margin:"8px 0 2px"},children:r.jsx(Fr,{frac:h/100,color:g.color,height:5})}),v>0&&r.jsxs("div",{className:"muted",style:{fontSize:10.5,marginTop:7},children:[r.jsxs("span",{style:{color:"var(--warn)"},children:[v," prompt",v>1?"s":""]})," could be improved — name a symbol, file or REQ id"]})]}),r.jsx(_g,{summaryState:s})]})]})}})}function Tg({p:e,tools:t}){const n=zp(e,t),s=e.input_tokens+e.output_tokens+e.cache_creation_tokens+e.cache_read_tokens,l=e.input_tokens+e.cache_creation_tokens+e.cache_read_tokens,o=l>0?e.cache_read_tokens/l:0,a=(e.cost_usd??0)>2.5;return r.jsxs("div",{className:"row gap-10 list-row",style:{padding:"11px 12px",borderRadius:8,background:"var(--bg-panel)",border:"1px solid var(--border-subtle)"},children:[r.jsx("span",{className:"mono muted",style:{fontSize:10.5,width:52,flexShrink:0},children:oi(e.ts)}),r.jsx("span",{title:`Prompt quality: ${n.label} (${n.score}/100)`,style:{width:8,height:8,borderRadius:"50%",background:n.color,flexShrink:0,boxShadow:`0 0 6px ${n.color}66`}}),r.jsxs("span",{className:"grow",style:{fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[!!e.is_sidechain&&r.jsxs(re,{color:"var(--node-code)",bg:"var(--node-code-soft)",children:[r.jsx(z,{name:"bot",size:10}),"subagent"]}),!!e.is_sidechain&&" ",zl(e.text??"")||r.jsx("span",{className:"muted",children:"(no text)"})]}),r.jsxs("span",{className:"row gap-4",style:{flexShrink:0},children:[r.jsx(z,{name:"wrench",size:11,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11},children:t.length})]}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11,width:50,textAlign:"right",flexShrink:0},children:U(s)}),r.jsxs("span",{className:"mono tabular",style:{fontSize:11,width:38,textAlign:"right",flexShrink:0,color:Hr(o)},children:[Math.round(o*100),"%"]}),r.jsxs("span",{className:"mono tabular",style:{fontSize:13,fontWeight:600,width:54,textAlign:"right",flexShrink:0,color:a?"var(--error)":"var(--text-primary)"},children:["$",(e.cost_usd??0).toFixed(2)]})]})}function _g({summaryState:e}){return r.jsx(ae,{state:e,label:"session summary",minHeight:120,children:t=>{const n=t.byTool.map(s=>({name:s.name,calls:s.calls,totalBytes:s.totalBytes}));return r.jsxs(r.Fragment,{children:[(t.slashCommands.length>0||t.skills.length>0)&&r.jsxs("div",{style:{marginBottom:20},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:10},children:"Commands & skills"}),r.jsxs("div",{className:"row gap-6",style:{flexWrap:"wrap"},children:[t.slashCommands.map(s=>r.jsxs("span",{className:"pill",style:{color:"var(--node-code)",background:"var(--node-code-soft)",fontFamily:"var(--font-mono)",fontWeight:500},children:[r.jsx(z,{name:"command",size:10}),s.name,s.count>1&&r.jsxs("span",{style:{opacity:.7},children:["×",s.count]})]},s.name)),t.skills.map(s=>r.jsxs("span",{className:"pill",style:{color:"var(--node-test)",background:"var(--node-test-soft)",fontFamily:"var(--font-mono)",fontWeight:500},children:[r.jsx(z,{name:"sparkles",size:10}),s.name,s.count>1&&r.jsxs("span",{style:{opacity:.7},children:["×",s.count]})]},s.name))]})]}),r.jsxs("div",{className:"eyebrow",style:{marginBottom:10},children:["Tools used · ",t.byTool.length]}),t.byTool.length?r.jsxs(r.Fragment,{children:[r.jsx(ii,{items:n,valueKey:"totalBytes",labelKey:"name",fmt:s=>U(s),color:s=>Number(s.totalBytes)>6e4?"var(--error)":Number(s.totalBytes)>2e4?"var(--warn)":"var(--node-code)"}),r.jsx("div",{className:"muted",style:{fontSize:10,marginTop:8},children:"bar = result tokens returned"})]}):r.jsx("div",{className:"muted",style:{fontSize:11.5},children:"No tool calls recorded."}),t.filesTouched.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"eyebrow",style:{margin:"20px 0 10px"},children:["Files touched · ",t.filesTouched.length]}),r.jsx("div",{className:"col gap-5",children:t.filesTouched.slice(0,10).map(s=>r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:10.5,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:"rtl",textAlign:"left",flex:1},title:s.path,children:s.path}),r.jsxs("span",{className:"mono tabular muted",style:{fontSize:10,flexShrink:0},children:["×",s.ops]}),r.jsx("span",{className:"pill",style:{fontSize:9.5,flexShrink:0},children:s.lastOp})]},s.path))})]}),t.durationMs>0&&r.jsxs("div",{className:"row gap-8",style:{marginTop:20},children:[r.jsx(z,{name:"clock",size:12,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"muted",style:{fontSize:11},children:"duration"}),r.jsx("span",{className:"mono tabular",style:{fontSize:11.5},children:Fm(t.durationMs)})]})]})}})}const Cp="specship-density",Ep="specship-boot-anim",Tp="specship-editor",Rg="specship-booted";function _p(){try{if(localStorage.getItem(Cp)==="compact")return"compact"}catch{}return"comfortable"}function Rp(e){document.documentElement.setAttribute("data-density",e);try{localStorage.setItem(Cp,e)}catch{}window.dispatchEvent(new Event("specship-density"))}function Mg(){try{return localStorage.getItem(Ep)!=="0"}catch{}return!0}function Pg(e){try{localStorage.setItem(Ep,e?"1":"0")}catch{}window.dispatchEvent(new Event("specship-prefs"))}const Mp=[{value:"code",label:"code (VS Code)"},{value:"subl",label:"subl (Sublime)"},{value:"cursor",label:"cursor"},{value:"nvim",label:"nvim"}];function Lg(){try{const e=localStorage.getItem(Tp);if(Mp.some(t=>t.value===e))return e}catch{}return"code"}function Dg(e){try{localStorage.setItem(Tp,e)}catch{}window.dispatchEvent(new Event("specship-prefs"))}function rr({icon:e,title:t,children:n}){return r.jsxs("div",{className:"card card-pad",style:{marginBottom:14},children:[r.jsxs("div",{className:"row gap-8",style:{marginBottom:12},children:[r.jsx(z,{name:e,size:15,style:{color:"var(--text-secondary)"}}),r.jsx("div",{style:{fontSize:13,fontWeight:600},children:t})]}),n]})}function io({label:e,hint:t,children:n}){return r.jsxs("div",{style:{padding:"8px 0"},children:[r.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"baseline",marginBottom:6},children:[r.jsx("div",{style:{fontSize:12.5,fontWeight:500},children:e}),t&&r.jsx("div",{className:"muted",style:{fontSize:11},children:t})]}),n]})}function Wc({label:e,desc:t,on:n,onClick:s,busy:l}){return r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:"8px 0"},children:[r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:12.5,fontWeight:500},children:e}),r.jsx("div",{className:"muted",style:{fontSize:11},children:t})]}),r.jsx("button",{role:"switch","aria-checked":n,"aria-label":e,disabled:l,onClick:s,style:{width:38,height:22,borderRadius:11,border:"none",cursor:l?"wait":"pointer",background:n?"var(--accent)":"var(--bg-elevated)",position:"relative",flexShrink:0,transition:"background var(--motion-fast)",opacity:l?.6:1},children:r.jsx("span",{style:{position:"absolute",top:2,left:n?18:2,width:18,height:18,borderRadius:"50%",background:"#fff",transition:"left var(--motion-fast)"}})})]})}function Xt({label:e,value:t,color:n}){return r.jsxs("div",{className:"row",style:{justifyContent:"space-between",padding:"6px 0",fontSize:12.5},children:[r.jsx("span",{className:"muted",children:e}),r.jsx("span",{className:"mono",style:{color:n??"var(--text-primary)"},children:t})]})}function Og(e){const[t,n]=N.useState(Sl),[s,l]=N.useState(_p),[o,a]=N.useState(Mg),[i,c]=N.useState(Lg),d=L(()=>P.status(e.project),[e.project]),u=km(),[f,h]=N.useState(!1),[g,v]=N.useState(null),p=S=>{const k=S;n(k),bl(k)},j=S=>{const k=S;l(k),Rp(k)},m=()=>{const S=!o;a(S),Pg(S)},x=S=>{const k=S;c(k),Dg(k)},y=async()=>{const S=!(u.data?.ingestEnabled??!1);h(!0),v(null);try{await P.config.set({ingestEnabled:S}),u.reload()}catch(k){v(k instanceof Error?k.message:"Failed to save")}finally{h(!1)}},w=()=>{try{sessionStorage.removeItem(Rg)}catch{}location.reload()};return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:22},children:[r.jsx(Ae,{icon:"settings",title:"Settings"}),r.jsxs("div",{style:{maxWidth:640},children:[r.jsxs(rr,{icon:"sparkles",title:"Appearance",children:[r.jsx(io,{label:"Theme",hint:"Dark, light, or follow your OS",children:r.jsx(Ce,{value:t,onChange:p,options:[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}]})}),r.jsx(io,{label:"Density",hint:"Row height & padding",children:r.jsx(Ce,{value:s,onChange:j,options:[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}]})}),r.jsx(Wc,{label:"Boot animation",desc:"The graph-assembly splash on app launch",on:o,onClick:m}),!o&&r.jsx("div",{style:{paddingTop:4},children:r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:w,children:[r.jsx(z,{name:"refresh",size:13})," Replay intro"]})})]}),r.jsxs(rr,{icon:"sessions",title:"Claude Code",children:[r.jsx(Wc,{label:"Enable transcript ingest",desc:"Read JSONL transcripts from ~/.claude/projects for analytics",on:u.data?.ingestEnabled??!1,onClick:y,busy:f||u.loading}),g&&r.jsx("div",{style:{fontSize:11.5,color:"var(--error)",padding:"4px 0"},children:g}),f&&r.jsx("div",{className:"muted",style:{fontSize:11.5,padding:"4px 0"},children:"Saving…"})]}),r.jsx(rr,{icon:"reveal",title:"Editor",children:r.jsx(io,{label:"Open files with",hint:"Used by Reveal / Open in editor",children:r.jsx(Ce,{value:i,onChange:x,options:Mp.map(S=>({value:S.value,label:S.label}))})})}),r.jsx(rr,{icon:"database",title:"Backend",children:r.jsx(ae,{state:d,label:"Backend",minHeight:120,children:S=>r.jsxs(r.Fragment,{children:[r.jsx(Xt,{label:"Database backend",value:S.backend}),r.jsx(Xt,{label:"Journal mode",value:S.journalMode}),r.jsx(Xt,{label:"Project root",value:r.jsx("span",{title:S.projectPath,children:S.projectPath})}),r.jsx(Xt,{label:"Indexed files",value:S.fileCount.toLocaleString()})]})})}),r.jsx(rr,{icon:"graph",title:"About",children:r.jsx(ae,{state:d,label:"About",minHeight:90,children:S=>r.jsxs(r.Fragment,{children:[r.jsx(Xt,{label:"Version",value:`v${S.version}`}),r.jsx(Xt,{label:"Backend",value:S.backend,color:"var(--success)"}),r.jsx(Xt,{label:"MCP server",value:"running",color:"var(--success)"})]})})})]})]})}const Pp=/^\s*<!--\s*id\s*:\s*([^\s-][^\s]*)\s*-->\s*$/,gs=/^(#{1,6})\s+(.+?)\s*$/,$c=/^\s*[-*]\s+(.*\S)\s*$/,en=e=>e.replace(/\r$/,""),vs=e=>en(e).match(Pp)?.[1]??null;function Lp(e,t){const n=e.findIndex(p=>vs(p)===t);if(n===-1)return null;let s=-1,l=2,o="";for(let p=n+1;p<e.length;p++){const j=en(e[p]);if(j.trim()==="")continue;const m=j.match(gs);m&&m[1]&&m[2]&&(s=p,l=m[1].length,o=m[2]);break}if(s===-1)return null;let a=e.length;for(let p=s+1;p<e.length;p++){const j=vs(e[p]);if(j&&j!==t&&!j.startsWith(t+".")){a=p;break}}let i=-1,c=-1;for(let p=s+1;p<a;p++){const j=en(e[p]),m=j.match(gs);if(m&&m[2]&&m[2].trim().toLowerCase()==="acceptance"||vs(e[p])){i=p;break}c===-1&&j.trim().startsWith("implementations:")&&(c=p)}const d=c!==-1?c:i!==-1?i:a,u=e.slice(s+1,d).map(en).join(`
|
|
47
|
+
`).trim(),f=i!==-1?i:a,h=c!==-1?e.slice(c,f):[];for(;h.length&&en(h[h.length-1]).trim()==="";)h.pop();const g=[];let v=null;if(i!==-1){let p=null;for(let j=i;j<a;j++){const m=en(e[j]),x=vs(e[j]);if(x){p=x;continue}const y=m.match(gs);if(y&&y[2]&&y[2].trim().toLowerCase()==="acceptance"){v===null&&(v=m);continue}const w=m.match($c);if(w&&w[1]){const S=[w[1].trim()];for(;j+1<a;){const k=en(e[j+1]);if(k.trim()===""||Pp.test(k)||gs.test(k)||$c.test(k))break;S.push(k.trim()),j++}g.push({id:p??"",text:S.join(" ").trim()}),p=null}}}return{start:n,end:a,headingIdx:s,headingLevel:l,title:o,statement:u,middle:h,acceptanceHeading:v,criteria:g}}function Dp(e,t){const n=Lp(e.split(`
|
|
48
|
+
`),t);if(!n)return null;const{title:s,headingLevel:l,statement:o,criteria:a}=n;return{title:s,headingLevel:l,statement:o,criteria:a}}function Ig(e){return{title:e.title.trim(),statement:e.statement.trim(),criteria:e.criteria.map(t=>({text:t.text.trim()})).filter(t=>t.text.length>0)}}function Ag(e,t,n){const s=e.split(`
|
|
49
|
+
`),l=Lp(s,t);if(!l)return null;const o=[s[l.start],"#".repeat(l.headingLevel)+" "+n.title,""];return n.statement&&o.push(...n.statement.split(`
|
|
50
|
+
`),""),l.middle.length&&o.push(...l.middle,""),n.criteria.length&&(o.push(l.acceptanceHeading??"## Acceptance"),n.criteria.forEach((a,i)=>{o.push(`<!-- id: ${t}.A${i+1} -->`,`- ${a.text}`)}),o.push("")),[...s.slice(0,l.start),...o,...s.slice(l.end)].join(`
|
|
51
|
+
`)}function Rs(e){let t=String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return t=t.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),t=t.replace(/`([^`]+?)`/g,"<code class='sp-code'>$1</code>"),t=t.replace(/\b(MUST NOT|MUST|SHALL NOT|SHALL|REQUIRED)\b/g,"<span class='sp-kw sp-kw-must'>$1</span>"),t=t.replace(/\b(SHOULD NOT|SHOULD|RECOMMENDED)\b/g,"<span class='sp-kw sp-kw-should'>$1</span>"),t=t.replace(/\b(MAY|OPTIONAL)\b/g,"<span class='sp-kw sp-kw-may'>$1</span>"),t}const Bg=new Set(["verified","implemented","completed"]);function sl(e,t){if(!e||!e.length)return t;const n=e.map(s=>s.state);return n.includes("broken")?"broken":n.includes("orphaned")?"orphaned":n.includes("drifted")?"drifted":n.every(s=>s==="verified")?"verified":"implemented"}const Wg={verified:"check",implemented:"check",completed:"check",drifted:"drift",broken:"cancel",orphaned:"cancel",failed:"cancel"};function $g({state:e}){const t=fe[e]??fe.info,n=Wg[e];return r.jsx("div",{className:"sp-crit-mark",style:{background:t.bg,color:t.color},children:n?r.jsx(z,{name:n,size:12}):r.jsx("span",{style:{width:7,height:7,borderRadius:"50%",border:"1.6px solid "+t.color,boxSizing:"border-box"}})})}function Fc(e){const t=e.lastIndexOf(".");return t===-1?e:e.slice(t+1)}function Fg(e){return fe[e]?.label??e}function Hg({id:e,project:t,cache:n}){return e?r.jsx(Vg,{id:e,project:t,cache:n}):r.jsx(Ug,{})}function Ug(){return r.jsx(ue,{icon:"book",title:"Pick a spec from the tree",body:"Or run specship init -i to index your specs/ folder if you haven’t yet.",action:r.jsxs("span",{className:"row gap-6",style:{justifyContent:"center"},children:[r.jsx("code",{className:"mono",style:{fontSize:11.5,color:"var(--accent)",background:"var(--bg-canvas)",padding:"5px 10px",borderRadius:6,border:"1px solid var(--border-subtle)"},children:"specship init -i"}),r.jsx(pt,{text:"specship init -i"})]})})}function Vg({id:e,project:t,cache:n}){const s=(t??"")+"|"+e,l=L(async()=>{const u=await P.spec(e,t);return n?.set(s,u),u},[e,t]),o=l.data??n?.get(s)??null,[a,i]=N.useState(!1),[c,d]=N.useState(null);return N.useEffect(()=>{i(!1),d(null)},[e]),o?a?r.jsx(rv,{data:o,project:t,onCancel:()=>i(!1),onSaved:u=>{i(!1),d(u),l.reload()}}):r.jsx(Qg,{data:o,notice:c,onEdit:()=>{d(null),i(!0)}}):l.loading?r.jsx(Kg,{}):Kt(l.error)?r.jsx(ue,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."}):r.jsx(ue,{icon:"drift",title:`Couldn’t load ${e}`,body:l.error instanceof Error?l.error.message:"The spec detail request failed.",action:r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:l.reload,children:[r.jsx(z,{name:"refresh",size:13}),"Retry"]})})}function Kg(){return r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"28px 32px 56px"},"data-testid":"spec-skeleton",children:r.jsxs("div",{className:"sp-doc",children:[r.jsx("div",{className:"skel",style:{width:230,height:12,marginBottom:20}}),r.jsx("div",{className:"skel",style:{width:"72%",height:28,marginBottom:16}}),r.jsx("div",{className:"skel",style:{width:340,height:20,marginBottom:32}}),r.jsx("div",{className:"skel",style:{width:"100%",height:96,marginBottom:30}}),r.jsx("div",{className:"skel",style:{width:"100%",height:132,marginBottom:30}}),r.jsx("div",{className:"skel",style:{width:"100%",height:56}})]})})}function Qg({data:e,notice:t,onEdit:n}){const{spec:s,parent:l,children:o,links:a,childLinks:i}=e,c=l?.sourcePath??s.sourcePath??"",d=e.source!=null&&Dp(e.source,s.id)!=null,u=d?"Edit this requirement in place":e.source==null?"Source file not available":"Couldn’t locate this requirement’s section in the source file",f=o.filter(k=>k.kind==="acceptance"),h=k=>sl(i[k.id],"pending"),g=sl(a,"drafted"),v=f.filter(k=>Bg.has(h(k))).length,p=(fe[g]??fe.info).color,j=g==="verified"?Dr(a.reduce((k,C)=>Math.max(k,C.updatedAt??0),0)||void 0):null,m=g==="verified"?"var(--success)":g==="broken"||g==="drifted"||g==="orphaned"?"var(--warn)":"var(--text-secondary)",x=typeof s.metadata?.rationale=="string"?s.metadata.rationale:typeof s.rationale=="string"?s.rationale:null,y=k=>[k.targetFilePath,k.targetQualifiedName].filter(Boolean).join(":")||"—",w=k=>B("graph",{query:{focus:k.resolvedNodeId||"spec:"+s.id}}),S=r.jsx("span",{className:"sep"});return r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"28px 32px 56px"},children:r.jsxs("div",{className:"sp-doc",children:[t!=null&&r.jsxs("div",{className:"card card-pad row gap-8",style:{color:"var(--warn)",borderColor:"var(--warn)",marginBottom:20,fontSize:12.5},children:[r.jsx(z,{name:"drift",size:14,style:{flexShrink:0}}),r.jsxs("span",{children:["Saved, but not yet indexed — re-sync failed (",t,"). The file is on disk; the next sync picks it up."]})]}),r.jsxs("div",{className:"sp-breadcrumb",children:[r.jsx(z,{name:"book",size:13,style:{color:"var(--node-spec)",flexShrink:0}}),r.jsx("span",{className:"mono sp-path",style:{color:"var(--text-secondary)"},children:c}),r.jsx(z,{name:"chevronRight",size:11,style:{flexShrink:0}}),r.jsx("span",{className:"mono",style:{color:"var(--node-spec)",fontWeight:600,flexShrink:0},children:s.id}),r.jsx(pt,{text:s.id,ariaLabel:"Copy spec id"})]}),r.jsx("h1",{className:"sp-title",children:s.title}),r.jsxs("div",{className:"sp-metaline",style:{marginBottom:32},children:[r.jsx(Ge,{state:g,pulse:g==="broken"||g==="drifted"}),r.jsx(re,{children:s.priority||"—"}),S,r.jsx("span",{className:"fact",children:r.jsx("b",{children:s.kind||"requirement"})}),S,r.jsxs("span",{className:"fact",children:["owned by ",r.jsx("b",{className:"mono",children:s.owner||"—"})]}),S,r.jsxs("span",{className:"fact",children:[g==="verified"?"verified ":null,r.jsx("b",{style:{color:m},children:j?j+" ago":"—"})]})]}),r.jsxs("div",{className:"sp-sec",children:[r.jsx("div",{className:"sp-label",children:"Requirement"}),r.jsx("div",{className:"sp-statement lead",style:{"--sp-accent":p},children:s.body?.trim()?r.jsx("div",{className:"sp-prose",dangerouslySetInnerHTML:{__html:Rs(s.body)}}):r.jsx("div",{className:"muted",style:{fontSize:13},children:"No normative statement recorded."})})]}),x&&r.jsxs("div",{className:"sp-sec",children:[r.jsx("div",{className:"sp-label",children:"Why it matters"}),r.jsx("div",{className:"sp-rationale",dangerouslySetInnerHTML:{__html:Rs(x)}})]}),f.length>0&&r.jsxs("div",{className:"sp-sec",children:[r.jsxs("div",{className:"sp-label",children:["Acceptance criteria",r.jsx("span",{className:"ct tabular",style:{color:v===f.length?"var(--success)":"var(--text-muted)"},children:v+" / "+f.length+" met"})]}),r.jsx("div",{className:"row gap-4",style:{marginBottom:12},children:f.map(k=>{const C=h(k),_=fe[C]??fe.info;return r.jsx("div",{title:Fc(k.id)+" · "+Fg(C),style:{flex:1,height:4,borderRadius:999,background:_.color,opacity:C==="pending"?.25:.9}},k.id)})}),r.jsx("div",{className:"card",style:{overflow:"hidden"},children:f.map(k=>r.jsxs("div",{className:"sp-crit",children:[r.jsx($g,{state:h(k)}),r.jsx("span",{className:"sp-crit-id",children:Fc(k.id)}),r.jsx("span",{className:"sp-crit-text",dangerouslySetInnerHTML:{__html:Rs(k.body||k.title)}})]},k.id))})]}),r.jsxs("div",{className:"sp-sec",children:[r.jsxs("div",{className:"sp-label",children:["Linked code",a.length>0&&r.jsx("span",{className:"ct",children:a.length+(a.length===1?" symbol":" symbols")})]}),a.length?r.jsx("div",{className:"card",style:{overflow:"hidden"},children:a.map((k,C)=>r.jsxs("div",{className:"row gap-10",style:{padding:"11px 14px",borderTop:C?"1px solid var(--border-subtle)":"none"},children:[r.jsx(Ge,{state:k.state}),k.driftAxis&&r.jsx(re,{color:"var(--warn)",bg:"var(--warn-soft)",children:k.driftAxis+" drift"}),r.jsx("span",{className:"mono grow",style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y(k)}),r.jsx(re,{children:k.provenance||"—"}),r.jsxs("button",{className:"btn btn-ghost btn-xs",onClick:()=>w(k),title:"Reveal in the graph",children:[r.jsx(z,{name:"reveal",size:12}),"Reveal"]})]},C))}):r.jsxs("div",{className:"card card-pad",style:{textAlign:"center",color:"var(--error)",borderColor:"rgba(242,85,90,0.3)"},children:[r.jsx(z,{name:"drift",size:16}),r.jsx("div",{style:{marginTop:6,fontSize:12.5},children:"Orphaned — no code implements this requirement yet"})]})]}),r.jsxs("div",{className:"row gap-8",style:{flexWrap:"wrap",marginTop:4},children:[r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!0,title:"Run automatically by the implementation workflow once Drafted",children:[r.jsx(z,{name:"play",size:13}),"Implement"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",disabled:!0,title:"Run automatically by the verification workflow",children:[r.jsx(z,{name:"check",size:13}),"Verify"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",disabled:!d,title:u,onClick:d?n:void 0,children:[r.jsx(z,{name:"reveal",size:13}),"Edit spec"]}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>B("graph",{query:{focus:"spec:"+s.id}}),children:[r.jsx(z,{name:"graph",size:13}),"Show in graph"]})]})]})})}const Yg=["pending","implementing","implemented","verified","drifted","broken"],Gg=["P0","P1","P2","P3"],qg=["requirement","constraint","guideline","invariant","non-functional"];function Xg(e,t){const{spec:n,childLinks:s}=e,l=typeof n.metadata?.rationale=="string"?n.metadata.rationale:typeof n.rationale=="string"?n.rationale:"";return{title:t.title,priority:n.priority??"",kind:n.kind??"requirement",owner:n.owner??"",statement:t.statement,rationale:l,criteria:t.criteria.map(o=>({id:o.id,state:sl(s[o.id],"pending"),text:o.text}))}}const Jg={title:"",priority:"",kind:"requirement",owner:"",statement:"",rationale:"",criteria:[]};function mn({label:e,hint:t,children:n}){return r.jsxs("div",{style:{marginBottom:22},children:[r.jsx("label",{className:"sp-fl",children:e}),n,t&&r.jsx("div",{className:"muted",style:{fontSize:11,marginTop:6},children:t})]})}function Zg({value:e,onChange:t,options:n,label:s}){const l=n.includes(e)?n:[e,...n];return r.jsx("select",{className:"input sp-select","aria-label":s,value:e,onChange:o=>t(o.target.value),style:{width:"100%",textTransform:"capitalize"},children:l.map(o=>r.jsx("option",{value:o,children:o},o))})}function ev({value:e,onChange:t,options:n,width:s,label:l}){const o=fe[e]??fe.info;return r.jsxs("div",{className:"row",style:{position:"relative",width:s??"auto",flexShrink:0},children:[r.jsx("span",{className:"pill-dot","data-testid":"crit-state-dot",style:{background:o.color,position:"absolute",left:11,pointerEvents:"none",zIndex:1}}),r.jsx("select",{className:"input sp-select","aria-label":l,value:e,onChange:a=>t(a.target.value),style:{width:"100%",paddingLeft:26,textTransform:"capitalize"},children:n.map(a=>r.jsx("option",{value:a,children:fe[a]?.label??a},a))})]})}function tv({state:e}){return r.jsxs("div",{className:"sp-status-auto",children:[e==="drafted"?r.jsxs(r.Fragment,{children:[r.jsx(Ge,{state:"drafted"}),r.jsx("span",{className:"muted",style:{fontSize:12},children:"queued for implementation"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Ge,{state:e}),r.jsx(z,{name:"arrowRight",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx(Ge,{state:"drafted"})]}),r.jsx("span",{className:"grow"}),r.jsx(z,{name:"lock",size:12,style:{color:"var(--text-faint)",flexShrink:0}})]})}function nv({criteria:e,onChange:t}){const n=(s,l)=>t(e.map((o,a)=>a===s?{...o,...l}:o));return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"row",style:{marginBottom:10,gap:10},children:[r.jsx("span",{className:"eyebrow",children:"Acceptance criteria"}),r.jsx("span",{style:{flex:1,height:1,background:"var(--border-subtle)"}}),r.jsx("span",{className:"mono tabular muted",style:{fontSize:11.5},children:e.length+" total"})]}),r.jsx("div",{className:"card",style:{overflow:"hidden",marginBottom:12},children:e.length===0?r.jsx("div",{className:"muted",style:{fontSize:12.5,textAlign:"center",padding:"18px 14px"},children:"No criteria yet — add one below."}):e.map((s,l)=>r.jsxs("div",{className:"sp-crit-edit",children:[r.jsx("span",{className:"sp-crit-grip",children:r.jsx(z,{name:"grip",size:14})}),r.jsx("span",{className:"sp-crit-num",children:"A"+(l+1)}),r.jsx(ev,{value:s.state,onChange:o=>n(l,{state:o}),options:Yg,width:156,label:"Criterion A"+(l+1)+" state"}),r.jsx("input",{className:"input grow",style:{fontSize:13},value:s.text,"aria-label":"Criterion A"+(l+1)+" text",placeholder:"Observable, testable condition…",onChange:o=>n(l,{text:o.target.value})}),r.jsx("button",{className:"sp-icon-btn",title:"Remove criterion","aria-label":"Remove criterion A"+(l+1),onClick:()=>t(e.filter((o,a)=>a!==l)),children:r.jsx(z,{name:"trash",size:14})})]},l))}),r.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>t([...e,{id:"",state:"pending",text:""}]),children:[r.jsx(z,{name:"plus",size:13}),"Add criterion"]})]})}function rv({data:e,project:t,onCancel:n,onSaved:s}){const{spec:l}=e,o=e.parent?.sourcePath??l.sourcePath??"",a=N.useMemo(()=>Dp(e.source??"",l.id),[e.source,l.id]),[i,c]=N.useState(()=>a?Xg(e,a):Jg),d=N.useRef(JSON.stringify(i)),u=JSON.stringify(i)!==d.current,[f,h]=N.useState("write"),[g,v]=N.useState(!1),[p,j]=N.useState(null),m=k=>c(C=>({...C,...k})),x=sl(e.links,"drafted"),y=(fe[x]??fe.info).color;if(!a)return r.jsx(ue,{icon:"drift",title:"Can’t edit this spec",body:"Its requirement section couldn’t be located in the source file."});const w=async()=>{if(!u||g)return;const k=Ig({title:i.title,statement:i.statement,criteria:i.criteria}),C=Ag(e.source??"",l.id,k);if(C===null){j("Could not locate this requirement’s section in the source file.");return}v(!0),j(null);try{const _=await P.specSave(l.id,C,t);s(_.syncError??null)}catch(_){j(_ instanceof Error?_.message:String(_)),v(!1)}},S=r.jsxs("button",{className:"btn btn-primary btn-sm",disabled:!u||g,onClick:w,children:[r.jsx(z,{name:"check",size:13}),g?"Saving…":"Save changes"]});return r.jsxs("div",{className:"col",style:{flex:1,minHeight:0},children:[r.jsxs("div",{className:"sp-edit-bar",children:[r.jsx(z,{name:"reveal",size:15,style:{color:"var(--accent)",flexShrink:0}}),r.jsxs("div",{className:"col",style:{gap:1,minWidth:0},children:[r.jsx("div",{style:{fontSize:13,fontWeight:600},children:"Editing spec"}),r.jsx("div",{className:"mono muted",style:{fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o+" · "+l.id})]}),r.jsx("div",{className:"grow"}),u&&r.jsxs("div",{className:"row gap-6",style:{marginRight:4},children:[r.jsx("span",{className:"sp-dirty-dot"}),r.jsx("span",{className:"muted",style:{fontSize:11.5},children:"Unsaved changes"})]}),r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:n,children:[r.jsx(z,{name:"x",size:13}),"Cancel"]}),S]}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"24px 28px 56px"},children:r.jsxs("div",{style:{maxWidth:780},children:[p&&r.jsxs("div",{className:"card card-pad row gap-8",role:"alert",style:{color:"var(--error)",borderColor:"rgba(242,85,90,0.35)",marginBottom:18,fontSize:12.5},children:[r.jsx(z,{name:"cancel",size:14,style:{flexShrink:0}}),r.jsxs("span",{children:["Save failed — ",p," Your draft is intact."]})]}),r.jsx(mn,{label:"Title",children:r.jsx("input",{className:"input sp-input-lg",value:i.title,"aria-label":"Title",placeholder:"Short, imperative requirement title",onChange:k=>m({title:k.target.value})})}),r.jsxs("div",{className:"sp-edit-grid",children:[r.jsx(mn,{label:"Status",hint:"Set automatically — saving re-queues this spec as Drafted so the implementation workflow picks it up.",children:r.jsx(tv,{state:x})}),r.jsx(mn,{label:"Priority",children:r.jsx(Ce,{options:Gg,value:i.priority,onChange:k=>m({priority:k}),label:"Priority"})}),r.jsx(mn,{label:"Kind",children:r.jsx(Zg,{value:i.kind,onChange:k=>m({kind:k}),options:qg,label:"Kind"})}),r.jsx(mn,{label:"Owner",children:r.jsx("input",{className:"input mono",style:{width:"100%"},value:i.owner,"aria-label":"Owner",placeholder:"unassigned",onChange:k=>m({owner:k.target.value})})})]}),r.jsx("div",{className:"muted",style:{fontSize:11,margin:"-8px 0 22px"},children:"Priority, kind, and owner are document-level in the current spec format — they render from available data but aren’t persisted per-requirement yet."}),r.jsxs("div",{style:{marginBottom:22},children:[r.jsxs("div",{className:"row",style:{marginBottom:7},children:[r.jsx("label",{className:"sp-fl",style:{marginBottom:0},children:"Normative statement"}),r.jsx("div",{className:"grow"}),r.jsx(Ce,{size:"sm",options:[{value:"write",label:"Write"},{value:"preview",label:"Preview"}],value:f,onChange:h,label:"Statement editor mode"})]}),f==="write"?r.jsx("textarea",{className:"input sp-textarea",value:i.statement,spellCheck:!1,"aria-label":"Normative statement",placeholder:"The server MUST validate … (use MUST / SHOULD / MAY, **bold**, and `code`)",onChange:k=>m({statement:k.target.value})}):r.jsx("div",{className:"sp-statement",style:{"--sp-accent":y},children:i.statement.trim()?r.jsx("div",{className:"sp-prose",dangerouslySetInnerHTML:{__html:Rs(i.statement)}}):r.jsx("div",{className:"muted",style:{fontSize:13},children:"Nothing to preview yet."})}),r.jsxs("div",{className:"sp-kw-legend",children:[r.jsx("span",{className:"label",children:"Keywords:"}),r.jsx("span",{className:"sp-kw sp-kw-must",children:"MUST"}),r.jsx("span",{className:"sp-kw sp-kw-should",children:"SHOULD"}),r.jsx("span",{className:"sp-kw sp-kw-may",children:"MAY"}),r.jsx("span",{className:"label",style:{marginLeft:4},children:"auto-highlight as you type"})]})]}),r.jsx(mn,{label:"Rationale",hint:"Optional — why this requirement exists. Presentation-only today: the spec format carries no per-requirement rationale field.",children:r.jsx("textarea",{className:"input sp-textarea",value:i.rationale,spellCheck:!1,style:{minHeight:84},"aria-label":"Rationale",placeholder:"Why does this matter? What breaks without it?",onChange:k=>m({rationale:k.target.value})})}),r.jsx(nv,{criteria:i.criteria,onChange:k=>m({criteria:k})}),r.jsxs("div",{className:"row",style:{gap:10,marginTop:32,paddingTop:20,borderTop:"1px solid var(--border-subtle)"},children:[S,r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"}),r.jsx("div",{className:"grow"}),r.jsx("span",{className:"mono muted",style:{fontSize:11},children:u?"edited":"no changes"})]})]})})]})}function Hc(e){return t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e())}}function sv(e){const t=new Map,n=new Map(e.map(l=>[l.id,l])),s=(l,o)=>{let a=t.get(l);return a||(a={doc:o,path:l,reqs:[]},t.set(l,a)),o&&!a.doc&&(a.doc=o),a};for(const l of e)l.kind==="document"&&s(l.sourcePath??l.id,l);for(const l of e){if(l.kind!=="requirement")continue;const o=l.parentId?n.get(l.parentId):void 0,a=o?.sourcePath??l.sourcePath??"(unknown)";s(a,o?.kind==="document"?o:null).reqs.push(l)}return[...t.values()]}const lv=["verified","implemented","drifted","broken","orphaned"];function ov({project:e,param:t,query:n}){const s=L(()=>P.specs(e),[e]),[l,o]=N.useState(t??n.sel??null);N.useEffect(()=>{const p=t??n.sel;p&&o(p)},[t,n.sel]);const[a,i]=N.useState(new Set),c=N.useRef(new Map).current,d=N.useMemo(()=>sv(s.data?.specs??[]),[s.data]),u=s.data?.linkStates??{};if(Kt(s.error))return r.jsx(ue,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const f=d.reduce((p,j)=>p+j.reqs.length,0),h={};for(const p of d)for(const j of p.reqs){const m=u[j.id];m&&(h[m]=(h[m]??0)+1)}const g=p=>{const j=u[p.id];return!!j&&a.has(j)},v=p=>i(j=>{const m=new Set(j);return m.has(p)?m.delete(p):m.add(p),m});return r.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[r.jsxs("div",{className:"col",style:{width:280,flexShrink:0,borderRight:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:[r.jsxs("div",{className:"row",style:{gap:8,padding:"11px 12px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(z,{name:"book",size:15,style:{color:"var(--accent)"}}),r.jsx("span",{style:{fontWeight:600,fontSize:13},children:"Specs"}),r.jsx("span",{className:"grow"}),r.jsx("span",{className:"muted tabular",style:{fontSize:11},children:s.data?f+" reqs":"…"})]}),r.jsxs("div",{className:"row",style:{gap:5,padding:"8px 10px",flexWrap:"wrap",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(z,{name:"filter",size:12,style:{color:"var(--text-muted)",flexShrink:0}}),lv.map(p=>{const j=!a.has(p),m=fe[p];return r.jsxs("button",{onClick:()=>v(p),className:"row gap-4",style:{height:22,padding:"0 8px",borderRadius:999,fontSize:10.5,fontWeight:500,cursor:"pointer",textTransform:"capitalize",border:"1px solid "+(j?"transparent":"var(--border-subtle)"),background:j?m.bg:"var(--bg-panel)",color:j?m.color:"var(--text-muted)"},children:[p,r.jsx("span",{className:"tabular",style:{opacity:.7},children:h[p]??0})]},p)})]}),r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:6},role:d.length?"tree":void 0,"aria-label":d.length?"Spec tree":void 0,children:[s.data&&!d.length&&r.jsx(ue,{icon:"book",title:"No specs yet",body:"Author one with the spec-author skill — specs/*.md index on sync."}),d.map(p=>r.jsx(av,{group:p,linkStates:u,selId:l,hidden:g,onSel:o},p.path))]})]}),r.jsx("div",{className:"col",style:{flex:1,minWidth:0},children:r.jsx(Hg,{id:l,project:e,cache:c},l??"")})]})}function av({group:e,linkStates:t,selId:n,hidden:s,onSel:l}){const[o,a]=N.useState(!0),i=e.reqs.filter(d=>!s(d)),c=e.reqs.filter(d=>["drifted","broken","orphaned"].includes(t[d.id]??"")).length;return r.jsxs("div",{children:[r.jsxs("div",{onClick:()=>a(!o),onKeyDown:Hc(()=>a(!o)),role:"treeitem","aria-expanded":o,tabIndex:0,className:"row gap-6 list-row",style:{padding:"6px 8px",borderRadius:6,cursor:"pointer",color:"var(--text-secondary)"},children:[r.jsx(z,{name:o?"chevronDown":"chevronRight",size:12,style:{color:"var(--text-muted)"}}),r.jsx(z,{name:"book",size:13,style:{color:"var(--node-spec)"}}),r.jsx("span",{className:"mono grow",style:{fontSize:12,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path.replace(/^specs\//,"")}),c>0&&r.jsx("span",{className:"pill",style:{fontSize:9.5,color:"var(--warn)",background:"var(--warn-soft)"},children:c})]}),o&&i.length>0&&r.jsx("div",{role:"group",style:{marginLeft:14,borderLeft:"1px solid var(--border-subtle)",paddingLeft:6},children:i.map(d=>{const u=n===d.id,f=fe[t[d.id]??""]??fe.drafted;return r.jsxs("div",{onClick:()=>l(d.id),onKeyDown:Hc(()=>l(d.id)),role:"treeitem","aria-selected":u,tabIndex:0,className:"row gap-6 list-row"+(u?" selected":""),style:{padding:"5px 8px",borderRadius:6,cursor:"pointer"},children:[r.jsx("span",{className:"pill-dot",style:{background:f.color,flexShrink:0}}),r.jsxs("div",{className:"grow",style:{minWidth:0},children:[r.jsx("div",{className:"mono",style:{fontSize:11,color:u?"var(--accent)":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.id}),r.jsx("div",{className:"muted",style:{fontSize:10.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.title})]})]},d.id)})})]})}const Uc={error:0,warn:1,info:2},iv=e=>e==="error"?"var(--error)":e==="warn"?"var(--warn)":"var(--info)";function cv({query:e,tips:t,onSetTipState:n}){const s=L(()=>P.claudeStats(),[]),l=s.data?.sessionCount===0,o=e.sel,a=t.data?.tips??[],i=[...a].sort((d,u)=>(Uc[d.severity]??9)-(Uc[u.severity]??9)),c=d=>a.filter(u=>u.severity===d&&u.state!=="applied").length;return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Ae,{icon:"tips",title:"Tips",sub:"A senior teammate reviewed your transcripts",actions:a.length>0&&r.jsxs("div",{className:"row gap-6",children:[r.jsxs(re,{color:"var(--error)",bg:"var(--error-soft)",children:[c("error")," urgent"]}),r.jsxs(re,{color:"var(--warn)",bg:"var(--warn-soft)",children:[c("warn")," warn"]}),r.jsxs(re,{color:"var(--info)",bg:"var(--info-soft)",children:[c("info")," info"]})]})}),l&&!a.length?r.jsx(Fn,{onIngested:()=>{s.reload(),t.reload()}}):r.jsx(ae,{state:t,label:"tips",minHeight:240,children:d=>d.tips.length?r.jsx("div",{className:"col gap-12",style:{maxWidth:860},children:i.map(u=>r.jsx(dv,{tip:u,focus:u.id===o,onApply:()=>n(u.id,"applied"),onDismiss:()=>n(u.id,"dismissed")},u.id))}):r.jsx("div",{className:"muted",style:{fontSize:12.5,padding:8},children:"No tips — nothing wasteful in your recent sessions."})})]})}function dv({tip:e,focus:t,onApply:n,onDismiss:s}){const[l,o]=N.useState(!1),a=N.useRef(null);N.useEffect(()=>{if(!t||!a.current)return;const d=a.current,u=d.closest(".scroll-y");u&&(u.scrollTop=Math.max(0,d.offsetTop-20)),o(!0);const f=setTimeout(()=>o(!1),1800);return()=>clearTimeout(f)},[t]);const i=iv(e.severity),c=e.state==="applied";return r.jsxs("div",{ref:a,className:"card",style:{display:"flex",opacity:c?.7:1,transition:"box-shadow var(--motion-fast), border-color var(--motion-fast)",boxShadow:l?`0 0 0 2px ${i}`:"none",borderColor:l?i:void 0},children:[r.jsx("div",{style:{width:3,background:i,flexShrink:0,borderRadius:"9px 0 0 9px"}}),r.jsxs("div",{style:{padding:"14px 16px",flex:1,minWidth:0},children:[r.jsxs("div",{className:"row gap-10",style:{marginBottom:10},children:[r.jsx("div",{style:{width:28,height:28,borderRadius:8,background:`color-mix(in srgb, ${i} 16%, transparent)`,display:"grid",placeItems:"center",color:i,flexShrink:0},children:r.jsx(z,{name:e.icon,size:15})}),r.jsx("div",{className:"grow",style:{minWidth:0},children:r.jsx("div",{style:{fontSize:14,fontWeight:600,letterSpacing:"-0.01em",textWrap:"pretty"},children:e.title})}),r.jsx(re,{color:i,bg:`color-mix(in srgb, ${i} 14%, transparent)`,children:e.severity})]}),r.jsx("div",{className:"secondary",style:{fontSize:12.5,lineHeight:1.6,marginBottom:12},children:e.why}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:14},children:[r.jsxs("div",{onClick:()=>B("sessions",{query:{sel:e.evidence.session}}),role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),B("sessions",{query:{sel:e.evidence.session}}))},title:"Open session "+e.evidence.session,className:"list-row",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:10,cursor:"pointer"},children:[r.jsxs("div",{className:"row gap-6",style:{marginBottom:5},children:[r.jsx("span",{className:"eyebrow",children:"Evidence"}),r.jsx("span",{className:"grow"}),r.jsx(z,{name:"arrowRight",size:11,style:{color:"var(--text-muted)"}})]}),r.jsxs("div",{className:"row gap-6",style:{fontSize:11.5},children:[r.jsx(z,{name:"sessions",size:11,style:{color:"var(--text-muted)"}}),r.jsx("span",{className:"mono",style:{color:"var(--accent)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.evidence.session})]}),r.jsx("div",{className:"mono secondary",style:{fontSize:11,marginTop:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.evidence.detail})]}),r.jsxs("div",{style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:10},children:[r.jsx("div",{className:"eyebrow",style:{marginBottom:5},children:"Impact"}),r.jsx("div",{className:"tabular",style:{fontSize:16,fontWeight:700,color:"var(--success)"},children:e.saving})]})]}),r.jsxs("div",{className:"row gap-8",style:{alignItems:"center"},children:[r.jsxs("div",{className:"row gap-8 grow",style:{background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:7,padding:"6px 10px",minWidth:0},children:[r.jsx("span",{className:"muted",style:{fontSize:10.5,flexShrink:0},children:"fix"}),r.jsx("code",{className:"mono grow",style:{fontSize:11.5,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.fix}),r.jsx(pt,{text:e.fix})]}),c?r.jsxs("span",{className:"pill",style:{color:"var(--success)",background:"var(--success-soft)"},children:[r.jsx(z,{name:"check",size:11}),"Applied"]}):r.jsx("button",{className:"btn btn-primary btn-sm",onClick:n,title:"Mark applied",children:"Apply"}),r.jsx("button",{className:"btn btn-secondary btn-sm",onClick:s,title:"Dismiss — this tip won't come back",children:"Dismiss"})]})]})]})}const uv={bundled:"var(--node-spec)",global:"var(--node-code)",project:"var(--node-route)"};function pv({project:e,query:t}){const n=L(()=>P.workflows(e),[e]),s=n.data?.workflows??[],[l,o]=N.useState(t.run??null);if(Kt(n.error))return r.jsx(ue,{icon:"folder",title:"No project selected",body:"Pick an indexed project from the switcher in the status strip."});const a=l?s.find(i=>i.workflow.name===l):void 0;return r.jsxs("div",{className:"scroll-y",style:{flex:1,padding:18},children:[r.jsx(Ae,{icon:"workflow",title:"Workflows",sub:n.data?"Run a YAML-defined DAG of agent, shell and approval steps":"Loading workflows…"}),n.data&&!s.length&&r.jsx(ue,{icon:"workflow",title:"No workflows found",body:"Add YAML definitions under .specship/workflows/ in this project or your home directory."}),r.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(340px, 1fr))",gap:12},children:s.map(({workflow:i,scope:c})=>{const d=uv[c]??"var(--text-secondary)";return r.jsxs("div",{className:"card card-pad",style:{display:"flex",flexDirection:"column",gap:10},children:[r.jsxs("div",{className:"row gap-8",children:[r.jsx("span",{className:"mono",style:{fontSize:13.5,fontWeight:600},children:i.name}),r.jsx(re,{color:d,bg:`color-mix(in srgb, ${d} 14%, transparent)`,children:c}),r.jsx("span",{className:"grow"}),r.jsxs("span",{className:"mono muted tabular",style:{fontSize:10.5},children:[i.nodes.length," nodes"]})]}),r.jsx("div",{className:"secondary",style:{fontSize:12.5,lineHeight:1.5,minHeight:36},children:i.description||"No description."}),r.jsxs("div",{className:"row gap-6",style:{flexWrap:"wrap",borderTop:"1px solid var(--border-subtle)",paddingTop:10},children:[(i.requires??[]).length>0&&r.jsx("span",{className:"muted",style:{fontSize:10.5},children:"requires"}),(i.requires??[]).map(u=>r.jsx("code",{className:"mono",style:{fontSize:10.5,color:"var(--text-secondary)",background:"var(--bg-canvas)",padding:"1px 6px",borderRadius:4},children:u},u)),(i.inputs??[]).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"muted",style:{fontSize:10.5,marginLeft:6},children:"inputs"}),(i.inputs??[]).map(u=>r.jsxs("code",{className:"mono",style:{fontSize:10.5,color:"var(--node-spec)",background:"var(--node-spec-soft)",padding:"1px 6px",borderRadius:4},children:["$",u.name]},u.name))]}),r.jsx("span",{className:"grow"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>o(i.name),children:[r.jsx(z,{name:"play",size:13}),"Launch"]})]})]},i.name)})}),a&&r.jsx(fv,{wf:a.workflow,project:e,onClose:()=>o(null)})]})}function fv({wf:e,project:t,onClose:n}){const s=e.inputs??[],[l,o]=N.useState(()=>Object.fromEntries(s.filter(h=>h.default).map(h=>[h.name,h.default]))),[a,i]=N.useState(!1),[c,d]=N.useState(null),u=s.filter(h=>h.required&&!(l[h.name]??"").trim()),f=()=>{if(a||u.length)return;i(!0),d(null);const h=Object.fromEntries(Object.entries(l).filter(([,g])=>g.trim()));P.launchRun(e.name,h,t).then(g=>B("runs",{param:g.runId}),g=>{d(g instanceof Error?g.message:String(g)),i(!1)})};return r.jsx("div",{onMouseDown:n,role:"dialog","aria-label":"Launch "+e.name,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:90,display:"grid",placeItems:"center"},children:r.jsxs("div",{onMouseDown:h=>h.stopPropagation(),style:{width:460,maxWidth:"90vw",background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:12,boxShadow:"var(--shadow-pop)"},children:[r.jsxs("div",{className:"row gap-10",style:{padding:"14px 16px",borderBottom:"1px solid var(--border-subtle)"},children:[r.jsx(z,{name:"workflow",size:16,style:{color:"var(--accent)"}}),r.jsx("span",{className:"mono grow",style:{fontWeight:600},children:e.name}),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:n,"aria-label":"Close",children:r.jsx(z,{name:"x",size:14})})]}),r.jsxs("div",{style:{padding:16},children:[r.jsx("div",{className:"secondary",style:{fontSize:12.5,marginBottom:16,lineHeight:1.55},children:e.description||"No description."}),s.length?s.map(h=>r.jsxs("div",{style:{marginBottom:12},children:[r.jsxs("label",{className:"eyebrow",style:{display:"block",marginBottom:5},htmlFor:"wf-input-"+h.name,children:[h.name,h.required&&r.jsx("span",{style:{color:"var(--error)"},children:" *"})]}),r.jsx("input",{id:"wf-input-"+h.name,className:"input mono",style:{width:"100%"},placeholder:h.description||(h.name==="SPEC_ID"?"REQ-AUTH-005":"value…"),value:l[h.name]||"",onChange:g=>o(v=>({...v,[h.name]:g.target.value})),onKeyDown:g=>{g.key==="Enter"&&f()}})]},h.name)):r.jsx("div",{className:"muted",style:{fontSize:12,padding:"8px 0"},children:"No inputs required."}),r.jsx("div",{className:"row gap-6",style:{marginTop:6,marginBottom:4},children:(e.requires??[]).map(h=>r.jsxs(re,{children:[r.jsx(z,{name:"check",size:10}),h]},h))}),c&&r.jsxs("div",{className:"row gap-8",style:{marginTop:8,padding:"8px 10px",borderRadius:7,background:"var(--error-soft)",color:"var(--error)",fontSize:12},children:[r.jsx(z,{name:"cancel",size:13,style:{flexShrink:0}}),r.jsx("span",{children:c})]})]}),r.jsxs("div",{className:"row gap-8",style:{padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"}),r.jsxs("button",{className:"btn btn-primary btn-sm",onClick:f,disabled:a||u.length>0,title:u.length?"Fill the required inputs: "+u.map(h=>h.name).join(", "):void 0,children:[r.jsx(z,{name:"play",size:13}),a?"Launching…":"Launch run"]})]})]})})}const xi=[{group:"Project",items:[{id:"dashboard",label:"Dashboard",icon:"dashboard"},{id:"graph",label:"Graph",icon:"graph"},{id:"specs",label:"Specs",icon:"book"},{id:"drift",label:"Drift queue",icon:"drift",badge:e=>e.drift},{id:"runs",label:"Runs",icon:"play",badge:e=>e.runs,badgeKind:"warn"}]},{group:"Claude Code",items:[{id:"sessions",label:"Sessions",icon:"sessions"},{id:"heatmap",label:"Heatmap",icon:"heatmap"},{id:"costs",label:"Costs",icon:"dollar"},{id:"compare",label:"Compare projects",icon:"compare"},{id:"memory",label:"Memory",icon:"memory"},{id:"mcp",label:"MCP",icon:"plug"},{id:"tips",label:"Tips",icon:"tips",badge:e=>e.tips,badgeKind:"error"}]}],hv=[...xi.flatMap(e=>e.items.map(({id:t,label:n,icon:s})=>({id:t,label:n,icon:s}))),{id:"workflows",label:"Workflows",icon:"workflow"},{id:"chat",label:"Chat",icon:"chat"},{id:"designsystem",label:"Design system",icon:"layers"},{id:"settings",label:"Settings",icon:"settings"}],mv=xi.flatMap(e=>e.items.map(t=>t.id)).slice(0,7),xv={dashboard:dx,graph:Ax,specs:ov,drift:Rx,runs:Sg,workflows:pv,chat:$m,designsystem:()=>r.jsx(Tx,{}),sessions:Ng,heatmap:Bx,costs:ax,compare:sx,memory:ag,mcp:eg,settings:e=>r.jsx(Og,{...e})},co="ss_project",Vc="ss_nav_groups",Kc="ss_nav_collapsed";function gv(){const{route:e,param:t,query:n}=hm(),[s,l]=N.useState(()=>{try{return localStorage.getItem(Kc)==="1"}catch{return!1}}),[o,a]=N.useState(()=>{try{return localStorage.getItem(co)}catch{return null}}),[i,c]=N.useState(!1),[d,u]=N.useState(!1),f=L(()=>P.status(o),[o,e]),h=L(()=>P.projects(),[]),g=L(()=>P.runs(o),[o,e]),v=L(()=>P.claudeTips(),[e]),p=L(()=>P.drift(o),[o,e]),j=N.useCallback(()=>u(_=>!_),[]);Cm({onTogglePalette:j,pageIds:mv});const m={drift:p.data?.links.length??f.data?.drift??0,runs:g.data?.runs.filter(_=>_.status==="running").length??0,tips:v.data?.tips.filter(_=>_.state!=="applied").length??0},x=N.useCallback(()=>u(!0),[]),y=N.useCallback((_,W)=>{P.setTipState(_,W).catch(()=>{}).finally(()=>v.reload())},[v.reload]),w=()=>l(_=>{try{localStorage.setItem(Kc,_?"0":"1")}catch{}return!_}),S=_=>{a(_);try{_?localStorage.setItem(co,_):localStorage.removeItem(co)}catch{}},k=()=>{c(!0),P.refresh(o).catch(()=>{}).finally(()=>{c(!1),f.reload()})},C=xv[e]??(()=>r.jsx(ig,{title:"Not found"}));return r.jsxs("div",{style:{display:"flex",height:"100%",position:"relative"},children:[r.jsx(vv,{route:e,collapsed:s,counts:m,onToggleCollapse:w}),r.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[r.jsx(jv,{status:f.data,projectless:Kt(f.error),projects:h.data?.projects??[],project:o,onPick:S,onRefresh:k,refreshing:i}),r.jsx(Sv,{onToggle:w,onOpenPalette:x}),r.jsx("div",{"data-screen":e,style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:e==="tips"?r.jsx(cv,{project:o,param:t,query:n,tips:v,onSetTipState:y}):r.jsx(C,{project:o,param:t,query:n})},e+(t??""))]}),r.jsx(Sm,{open:d,onClose:()=>u(!1),pages:hv,project:o})]})}function vv({route:e,collapsed:t,counts:n,onToggleCollapse:s}){const[l,o]=N.useState(()=>{try{return JSON.parse(localStorage.getItem(Vc)||"null")||{}}catch{return{}}}),a=c=>l[c]!==!1,i=c=>o(d=>{const u={...d,[c]:d[c]===!1};try{localStorage.setItem(Vc,JSON.stringify(u))}catch{}return u});return r.jsxs("nav",{style:{width:t?"var(--sidebar-w-collapsed)":"var(--sidebar-w)",flexShrink:0,background:"var(--bg-panel)",borderRight:"1px solid var(--border-subtle)",display:"flex",flexDirection:"column",transition:"width 120ms",overflow:"hidden"},children:[r.jsxs("div",{className:"row gap-8",onClick:s,title:t?"Expand menu":"Collapse menu",style:{padding:t?"14px 0":"15px 16px",justifyContent:t?"center":"flex-start",cursor:"pointer",userSelect:"none"},children:[r.jsx(ap,{size:26}),!t&&r.jsx("div",{className:"grow",style:{fontWeight:600,fontSize:13.5,letterSpacing:"-0.01em"},children:"SpecShip"})]}),r.jsx("div",{className:"scroll-y",style:{flex:1,padding:"4px 8px"},children:xi.map(c=>r.jsxs("div",{style:{marginBottom:t?10:4},children:[!t&&r.jsxs("button",{onClick:()=>i(c.group),className:"row gap-6",style:{width:"100%",padding:"8px 8px 4px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[r.jsx("span",{className:"eyebrow grow",children:c.group}),r.jsx(z,{name:a(c.group)?"chevronDown":"chevronRight",size:12,style:{color:"var(--text-muted)"}})]}),(t||a(c.group))&&c.items.map(d=>r.jsx(uo,{item:d,active:e===d.id,collapsed:t,counts:n},d.id))]},c.group))}),r.jsxs("div",{style:{padding:8,borderTop:"1px solid var(--border-subtle)"},children:[r.jsx(uo,{item:{id:"designsystem",label:"Design system",icon:"layers"},active:e==="designsystem",collapsed:t}),r.jsx(uo,{item:{id:"settings",label:"Settings",icon:"settings"},active:e==="settings",collapsed:t})]})]})}function uo({item:e,active:t,collapsed:n,counts:s}){const l=i=>{i.metaKey||i.ctrlKey||i.shiftKey||i.button!==0||(i.preventDefault(),B(e.id))},o=e.badge&&s?e.badge(s):0,a=e.badgeKind;return r.jsxs("a",{href:"/"+e.id,onClick:l,title:n?e.label:void 0,className:"list-row",style:{display:"flex",alignItems:"center",gap:10,height:32,padding:n?0:"0 10px",justifyContent:n?"center":"flex-start",borderRadius:7,textDecoration:"none",marginBottom:1,color:t?"var(--text-primary)":"var(--text-secondary)",background:t?"var(--bg-active)":void 0,fontWeight:t?600:450,fontSize:13,position:"relative"},children:[t&&r.jsx("span",{style:{position:"absolute",left:0,top:7,bottom:7,width:2.5,borderRadius:2,background:"var(--accent)"}}),r.jsx(z,{name:e.icon,size:16,style:{color:t?"var(--accent)":"inherit",flexShrink:0}}),!n&&r.jsx("span",{className:"grow",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),!n&&o>0&&r.jsx("span",{className:"pill tabular",style:{fontSize:10,fontWeight:700,padding:"1px 6px",minWidth:18,justifyContent:"center",color:a==="error"?"var(--error)":a==="warn"?"var(--warn)":"var(--text-secondary)",background:a==="error"?"var(--error-soft)":a==="warn"?"var(--warn-soft)":"rgba(255,255,255,0.06)"},children:o}),n&&o>0&&r.jsx("span",{style:{position:"absolute",top:5,right:9,width:6,height:6,borderRadius:"50%",background:a==="error"?"var(--error)":"var(--warn)"}})]})}function yv({projects:e,project:t,projectPath:n,onPick:s}){const[l,o]=N.useState(!1),a=N.useRef(null),[i,c]=N.useState(null),d=()=>{if(!l){const g=a.current?.getBoundingClientRect();c(g?{top:g.bottom+5,left:g.left}:null)}o(g=>!g)};N.useEffect(()=>{if(!l)return;const g=v=>{v.target.closest("[data-projsw]")||o(!1)};return window.addEventListener("mousedown",g),()=>window.removeEventListener("mousedown",g)},[l]);const u=e.filter(g=>g.initialized),f=t??"",h=n||(t??"pick a project");return r.jsxs("div",{"data-projsw":"1",style:{position:"relative",flexShrink:0},children:[r.jsxs("button",{ref:a,onClick:d,className:"row gap-6",title:"Switch project",style:{height:24,padding:"0 8px",borderRadius:6,cursor:"pointer",background:l?"var(--bg-hover)":"transparent",border:"1px solid "+(l?"var(--border-strong)":"transparent"),transition:"background var(--motion-fast), border-color var(--motion-fast)"},children:[r.jsx(z,{name:"folder",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"mono",style:{fontSize:11.5,color:"var(--text-primary)",maxWidth:280,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h}),r.jsx(z,{name:"chevronDown",size:12,style:{color:"var(--text-muted)",flexShrink:0}})]}),l&&r.jsxs("div",{style:{position:"fixed",top:i?.top??34,left:i?.left??8,minWidth:264,background:"var(--bg-elevated)",border:"1px solid var(--border-strong)",borderRadius:9,boxShadow:"var(--shadow-pop)",padding:5,zIndex:60},children:[r.jsx("div",{className:"eyebrow",style:{padding:"5px 8px 6px"},children:"Indexed projects"}),r.jsxs("button",{className:"row gap-8",onClick:()=>{s(null),o(!1)},style:Qc(f===""),children:[r.jsx(z,{name:"folder",size:13,style:{color:"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"grow",style:{textAlign:"left",fontSize:12.5},children:"Primary project"}),f===""&&r.jsx(z,{name:"check",size:13,style:{color:"var(--accent)",flexShrink:0}})]}),u.map(g=>{const v=g.slug===f;return r.jsxs("button",{className:"row gap-8",onClick:()=>{s(g.slug),o(!1)},style:Qc(v),children:[r.jsx(z,{name:"folder",size:13,style:{color:v?"var(--accent)":"var(--text-muted)",flexShrink:0}}),r.jsx("span",{className:"grow mono",style:{textAlign:"left",fontSize:11.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.path}),(g.driftCount??0)>0&&r.jsxs("span",{className:"pill tabular",style:{fontSize:9.5,color:"var(--warn)",background:"var(--warn-soft)",flexShrink:0},children:[g.driftCount," drift"]}),v&&r.jsx(z,{name:"check",size:13,style:{color:"var(--accent)",flexShrink:0}})]},g.slug)}),!u.length&&r.jsx("div",{className:"muted",style:{padding:"6px 8px",fontSize:12},children:"No initialized projects found."})]})]})}function Qc(e){return{width:"100%",textAlign:"left",padding:"7px 8px",borderRadius:6,cursor:"pointer",border:"none",background:e?"var(--bg-active)":"transparent"}}function jv({status:e,projectless:t,projects:n,project:s,onPick:l,onRefresh:o,refreshing:a}){const i=(u,f,h)=>r.jsxs("div",{className:"row gap-6",style:{flexShrink:0},children:[r.jsx("span",{className:"muted",style:{fontSize:11},children:u}),r.jsx("span",{className:"mono tabular",style:{fontSize:11.5,color:h||"var(--text-secondary)"},children:f})]}),c=r.jsx("span",{style:{width:1,height:12,background:"var(--border-subtle)",flexShrink:0}}),d=e?.lastIndexed?new Date(e.lastIndexed).toLocaleString():"—";return r.jsxs("div",{style:{height:"var(--status-h)",flexShrink:0,display:"flex",alignItems:"center",gap:14,padding:"0 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel-2)",overflow:"hidden",whiteSpace:"nowrap"},children:[r.jsx(yv,{projects:n,project:s,projectPath:e?.projectPath??null,onPick:l}),c,i("nodes",e?e.nodeCount.toLocaleString():t?"—":"…"),i("edges",e?e.edgeCount.toLocaleString():t?"—":"…"),c,i("drift",e?String(e.drift):"—",e?e.drift?"var(--warn)":"var(--success)":void 0),r.jsx("div",{className:"grow"}),i("indexed",d),r.jsx("button",{className:"btn btn-ghost btn-xs",onClick:o,title:"Refresh now","aria-label":"Refresh now",children:r.jsx(z,{name:"refresh",size:12,style:{animation:a?"spin 0.8s linear infinite":"none"}})})]})}const wv={fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-muted)",background:"var(--bg-canvas)",border:"1px solid var(--border-subtle)",borderRadius:4,padding:"2px 6px"};function Sv({onToggle:e,onOpenPalette:t}){return r.jsxs("div",{style:{height:44,flexShrink:0,display:"flex",alignItems:"center",gap:10,padding:"0 14px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-canvas)"},children:[r.jsx("button",{className:"btn btn-ghost",onClick:e,style:{padding:6},title:"Toggle sidebar","aria-label":"Toggle sidebar",children:r.jsx(z,{name:"menu",size:16})}),r.jsxs("button",{onClick:t,className:"row gap-8",style:{flex:1,maxWidth:380,height:30,padding:"0 11px",background:"var(--bg-panel)",border:"1px solid var(--border-subtle)",borderRadius:8,cursor:"text",color:"var(--text-muted)",fontSize:12.5},children:[r.jsx(z,{name:"search",size:14}),r.jsx("span",{className:"grow",style:{textAlign:"left"},children:"Search or jump to…"}),r.jsx("kbd",{style:wv,children:"⌘K"})]}),r.jsx("div",{className:"grow"}),r.jsx(bv,{}),r.jsx("button",{className:"btn btn-ghost btn-sm",onClick:t,title:"Command palette","aria-label":"Command palette",children:r.jsx(z,{name:"command",size:14})})]})}function bv(){const[e,t]=N.useState(Sl()),n={dark:"light",light:"system",system:"dark"},s={dark:"moon",light:"sun",system:"monitor"},l=n[e];return r.jsx("button",{className:"btn btn-ghost btn-sm",title:"Theme: "+e+" — switch to "+l,"aria-label":"Theme: "+e+" — switch to "+l,onClick:()=>{bl(l),t(l)},children:r.jsx(z,{name:s[e],size:15})})}bl(Sl());Tm();Rp(_p());po.createRoot(document.getElementById("root")).render(r.jsx(Jp.StrictMode,{children:r.jsx(gv,{})}));
|