@grackle-ai/web 0.106.3 → 0.107.1

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.
@@ -1,725 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-DVM_7qDh.js","assets/dagview-tHPW3Rz3.js","assets/grpc-DIjMtMRF.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
- import{r as vT,a as yT,b as y,j as i,d as oy,H as ry,P as ly,i as bT,B as xT,c as _T,C as kT,M as ST,e as TT}from"./dagview-tHPW3Rz3.js";import{c as jT,a as kd,G as wT,b as NT,d as CT,e as ET,f as AT,M as DT,A as _x,D as kx,W as MT,O as RT,g as IT,C as Ci,h as Sx,i as Tx,w as OT,t as BT,p as Rc,j as LT,R as Or,S as cy}from"./grpc-DIjMtMRF.js";import{v as zT,r as $T,t as Ic,i as PT,f as UT,M as Sd,a as Td}from"./markdown-Yr3vTPLR.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function o(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=o(c);fetch(c.href,d)}})();var Zf={exports:{}},Br={},Kf={exports:{}},Yf={};/**
3
- * @license React
4
- * scheduler.production.js
5
- *
6
- * Copyright (c) Meta Platforms, Inc. and affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var dy;function HT(){return dy||(dy=1,(function(t){function s(M,O){var X=M.length;M.push(O);e:for(;0<X;){var he=X-1>>>1,W=M[he];if(0<c(W,O))M[he]=O,M[X]=W,X=he;else break e}}function o(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var O=M[0],X=M.pop();if(X!==O){M[0]=X;e:for(var he=0,W=M.length,ye=W>>>1;he<ye;){var fe=2*(he+1)-1,Ne=M[fe],Ue=fe+1,ge=M[Ue];if(0>c(Ne,X))Ue<W&&0>c(ge,Ne)?(M[he]=ge,M[Ue]=X,he=Ue):(M[he]=Ne,M[fe]=X,he=fe);else if(Ue<W&&0>c(ge,X))M[he]=ge,M[Ue]=X,he=Ue;else break e}}return O}function c(M,O){var X=M.sortIndex-O.sortIndex;return X!==0?X:M.id-O.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,p=u.now();t.unstable_now=function(){return u.now()-p}}var m=[],g=[],v=1,x=null,b=3,k=!1,S=!1,j=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function B(M){for(var O=o(g);O!==null;){if(O.callback===null)r(g);else if(O.startTime<=M)r(g),O.sortIndex=O.expirationTime,s(m,O);else break;O=o(g)}}function E(M){if(j=!1,B(M),!S)if(o(m)!==null)S=!0,A||(A=!0,K());else{var O=o(g);O!==null&&ie(E,O.startTime-M)}}var A=!1,$=-1,L=5,U=-1;function J(){return N?!0:!(t.unstable_now()-U<L)}function V(){if(N=!1,A){var M=t.unstable_now();U=M;var O=!0;try{e:{S=!1,j&&(j=!1,C($),$=-1),k=!0;var X=b;try{t:{for(B(M),x=o(m);x!==null&&!(x.expirationTime>M&&J());){var he=x.callback;if(typeof he=="function"){x.callback=null,b=x.priorityLevel;var W=he(x.expirationTime<=M);if(M=t.unstable_now(),typeof W=="function"){x.callback=W,B(M),O=!0;break t}x===o(m)&&r(m),B(M)}else r(m);x=o(m)}if(x!==null)O=!0;else{var ye=o(g);ye!==null&&ie(E,ye.startTime-M),O=!1}}break e}finally{x=null,b=X,k=!1}O=void 0}}finally{O?K():A=!1}}}var K;if(typeof D=="function")K=function(){D(V)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,ee=de.port2;de.port1.onmessage=V,K=function(){ee.postMessage(null)}}else K=function(){T(V,0)};function ie(M,O){$=T(function(){M(t.unstable_now())},O)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(M){M.callback=null},t.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<M?Math.floor(1e3/M):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(M){switch(b){case 1:case 2:case 3:var O=3;break;default:O=b}var X=b;b=O;try{return M()}finally{b=X}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(M,O){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var X=b;b=M;try{return O()}finally{b=X}},t.unstable_scheduleCallback=function(M,O,X){var he=t.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?he+X:he):X=he,M){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=X+W,M={id:v++,callback:O,priorityLevel:M,startTime:X,expirationTime:W,sortIndex:-1},X>he?(M.sortIndex=X,s(g,M),o(m)===null&&M===o(g)&&(j?(C($),$=-1):j=!0,ie(E,X-he))):(M.sortIndex=W,s(m,M),S||k||(S=!0,A||(A=!0,K()))),M},t.unstable_shouldYield=J,t.unstable_wrapCallback=function(M){var O=b;return function(){var X=b;b=O;try{return M.apply(this,arguments)}finally{b=X}}}})(Yf)),Yf}var uy;function VT(){return uy||(uy=1,Kf.exports=HT()),Kf.exports}/**
11
- * @license React
12
- * react-dom-client.production.js
13
- *
14
- * Copyright (c) Meta Platforms, Inc. and affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var fy;function qT(){if(fy)return Br;fy=1;var t=VT(),s=vT(),o=yT();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(d(e)!==e)throw Error(r(188))}function g(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(r(188));return n!==e?null:e}for(var a=e,l=n;;){var f=a.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===a)return m(f),e;if(h===l)return m(f),n;h=h.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=h;else{for(var _=!1,w=f.child;w;){if(w===a){_=!0,a=f,l=h;break}if(w===l){_=!0,l=f,a=h;break}w=w.sibling}if(!_){for(w=h.child;w;){if(w===a){_=!0,a=h,l=f;break}if(w===l){_=!0,l=h,a=f;break}w=w.sibling}if(!_)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var x=Object.assign,b=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),D=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),J=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function K(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var de=Symbol.for("react.client.reference");function ee(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case T:return"Profiler";case N:return"StrictMode";case E:return"Suspense";case A:return"SuspenseList";case U:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case D:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case B:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $:return n=e.displayName||null,n!==null?n:ee(e.type)||"Memo";case L:n=e._payload,e=e._init;try{return ee(e(n))}catch{}}return null}var ie=Array.isArray,M=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},he=[],W=-1;function ye(e){return{current:e}}function fe(e){0>W||(e.current=he[W],he[W]=null,W--)}function Ne(e,n){W++,he[W]=e.current,e.current=n}var Ue=ye(null),ge=ye(null),ke=ye(null),xe=ye(null);function Be(e,n){switch(Ne(ke,n),Ne(ge,e),Ne(Ue,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?E0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=E0(n),e=A0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}fe(Ue),Ne(Ue,e)}function It(){fe(Ue),fe(ge),fe(ke)}function zn(e){e.memoizedState!==null&&Ne(xe,e);var n=Ue.current,a=A0(n,e.type);n!==a&&(Ne(ge,e),Ne(Ue,a))}function oe(e){ge.current===e&&(fe(Ue),fe(ge)),xe.current===e&&(fe(xe),Dr._currentValue=X)}var Je,Ut;function ne(e){if(Je===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Je=n&&n[1]||"",Ut=-1<a.stack.indexOf(`
19
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+Je+e+Ut}var wt=!1;function Ot(e,n){if(!e||wt)return"";wt=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(Z){var F=Z}Reflect.construct(e,[],ae)}else{try{ae.call()}catch(Z){F=Z}e.call(ae.prototype)}}else{try{throw Error()}catch(Z){F=Z}(ae=e())&&typeof ae.catch=="function"&&ae.catch(function(){})}}catch(Z){if(Z&&F&&typeof Z.stack=="string")return[Z.stack,F.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),_=h[0],w=h[1];if(_&&w){var R=_.split(`
21
- `),G=w.split(`
22
- `);for(f=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;f<G.length&&!G[f].includes("DetermineComponentFrameRoot");)f++;if(l===R.length||f===G.length)for(l=R.length-1,f=G.length-1;1<=l&&0<=f&&R[l]!==G[f];)f--;for(;1<=l&&0<=f;l--,f--)if(R[l]!==G[f]){if(l!==1||f!==1)do if(l--,f--,0>f||R[l]!==G[f]){var Q=`
23
- `+R[l].replace(" at new "," at ");return e.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",e.displayName)),Q}while(1<=l&&0<=f);break}}}finally{wt=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ne(a):""}function Bt(e,n){switch(e.tag){case 26:case 27:case 5:return ne(e.type);case 16:return ne("Lazy");case 13:return e.child!==n&&n!==null?ne("Suspense Fallback"):ne("Suspense");case 19:return ne("SuspenseList");case 0:case 15:return Ot(e.type,!1);case 11:return Ot(e.type.render,!1);case 1:return Ot(e.type,!0);case 31:return ne("Activity");default:return""}}function ze(e){try{var n="",a=null;do n+=Bt(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
24
- Error generating stack: `+l.message+`
25
- `+l.stack}}var sn=Object.prototype.hasOwnProperty,ca=t.unstable_scheduleCallback,is=t.unstable_cancelCallback,Ja=t.unstable_shouldYield,da=t.unstable_requestPaint,Jt=t.unstable_now,Bi=t.unstable_getCurrentPriorityLevel,ua=t.unstable_ImmediatePriority,Wa=t.unstable_UserBlockingPriority,ys=t.unstable_NormalPriority,Li=t.unstable_LowPriority,$n=t.unstable_IdlePriority,Ae=t.log,We=t.unstable_setDisableYieldValue,Wt=null,St=null;function mn(e){if(typeof Ae=="function"&&We(e),St&&typeof St.setStrictMode=="function")try{St.setStrictMode(Wt,e)}catch{}}var Xt=Math.clz32?Math.clz32:Pi,zi=Math.log,$i=Math.LN2;function Pi(e){return e>>>=0,e===0?32:31-(zi(e)/$i|0)|0}var Xa=256,Qa=262144,ei=4194304;function bs(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ti(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~h,l!==0?f=bs(l):(_&=w,_!==0?f=bs(_):a||(a=w&~e,a!==0&&(f=bs(a))))):(w=l&~h,w!==0?f=bs(w):_!==0?f=bs(_):a||(a=l&~e,a!==0&&(f=bs(a)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:f}function fa(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function bl(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function xl(){var e=ei;return ei<<=1,(ei&62914560)===0&&(ei=4194304),e}function H(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function te(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function re(e,n,a,l,f,h){var _=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var w=e.entanglements,R=e.expirationTimes,G=e.hiddenUpdates;for(a=_&~a;0<a;){var Q=31-Xt(a),ae=1<<Q;w[Q]=0,R[Q]=-1;var F=G[Q];if(F!==null)for(G[Q]=null,Q=0;Q<F.length;Q++){var Z=F[Q];Z!==null&&(Z.lane&=-536870913)}a&=~ae}l!==0&&ce(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(_&~n))}function ce(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Xt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function me(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-Xt(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function He(e,n){var a=n&-n;return a=(a&42)!==0?1:Se(a),(a&(e.suspendedLanes|n))!==0?0:a}function Se(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Me(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Xe(){var e=O.p;return e!==0?e:(e=window.event,e===void 0?32:Q0(e.type))}function ht(e,n){var a=O.p;try{return O.p=e,n()}finally{O.p=a}}var Le=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Le,rt="__reactProps$"+Le,vt="__reactContainer$"+Le,xs="__reactEvents$"+Le,Rs="__reactListeners$"+Le,Go="__reactHandles$"+Le,gh="__reactResources$"+Le,Fo="__reactMarker$"+Le;function zd(e){delete e[Qe],delete e[rt],delete e[xs],delete e[Rs],delete e[Go]}function Ui(e){var n=e[Qe];if(n)return n;for(var a=e.parentNode;a;){if(n=a[vt]||a[Qe]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=L0(e);e!==null;){if(a=e[Qe])return a;e=L0(e)}return n}e=a,a=e.parentNode}return null}function Hi(e){if(e=e[Qe]||e[vt]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Zo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function Vi(e){var n=e[gh];return n||(n=e[gh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Qt(e){e[Fo]=!0}var vh=new Set,yh={};function ni(e,n){qi(e,n),qi(e+"Capture",n)}function qi(e,n){for(yh[e]=n,e=0;e<n.length;e++)vh.add(n[e])}var lk=RegExp("^[: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]*$"),bh={},xh={};function ck(e){return sn.call(xh,e)?!0:sn.call(bh,e)?!1:lk.test(e)?xh[e]=!0:(bh[e]=!0,!1)}function _l(e,n,a){if(ck(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function kl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function Is(e,n,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+l)}}function Pn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _h(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function dk(e,n,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(_){a=""+_,h.call(this,_)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function $d(e){if(!e._valueTracker){var n=_h(e)?"checked":"value";e._valueTracker=dk(e,n,""+e[n])}}function kh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=_h(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function Sl(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}}var uk=/[\n"\\]/g;function Un(e){return e.replace(uk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Pd(e,n,a,l,f,h,_,w){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),n!=null?_==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Pn(n)):e.value!==""+Pn(n)&&(e.value=""+Pn(n)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),n!=null?Ud(e,_,Pn(n)):a!=null?Ud(e,_,Pn(a)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Pn(w):e.removeAttribute("name")}function Sh(e,n,a,l,f,h,_,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){$d(e);return}a=a!=null?""+Pn(a):"",n=n!=null?""+Pn(n):a,w||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),$d(e)}function Ud(e,n,a){n==="number"&&Sl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Gi(e,n,a,l){if(e=e.options,n){n={};for(var f=0;f<a.length;f++)n["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=n.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&l&&(e[a].defaultSelected=!0)}else{for(a=""+Pn(a),n=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Th(e,n,a){if(n!=null&&(n=""+Pn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Pn(a):""}function jh(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(r(92));if(ie(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=Pn(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),$d(e)}function Fi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var fk=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function wh(e,n,a){var l=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,a):typeof a!="number"||a===0||fk.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function Nh(e,n,a){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&a[f]!==l&&wh(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&wh(e,h,n[h])}function Hd(e){if(e.indexOf("-")===-1)return!1;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 pk=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),mk=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Tl(e){return mk.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Os(){}var Vd=null;function qd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zi=null,Ki=null;function Ch(e){var n=Hi(e);if(n&&(e=n.stateNode)){var a=e[rt]||null;e:switch(e=n.stateNode,n.type){case"input":if(Pd(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Un(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[rt]||null;if(!f)throw Error(r(90));Pd(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<a.length;n++)l=a[n],l.form===e.form&&kh(l)}break e;case"textarea":Th(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Gi(e,!!a.multiple,n,!1)}}}var Gd=!1;function Eh(e,n,a){if(Gd)return e(n,a);Gd=!0;try{var l=e(n);return l}finally{if(Gd=!1,(Zi!==null||Ki!==null)&&(uc(),Zi&&(n=Zi,e=Ki,Ki=Zi=null,Ch(n),e)))for(n=0;n<e.length;n++)Ch(e[n])}}function Ko(e,n){var a=e.stateNode;if(a===null)return null;var l=a[rt]||null;if(l===null)return null;a=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,n,typeof a));return a}var Bs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fd=!1;if(Bs)try{var Yo={};Object.defineProperty(Yo,"passive",{get:function(){Fd=!0}}),window.addEventListener("test",Yo,Yo),window.removeEventListener("test",Yo,Yo)}catch{Fd=!1}var pa=null,Zd=null,jl=null;function Ah(){if(jl)return jl;var e,n=Zd,a=n.length,l,f="value"in pa?pa.value:pa.textContent,h=f.length;for(e=0;e<a&&n[e]===f[e];e++);var _=a-e;for(l=1;l<=_&&n[a-l]===f[h-l];l++);return jl=f.slice(e,1<l?1-l:void 0)}function wl(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Nl(){return!0}function Dh(){return!1}function bn(e){function n(a,l,f,h,_){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=_,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(a=e[w],this[w]=a?a(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Nl:Dh,this.isPropagationStopped=Dh,this}return x(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Nl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Nl)},persist:function(){},isPersistent:Nl}),n}var si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cl=bn(si),Jo=x({},si,{view:0,detail:0}),hk=bn(Jo),Kd,Yd,Wo,El=x({},Jo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wd,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!==Wo&&(Wo&&e.type==="mousemove"?(Kd=e.screenX-Wo.screenX,Yd=e.screenY-Wo.screenY):Yd=Kd=0,Wo=e),Kd)},movementY:function(e){return"movementY"in e?e.movementY:Yd}}),Mh=bn(El),gk=x({},El,{dataTransfer:0}),vk=bn(gk),yk=x({},Jo,{relatedTarget:0}),Jd=bn(yk),bk=x({},si,{animationName:0,elapsedTime:0,pseudoElement:0}),xk=bn(bk),_k=x({},si,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kk=bn(_k),Sk=x({},si,{data:0}),Rh=bn(Sk),Tk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jk={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"},wk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nk(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=wk[e])?!!n[e]:!1}function Wd(){return Nk}var Ck=x({},Jo,{key:function(e){if(e.key){var n=Tk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=wl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?jk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wd,charCode:function(e){return e.type==="keypress"?wl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?wl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ek=bn(Ck),Ak=x({},El,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ih=bn(Ak),Dk=x({},Jo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wd}),Mk=bn(Dk),Rk=x({},si,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ik=bn(Rk),Ok=x({},El,{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}),Bk=bn(Ok),Lk=x({},si,{newState:0,oldState:0}),zk=bn(Lk),$k=[9,13,27,32],Xd=Bs&&"CompositionEvent"in window,Xo=null;Bs&&"documentMode"in document&&(Xo=document.documentMode);var Pk=Bs&&"TextEvent"in window&&!Xo,Oh=Bs&&(!Xd||Xo&&8<Xo&&11>=Xo),Bh=" ",Lh=!1;function zh(e,n){switch(e){case"keyup":return $k.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $h(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yi=!1;function Uk(e,n){switch(e){case"compositionend":return $h(n);case"keypress":return n.which!==32?null:(Lh=!0,Bh);case"textInput":return e=n.data,e===Bh&&Lh?null:e;default:return null}}function Hk(e,n){if(Yi)return e==="compositionend"||!Xd&&zh(e,n)?(e=Ah(),jl=Zd=pa=null,Yi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Oh&&n.locale!=="ko"?null:n.data;default:return null}}var Vk={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 Ph(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Vk[e.type]:n==="textarea"}function Uh(e,n,a,l){Zi?Ki?Ki.push(l):Ki=[l]:Zi=l,n=yc(n,"onChange"),0<n.length&&(a=new Cl("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Qo=null,er=null;function qk(e){S0(e,0)}function Al(e){var n=Zo(e);if(kh(n))return e}function Hh(e,n){if(e==="change")return n}var Vh=!1;if(Bs){var Qd;if(Bs){var eu="oninput"in document;if(!eu){var qh=document.createElement("div");qh.setAttribute("oninput","return;"),eu=typeof qh.oninput=="function"}Qd=eu}else Qd=!1;Vh=Qd&&(!document.documentMode||9<document.documentMode)}function Gh(){Qo&&(Qo.detachEvent("onpropertychange",Fh),er=Qo=null)}function Fh(e){if(e.propertyName==="value"&&Al(er)){var n=[];Uh(n,er,e,qd(e)),Eh(qk,n)}}function Gk(e,n,a){e==="focusin"?(Gh(),Qo=n,er=a,Qo.attachEvent("onpropertychange",Fh)):e==="focusout"&&Gh()}function Fk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Al(er)}function Zk(e,n){if(e==="click")return Al(n)}function Kk(e,n){if(e==="input"||e==="change")return Al(n)}function Yk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var jn=typeof Object.is=="function"?Object.is:Yk;function tr(e,n){if(jn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),l=Object.keys(n);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!sn.call(n,f)||!jn(e[f],n[f]))return!1}return!0}function Zh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Kh(e,n){var a=Zh(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=n&&l>=n)return{node:a,offset:n-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Zh(a)}}function Yh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Yh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Jh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Sl(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Sl(e.document)}return n}function tu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Jk=Bs&&"documentMode"in document&&11>=document.documentMode,Ji=null,nu=null,nr=null,su=!1;function Wh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;su||Ji==null||Ji!==Sl(l)||(l=Ji,"selectionStart"in l&&tu(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),nr&&tr(nr,l)||(nr=l,l=yc(nu,"onSelect"),0<l.length&&(n=new Cl("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Ji)))}function ai(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Wi={animationend:ai("Animation","AnimationEnd"),animationiteration:ai("Animation","AnimationIteration"),animationstart:ai("Animation","AnimationStart"),transitionrun:ai("Transition","TransitionRun"),transitionstart:ai("Transition","TransitionStart"),transitioncancel:ai("Transition","TransitionCancel"),transitionend:ai("Transition","TransitionEnd")},au={},Xh={};Bs&&(Xh=document.createElement("div").style,"AnimationEvent"in window||(delete Wi.animationend.animation,delete Wi.animationiteration.animation,delete Wi.animationstart.animation),"TransitionEvent"in window||delete Wi.transitionend.transition);function ii(e){if(au[e])return au[e];if(!Wi[e])return e;var n=Wi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Xh)return au[e]=n[a];return e}var Qh=ii("animationend"),eg=ii("animationiteration"),tg=ii("animationstart"),Wk=ii("transitionrun"),Xk=ii("transitionstart"),Qk=ii("transitioncancel"),ng=ii("transitionend"),sg=new Map,iu="abort auxClick beforeToggle 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(" ");iu.push("scrollEnd");function os(e,n){sg.set(e,n),ni(n,[e])}var Dl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Hn=[],Xi=0,ou=0;function Ml(){for(var e=Xi,n=ou=Xi=0;n<e;){var a=Hn[n];Hn[n++]=null;var l=Hn[n];Hn[n++]=null;var f=Hn[n];Hn[n++]=null;var h=Hn[n];if(Hn[n++]=null,l!==null&&f!==null){var _=l.pending;_===null?f.next=f:(f.next=_.next,_.next=f),l.pending=f}h!==0&&ag(a,f,h)}}function Rl(e,n,a,l){Hn[Xi++]=e,Hn[Xi++]=n,Hn[Xi++]=a,Hn[Xi++]=l,ou|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function ru(e,n,a,l){return Rl(e,n,a,l),Il(e)}function oi(e,n){return Rl(e,null,null,n),Il(e)}function ag(e,n,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,h=e.return;h!==null;)h.childLanes|=a,l=h.alternate,l!==null&&(l.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-Xt(a),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),h):null}function Il(e){if(50<Tr)throw Tr=0,vf=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Qi={};function eS(e,n,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wn(e,n,a,l){return new eS(e,n,a,l)}function lu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ls(e,n){var a=e.alternate;return a===null?(a=wn(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function ig(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Ol(e,n,a,l,f,h){var _=0;if(l=e,typeof e=="function")lu(e)&&(_=1);else if(typeof e=="string")_=iT(e,a,Ue.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case U:return e=wn(31,a,n,f),e.elementType=U,e.lanes=h,e;case j:return ri(a.children,f,h,n);case N:_=8,f|=24;break;case T:return e=wn(12,a,n,f|2),e.elementType=T,e.lanes=h,e;case E:return e=wn(13,a,n,f),e.elementType=E,e.lanes=h,e;case A:return e=wn(19,a,n,f),e.elementType=A,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:_=10;break e;case C:_=9;break e;case B:_=11;break e;case $:_=14;break e;case L:_=16,l=null;break e}_=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=wn(_,a,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function ri(e,n,a,l){return e=wn(7,e,l,n),e.lanes=a,e}function cu(e,n,a){return e=wn(6,e,null,n),e.lanes=a,e}function og(e){var n=wn(18,null,null,0);return n.stateNode=e,n}function du(e,n,a){return n=wn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var rg=new WeakMap;function Vn(e,n){if(typeof e=="object"&&e!==null){var a=rg.get(e);return a!==void 0?a:(n={value:e,source:n,stack:ze(n)},rg.set(e,n),n)}return{value:e,source:n,stack:ze(n)}}var eo=[],to=0,Bl=null,sr=0,qn=[],Gn=0,ma=null,_s=1,ks="";function zs(e,n){eo[to++]=sr,eo[to++]=Bl,Bl=e,sr=n}function lg(e,n,a){qn[Gn++]=_s,qn[Gn++]=ks,qn[Gn++]=ma,ma=e;var l=_s;e=ks;var f=32-Xt(l)-1;l&=~(1<<f),a+=1;var h=32-Xt(n)+f;if(30<h){var _=f-f%5;h=(l&(1<<_)-1).toString(32),l>>=_,f-=_,_s=1<<32-Xt(n)+f|a<<f|l,ks=h+e}else _s=1<<h|a<<f|l,ks=e}function uu(e){e.return!==null&&(zs(e,1),lg(e,1,0))}function fu(e){for(;e===Bl;)Bl=eo[--to],eo[to]=null,sr=eo[--to],eo[to]=null;for(;e===ma;)ma=qn[--Gn],qn[Gn]=null,ks=qn[--Gn],qn[Gn]=null,_s=qn[--Gn],qn[Gn]=null}function cg(e,n){qn[Gn++]=_s,qn[Gn++]=ks,qn[Gn++]=ma,_s=n.id,ks=n.overflow,ma=e}var an=null,yt=null,Fe=!1,ha=null,Fn=!1,pu=Error(r(519));function ga(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ar(Vn(n,e)),pu}function dg(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[Qe]=e,n[rt]=l,a){case"dialog":Pe("cancel",n),Pe("close",n);break;case"iframe":case"object":case"embed":Pe("load",n);break;case"video":case"audio":for(a=0;a<wr.length;a++)Pe(wr[a],n);break;case"source":Pe("error",n);break;case"img":case"image":case"link":Pe("error",n),Pe("load",n);break;case"details":Pe("toggle",n);break;case"input":Pe("invalid",n),Sh(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Pe("invalid",n);break;case"textarea":Pe("invalid",n),jh(n,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||l.suppressHydrationWarning===!0||N0(n.textContent,a)?(l.popover!=null&&(Pe("beforetoggle",n),Pe("toggle",n)),l.onScroll!=null&&Pe("scroll",n),l.onScrollEnd!=null&&Pe("scrollend",n),l.onClick!=null&&(n.onclick=Os),n=!0):n=!1,n||ga(e,!0)}function ug(e){for(an=e.return;an;)switch(an.tag){case 5:case 31:case 13:Fn=!1;return;case 27:case 3:Fn=!0;return;default:an=an.return}}function no(e){if(e!==an)return!1;if(!Fe)return ug(e),Fe=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Mf(e.type,e.memoizedProps)),a=!a),a&&yt&&ga(e),ug(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));yt=B0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));yt=B0(e)}else n===27?(n=yt,Aa(e.type)?(e=Lf,Lf=null,yt=e):yt=n):yt=an?Kn(e.stateNode.nextSibling):null;return!0}function li(){yt=an=null,Fe=!1}function mu(){var e=ha;return e!==null&&(Sn===null?Sn=e:Sn.push.apply(Sn,e),ha=null),e}function ar(e){ha===null?ha=[e]:ha.push(e)}var hu=ye(null),ci=null,$s=null;function va(e,n,a){Ne(hu,n._currentValue),n._currentValue=a}function Ps(e){e._currentValue=hu.current,fe(hu)}function gu(e,n,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===a)break;e=e.return}}function vu(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var _=f.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=f;for(var R=0;R<n.length;R++)if(w.context===n[R]){h.lanes|=a,w=h.alternate,w!==null&&(w.lanes|=a),gu(h.return,a,e),l||(_=null);break e}h=w.next}}else if(f.tag===18){if(_=f.return,_===null)throw Error(r(341));_.lanes|=a,h=_.alternate,h!==null&&(h.lanes|=a),gu(_,a,e),_=null}else _=f.child;if(_!==null)_.return=f;else for(_=f;_!==null;){if(_===e){_=null;break}if(f=_.sibling,f!==null){f.return=_.return,_=f;break}_=_.return}f=_}}function so(e,n,a,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var _=f.alternate;if(_===null)throw Error(r(387));if(_=_.memoizedProps,_!==null){var w=f.type;jn(f.pendingProps.value,_.value)||(e!==null?e.push(w):e=[w])}}else if(f===xe.current){if(_=f.alternate,_===null)throw Error(r(387));_.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Dr):e=[Dr])}f=f.return}e!==null&&vu(n,e,a,l),n.flags|=262144}function Ll(e){for(e=e.firstContext;e!==null;){if(!jn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function di(e){ci=e,$s=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function on(e){return fg(ci,e)}function zl(e,n){return ci===null&&di(e),fg(e,n)}function fg(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},$s===null){if(e===null)throw Error(r(308));$s=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else $s=$s.next=n;return a}var tS=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},nS=t.unstable_scheduleCallback,sS=t.unstable_NormalPriority,Ht={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yu(){return{controller:new tS,data:new Map,refCount:0}}function ir(e){e.refCount--,e.refCount===0&&nS(sS,function(){e.controller.abort()})}var or=null,bu=0,ao=0,io=null;function aS(e,n){if(or===null){var a=or=[];bu=0,ao=Sf(),io={status:"pending",value:void 0,then:function(l){a.push(l)}}}return bu++,n.then(pg,pg),n}function pg(){if(--bu===0&&or!==null){io!==null&&(io.status="fulfilled");var e=or;or=null,ao=0,io=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function iS(e,n){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<a.length;f++)(0,a[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var mg=M.S;M.S=function(e,n){Wv=Jt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&aS(e,n),mg!==null&&mg(e,n)};var ui=ye(null);function xu(){var e=ui.current;return e!==null?e:gt.pooledCache}function $l(e,n){n===null?Ne(ui,ui.current):Ne(ui,n.pool)}function hg(){var e=xu();return e===null?null:{parent:Ht._currentValue,pool:e}}var oo=Error(r(460)),_u=Error(r(474)),Pl=Error(r(542)),Ul={then:function(){}};function gg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function vg(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(Os,Os),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,bg(e),e;default:if(typeof n.status=="string")n.then(Os,Os);else{if(e=gt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(l){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=l}},function(l){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,bg(e),e}throw pi=n,oo}}function fi(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(pi=a,oo):a}}var pi=null;function yg(){if(pi===null)throw Error(r(459));var e=pi;return pi=null,e}function bg(e){if(e===oo||e===Pl)throw Error(r(483))}var ro=null,rr=0;function Hl(e){var n=rr;return rr+=1,ro===null&&(ro=[]),vg(ro,e,n)}function lr(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Vl(e,n){throw n.$$typeof===b?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function xg(e){function n(P,z){if(e){var q=P.deletions;q===null?(P.deletions=[z],P.flags|=16):q.push(z)}}function a(P,z){if(!e)return null;for(;z!==null;)n(P,z),z=z.sibling;return null}function l(P){for(var z=new Map;P!==null;)P.key!==null?z.set(P.key,P):z.set(P.index,P),P=P.sibling;return z}function f(P,z){return P=Ls(P,z),P.index=0,P.sibling=null,P}function h(P,z,q){return P.index=q,e?(q=P.alternate,q!==null?(q=q.index,q<z?(P.flags|=67108866,z):q):(P.flags|=67108866,z)):(P.flags|=1048576,z)}function _(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function w(P,z,q,se){return z===null||z.tag!==6?(z=cu(q,P.mode,se),z.return=P,z):(z=f(z,q),z.return=P,z)}function R(P,z,q,se){var je=q.type;return je===j?Q(P,z,q.props.children,se,q.key):z!==null&&(z.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===L&&fi(je)===z.type)?(z=f(z,q.props),lr(z,q),z.return=P,z):(z=Ol(q.type,q.key,q.props,null,P.mode,se),lr(z,q),z.return=P,z)}function G(P,z,q,se){return z===null||z.tag!==4||z.stateNode.containerInfo!==q.containerInfo||z.stateNode.implementation!==q.implementation?(z=du(q,P.mode,se),z.return=P,z):(z=f(z,q.children||[]),z.return=P,z)}function Q(P,z,q,se,je){return z===null||z.tag!==7?(z=ri(q,P.mode,se,je),z.return=P,z):(z=f(z,q),z.return=P,z)}function ae(P,z,q){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=cu(""+z,P.mode,q),z.return=P,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case k:return q=Ol(z.type,z.key,z.props,null,P.mode,q),lr(q,z),q.return=P,q;case S:return z=du(z,P.mode,q),z.return=P,z;case L:return z=fi(z),ae(P,z,q)}if(ie(z)||K(z))return z=ri(z,P.mode,q,null),z.return=P,z;if(typeof z.then=="function")return ae(P,Hl(z),q);if(z.$$typeof===D)return ae(P,zl(P,z),q);Vl(P,z)}return null}function F(P,z,q,se){var je=z!==null?z.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return je!==null?null:w(P,z,""+q,se);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case k:return q.key===je?R(P,z,q,se):null;case S:return q.key===je?G(P,z,q,se):null;case L:return q=fi(q),F(P,z,q,se)}if(ie(q)||K(q))return je!==null?null:Q(P,z,q,se,null);if(typeof q.then=="function")return F(P,z,Hl(q),se);if(q.$$typeof===D)return F(P,z,zl(P,q),se);Vl(P,q)}return null}function Z(P,z,q,se,je){if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return P=P.get(q)||null,w(z,P,""+se,je);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case k:return P=P.get(se.key===null?q:se.key)||null,R(z,P,se,je);case S:return P=P.get(se.key===null?q:se.key)||null,G(z,P,se,je);case L:return se=fi(se),Z(P,z,q,se,je)}if(ie(se)||K(se))return P=P.get(q)||null,Q(z,P,se,je,null);if(typeof se.then=="function")return Z(P,z,q,Hl(se),je);if(se.$$typeof===D)return Z(P,z,q,zl(z,se),je);Vl(z,se)}return null}function be(P,z,q,se){for(var je=null,et=null,_e=z,Oe=z=0,qe=null;_e!==null&&Oe<q.length;Oe++){_e.index>Oe?(qe=_e,_e=null):qe=_e.sibling;var tt=F(P,_e,q[Oe],se);if(tt===null){_e===null&&(_e=qe);break}e&&_e&&tt.alternate===null&&n(P,_e),z=h(tt,z,Oe),et===null?je=tt:et.sibling=tt,et=tt,_e=qe}if(Oe===q.length)return a(P,_e),Fe&&zs(P,Oe),je;if(_e===null){for(;Oe<q.length;Oe++)_e=ae(P,q[Oe],se),_e!==null&&(z=h(_e,z,Oe),et===null?je=_e:et.sibling=_e,et=_e);return Fe&&zs(P,Oe),je}for(_e=l(_e);Oe<q.length;Oe++)qe=Z(_e,P,Oe,q[Oe],se),qe!==null&&(e&&qe.alternate!==null&&_e.delete(qe.key===null?Oe:qe.key),z=h(qe,z,Oe),et===null?je=qe:et.sibling=qe,et=qe);return e&&_e.forEach(function(Oa){return n(P,Oa)}),Fe&&zs(P,Oe),je}function Ce(P,z,q,se){if(q==null)throw Error(r(151));for(var je=null,et=null,_e=z,Oe=z=0,qe=null,tt=q.next();_e!==null&&!tt.done;Oe++,tt=q.next()){_e.index>Oe?(qe=_e,_e=null):qe=_e.sibling;var Oa=F(P,_e,tt.value,se);if(Oa===null){_e===null&&(_e=qe);break}e&&_e&&Oa.alternate===null&&n(P,_e),z=h(Oa,z,Oe),et===null?je=Oa:et.sibling=Oa,et=Oa,_e=qe}if(tt.done)return a(P,_e),Fe&&zs(P,Oe),je;if(_e===null){for(;!tt.done;Oe++,tt=q.next())tt=ae(P,tt.value,se),tt!==null&&(z=h(tt,z,Oe),et===null?je=tt:et.sibling=tt,et=tt);return Fe&&zs(P,Oe),je}for(_e=l(_e);!tt.done;Oe++,tt=q.next())tt=Z(_e,P,Oe,tt.value,se),tt!==null&&(e&&tt.alternate!==null&&_e.delete(tt.key===null?Oe:tt.key),z=h(tt,z,Oe),et===null?je=tt:et.sibling=tt,et=tt);return e&&_e.forEach(function(gT){return n(P,gT)}),Fe&&zs(P,Oe),je}function pt(P,z,q,se){if(typeof q=="object"&&q!==null&&q.type===j&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case k:e:{for(var je=q.key;z!==null;){if(z.key===je){if(je=q.type,je===j){if(z.tag===7){a(P,z.sibling),se=f(z,q.props.children),se.return=P,P=se;break e}}else if(z.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===L&&fi(je)===z.type){a(P,z.sibling),se=f(z,q.props),lr(se,q),se.return=P,P=se;break e}a(P,z);break}else n(P,z);z=z.sibling}q.type===j?(se=ri(q.props.children,P.mode,se,q.key),se.return=P,P=se):(se=Ol(q.type,q.key,q.props,null,P.mode,se),lr(se,q),se.return=P,P=se)}return _(P);case S:e:{for(je=q.key;z!==null;){if(z.key===je)if(z.tag===4&&z.stateNode.containerInfo===q.containerInfo&&z.stateNode.implementation===q.implementation){a(P,z.sibling),se=f(z,q.children||[]),se.return=P,P=se;break e}else{a(P,z);break}else n(P,z);z=z.sibling}se=du(q,P.mode,se),se.return=P,P=se}return _(P);case L:return q=fi(q),pt(P,z,q,se)}if(ie(q))return be(P,z,q,se);if(K(q)){if(je=K(q),typeof je!="function")throw Error(r(150));return q=je.call(q),Ce(P,z,q,se)}if(typeof q.then=="function")return pt(P,z,Hl(q),se);if(q.$$typeof===D)return pt(P,z,zl(P,q),se);Vl(P,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,z!==null&&z.tag===6?(a(P,z.sibling),se=f(z,q),se.return=P,P=se):(a(P,z),se=cu(q,P.mode,se),se.return=P,P=se),_(P)):a(P,z)}return function(P,z,q,se){try{rr=0;var je=pt(P,z,q,se);return ro=null,je}catch(_e){if(_e===oo||_e===Pl)throw _e;var et=wn(29,_e,null,P.mode);return et.lanes=se,et.return=P,et}finally{}}}var mi=xg(!0),_g=xg(!1),ya=!1;function ku(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Su(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ba(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xa(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(at&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=Il(e),ag(e,null,a),n}return Rl(e,l,n,a),Il(e)}function cr(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,me(e,a)}}function Tu(e,n){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?f=h=_:h=h.next=_,a=a.next}while(a!==null);h===null?f=h=n:h=h.next=n}else f=h=n;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var ju=!1;function dr(){if(ju){var e=io;if(e!==null)throw e}}function ur(e,n,a,l){ju=!1;var f=e.updateQueue;ya=!1;var h=f.firstBaseUpdate,_=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var R=w,G=R.next;R.next=null,_===null?h=G:_.next=G,_=R;var Q=e.alternate;Q!==null&&(Q=Q.updateQueue,w=Q.lastBaseUpdate,w!==_&&(w===null?Q.firstBaseUpdate=G:w.next=G,Q.lastBaseUpdate=R))}if(h!==null){var ae=f.baseState;_=0,Q=G=R=null,w=h;do{var F=w.lane&-536870913,Z=F!==w.lane;if(Z?(Ve&F)===F:(l&F)===F){F!==0&&F===ao&&(ju=!0),Q!==null&&(Q=Q.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var be=e,Ce=w;F=n;var pt=a;switch(Ce.tag){case 1:if(be=Ce.payload,typeof be=="function"){ae=be.call(pt,ae,F);break e}ae=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ce.payload,F=typeof be=="function"?be.call(pt,ae,F):be,F==null)break e;ae=x({},ae,F);break e;case 2:ya=!0}}F=w.callback,F!==null&&(e.flags|=64,Z&&(e.flags|=8192),Z=f.callbacks,Z===null?f.callbacks=[F]:Z.push(F))}else Z={lane:F,tag:w.tag,payload:w.payload,callback:w.callback,next:null},Q===null?(G=Q=Z,R=ae):Q=Q.next=Z,_|=F;if(w=w.next,w===null){if(w=f.shared.pending,w===null)break;Z=w,w=Z.next,Z.next=null,f.lastBaseUpdate=Z,f.shared.pending=null}}while(!0);Q===null&&(R=ae),f.baseState=R,f.firstBaseUpdate=G,f.lastBaseUpdate=Q,h===null&&(f.shared.lanes=0),ja|=_,e.lanes=_,e.memoizedState=ae}}function kg(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function Sg(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)kg(a[e],n)}var lo=ye(null),ql=ye(0);function Tg(e,n){e=Ys,Ne(ql,e),Ne(lo,n),Ys=e|n.baseLanes}function wu(){Ne(ql,Ys),Ne(lo,lo.current)}function Nu(){Ys=ql.current,fe(lo),fe(ql)}var Nn=ye(null),Zn=null;function _a(e){var n=e.alternate;Ne(Lt,Lt.current&1),Ne(Nn,e),Zn===null&&(n===null||lo.current!==null||n.memoizedState!==null)&&(Zn=e)}function Cu(e){Ne(Lt,Lt.current),Ne(Nn,e),Zn===null&&(Zn=e)}function jg(e){e.tag===22?(Ne(Lt,Lt.current),Ne(Nn,e),Zn===null&&(Zn=e)):ka()}function ka(){Ne(Lt,Lt.current),Ne(Nn,Nn.current)}function Cn(e){fe(Nn),Zn===e&&(Zn=null),fe(Lt)}var Lt=ye(0);function Gl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Of(a)||Bf(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Us=0,Ie=null,ut=null,Vt=null,Fl=!1,co=!1,hi=!1,Zl=0,fr=0,uo=null,oS=0;function Et(){throw Error(r(321))}function Eu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!jn(e[a],n[a]))return!1;return!0}function Au(e,n,a,l,f,h){return Us=h,Ie=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,M.H=e===null||e.memoizedState===null?lv:Gu,hi=!1,h=a(l,f),hi=!1,co&&(h=Ng(n,a,l,f)),wg(e),h}function wg(e){M.H=hr;var n=ut!==null&&ut.next!==null;if(Us=0,Vt=ut=Ie=null,Fl=!1,fr=0,uo=null,n)throw Error(r(300));e===null||qt||(e=e.dependencies,e!==null&&Ll(e)&&(qt=!0))}function Ng(e,n,a,l){Ie=e;var f=0;do{if(co&&(uo=null),fr=0,co=!1,25<=f)throw Error(r(301));if(f+=1,Vt=ut=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}M.H=cv,h=n(a,l)}while(co);return h}function rS(){var e=M.H,n=e.useState()[0];return n=typeof n.then=="function"?pr(n):n,e=e.useState()[0],(ut!==null?ut.memoizedState:null)!==e&&(Ie.flags|=1024),n}function Du(){var e=Zl!==0;return Zl=0,e}function Mu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Ru(e){if(Fl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Fl=!1}Us=0,Vt=ut=Ie=null,co=!1,fr=Zl=0,uo=null}function hn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?Ie.memoizedState=Vt=e:Vt=Vt.next=e,Vt}function zt(){if(ut===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=ut.next;var n=Vt===null?Ie.memoizedState:Vt.next;if(n!==null)Vt=n,ut=e;else{if(e===null)throw Ie.alternate===null?Error(r(467)):Error(r(310));ut=e,e={memoizedState:ut.memoizedState,baseState:ut.baseState,baseQueue:ut.baseQueue,queue:ut.queue,next:null},Vt===null?Ie.memoizedState=Vt=e:Vt=Vt.next=e}return Vt}function Kl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pr(e){var n=fr;return fr+=1,uo===null&&(uo=[]),e=vg(uo,e,n),n=Ie,(Vt===null?n.memoizedState:Vt.next)===null&&(n=n.alternate,M.H=n===null||n.memoizedState===null?lv:Gu),e}function Yl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return pr(e);if(e.$$typeof===D)return on(e)}throw Error(r(438,String(e)))}function Iu(e){var n=null,a=Ie.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=Ie.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Kl(),Ie.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),l=0;l<e;l++)a[l]=J;return n.index++,a}function Hs(e,n){return typeof n=="function"?n(e):n}function Jl(e){var n=zt();return Ou(n,ut,e)}function Ou(e,n,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var _=f.next;f.next=h.next,h.next=_}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var w=_=null,R=null,G=n,Q=!1;do{var ae=G.lane&-536870913;if(ae!==G.lane?(Ve&ae)===ae:(Us&ae)===ae){var F=G.revertLane;if(F===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),ae===ao&&(Q=!0);else if((Us&F)===F){G=G.next,F===ao&&(Q=!0);continue}else ae={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},R===null?(w=R=ae,_=h):R=R.next=ae,Ie.lanes|=F,ja|=F;ae=G.action,hi&&a(h,ae),h=G.hasEagerState?G.eagerState:a(h,ae)}else F={lane:ae,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},R===null?(w=R=F,_=h):R=R.next=F,Ie.lanes|=ae,ja|=ae;G=G.next}while(G!==null&&G!==n);if(R===null?_=h:R.next=w,!jn(h,e.memoizedState)&&(qt=!0,Q&&(a=io,a!==null)))throw a;e.memoizedState=h,e.baseState=_,e.baseQueue=R,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Bu(e){var n=zt(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,h=n.memoizedState;if(f!==null){a.pending=null;var _=f=f.next;do h=e(h,_.action),_=_.next;while(_!==f);jn(h,n.memoizedState)||(qt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,l]}function Cg(e,n,a){var l=Ie,f=zt(),h=Fe;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=n();var _=!jn((ut||f).memoizedState,a);if(_&&(f.memoizedState=a,qt=!0),f=f.queue,$u(Dg.bind(null,l,f,e),[e]),f.getSnapshot!==n||_||Vt!==null&&Vt.memoizedState.tag&1){if(l.flags|=2048,fo(9,{destroy:void 0},Ag.bind(null,l,f,a,n),null),gt===null)throw Error(r(349));h||(Us&127)!==0||Eg(l,n,a)}return a}function Eg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ie.updateQueue,n===null?(n=Kl(),Ie.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Ag(e,n,a,l){n.value=a,n.getSnapshot=l,Mg(n)&&Rg(e)}function Dg(e,n,a){return a(function(){Mg(n)&&Rg(e)})}function Mg(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!jn(e,a)}catch{return!0}}function Rg(e){var n=oi(e,2);n!==null&&Tn(n,e,2)}function Lu(e){var n=hn();if(typeof e=="function"){var a=e;if(e=a(),hi){mn(!0);try{a()}finally{mn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hs,lastRenderedState:e},n}function Ig(e,n,a,l){return e.baseState=a,Ou(e,ut,typeof l=="function"?l:Hs)}function lS(e,n,a,l,f){if(Ql(e))throw Error(r(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){h.listeners.push(_)}};M.T!==null?a(!0):h.isTransition=!1,l(h),a=n.pending,a===null?(h.next=n.pending=h,Og(n,h)):(h.next=a.next,n.pending=a.next=h)}}function Og(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=M.T,_={};M.T=_;try{var w=a(f,l),R=M.S;R!==null&&R(_,w),Bg(e,n,w)}catch(G){zu(e,n,G)}finally{h!==null&&_.types!==null&&(h.types=_.types),M.T=h}}else try{h=a(f,l),Bg(e,n,h)}catch(G){zu(e,n,G)}}function Bg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){Lg(e,n,l)},function(l){return zu(e,n,l)}):Lg(e,n,a)}function Lg(e,n,a){n.status="fulfilled",n.value=a,zg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Og(e,a)))}function zu(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,zg(n),n=n.next;while(n!==l)}e.action=null}function zg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function $g(e,n){return n}function Pg(e,n){if(Fe){var a=gt.formState;if(a!==null){e:{var l=Ie;if(Fe){if(yt){t:{for(var f=yt,h=Fn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Kn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){yt=Kn(f.nextSibling),l=f.data==="F!";break e}}ga(l)}l=!1}l&&(n=a[0])}}return a=hn(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$g,lastRenderedState:n},a.queue=l,a=iv.bind(null,Ie,l),l.dispatch=a,l=Lu(!1),h=qu.bind(null,Ie,!1,l.queue),l=hn(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=lS.bind(null,Ie,f,h,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function Ug(e){var n=zt();return Hg(n,ut,e)}function Hg(e,n,a){if(n=Ou(e,n,$g)[0],e=Jl(Hs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=pr(n)}catch(_){throw _===oo?Pl:_}else l=n;n=zt();var f=n.queue,h=f.dispatch;return a!==n.memoizedState&&(Ie.flags|=2048,fo(9,{destroy:void 0},cS.bind(null,f,a),null)),[l,h,e]}function cS(e,n){e.action=n}function Vg(e){var n=zt(),a=ut;if(a!==null)return Hg(n,a,e);zt(),n=n.memoizedState,a=zt();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function fo(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=Ie.updateQueue,n===null&&(n=Kl(),Ie.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,n.lastEffect=e),e}function qg(){return zt().memoizedState}function Wl(e,n,a,l){var f=hn();Ie.flags|=e,f.memoizedState=fo(1|n,{destroy:void 0},a,l===void 0?null:l)}function Xl(e,n,a,l){var f=zt();l=l===void 0?null:l;var h=f.memoizedState.inst;ut!==null&&l!==null&&Eu(l,ut.memoizedState.deps)?f.memoizedState=fo(n,h,a,l):(Ie.flags|=e,f.memoizedState=fo(1|n,h,a,l))}function Gg(e,n){Wl(8390656,8,e,n)}function $u(e,n){Xl(2048,8,e,n)}function dS(e){Ie.flags|=4;var n=Ie.updateQueue;if(n===null)n=Kl(),Ie.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Fg(e){var n=zt().memoizedState;return dS({ref:n,nextImpl:e}),function(){if((at&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Zg(e,n){return Xl(4,2,e,n)}function Kg(e,n){return Xl(4,4,e,n)}function Yg(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Jg(e,n,a){a=a!=null?a.concat([e]):null,Xl(4,4,Yg.bind(null,n,e),a)}function Pu(){}function Wg(e,n){var a=zt();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&Eu(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Xg(e,n){var a=zt();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&Eu(n,l[1]))return l[0];if(l=e(),hi){mn(!0);try{e()}finally{mn(!1)}}return a.memoizedState=[l,n],l}function Uu(e,n,a){return a===void 0||(Us&1073741824)!==0&&(Ve&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Qv(),Ie.lanes|=e,ja|=e,a)}function Qg(e,n,a,l){return jn(a,n)?a:lo.current!==null?(e=Uu(e,a,l),jn(e,n)||(qt=!0),e):(Us&42)===0||(Us&1073741824)!==0&&(Ve&261930)===0?(qt=!0,e.memoizedState=a):(e=Qv(),Ie.lanes|=e,ja|=e,n)}function ev(e,n,a,l,f){var h=O.p;O.p=h!==0&&8>h?h:8;var _=M.T,w={};M.T=w,qu(e,!1,n,a);try{var R=f(),G=M.S;if(G!==null&&G(w,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Q=iS(R,l);mr(e,n,Q,Dn(e))}else mr(e,n,l,Dn(e))}catch(ae){mr(e,n,{then:function(){},status:"rejected",reason:ae},Dn())}finally{O.p=h,_!==null&&w.types!==null&&(_.types=w.types),M.T=_}}function uS(){}function Hu(e,n,a,l){if(e.tag!==5)throw Error(r(476));var f=tv(e).queue;ev(e,f,n,X,a===null?uS:function(){return nv(e),a(l)})}function tv(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hs,lastRenderedState:X},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hs,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function nv(e){var n=tv(e);n.next===null&&(n=e.alternate.memoizedState),mr(e,n.next.queue,{},Dn())}function Vu(){return on(Dr)}function sv(){return zt().memoizedState}function av(){return zt().memoizedState}function fS(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Dn();e=ba(a);var l=xa(n,e,a);l!==null&&(Tn(l,n,a),cr(l,n,a)),n={cache:yu()},e.payload=n;return}n=n.return}}function pS(e,n,a){var l=Dn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ql(e)?ov(n,a):(a=ru(e,n,a,l),a!==null&&(Tn(a,e,l),rv(a,n,l)))}function iv(e,n,a){var l=Dn();mr(e,n,a,l)}function mr(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ql(e))ov(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var _=n.lastRenderedState,w=h(_,a);if(f.hasEagerState=!0,f.eagerState=w,jn(w,_))return Rl(e,n,f,0),gt===null&&Ml(),!1}catch{}finally{}if(a=ru(e,n,f,l),a!==null)return Tn(a,e,l),rv(a,n,l),!0}return!1}function qu(e,n,a,l){if(l={lane:2,revertLane:Sf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ql(e)){if(n)throw Error(r(479))}else n=ru(e,a,l,2),n!==null&&Tn(n,e,2)}function Ql(e){var n=e.alternate;return e===Ie||n!==null&&n===Ie}function ov(e,n){co=Fl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function rv(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,me(e,a)}}var hr={readContext:on,use:Yl,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};hr.useEffectEvent=Et;var lv={readContext:on,use:Yl,useCallback:function(e,n){return hn().memoizedState=[e,n===void 0?null:n],e},useContext:on,useEffect:Gg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Wl(4194308,4,Yg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Wl(4194308,4,e,n)},useInsertionEffect:function(e,n){Wl(4,2,e,n)},useMemo:function(e,n){var a=hn();n=n===void 0?null:n;var l=e();if(hi){mn(!0);try{e()}finally{mn(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=hn();if(a!==void 0){var f=a(n);if(hi){mn(!0);try{a(n)}finally{mn(!1)}}}else f=n;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=pS.bind(null,Ie,e),[l.memoizedState,e]},useRef:function(e){var n=hn();return e={current:e},n.memoizedState=e},useState:function(e){e=Lu(e);var n=e.queue,a=iv.bind(null,Ie,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Pu,useDeferredValue:function(e,n){var a=hn();return Uu(a,e,n)},useTransition:function(){var e=Lu(!1);return e=ev.bind(null,Ie,e.queue,!0,!1),hn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=Ie,f=hn();if(Fe){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),gt===null)throw Error(r(349));(Ve&127)!==0||Eg(l,n,a)}f.memoizedState=a;var h={value:a,getSnapshot:n};return f.queue=h,Gg(Dg.bind(null,l,h,e),[e]),l.flags|=2048,fo(9,{destroy:void 0},Ag.bind(null,l,h,a,n),null),a},useId:function(){var e=hn(),n=gt.identifierPrefix;if(Fe){var a=ks,l=_s;a=(l&~(1<<32-Xt(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Zl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=oS++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Vu,useFormState:Pg,useActionState:Pg,useOptimistic:function(e){var n=hn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=qu.bind(null,Ie,!0,a),a.dispatch=n,[e,n]},useMemoCache:Iu,useCacheRefresh:function(){return hn().memoizedState=fS.bind(null,Ie)},useEffectEvent:function(e){var n=hn(),a={impl:e};return n.memoizedState=a,function(){if((at&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Gu={readContext:on,use:Yl,useCallback:Wg,useContext:on,useEffect:$u,useImperativeHandle:Jg,useInsertionEffect:Zg,useLayoutEffect:Kg,useMemo:Xg,useReducer:Jl,useRef:qg,useState:function(){return Jl(Hs)},useDebugValue:Pu,useDeferredValue:function(e,n){var a=zt();return Qg(a,ut.memoizedState,e,n)},useTransition:function(){var e=Jl(Hs)[0],n=zt().memoizedState;return[typeof e=="boolean"?e:pr(e),n]},useSyncExternalStore:Cg,useId:sv,useHostTransitionStatus:Vu,useFormState:Ug,useActionState:Ug,useOptimistic:function(e,n){var a=zt();return Ig(a,ut,e,n)},useMemoCache:Iu,useCacheRefresh:av};Gu.useEffectEvent=Fg;var cv={readContext:on,use:Yl,useCallback:Wg,useContext:on,useEffect:$u,useImperativeHandle:Jg,useInsertionEffect:Zg,useLayoutEffect:Kg,useMemo:Xg,useReducer:Bu,useRef:qg,useState:function(){return Bu(Hs)},useDebugValue:Pu,useDeferredValue:function(e,n){var a=zt();return ut===null?Uu(a,e,n):Qg(a,ut.memoizedState,e,n)},useTransition:function(){var e=Bu(Hs)[0],n=zt().memoizedState;return[typeof e=="boolean"?e:pr(e),n]},useSyncExternalStore:Cg,useId:sv,useHostTransitionStatus:Vu,useFormState:Vg,useActionState:Vg,useOptimistic:function(e,n){var a=zt();return ut!==null?Ig(a,ut,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Iu,useCacheRefresh:av};cv.useEffectEvent=Fg;function Fu(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:x({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Zu={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=Dn(),f=ba(l);f.payload=n,a!=null&&(f.callback=a),n=xa(e,f,l),n!==null&&(Tn(n,e,l),cr(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=Dn(),f=ba(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=xa(e,f,l),n!==null&&(Tn(n,e,l),cr(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Dn(),l=ba(a);l.tag=2,n!=null&&(l.callback=n),n=xa(e,l,a),n!==null&&(Tn(n,e,a),cr(n,e,a))}};function dv(e,n,a,l,f,h,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,_):n.prototype&&n.prototype.isPureReactComponent?!tr(a,l)||!tr(f,h):!0}function uv(e,n,a,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,l),n.state!==e&&Zu.enqueueReplaceState(n,n.state,null)}function gi(e,n){var a=n;if("ref"in n){a={};for(var l in n)l!=="ref"&&(a[l]=n[l])}if(e=e.defaultProps){a===n&&(a=x({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function fv(e){Dl(e)}function pv(e){console.error(e)}function mv(e){Dl(e)}function ec(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function hv(e,n,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Ku(e,n,a){return a=ba(a),a.tag=3,a.payload={element:null},a.callback=function(){ec(e,n)},a}function gv(e){return e=ba(e),e.tag=3,e}function vv(e,n,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var h=l.value;e.payload=function(){return f(h)},e.callback=function(){hv(n,a,l)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){hv(n,a,l),typeof f!="function"&&(wa===null?wa=new Set([this]):wa.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function mS(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&so(n,a,f,!0),a=Nn.current,a!==null){switch(a.tag){case 31:case 13:return Zn===null?fc():a.alternate===null&&At===0&&(At=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Ul?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),xf(e,l,f)),!1;case 22:return a.flags|=65536,l===Ul?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([l]):a.add(l)),xf(e,l,f)),!1}throw Error(r(435,a.tag))}return xf(e,l,f),fc(),!1}if(Fe)return n=Nn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==pu&&(e=Error(r(422),{cause:l}),ar(Vn(e,a)))):(l!==pu&&(n=Error(r(423),{cause:l}),ar(Vn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Vn(l,a),f=Ku(e.stateNode,l,f),Tu(e,f),At!==4&&(At=2)),!1;var h=Error(r(520),{cause:l});if(h=Vn(h,a),Sr===null?Sr=[h]:Sr.push(h),At!==4&&(At=2),n===null)return!0;l=Vn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Ku(a.stateNode,l,e),Tu(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(wa===null||!wa.has(h))))return a.flags|=65536,f&=-f,a.lanes|=f,f=gv(f),vv(f,e,a,l),Tu(a,f),!1}a=a.return}while(a!==null);return!1}var Yu=Error(r(461)),qt=!1;function rn(e,n,a,l){n.child=e===null?_g(n,null,a,l):mi(n,e.child,a,l)}function yv(e,n,a,l,f){a=a.render;var h=n.ref;if("ref"in l){var _={};for(var w in l)w!=="ref"&&(_[w]=l[w])}else _=l;return di(n),l=Au(e,n,a,_,h,f),w=Du(),e!==null&&!qt?(Mu(e,n,f),Vs(e,n,f)):(Fe&&w&&uu(n),n.flags|=1,rn(e,n,l,f),n.child)}function bv(e,n,a,l,f){if(e===null){var h=a.type;return typeof h=="function"&&!lu(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,xv(e,n,h,l,f)):(e=Ol(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!sf(e,f)){var _=h.memoizedProps;if(a=a.compare,a=a!==null?a:tr,a(_,l)&&e.ref===n.ref)return Vs(e,n,f)}return n.flags|=1,e=Ls(h,l),e.ref=n.ref,e.return=n,n.child=e}function xv(e,n,a,l,f){if(e!==null){var h=e.memoizedProps;if(tr(h,l)&&e.ref===n.ref)if(qt=!1,n.pendingProps=l=h,sf(e,f))(e.flags&131072)!==0&&(qt=!0);else return n.lanes=e.lanes,Vs(e,n,f)}return Ju(e,n,a,l,f)}function _v(e,n,a,l){var f=l.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|a:a,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~h}else l=0,n.child=null;return kv(e,n,h,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&$l(n,h!==null?h.cachePool:null),h!==null?Tg(n,h):wu(),jg(n);else return l=n.lanes=536870912,kv(e,n,h!==null?h.baseLanes|a:a,a,l)}else h!==null?($l(n,h.cachePool),Tg(n,h),ka(),n.memoizedState=null):(e!==null&&$l(n,null),wu(),ka());return rn(e,n,f,a),n.child}function gr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function kv(e,n,a,l,f){var h=xu();return h=h===null?null:{parent:Ht._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&$l(n,null),wu(),jg(n),e!==null&&so(e,n,l,!0),n.childLanes=f,null}function tc(e,n){return n=sc({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Sv(e,n,a){return mi(n,e.child,null,a),e=tc(n,n.pendingProps),e.flags|=2,Cn(n),n.memoizedState=null,e}function hS(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Fe){if(l.mode==="hidden")return e=tc(n,l),n.lanes=536870912,gr(null,e);if(Cu(n),(e=yt)?(e=O0(e,Fn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ma!==null?{id:_s,overflow:ks}:null,retryLane:536870912,hydrationErrors:null},a=og(e),a.return=n,n.child=a,an=n,yt=null)):e=null,e===null)throw ga(n);return n.lanes=536870912,null}return tc(n,l)}var h=e.memoizedState;if(h!==null){var _=h.dehydrated;if(Cu(n),f)if(n.flags&256)n.flags&=-257,n=Sv(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(qt||so(e,n,a,!1),f=(a&e.childLanes)!==0,qt||f){if(l=gt,l!==null&&(_=He(l,a),_!==0&&_!==h.retryLane))throw h.retryLane=_,oi(e,_),Tn(l,e,_),Yu;fc(),n=Sv(e,n,a)}else e=h.treeContext,yt=Kn(_.nextSibling),an=n,Fe=!0,ha=null,Fn=!1,e!==null&&cg(n,e),n=tc(n,l),n.flags|=4096;return n}return e=Ls(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function nc(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Ju(e,n,a,l,f){return di(n),a=Au(e,n,a,l,void 0,f),l=Du(),e!==null&&!qt?(Mu(e,n,f),Vs(e,n,f)):(Fe&&l&&uu(n),n.flags|=1,rn(e,n,a,f),n.child)}function Tv(e,n,a,l,f,h){return di(n),n.updateQueue=null,a=Ng(n,l,a,f),wg(e),l=Du(),e!==null&&!qt?(Mu(e,n,h),Vs(e,n,h)):(Fe&&l&&uu(n),n.flags|=1,rn(e,n,a,h),n.child)}function jv(e,n,a,l,f){if(di(n),n.stateNode===null){var h=Qi,_=a.contextType;typeof _=="object"&&_!==null&&(h=on(_)),h=new a(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Zu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},ku(n),_=a.contextType,h.context=typeof _=="object"&&_!==null?on(_):Qi,h.state=n.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(Fu(n,a,_,l),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(_=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),_!==h.state&&Zu.enqueueReplaceState(h,h.state,null),ur(n,l,h,f),dr(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var w=n.memoizedProps,R=gi(a,w);h.props=R;var G=h.context,Q=a.contextType;_=Qi,typeof Q=="object"&&Q!==null&&(_=on(Q));var ae=a.getDerivedStateFromProps;Q=typeof ae=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,Q||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||G!==_)&&uv(n,h,l,_),ya=!1;var F=n.memoizedState;h.state=F,ur(n,l,h,f),dr(),G=n.memoizedState,w||F!==G||ya?(typeof ae=="function"&&(Fu(n,a,ae,l),G=n.memoizedState),(R=ya||dv(n,a,R,l,F,G,_))?(Q||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=G),h.props=l,h.state=G,h.context=_,l=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,Su(e,n),_=n.memoizedProps,Q=gi(a,_),h.props=Q,ae=n.pendingProps,F=h.context,G=a.contextType,R=Qi,typeof G=="object"&&G!==null&&(R=on(G)),w=a.getDerivedStateFromProps,(G=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(_!==ae||F!==R)&&uv(n,h,l,R),ya=!1,F=n.memoizedState,h.state=F,ur(n,l,h,f),dr();var Z=n.memoizedState;_!==ae||F!==Z||ya||e!==null&&e.dependencies!==null&&Ll(e.dependencies)?(typeof w=="function"&&(Fu(n,a,w,l),Z=n.memoizedState),(Q=ya||dv(n,a,Q,l,F,Z,R)||e!==null&&e.dependencies!==null&&Ll(e.dependencies))?(G||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,Z,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,Z,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=Z),h.props=l,h.state=Z,h.context=R,l=Q):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,nc(e,n),l=(n.flags&128)!==0,h||l?(h=n.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&l?(n.child=mi(n,e.child,null,f),n.child=mi(n,null,a,f)):rn(e,n,a,f),n.memoizedState=h.state,e=n.child):e=Vs(e,n,f),e}function wv(e,n,a,l){return li(),n.flags|=256,rn(e,n,a,l),n.child}var Wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xu(e){return{baseLanes:e,cachePool:hg()}}function Qu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=An),e}function Nv(e,n,a){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,_;if((_=h)||(_=e!==null&&e.memoizedState===null?!1:(Lt.current&2)!==0),_&&(f=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,e===null){if(Fe){if(f?_a(n):ka(),(e=yt)?(e=O0(e,Fn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ma!==null?{id:_s,overflow:ks}:null,retryLane:536870912,hydrationErrors:null},a=og(e),a.return=n,n.child=a,an=n,yt=null)):e=null,e===null)throw ga(n);return Bf(e)?n.lanes=32:n.lanes=536870912,null}var w=l.children;return l=l.fallback,f?(ka(),f=n.mode,w=sc({mode:"hidden",children:w},f),l=ri(l,f,a,null),w.return=n,l.return=n,w.sibling=l,n.child=w,l=n.child,l.memoizedState=Xu(a),l.childLanes=Qu(e,_,a),n.memoizedState=Wu,gr(null,l)):(_a(n),ef(n,w))}var R=e.memoizedState;if(R!==null&&(w=R.dehydrated,w!==null)){if(h)n.flags&256?(_a(n),n.flags&=-257,n=tf(e,n,a)):n.memoizedState!==null?(ka(),n.child=e.child,n.flags|=128,n=null):(ka(),w=l.fallback,f=n.mode,l=sc({mode:"visible",children:l.children},f),w=ri(w,f,a,null),w.flags|=2,l.return=n,w.return=n,l.sibling=w,n.child=l,mi(n,e.child,null,a),l=n.child,l.memoizedState=Xu(a),l.childLanes=Qu(e,_,a),n.memoizedState=Wu,n=gr(null,l));else if(_a(n),Bf(w)){if(_=w.nextSibling&&w.nextSibling.dataset,_)var G=_.dgst;_=G,l=Error(r(419)),l.stack="",l.digest=_,ar({value:l,source:null,stack:null}),n=tf(e,n,a)}else if(qt||so(e,n,a,!1),_=(a&e.childLanes)!==0,qt||_){if(_=gt,_!==null&&(l=He(_,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,oi(e,l),Tn(_,e,l),Yu;Of(w)||fc(),n=tf(e,n,a)}else Of(w)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,yt=Kn(w.nextSibling),an=n,Fe=!0,ha=null,Fn=!1,e!==null&&cg(n,e),n=ef(n,l.children),n.flags|=4096);return n}return f?(ka(),w=l.fallback,f=n.mode,R=e.child,G=R.sibling,l=Ls(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,G!==null?w=Ls(G,w):(w=ri(w,f,a,null),w.flags|=2),w.return=n,l.return=n,l.sibling=w,n.child=l,gr(null,l),l=n.child,w=e.child.memoizedState,w===null?w=Xu(a):(f=w.cachePool,f!==null?(R=Ht._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=hg(),w={baseLanes:w.baseLanes|a,cachePool:f}),l.memoizedState=w,l.childLanes=Qu(e,_,a),n.memoizedState=Wu,gr(e.child,l)):(_a(n),a=e.child,e=a.sibling,a=Ls(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(_=n.deletions,_===null?(n.deletions=[e],n.flags|=16):_.push(e)),n.child=a,n.memoizedState=null,a)}function ef(e,n){return n=sc({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function sc(e,n){return e=wn(22,e,null,n),e.lanes=0,e}function tf(e,n,a){return mi(n,e.child,null,a),e=ef(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Cv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),gu(e.return,n,a)}function nf(e,n,a,l,f,h){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:h}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=l,_.tail=a,_.tailMode=f,_.treeForkCount=h)}function Ev(e,n,a){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var _=Lt.current,w=(_&2)!==0;if(w?(_=_&1|2,n.flags|=128):_&=1,Ne(Lt,_),rn(e,n,l,a),l=Fe?sr:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cv(e,a,n);else if(e.tag===19)Cv(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=n.child,f=null;a!==null;)e=a.alternate,e!==null&&Gl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),nf(n,!1,f,a,h,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Gl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}nf(n,!0,a,null,h,l);break;case"together":nf(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Vs(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),ja|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(so(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,a=Ls(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Ls(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function sf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ll(e)))}function gS(e,n,a){switch(n.tag){case 3:Be(n,n.stateNode.containerInfo),va(n,Ht,e.memoizedState.cache),li();break;case 27:case 5:zn(n);break;case 4:Be(n,n.stateNode.containerInfo);break;case 10:va(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Cu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(_a(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Nv(e,n,a):(_a(n),e=Vs(e,n,a),e!==null?e.sibling:null);_a(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(so(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return Ev(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ne(Lt,Lt.current),l)break;return null;case 22:return n.lanes=0,_v(e,n,a,n.pendingProps);case 24:va(n,Ht,e.memoizedState.cache)}return Vs(e,n,a)}function Av(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)qt=!0;else{if(!sf(e,a)&&(n.flags&128)===0)return qt=!1,gS(e,n,a);qt=(e.flags&131072)!==0}else qt=!1,Fe&&(n.flags&1048576)!==0&&lg(n,sr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=fi(n.elementType),n.type=e,typeof e=="function")lu(e)?(l=gi(e,l),n.tag=1,n=jv(null,n,e,l,a)):(n.tag=0,n=Ju(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===B){n.tag=11,n=yv(null,n,e,l,a);break e}else if(f===$){n.tag=14,n=bv(null,n,e,l,a);break e}}throw n=ee(e)||e,Error(r(306,n,""))}}return n;case 0:return Ju(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=gi(l,n.pendingProps),jv(e,n,l,f,a);case 3:e:{if(Be(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var h=n.memoizedState;f=h.element,Su(e,n),ur(n,l,null,a);var _=n.memoizedState;if(l=_.cache,va(n,Ht,l),l!==h.cache&&vu(n,[Ht],a,!0),dr(),l=_.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=wv(e,n,l,a);break e}else if(l!==f){f=Vn(Error(r(424)),n),ar(f),n=wv(e,n,l,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(yt=Kn(e.firstChild),an=n,Fe=!0,ha=null,Fn=!0,a=_g(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(li(),l===f){n=Vs(e,n,a);break e}rn(e,n,l,a)}n=n.child}return n;case 26:return nc(e,n),e===null?(a=U0(n.type,null,n.pendingProps,null))?n.memoizedState=a:Fe||(a=n.type,e=n.pendingProps,l=bc(ke.current).createElement(a),l[Qe]=n,l[rt]=e,ln(l,a,e),Qt(l),n.stateNode=l):n.memoizedState=U0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return zn(n),e===null&&Fe&&(l=n.stateNode=z0(n.type,n.pendingProps,ke.current),an=n,Fn=!0,f=yt,Aa(n.type)?(Lf=f,yt=Kn(l.firstChild)):yt=f),rn(e,n,n.pendingProps.children,a),nc(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Fe&&((f=l=yt)&&(l=FS(l,n.type,n.pendingProps,Fn),l!==null?(n.stateNode=l,an=n,yt=Kn(l.firstChild),Fn=!1,f=!0):f=!1),f||ga(n)),zn(n),f=n.type,h=n.pendingProps,_=e!==null?e.memoizedProps:null,l=h.children,Mf(f,h)?l=null:_!==null&&Mf(f,_)&&(n.flags|=32),n.memoizedState!==null&&(f=Au(e,n,rS,null,null,a),Dr._currentValue=f),nc(e,n),rn(e,n,l,a),n.child;case 6:return e===null&&Fe&&((e=a=yt)&&(a=ZS(a,n.pendingProps,Fn),a!==null?(n.stateNode=a,an=n,yt=null,e=!0):e=!1),e||ga(n)),null;case 13:return Nv(e,n,a);case 4:return Be(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=mi(n,null,l,a):rn(e,n,l,a),n.child;case 11:return yv(e,n,n.type,n.pendingProps,a);case 7:return rn(e,n,n.pendingProps,a),n.child;case 8:return rn(e,n,n.pendingProps.children,a),n.child;case 12:return rn(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,va(n,n.type,l.value),rn(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,di(n),f=on(f),l=l(f),n.flags|=1,rn(e,n,l,a),n.child;case 14:return bv(e,n,n.type,n.pendingProps,a);case 15:return xv(e,n,n.type,n.pendingProps,a);case 19:return Ev(e,n,a);case 31:return hS(e,n,a);case 22:return _v(e,n,a,n.pendingProps);case 24:return di(n),l=on(Ht),e===null?(f=xu(),f===null&&(f=gt,h=yu(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=a),f=h),n.memoizedState={parent:l,cache:f},ku(n),va(n,Ht,f)):((e.lanes&a)!==0&&(Su(e,n),ur(n,null,null,a),dr()),f=e.memoizedState,h=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),va(n,Ht,l)):(l=h.cache,va(n,Ht,l),l!==f.cache&&vu(n,[Ht],a,!0))),rn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function qs(e){e.flags|=4}function af(e,n,a,l,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(s0())e.flags|=8192;else throw pi=Ul,_u}else e.flags&=-16777217}function Dv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!F0(n))if(s0())e.flags|=8192;else throw pi=Ul,_u}function ac(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?xl():536870912,e.lanes|=n,go|=n)}function vr(e,n){if(!Fe)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function bt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(n)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,n}function vS(e,n,a){var l=n.pendingProps;switch(fu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bt(n),null;case 1:return bt(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Ps(Ht),It(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(no(n)?qs(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,mu())),bt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(qs(n),h!==null?(bt(n),Dv(n,h)):(bt(n),af(n,f,null,l,a))):h?h!==e.memoizedState?(qs(n),bt(n),Dv(n,h)):(bt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&qs(n),bt(n),af(n,f,e,l,a)),null;case 27:if(oe(n),a=ke.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&qs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return bt(n),null}e=Ue.current,no(n)?dg(n):(e=z0(f,l,a),n.stateNode=e,qs(n))}return bt(n),null;case 5:if(oe(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&qs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return bt(n),null}if(h=Ue.current,no(n))dg(n);else{var _=bc(ke.current);switch(h){case 1:h=_.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=_.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=_.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?_.createElement("select",{is:l.is}):_.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?_.createElement(f,{is:l.is}):_.createElement(f)}}h[Qe]=n,h[rt]=l;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)h.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=h;e:switch(ln(h,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&qs(n)}}return bt(n),af(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&qs(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=ke.current,no(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=an,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[Qe]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||N0(e.nodeValue,a)),e||ga(n,!0)}else e=bc(e).createTextNode(l),e[Qe]=n,n.stateNode=e}return bt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=no(n),a!==null){if(e===null){if(!l)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[Qe]=n}else li(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;bt(n),e=!1}else a=mu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Cn(n),n):(Cn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return bt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=no(n),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(r(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[Qe]=n}else li(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;bt(n),f=!1}else f=mu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Cn(n),n):(Cn(n),null)}return Cn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==f&&(l.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),ac(n,n.updateQueue),bt(n),null);case 4:return It(),e===null&&Nf(n.stateNode.containerInfo),bt(n),null;case 10:return Ps(n.type),bt(n),null;case 19:if(fe(Lt),l=n.memoizedState,l===null)return bt(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)vr(l,!1);else{if(At!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Gl(e),h!==null){for(n.flags|=128,vr(l,!1),e=h.updateQueue,n.updateQueue=e,ac(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)ig(a,e),a=a.sibling;return Ne(Lt,Lt.current&1|2),Fe&&zs(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Jt()>cc&&(n.flags|=128,f=!0,vr(l,!1),n.lanes=4194304)}else{if(!f)if(e=Gl(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,ac(n,e),vr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Fe)return bt(n),null}else 2*Jt()-l.renderingStartTime>cc&&a!==536870912&&(n.flags|=128,f=!0,vr(l,!1),n.lanes=4194304);l.isBackwards?(h.sibling=n.child,n.child=h):(e=l.last,e!==null?e.sibling=h:n.child=h,l.last=h)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Jt(),e.sibling=null,a=Lt.current,Ne(Lt,f?a&1|2:a&1),Fe&&zs(n,l.treeForkCount),e):(bt(n),null);case 22:case 23:return Cn(n),Nu(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(a&536870912)!==0&&(n.flags&128)===0&&(bt(n),n.subtreeFlags&6&&(n.flags|=8192)):bt(n),a=n.updateQueue,a!==null&&ac(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==a&&(n.flags|=2048),e!==null&&fe(ui),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Ps(Ht),bt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function yS(e,n){switch(fu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Ps(Ht),It(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return oe(n),null;case 31:if(n.memoizedState!==null){if(Cn(n),n.alternate===null)throw Error(r(340));li()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Cn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));li()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return fe(Lt),null;case 4:return It(),null;case 10:return Ps(n.type),null;case 22:case 23:return Cn(n),Nu(),e!==null&&fe(ui),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Ps(Ht),null;case 25:return null;default:return null}}function Mv(e,n){switch(fu(n),n.tag){case 3:Ps(Ht),It();break;case 26:case 27:case 5:oe(n);break;case 4:It();break;case 31:n.memoizedState!==null&&Cn(n);break;case 13:Cn(n);break;case 19:fe(Lt);break;case 10:Ps(n.type);break;case 22:case 23:Cn(n),Nu(),e!==null&&fe(ui);break;case 24:Ps(Ht)}}function yr(e,n){try{var a=n.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var h=a.create,_=a.inst;l=h(),_.destroy=l}a=a.next}while(a!==f)}}catch(w){ct(n,n.return,w)}}function Sa(e,n,a){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var _=l.inst,w=_.destroy;if(w!==void 0){_.destroy=void 0,f=n;var R=a,G=w;try{G()}catch(Q){ct(f,R,Q)}}}l=l.next}while(l!==h)}}catch(Q){ct(n,n.return,Q)}}function Rv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Sg(n,a)}catch(l){ct(e,e.return,l)}}}function Iv(e,n,a){a.props=gi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){ct(e,n,l)}}function br(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){ct(e,n,f)}}function Ss(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){ct(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){ct(e,n,f)}else a.current=null}function Ov(e){var n=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){ct(e,e.return,f)}}function of(e,n,a){try{var l=e.stateNode;PS(l,e.type,a,n),l[rt]=n}catch(f){ct(e,e.return,f)}}function Bv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Aa(e.type)||e.tag===4}function rf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Bv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Aa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function lf(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Os));else if(l!==4&&(l===27&&Aa(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(lf(e,n,a),e=e.sibling;e!==null;)lf(e,n,a),e=e.sibling}function ic(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(l!==4&&(l===27&&Aa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(ic(e,n,a),e=e.sibling;e!==null;)ic(e,n,a),e=e.sibling}function Lv(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);ln(n,l,a),n[Qe]=e,n[rt]=a}catch(h){ct(e,e.return,h)}}var Gs=!1,Gt=!1,cf=!1,zv=typeof WeakSet=="function"?WeakSet:Set,en=null;function bS(e,n){if(e=e.containerInfo,Af=wc,e=Jh(e),tu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var _=0,w=-1,R=-1,G=0,Q=0,ae=e,F=null;t:for(;;){for(var Z;ae!==a||f!==0&&ae.nodeType!==3||(w=_+f),ae!==h||l!==0&&ae.nodeType!==3||(R=_+l),ae.nodeType===3&&(_+=ae.nodeValue.length),(Z=ae.firstChild)!==null;)F=ae,ae=Z;for(;;){if(ae===e)break t;if(F===a&&++G===f&&(w=_),F===h&&++Q===l&&(R=_),(Z=ae.nextSibling)!==null)break;ae=F,F=ae.parentNode}ae=Z}a=w===-1||R===-1?null:{start:w,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Df={focusedElem:e,selectionRange:a},wc=!1,en=n;en!==null;)if(n=en,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,en=e;else for(;en!==null;){switch(n=en,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,f=h.memoizedProps,h=h.memoizedState,l=a.stateNode;try{var be=gi(a.type,f);e=l.getSnapshotBeforeUpdate(be,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){ct(a,a.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)If(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":If(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=n.sibling,e!==null){e.return=n.return,en=e;break}en=n.return}}function $v(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Zs(e,a),l&4&&yr(5,a);break;case 1:if(Zs(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(_){ct(a,a.return,_)}else{var f=gi(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(_){ct(a,a.return,_)}}l&64&&Rv(a),l&512&&br(a,a.return);break;case 3:if(Zs(e,a),l&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{Sg(e,n)}catch(_){ct(a,a.return,_)}}break;case 27:n===null&&l&4&&Lv(a);case 26:case 5:Zs(e,a),n===null&&l&4&&Ov(a),l&512&&br(a,a.return);break;case 12:Zs(e,a);break;case 31:Zs(e,a),l&4&&Hv(e,a);break;case 13:Zs(e,a),l&4&&Vv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=CS.bind(null,a),KS(e,a))));break;case 22:if(l=a.memoizedState!==null||Gs,!l){n=n!==null&&n.memoizedState!==null||Gt,f=Gs;var h=Gt;Gs=l,(Gt=n)&&!h?Ks(e,a,(a.subtreeFlags&8772)!==0):Zs(e,a),Gs=f,Gt=h}break;case 30:break;default:Zs(e,a)}}function Pv(e){var n=e.alternate;n!==null&&(e.alternate=null,Pv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&zd(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Tt=null,xn=!1;function Fs(e,n,a){for(a=a.child;a!==null;)Uv(e,n,a),a=a.sibling}function Uv(e,n,a){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(Wt,a)}catch{}switch(a.tag){case 26:Gt||Ss(a,n),Fs(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Gt||Ss(a,n);var l=Tt,f=xn;Aa(a.type)&&(Tt=a.stateNode,xn=!1),Fs(e,n,a),Cr(a.stateNode),Tt=l,xn=f;break;case 5:Gt||Ss(a,n);case 6:if(l=Tt,f=xn,Tt=null,Fs(e,n,a),Tt=l,xn=f,Tt!==null)if(xn)try{(Tt.nodeType===9?Tt.body:Tt.nodeName==="HTML"?Tt.ownerDocument.body:Tt).removeChild(a.stateNode)}catch(h){ct(a,n,h)}else try{Tt.removeChild(a.stateNode)}catch(h){ct(a,n,h)}break;case 18:Tt!==null&&(xn?(e=Tt,R0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),To(e)):R0(Tt,a.stateNode));break;case 4:l=Tt,f=xn,Tt=a.stateNode.containerInfo,xn=!0,Fs(e,n,a),Tt=l,xn=f;break;case 0:case 11:case 14:case 15:Sa(2,a,n),Gt||Sa(4,a,n),Fs(e,n,a);break;case 1:Gt||(Ss(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Iv(a,n,l)),Fs(e,n,a);break;case 21:Fs(e,n,a);break;case 22:Gt=(l=Gt)||a.memoizedState!==null,Fs(e,n,a),Gt=l;break;default:Fs(e,n,a)}}function Hv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{To(e)}catch(a){ct(n,n.return,a)}}}function Vv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{To(e)}catch(a){ct(n,n.return,a)}}function xS(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new zv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new zv),n;default:throw Error(r(435,e.tag))}}function oc(e,n){var a=xS(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=ES.bind(null,e,l);l.then(f,f)}})}function _n(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],h=e,_=n,w=_;e:for(;w!==null;){switch(w.tag){case 27:if(Aa(w.type)){Tt=w.stateNode,xn=!1;break e}break;case 5:Tt=w.stateNode,xn=!1;break e;case 3:case 4:Tt=w.stateNode.containerInfo,xn=!0;break e}w=w.return}if(Tt===null)throw Error(r(160));Uv(h,_,f),Tt=null,xn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)qv(n,e),n=n.sibling}var rs=null;function qv(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:_n(n,e),kn(e),l&4&&(Sa(3,e,e.return),yr(3,e),Sa(5,e,e.return));break;case 1:_n(n,e),kn(e),l&512&&(Gt||a===null||Ss(a,a.return)),l&64&&Gs&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=rs;if(_n(n,e),kn(e),l&512&&(Gt||a===null||Ss(a,a.return)),l&4){var h=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":h=f.getElementsByTagName("title")[0],(!h||h[Fo]||h[Qe]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),ln(h,l,a),h[Qe]=e,Qt(h),l=h;break e;case"link":var _=q0("link","href",f).get(l+(a.href||""));if(_){for(var w=0;w<_.length;w++)if(h=_[w],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){_.splice(w,1);break t}}h=f.createElement(l),ln(h,l,a),f.head.appendChild(h);break;case"meta":if(_=q0("meta","content",f).get(l+(a.content||""))){for(w=0;w<_.length;w++)if(h=_[w],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){_.splice(w,1);break t}}h=f.createElement(l),ln(h,l,a),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[Qe]=e,Qt(h),l=h}e.stateNode=l}else G0(f,e.type,e.stateNode);else e.stateNode=V0(f,l,e.memoizedProps);else h!==l?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,l===null?G0(f,e.type,e.stateNode):V0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&of(e,e.memoizedProps,a.memoizedProps)}break;case 27:_n(n,e),kn(e),l&512&&(Gt||a===null||Ss(a,a.return)),a!==null&&l&4&&of(e,e.memoizedProps,a.memoizedProps);break;case 5:if(_n(n,e),kn(e),l&512&&(Gt||a===null||Ss(a,a.return)),e.flags&32){f=e.stateNode;try{Fi(f,"")}catch(be){ct(e,e.return,be)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,of(e,f,a!==null?a.memoizedProps:f)),l&1024&&(cf=!0);break;case 6:if(_n(n,e),kn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(be){ct(e,e.return,be)}}break;case 3:if(kc=null,f=rs,rs=xc(n.containerInfo),_n(n,e),rs=f,kn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{To(n.containerInfo)}catch(be){ct(e,e.return,be)}cf&&(cf=!1,Gv(e));break;case 4:l=rs,rs=xc(e.stateNode.containerInfo),_n(n,e),kn(e),rs=l;break;case 12:_n(n,e),kn(e);break;case 31:_n(n,e),kn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,oc(e,l)));break;case 13:_n(n,e),kn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(lc=Jt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,oc(e,l)));break;case 22:f=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,G=Gs,Q=Gt;if(Gs=G||f,Gt=Q||R,_n(n,e),Gt=Q,Gs=G,kn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||R||Gs||Gt||vi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,f)_=h.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{w=R.stateNode;var ae=R.memoizedProps.style,F=ae!=null&&ae.hasOwnProperty("display")?ae.display:null;w.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(be){ct(R,R.return,be)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(be){ct(R,R.return,be)}}}else if(n.tag===18){if(a===null){R=n;try{var Z=R.stateNode;f?I0(Z,!0):I0(R.stateNode,!1)}catch(be){ct(R,R.return,be)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,oc(e,a))));break;case 19:_n(n,e),kn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,oc(e,l)));break;case 30:break;case 21:break;default:_n(n,e),kn(e)}}function kn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(Bv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,h=rf(e);ic(e,h,f);break;case 5:var _=a.stateNode;a.flags&32&&(Fi(_,""),a.flags&=-33);var w=rf(e);ic(e,w,_);break;case 3:case 4:var R=a.stateNode.containerInfo,G=rf(e);lf(e,G,R);break;default:throw Error(r(161))}}catch(Q){ct(e,e.return,Q)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Gv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Gv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Zs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)$v(e,n.alternate,n),n=n.sibling}function vi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Sa(4,n,n.return),vi(n);break;case 1:Ss(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Iv(n,n.return,a),vi(n);break;case 27:Cr(n.stateNode);case 26:case 5:Ss(n,n.return),vi(n);break;case 22:n.memoizedState===null&&vi(n);break;case 30:vi(n);break;default:vi(n)}e=e.sibling}}function Ks(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,_=h.flags;switch(h.tag){case 0:case 11:case 15:Ks(f,h,a),yr(4,h);break;case 1:if(Ks(f,h,a),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(G){ct(l,l.return,G)}if(l=h,f=l.updateQueue,f!==null){var w=l.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)kg(R[f],w)}catch(G){ct(l,l.return,G)}}a&&_&64&&Rv(h),br(h,h.return);break;case 27:Lv(h);case 26:case 5:Ks(f,h,a),a&&l===null&&_&4&&Ov(h),br(h,h.return);break;case 12:Ks(f,h,a);break;case 31:Ks(f,h,a),a&&_&4&&Hv(f,h);break;case 13:Ks(f,h,a),a&&_&4&&Vv(f,h);break;case 22:h.memoizedState===null&&Ks(f,h,a),br(h,h.return);break;case 30:break;default:Ks(f,h,a)}n=n.sibling}}function df(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&ir(a))}function uf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ir(e))}function ls(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Fv(e,n,a,l),n=n.sibling}function Fv(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:ls(e,n,a,l),f&2048&&yr(9,n);break;case 1:ls(e,n,a,l);break;case 3:ls(e,n,a,l),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ir(e)));break;case 12:if(f&2048){ls(e,n,a,l),e=n.stateNode;try{var h=n.memoizedProps,_=h.id,w=h.onPostCommit;typeof w=="function"&&w(_,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){ct(n,n.return,R)}}else ls(e,n,a,l);break;case 31:ls(e,n,a,l);break;case 13:ls(e,n,a,l);break;case 23:break;case 22:h=n.stateNode,_=n.alternate,n.memoizedState!==null?h._visibility&2?ls(e,n,a,l):xr(e,n):h._visibility&2?ls(e,n,a,l):(h._visibility|=2,po(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&df(_,n);break;case 24:ls(e,n,a,l),f&2048&&uf(n.alternate,n);break;default:ls(e,n,a,l)}}function po(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,_=n,w=a,R=l,G=_.flags;switch(_.tag){case 0:case 11:case 15:po(h,_,w,R,f),yr(8,_);break;case 23:break;case 22:var Q=_.stateNode;_.memoizedState!==null?Q._visibility&2?po(h,_,w,R,f):xr(h,_):(Q._visibility|=2,po(h,_,w,R,f)),f&&G&2048&&df(_.alternate,_);break;case 24:po(h,_,w,R,f),f&&G&2048&&uf(_.alternate,_);break;default:po(h,_,w,R,f)}n=n.sibling}}function xr(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,l=n,f=l.flags;switch(l.tag){case 22:xr(a,l),f&2048&&df(l.alternate,l);break;case 24:xr(a,l),f&2048&&uf(l.alternate,l);break;default:xr(a,l)}n=n.sibling}}var _r=8192;function mo(e,n,a){if(e.subtreeFlags&_r)for(e=e.child;e!==null;)Zv(e,n,a),e=e.sibling}function Zv(e,n,a){switch(e.tag){case 26:mo(e,n,a),e.flags&_r&&e.memoizedState!==null&&oT(a,rs,e.memoizedState,e.memoizedProps);break;case 5:mo(e,n,a);break;case 3:case 4:var l=rs;rs=xc(e.stateNode.containerInfo),mo(e,n,a),rs=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=_r,_r=16777216,mo(e,n,a),_r=l):mo(e,n,a));break;default:mo(e,n,a)}}function Kv(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function kr(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];en=l,Jv(l,e)}Kv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Yv(e),e=e.sibling}function Yv(e){switch(e.tag){case 0:case 11:case 15:kr(e),e.flags&2048&&Sa(9,e,e.return);break;case 3:kr(e);break;case 12:kr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,rc(e)):kr(e);break;default:kr(e)}}function rc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];en=l,Jv(l,e)}Kv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Sa(8,n,n.return),rc(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,rc(n));break;default:rc(n)}e=e.sibling}}function Jv(e,n){for(;en!==null;){var a=en;switch(a.tag){case 0:case 11:case 15:Sa(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ir(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,en=l;else e:for(a=e;en!==null;){l=en;var f=l.sibling,h=l.return;if(Pv(l),l===a){en=null;break e}if(f!==null){f.return=h,en=f;break e}en=h}}}var _S={getCacheForType:function(e){var n=on(Ht),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return on(Ht).controller.signal}},kS=typeof WeakMap=="function"?WeakMap:Map,at=0,gt=null,$e=null,Ve=0,lt=0,En=null,Ta=!1,ho=!1,ff=!1,Ys=0,At=0,ja=0,yi=0,pf=0,An=0,go=0,Sr=null,Sn=null,mf=!1,lc=0,Wv=0,cc=1/0,dc=null,wa=null,Zt=0,Na=null,vo=null,Js=0,hf=0,gf=null,Xv=null,Tr=0,vf=null;function Dn(){return(at&2)!==0&&Ve!==0?Ve&-Ve:M.T!==null?Sf():Xe()}function Qv(){if(An===0)if((Ve&536870912)===0||Fe){var e=Qa;Qa<<=1,(Qa&3932160)===0&&(Qa=262144),An=e}else An=536870912;return e=Nn.current,e!==null&&(e.flags|=32),An}function Tn(e,n,a){(e===gt&&(lt===2||lt===9)||e.cancelPendingCommit!==null)&&(yo(e,0),Ca(e,Ve,An,!1)),te(e,a),((at&2)===0||e!==gt)&&(e===gt&&((at&2)===0&&(yi|=a),At===4&&Ca(e,Ve,An,!1)),Ts(e))}function e0(e,n,a){if((at&6)!==0)throw Error(r(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||fa(e,n),f=l?jS(e,n):bf(e,n,!0),h=l;do{if(f===0){ho&&!l&&Ca(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!SS(a)){f=bf(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var w=e;f=Sr;var R=w.current.memoizedState.isDehydrated;if(R&&(yo(w,_).flags|=256),_=bf(w,_,!1),_!==2){if(ff&&!R){w.errorRecoveryDisabledLanes|=h,yi|=h,f=4;break e}h=Sn,Sn=f,h!==null&&(Sn===null?Sn=h:Sn.push.apply(Sn,h))}f=_}if(h=!1,f!==2)continue}}if(f===1){yo(e,0),Ca(e,n,0,!0);break}e:{switch(l=e,h=f,h){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:Ca(l,n,An,!Ta);break e;case 2:Sn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=lc+300-Jt(),10<f)){if(Ca(l,n,An,!Ta),ti(l,0,!0)!==0)break e;Js=n,l.timeoutHandle=D0(t0.bind(null,l,a,Sn,dc,mf,n,An,yi,go,Ta,h,"Throttled",-0,0),f);break e}t0(l,a,Sn,dc,mf,n,An,yi,go,Ta,h,null,-0,0)}}break}while(!0);Ts(e)}function t0(e,n,a,l,f,h,_,w,R,G,Q,ae,F,Z){if(e.timeoutHandle=-1,ae=n.subtreeFlags,ae&8192||(ae&16785408)===16785408){ae={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Os},Zv(n,h,ae);var be=(h&62914560)===h?lc-Jt():(h&4194048)===h?Wv-Jt():0;if(be=rT(ae,be),be!==null){Js=h,e.cancelPendingCommit=be(c0.bind(null,e,n,h,a,l,f,_,w,R,Q,ae,null,F,Z)),Ca(e,h,_,!G);return}}c0(e,n,h,a,l,f,_,w,R)}function SS(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],h=f.getSnapshot;f=f.value;try{if(!jn(h(),f))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Ca(e,n,a,l){n&=~pf,n&=~yi,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-Xt(f),_=1<<h;l[h]=-1,f&=~_}a!==0&&ce(e,a,n)}function uc(){return(at&6)===0?(jr(0),!1):!0}function yf(){if($e!==null){if(lt===0)var e=$e.return;else e=$e,$s=ci=null,Ru(e),ro=null,rr=0,e=$e;for(;e!==null;)Mv(e.alternate,e),e=e.return;$e=null}}function yo(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,VS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Js=0,yf(),gt=e,$e=a=Ls(e.current,null),Ve=n,lt=0,En=null,Ta=!1,ho=fa(e,n),ff=!1,go=An=pf=yi=ja=At=0,Sn=Sr=null,mf=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var f=31-Xt(l),h=1<<f;n|=e[f],l&=~h}return Ys=n,Ml(),a}function n0(e,n){Ie=null,M.H=hr,n===oo||n===Pl?(n=yg(),lt=3):n===_u?(n=yg(),lt=4):lt=n===Yu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,En=n,$e===null&&(At=1,ec(e,Vn(n,e.current)))}function s0(){var e=Nn.current;return e===null?!0:(Ve&4194048)===Ve?Zn===null:(Ve&62914560)===Ve||(Ve&536870912)!==0?e===Zn:!1}function a0(){var e=M.H;return M.H=hr,e===null?hr:e}function i0(){var e=M.A;return M.A=_S,e}function fc(){At=4,Ta||(Ve&4194048)!==Ve&&Nn.current!==null||(ho=!0),(ja&134217727)===0&&(yi&134217727)===0||gt===null||Ca(gt,Ve,An,!1)}function bf(e,n,a){var l=at;at|=2;var f=a0(),h=i0();(gt!==e||Ve!==n)&&(dc=null,yo(e,n)),n=!1;var _=At;e:do try{if(lt!==0&&$e!==null){var w=$e,R=En;switch(lt){case 8:yf(),_=6;break e;case 3:case 2:case 9:case 6:Nn.current===null&&(n=!0);var G=lt;if(lt=0,En=null,bo(e,w,R,G),a&&ho){_=0;break e}break;default:G=lt,lt=0,En=null,bo(e,w,R,G)}}TS(),_=At;break}catch(Q){n0(e,Q)}while(!0);return n&&e.shellSuspendCounter++,$s=ci=null,at=l,M.H=f,M.A=h,$e===null&&(gt=null,Ve=0,Ml()),_}function TS(){for(;$e!==null;)o0($e)}function jS(e,n){var a=at;at|=2;var l=a0(),f=i0();gt!==e||Ve!==n?(dc=null,cc=Jt()+500,yo(e,n)):ho=fa(e,n);e:do try{if(lt!==0&&$e!==null){n=$e;var h=En;t:switch(lt){case 1:lt=0,En=null,bo(e,n,h,1);break;case 2:case 9:if(gg(h)){lt=0,En=null,r0(n);break}n=function(){lt!==2&&lt!==9||gt!==e||(lt=7),Ts(e)},h.then(n,n);break e;case 3:lt=7;break e;case 4:lt=5;break e;case 7:gg(h)?(lt=0,En=null,r0(n)):(lt=0,En=null,bo(e,n,h,7));break;case 5:var _=null;switch($e.tag){case 26:_=$e.memoizedState;case 5:case 27:var w=$e;if(_?F0(_):w.stateNode.complete){lt=0,En=null;var R=w.sibling;if(R!==null)$e=R;else{var G=w.return;G!==null?($e=G,pc(G)):$e=null}break t}}lt=0,En=null,bo(e,n,h,5);break;case 6:lt=0,En=null,bo(e,n,h,6);break;case 8:yf(),At=6;break e;default:throw Error(r(462))}}wS();break}catch(Q){n0(e,Q)}while(!0);return $s=ci=null,M.H=l,M.A=f,at=a,$e!==null?0:(gt=null,Ve=0,Ml(),At)}function wS(){for(;$e!==null&&!Ja();)o0($e)}function o0(e){var n=Av(e.alternate,e,Ys);e.memoizedProps=e.pendingProps,n===null?pc(e):$e=n}function r0(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=Tv(a,n,n.pendingProps,n.type,void 0,Ve);break;case 11:n=Tv(a,n,n.pendingProps,n.type.render,n.ref,Ve);break;case 5:Ru(n);default:Mv(a,n),n=$e=ig(n,Ys),n=Av(a,n,Ys)}e.memoizedProps=e.pendingProps,n===null?pc(e):$e=n}function bo(e,n,a,l){$s=ci=null,Ru(n),ro=null,rr=0;var f=n.return;try{if(mS(e,f,n,a,Ve)){At=1,ec(e,Vn(a,e.current)),$e=null;return}}catch(h){if(f!==null)throw $e=f,h;At=1,ec(e,Vn(a,e.current)),$e=null;return}n.flags&32768?(Fe||l===1?e=!0:ho||(Ve&536870912)!==0?e=!1:(Ta=e=!0,(l===2||l===9||l===3||l===6)&&(l=Nn.current,l!==null&&l.tag===13&&(l.flags|=16384))),l0(n,e)):pc(n)}function pc(e){var n=e;do{if((n.flags&32768)!==0){l0(n,Ta);return}e=n.return;var a=vS(n.alternate,n,Ys);if(a!==null){$e=a;return}if(n=n.sibling,n!==null){$e=n;return}$e=n=e}while(n!==null);At===0&&(At=5)}function l0(e,n){do{var a=yS(e.alternate,e);if(a!==null){a.flags&=32767,$e=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){$e=e;return}$e=e=a}while(e!==null);At=6,$e=null}function c0(e,n,a,l,f,h,_,w,R){e.cancelPendingCommit=null;do mc();while(Zt!==0);if((at&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=ou,re(e,a,h,_,w,R),e===gt&&($e=gt=null,Ve=0),vo=n,Na=e,Js=a,hf=h,gf=f,Xv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,AS(ys,function(){return m0(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=M.T,M.T=null,f=O.p,O.p=2,_=at,at|=4;try{bS(e,n,a)}finally{at=_,O.p=f,M.T=l}}Zt=1,d0(),u0(),f0()}}function d0(){if(Zt===1){Zt=0;var e=Na,n=vo,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=M.T,M.T=null;var l=O.p;O.p=2;var f=at;at|=4;try{qv(n,e);var h=Df,_=Jh(e.containerInfo),w=h.focusedElem,R=h.selectionRange;if(_!==w&&w&&w.ownerDocument&&Yh(w.ownerDocument.documentElement,w)){if(R!==null&&tu(w)){var G=R.start,Q=R.end;if(Q===void 0&&(Q=G),"selectionStart"in w)w.selectionStart=G,w.selectionEnd=Math.min(Q,w.value.length);else{var ae=w.ownerDocument||document,F=ae&&ae.defaultView||window;if(F.getSelection){var Z=F.getSelection(),be=w.textContent.length,Ce=Math.min(R.start,be),pt=R.end===void 0?Ce:Math.min(R.end,be);!Z.extend&&Ce>pt&&(_=pt,pt=Ce,Ce=_);var P=Kh(w,Ce),z=Kh(w,pt);if(P&&z&&(Z.rangeCount!==1||Z.anchorNode!==P.node||Z.anchorOffset!==P.offset||Z.focusNode!==z.node||Z.focusOffset!==z.offset)){var q=ae.createRange();q.setStart(P.node,P.offset),Z.removeAllRanges(),Ce>pt?(Z.addRange(q),Z.extend(z.node,z.offset)):(q.setEnd(z.node,z.offset),Z.addRange(q))}}}}for(ae=[],Z=w;Z=Z.parentNode;)Z.nodeType===1&&ae.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ae.length;w++){var se=ae[w];se.element.scrollLeft=se.left,se.element.scrollTop=se.top}}wc=!!Af,Df=Af=null}finally{at=f,O.p=l,M.T=a}}e.current=n,Zt=2}}function u0(){if(Zt===2){Zt=0;var e=Na,n=vo,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=M.T,M.T=null;var l=O.p;O.p=2;var f=at;at|=4;try{$v(e,n.alternate,n)}finally{at=f,O.p=l,M.T=a}}Zt=3}}function f0(){if(Zt===4||Zt===3){Zt=0,da();var e=Na,n=vo,a=Js,l=Xv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Zt=5:(Zt=0,vo=Na=null,p0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(wa=null),Me(a),n=n.stateNode,St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(Wt,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=M.T,f=O.p,O.p=2,M.T=null;try{for(var h=e.onRecoverableError,_=0;_<l.length;_++){var w=l[_];h(w.value,{componentStack:w.stack})}}finally{M.T=n,O.p=f}}(Js&3)!==0&&mc(),Ts(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===vf?Tr++:(Tr=0,vf=e):Tr=0,jr(0)}}function p0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,ir(n)))}function mc(){return d0(),u0(),f0(),m0()}function m0(){if(Zt!==5)return!1;var e=Na,n=hf;hf=0;var a=Me(Js),l=M.T,f=O.p;try{O.p=32>a?32:a,M.T=null,a=gf,gf=null;var h=Na,_=Js;if(Zt=0,vo=Na=null,Js=0,(at&6)!==0)throw Error(r(331));var w=at;if(at|=4,Yv(h.current),Fv(h,h.current,_,a),at=w,jr(0,!1),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(Wt,h)}catch{}return!0}finally{O.p=f,M.T=l,p0(e,n)}}function h0(e,n,a){n=Vn(a,n),n=Ku(e.stateNode,n,2),e=xa(e,n,2),e!==null&&(te(e,2),Ts(e))}function ct(e,n,a){if(e.tag===3)h0(e,e,a);else for(;n!==null;){if(n.tag===3){h0(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(wa===null||!wa.has(l))){e=Vn(a,e),a=gv(2),l=xa(n,a,2),l!==null&&(vv(a,l,n,e),te(l,2),Ts(l));break}}n=n.return}}function xf(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new kS;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(a)||(ff=!0,f.add(a),e=NS.bind(null,e,n,a),n.then(e,e))}function NS(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,gt===e&&(Ve&a)===a&&(At===4||At===3&&(Ve&62914560)===Ve&&300>Jt()-lc?(at&2)===0&&yo(e,0):pf|=a,go===Ve&&(go=0)),Ts(e)}function g0(e,n){n===0&&(n=xl()),e=oi(e,n),e!==null&&(te(e,n),Ts(e))}function CS(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),g0(e,a)}function ES(e,n){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(n),g0(e,a)}function AS(e,n){return ca(e,n)}var hc=null,xo=null,_f=!1,gc=!1,kf=!1,Ea=0;function Ts(e){e!==xo&&e.next===null&&(xo===null?hc=xo=e:xo=xo.next=e),gc=!0,_f||(_f=!0,MS())}function jr(e,n){if(!kf&&gc){kf=!0;do for(var a=!1,l=hc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var _=l.suspendedLanes,w=l.pingedLanes;h=(1<<31-Xt(42|e)+1)-1,h&=f&~(_&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,x0(l,h))}else h=Ve,h=ti(l,l===gt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||fa(l,h)||(a=!0,x0(l,h));l=l.next}while(a);kf=!1}}function DS(){v0()}function v0(){gc=_f=!1;var e=0;Ea!==0&&HS()&&(e=Ea);for(var n=Jt(),a=null,l=hc;l!==null;){var f=l.next,h=y0(l,n);h===0?(l.next=null,a===null?hc=f:a.next=f,f===null&&(xo=a)):(a=l,(e!==0||(h&3)!==0)&&(gc=!0)),l=f}Zt!==0&&Zt!==5||jr(e),Ea!==0&&(Ea=0)}function y0(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var _=31-Xt(h),w=1<<_,R=f[_];R===-1?((w&a)===0||(w&l)!==0)&&(f[_]=bl(w,n)):R<=n&&(e.expiredLanes|=w),h&=~w}if(n=gt,a=Ve,a=ti(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(lt===2||lt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&is(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||fa(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&is(l),Me(a)){case 2:case 8:a=Wa;break;case 32:a=ys;break;case 268435456:a=$n;break;default:a=ys}return l=b0.bind(null,e),a=ca(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&is(l),e.callbackPriority=2,e.callbackNode=null,2}function b0(e,n){if(Zt!==0&&Zt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(mc()&&e.callbackNode!==a)return null;var l=Ve;return l=ti(e,e===gt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(e0(e,l,n),y0(e,Jt()),e.callbackNode!=null&&e.callbackNode===a?b0.bind(null,e):null)}function x0(e,n){if(mc())return null;e0(e,n,!0)}function MS(){qS(function(){(at&6)!==0?ca(ua,DS):v0()})}function Sf(){if(Ea===0){var e=ao;e===0&&(e=Xa,Xa<<=1,(Xa&261888)===0&&(Xa=256)),Ea=e}return Ea}function _0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Tl(""+e)}function k0(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function RS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var h=_0((f[rt]||null).action),_=l.submitter;_&&(n=(n=_[rt]||null)?_0(n.formAction):_.getAttribute("formAction"),n!==null&&(h=n,_=null));var w=new Cl("action","action",null,l,f);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ea!==0){var R=_?k0(f,_):new FormData(f);Hu(a,{pending:!0,data:R,method:f.method,action:h},null,R)}}else typeof h=="function"&&(w.preventDefault(),R=_?k0(f,_):new FormData(f),Hu(a,{pending:!0,data:R,method:f.method,action:h},h,R))},currentTarget:f}]})}}for(var Tf=0;Tf<iu.length;Tf++){var jf=iu[Tf],IS=jf.toLowerCase(),OS=jf[0].toUpperCase()+jf.slice(1);os(IS,"on"+OS)}os(Qh,"onAnimationEnd"),os(eg,"onAnimationIteration"),os(tg,"onAnimationStart"),os("dblclick","onDoubleClick"),os("focusin","onFocus"),os("focusout","onBlur"),os(Wk,"onTransitionRun"),os(Xk,"onTransitionStart"),os(Qk,"onTransitionCancel"),os(ng,"onTransitionEnd"),qi("onMouseEnter",["mouseout","mouseover"]),qi("onMouseLeave",["mouseout","mouseover"]),qi("onPointerEnter",["pointerout","pointerover"]),qi("onPointerLeave",["pointerout","pointerover"]),ni("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ni("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ni("onBeforeInput",["compositionend","keypress","textInput","paste"]),ni("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ni("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ni("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wr="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(" "),BS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wr));function S0(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var _=l.length-1;0<=_;_--){var w=l[_],R=w.instance,G=w.currentTarget;if(w=w.listener,R!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=G;try{h(f)}catch(Q){Dl(Q)}f.currentTarget=null,h=R}else for(_=0;_<l.length;_++){if(w=l[_],R=w.instance,G=w.currentTarget,w=w.listener,R!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=G;try{h(f)}catch(Q){Dl(Q)}f.currentTarget=null,h=R}}}}function Pe(e,n){var a=n[xs];a===void 0&&(a=n[xs]=new Set);var l=e+"__bubble";a.has(l)||(T0(n,e,2,!1),a.add(l))}function wf(e,n,a){var l=0;n&&(l|=4),T0(a,e,l,n)}var vc="_reactListening"+Math.random().toString(36).slice(2);function Nf(e){if(!e[vc]){e[vc]=!0,vh.forEach(function(a){a!=="selectionchange"&&(BS.has(a)||wf(a,!1,e),wf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[vc]||(n[vc]=!0,wf("selectionchange",!1,n))}}function T0(e,n,a,l){switch(Q0(n)){case 2:var f=dT;break;case 8:f=uT;break;default:f=Hf}a=f.bind(null,n,a,e),f=void 0,!Fd||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(n,a,{capture:!0,passive:f}):e.addEventListener(n,a,!0):f!==void 0?e.addEventListener(n,a,{passive:f}):e.addEventListener(n,a,!1)}function Cf(e,n,a,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var _=l.tag;if(_===3||_===4){var w=l.stateNode.containerInfo;if(w===f)break;if(_===4)for(_=l.return;_!==null;){var R=_.tag;if((R===3||R===4)&&_.stateNode.containerInfo===f)return;_=_.return}for(;w!==null;){if(_=Ui(w),_===null)return;if(R=_.tag,R===5||R===6||R===26||R===27){l=h=_;continue e}w=w.parentNode}}l=l.return}Eh(function(){var G=h,Q=qd(a),ae=[];e:{var F=sg.get(e);if(F!==void 0){var Z=Cl,be=e;switch(e){case"keypress":if(wl(a)===0)break e;case"keydown":case"keyup":Z=Ek;break;case"focusin":be="focus",Z=Jd;break;case"focusout":be="blur",Z=Jd;break;case"beforeblur":case"afterblur":Z=Jd;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Z=Mh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=vk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=Mk;break;case Qh:case eg:case tg:Z=xk;break;case ng:Z=Ik;break;case"scroll":case"scrollend":Z=hk;break;case"wheel":Z=Bk;break;case"copy":case"cut":case"paste":Z=kk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=Ih;break;case"toggle":case"beforetoggle":Z=zk}var Ce=(n&4)!==0,pt=!Ce&&(e==="scroll"||e==="scrollend"),P=Ce?F!==null?F+"Capture":null:F;Ce=[];for(var z=G,q;z!==null;){var se=z;if(q=se.stateNode,se=se.tag,se!==5&&se!==26&&se!==27||q===null||P===null||(se=Ko(z,P),se!=null&&Ce.push(Nr(z,se,q))),pt)break;z=z.return}0<Ce.length&&(F=new Z(F,be,null,a,Q),ae.push({event:F,listeners:Ce}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",Z=e==="mouseout"||e==="pointerout",F&&a!==Vd&&(be=a.relatedTarget||a.fromElement)&&(Ui(be)||be[vt]))break e;if((Z||F)&&(F=Q.window===Q?Q:(F=Q.ownerDocument)?F.defaultView||F.parentWindow:window,Z?(be=a.relatedTarget||a.toElement,Z=G,be=be?Ui(be):null,be!==null&&(pt=d(be),Ce=be.tag,be!==pt||Ce!==5&&Ce!==27&&Ce!==6)&&(be=null)):(Z=null,be=G),Z!==be)){if(Ce=Mh,se="onMouseLeave",P="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=Ih,se="onPointerLeave",P="onPointerEnter",z="pointer"),pt=Z==null?F:Zo(Z),q=be==null?F:Zo(be),F=new Ce(se,z+"leave",Z,a,Q),F.target=pt,F.relatedTarget=q,se=null,Ui(Q)===G&&(Ce=new Ce(P,z+"enter",be,a,Q),Ce.target=q,Ce.relatedTarget=pt,se=Ce),pt=se,Z&&be)t:{for(Ce=LS,P=Z,z=be,q=0,se=P;se;se=Ce(se))q++;se=0;for(var je=z;je;je=Ce(je))se++;for(;0<q-se;)P=Ce(P),q--;for(;0<se-q;)z=Ce(z),se--;for(;q--;){if(P===z||z!==null&&P===z.alternate){Ce=P;break t}P=Ce(P),z=Ce(z)}Ce=null}else Ce=null;Z!==null&&j0(ae,F,Z,Ce,!1),be!==null&&pt!==null&&j0(ae,pt,be,Ce,!0)}}e:{if(F=G?Zo(G):window,Z=F.nodeName&&F.nodeName.toLowerCase(),Z==="select"||Z==="input"&&F.type==="file")var et=Hh;else if(Ph(F))if(Vh)et=Kk;else{et=Fk;var _e=Gk}else Z=F.nodeName,!Z||Z.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?G&&Hd(G.elementType)&&(et=Hh):et=Zk;if(et&&(et=et(e,G))){Uh(ae,et,a,Q);break e}_e&&_e(e,F,G),e==="focusout"&&G&&F.type==="number"&&G.memoizedProps.value!=null&&Ud(F,"number",F.value)}switch(_e=G?Zo(G):window,e){case"focusin":(Ph(_e)||_e.contentEditable==="true")&&(Ji=_e,nu=G,nr=null);break;case"focusout":nr=nu=Ji=null;break;case"mousedown":su=!0;break;case"contextmenu":case"mouseup":case"dragend":su=!1,Wh(ae,a,Q);break;case"selectionchange":if(Jk)break;case"keydown":case"keyup":Wh(ae,a,Q)}var Oe;if(Xd)e:{switch(e){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else Yi?zh(e,a)&&(qe="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(qe="onCompositionStart");qe&&(Oh&&a.locale!=="ko"&&(Yi||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&Yi&&(Oe=Ah()):(pa=Q,Zd="value"in pa?pa.value:pa.textContent,Yi=!0)),_e=yc(G,qe),0<_e.length&&(qe=new Rh(qe,e,null,a,Q),ae.push({event:qe,listeners:_e}),Oe?qe.data=Oe:(Oe=$h(a),Oe!==null&&(qe.data=Oe)))),(Oe=Pk?Uk(e,a):Hk(e,a))&&(qe=yc(G,"onBeforeInput"),0<qe.length&&(_e=new Rh("onBeforeInput","beforeinput",null,a,Q),ae.push({event:_e,listeners:qe}),_e.data=Oe)),RS(ae,e,G,a,Q)}S0(ae,n)})}function Nr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function yc(e,n){for(var a=n+"Capture",l=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=Ko(e,a),f!=null&&l.unshift(Nr(e,f,h)),f=Ko(e,n),f!=null&&l.push(Nr(e,f,h))),e.tag===3)return l;e=e.return}return[]}function LS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function j0(e,n,a,l,f){for(var h=n._reactName,_=[];a!==null&&a!==l;){var w=a,R=w.alternate,G=w.stateNode;if(w=w.tag,R!==null&&R===l)break;w!==5&&w!==26&&w!==27||G===null||(R=G,f?(G=Ko(a,h),G!=null&&_.unshift(Nr(a,G,R))):f||(G=Ko(a,h),G!=null&&_.push(Nr(a,G,R)))),a=a.return}_.length!==0&&e.push({event:n,listeners:_})}var zS=/\r\n?/g,$S=/\u0000|\uFFFD/g;function w0(e){return(typeof e=="string"?e:""+e).replace(zS,`
26
- `).replace($S,"")}function N0(e,n){return n=w0(n),w0(e)===n}function ft(e,n,a,l,f,h){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Fi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Fi(e,""+l);break;case"className":kl(e,"class",l);break;case"tabIndex":kl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":kl(e,a,l);break;case"style":Nh(e,l,h);break;case"data":if(n!=="object"){kl(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Tl(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(a==="formAction"?(n!=="input"&&ft(e,n,"name",f.name,f,null),ft(e,n,"formEncType",f.formEncType,f,null),ft(e,n,"formMethod",f.formMethod,f,null),ft(e,n,"formTarget",f.formTarget,f,null)):(ft(e,n,"encType",f.encType,f,null),ft(e,n,"method",f.method,f,null),ft(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Tl(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Os);break;case"onScroll":l!=null&&Pe("scroll",e);break;case"onScrollEnd":l!=null&&Pe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=Tl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":Pe("beforetoggle",e),Pe("toggle",e),_l(e,"popover",l);break;case"xlinkActuate":Is(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Is(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Is(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Is(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Is(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Is(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Is(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Is(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Is(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":_l(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=pk.get(a)||a,_l(e,a,l))}}function Ef(e,n,a,l,f,h){switch(a){case"style":Nh(e,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof l=="string"?Fi(e,l):(typeof l=="number"||typeof l=="bigint")&&Fi(e,""+l);break;case"onScroll":l!=null&&Pe("scroll",e);break;case"onScrollEnd":l!=null&&Pe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Os);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!yh.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),n=a.slice(2,f?a.length-7:void 0),h=e[rt]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,f),typeof l=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):_l(e,a,l)}}}function ln(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Pe("error",e),Pe("load",e);var l=!1,f=!1,h;for(h in a)if(a.hasOwnProperty(h)){var _=a[h];if(_!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ft(e,n,h,_,a,null)}}f&&ft(e,n,"srcSet",a.srcSet,a,null),l&&ft(e,n,"src",a.src,a,null);return;case"input":Pe("invalid",e);var w=h=_=f=null,R=null,G=null;for(l in a)if(a.hasOwnProperty(l)){var Q=a[l];if(Q!=null)switch(l){case"name":f=Q;break;case"type":_=Q;break;case"checked":R=Q;break;case"defaultChecked":G=Q;break;case"value":h=Q;break;case"defaultValue":w=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,n));break;default:ft(e,n,l,Q,a,null)}}Sh(e,h,w,R,G,_,f,!1);return;case"select":Pe("invalid",e),l=_=h=null;for(f in a)if(a.hasOwnProperty(f)&&(w=a[f],w!=null))switch(f){case"value":h=w;break;case"defaultValue":_=w;break;case"multiple":l=w;default:ft(e,n,f,w,a,null)}n=h,a=_,e.multiple=!!l,n!=null?Gi(e,!!l,n,!1):a!=null&&Gi(e,!!l,a,!0);return;case"textarea":Pe("invalid",e),h=f=l=null;for(_ in a)if(a.hasOwnProperty(_)&&(w=a[_],w!=null))switch(_){case"value":l=w;break;case"defaultValue":f=w;break;case"children":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:ft(e,n,_,w,a,null)}jh(e,l,f,h);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(l=a[R],l!=null))switch(R){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ft(e,n,R,l,a,null)}return;case"dialog":Pe("beforetoggle",e),Pe("toggle",e),Pe("cancel",e),Pe("close",e);break;case"iframe":case"object":Pe("load",e);break;case"video":case"audio":for(l=0;l<wr.length;l++)Pe(wr[l],e);break;case"image":Pe("error",e),Pe("load",e);break;case"details":Pe("toggle",e);break;case"embed":case"source":case"link":Pe("error",e),Pe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in a)if(a.hasOwnProperty(G)&&(l=a[G],l!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ft(e,n,G,l,a,null)}return;default:if(Hd(n)){for(Q in a)a.hasOwnProperty(Q)&&(l=a[Q],l!==void 0&&Ef(e,n,Q,l,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(l=a[w],l!=null&&ft(e,n,w,l,a,null))}function PS(e,n,a,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,_=null,w=null,R=null,G=null,Q=null;for(Z in a){var ae=a[Z];if(a.hasOwnProperty(Z)&&ae!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":R=ae;default:l.hasOwnProperty(Z)||ft(e,n,Z,null,l,ae)}}for(var F in l){var Z=l[F];if(ae=a[F],l.hasOwnProperty(F)&&(Z!=null||ae!=null))switch(F){case"type":h=Z;break;case"name":f=Z;break;case"checked":G=Z;break;case"defaultChecked":Q=Z;break;case"value":_=Z;break;case"defaultValue":w=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(r(137,n));break;default:Z!==ae&&ft(e,n,F,Z,l,ae)}}Pd(e,_,w,R,G,Q,h,f);return;case"select":Z=_=w=F=null;for(h in a)if(R=a[h],a.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":Z=R;default:l.hasOwnProperty(h)||ft(e,n,h,null,l,R)}for(f in l)if(h=l[f],R=a[f],l.hasOwnProperty(f)&&(h!=null||R!=null))switch(f){case"value":F=h;break;case"defaultValue":w=h;break;case"multiple":_=h;default:h!==R&&ft(e,n,f,h,l,R)}n=w,a=_,l=Z,F!=null?Gi(e,!!a,F,!1):!!l!=!!a&&(n!=null?Gi(e,!!a,n,!0):Gi(e,!!a,a?[]:"",!1));return;case"textarea":Z=F=null;for(w in a)if(f=a[w],a.hasOwnProperty(w)&&f!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:ft(e,n,w,null,l,f)}for(_ in l)if(f=l[_],h=a[_],l.hasOwnProperty(_)&&(f!=null||h!=null))switch(_){case"value":F=f;break;case"defaultValue":Z=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&ft(e,n,_,f,l,h)}Th(e,F,Z);return;case"option":for(var be in a)if(F=a[be],a.hasOwnProperty(be)&&F!=null&&!l.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:ft(e,n,be,null,l,F)}for(R in l)if(F=l[R],Z=a[R],l.hasOwnProperty(R)&&F!==Z&&(F!=null||Z!=null))switch(R){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:ft(e,n,R,F,l,Z)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ce in a)F=a[Ce],a.hasOwnProperty(Ce)&&F!=null&&!l.hasOwnProperty(Ce)&&ft(e,n,Ce,null,l,F);for(G in l)if(F=l[G],Z=a[G],l.hasOwnProperty(G)&&F!==Z&&(F!=null||Z!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(r(137,n));break;default:ft(e,n,G,F,l,Z)}return;default:if(Hd(n)){for(var pt in a)F=a[pt],a.hasOwnProperty(pt)&&F!==void 0&&!l.hasOwnProperty(pt)&&Ef(e,n,pt,void 0,l,F);for(Q in l)F=l[Q],Z=a[Q],!l.hasOwnProperty(Q)||F===Z||F===void 0&&Z===void 0||Ef(e,n,Q,F,l,Z);return}}for(var P in a)F=a[P],a.hasOwnProperty(P)&&F!=null&&!l.hasOwnProperty(P)&&ft(e,n,P,null,l,F);for(ae in l)F=l[ae],Z=a[ae],!l.hasOwnProperty(ae)||F===Z||F==null&&Z==null||ft(e,n,ae,F,l,Z)}function C0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function US(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],h=f.transferSize,_=f.initiatorType,w=f.duration;if(h&&w&&C0(_)){for(_=0,w=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],G=R.startTime;if(G>w)break;var Q=R.transferSize,ae=R.initiatorType;Q&&C0(ae)&&(R=R.responseEnd,_+=Q*(R<w?1:(w-G)/(R-G)))}if(--l,n+=8*(h+_)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Af=null,Df=null;function bc(e){return e.nodeType===9?e:e.ownerDocument}function E0(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function A0(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Mf(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Rf=null;function HS(){var e=window.event;return e&&e.type==="popstate"?e===Rf?!1:(Rf=e,!0):(Rf=null,!1)}var D0=typeof setTimeout=="function"?setTimeout:void 0,VS=typeof clearTimeout=="function"?clearTimeout:void 0,M0=typeof Promise=="function"?Promise:void 0,qS=typeof queueMicrotask=="function"?queueMicrotask:typeof M0<"u"?function(e){return M0.resolve(null).then(e).catch(GS)}:D0;function GS(e){setTimeout(function(){throw e})}function Aa(e){return e==="head"}function R0(e,n){var a=n,l=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(f),To(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Cr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Cr(a);for(var h=a.firstChild;h;){var _=h.nextSibling,w=h.nodeName;h[Fo]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=_}}else a==="body"&&Cr(e.ownerDocument.body);a=f}while(a);To(n)}function I0(e,n){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function If(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":If(a),zd(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function FS(e,n,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Fo])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Kn(e.nextSibling),e===null)break}return null}function ZS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Kn(e.nextSibling),e===null))return null;return e}function O0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Kn(e.nextSibling),e===null))return null;return e}function Of(e){return e.data==="$?"||e.data==="$~"}function Bf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function KS(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var l=function(){n(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Kn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Lf=null;function B0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Kn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function L0(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function z0(e,n,a){switch(n=bc(a),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Cr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);zd(e)}var Yn=new Map,$0=new Set;function xc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ws=O.d;O.d={f:YS,r:JS,D:WS,C:XS,L:QS,m:eT,X:nT,S:tT,M:sT};function YS(){var e=Ws.f(),n=uc();return e||n}function JS(e){var n=Hi(e);n!==null&&n.tag===5&&n.type==="form"?nv(n):Ws.r(e)}var _o=typeof document>"u"?null:document;function P0(e,n,a){var l=_o;if(l&&typeof n=="string"&&n){var f=Un(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),$0.has(f)||($0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),ln(n,"link",e),Qt(n),l.head.appendChild(n)))}}function WS(e){Ws.D(e),P0("dns-prefetch",e,null)}function XS(e,n){Ws.C(e,n),P0("preconnect",e,n)}function QS(e,n,a){Ws.L(e,n,a);var l=_o;if(l&&e&&n){var f='link[rel="preload"][as="'+Un(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Un(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Un(a.imageSizes)+'"]')):f+='[href="'+Un(e)+'"]';var h=f;switch(n){case"style":h=ko(e);break;case"script":h=So(e)}Yn.has(h)||(e=x({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Yn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(Er(h))||n==="script"&&l.querySelector(Ar(h))||(n=l.createElement("link"),ln(n,"link",e),Qt(n),l.head.appendChild(n)))}}function eT(e,n){Ws.m(e,n);var a=_o;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Un(l)+'"][href="'+Un(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=So(e)}if(!Yn.has(h)&&(e=x({rel:"modulepreload",href:e},n),Yn.set(h,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ar(h)))return}l=a.createElement("link"),ln(l,"link",e),Qt(l),a.head.appendChild(l)}}}function tT(e,n,a){Ws.S(e,n,a);var l=_o;if(l&&e){var f=Vi(l).hoistableStyles,h=ko(e);n=n||"default";var _=f.get(h);if(!_){var w={loading:0,preload:null};if(_=l.querySelector(Er(h)))w.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Yn.get(h))&&zf(e,a);var R=_=l.createElement("link");Qt(R),ln(R,"link",e),R._p=new Promise(function(G,Q){R.onload=G,R.onerror=Q}),R.addEventListener("load",function(){w.loading|=1}),R.addEventListener("error",function(){w.loading|=2}),w.loading|=4,_c(_,n,l)}_={type:"stylesheet",instance:_,count:1,state:w},f.set(h,_)}}}function nT(e,n){Ws.X(e,n);var a=_o;if(a&&e){var l=Vi(a).hoistableScripts,f=So(e),h=l.get(f);h||(h=a.querySelector(Ar(f)),h||(e=x({src:e,async:!0},n),(n=Yn.get(f))&&$f(e,n),h=a.createElement("script"),Qt(h),ln(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function sT(e,n){Ws.M(e,n);var a=_o;if(a&&e){var l=Vi(a).hoistableScripts,f=So(e),h=l.get(f);h||(h=a.querySelector(Ar(f)),h||(e=x({src:e,async:!0,type:"module"},n),(n=Yn.get(f))&&$f(e,n),h=a.createElement("script"),Qt(h),ln(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function U0(e,n,a,l){var f=(f=ke.current)?xc(f):null;if(!f)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ko(a.href),a=Vi(f).hoistableStyles,l=a.get(n),l||(l={type:"style",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ko(a.href);var h=Vi(f).hoistableStyles,_=h.get(e);if(_||(f=f.ownerDocument||f,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,_),(h=f.querySelector(Er(e)))&&!h._p&&(_.instance=h,_.state.loading=5),Yn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Yn.set(e,a),h||aT(f,e,a,_.state))),n&&l===null)throw Error(r(528,""));return _}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=So(a),a=Vi(f).hoistableScripts,l=a.get(n),l||(l={type:"script",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function ko(e){return'href="'+Un(e)+'"'}function Er(e){return'link[rel="stylesheet"]['+e+"]"}function H0(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function aT(e,n,a,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),ln(n,"link",a),Qt(n),e.head.appendChild(n))}function So(e){return'[src="'+Un(e)+'"]'}function Ar(e){return"script[async]"+e}function V0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Un(a.href)+'"]');if(l)return n.instance=l,Qt(l),l;var f=x({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Qt(l),ln(l,"style",f),_c(l,a.precedence,e),n.instance=l;case"stylesheet":f=ko(a.href);var h=e.querySelector(Er(f));if(h)return n.state.loading|=4,n.instance=h,Qt(h),h;l=H0(a),(f=Yn.get(f))&&zf(l,f),h=(e.ownerDocument||e).createElement("link"),Qt(h);var _=h;return _._p=new Promise(function(w,R){_.onload=w,_.onerror=R}),ln(h,"link",l),n.state.loading|=4,_c(h,a.precedence,e),n.instance=h;case"script":return h=So(a.src),(f=e.querySelector(Ar(h)))?(n.instance=f,Qt(f),f):(l=a,(f=Yn.get(h))&&(l=x({},a),$f(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),Qt(f),ln(f,"link",l),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,_c(l,a.precedence,e));return n.instance}function _c(e,n,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,_=0;_<l.length;_++){var w=l[_];if(w.dataset.precedence===n)h=w;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function zf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function $f(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var kc=null;function q0(e,n,a){if(kc===null){var l=new Map,f=kc=new Map;f.set(a,l)}else f=kc,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var h=a[f];if(!(h[Fo]||h[Qe]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var _=h.getAttribute(n)||"";_=e+_;var w=l.get(_);w?w.push(h):l.set(_,[h])}}return l}function G0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function iT(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function F0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function oT(e,n,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=ko(l.href),h=n.querySelector(Er(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Sc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,Qt(h);return}h=n.ownerDocument||n,l=H0(l),(f=Yn.get(f))&&zf(l,f),h=h.createElement("link"),Qt(h);var _=h;_._p=new Promise(function(w,R){_.onload=w,_.onerror=R}),ln(h,"link",l),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Sc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Pf=0;function rT(e,n){return e.stylesheets&&e.count===0&&jc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&jc(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Pf===0&&(Pf=62500*US());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&jc(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Pf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Sc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Tc=null;function jc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Tc=new Map,n.forEach(lT,e),Tc=null,Sc.call(e))}function lT(e,n){if(!(n.state.loading&4)){var a=Tc.get(e);if(a)var l=a.get(null);else{a=new Map,Tc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var _=f[h];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),l=_)}l&&a.set(null,l)}f=n.instance,_=f.getAttribute("data-precedence"),h=a.get(_)||l,h===l&&a.set(null,f),a.set(_,f),this.count++,l=Sc.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),h?h.parentNode.insertBefore(f,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var Dr={$$typeof:D,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function cT(e,n,a,l,f,h,_,w,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=H(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=H(0),this.hiddenUpdates=H(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Z0(e,n,a,l,f,h,_,w,R,G,Q,ae){return e=new cT(e,n,a,_,R,G,Q,ae,w),n=1,h===!0&&(n|=24),h=wn(3,null,null,n),e.current=h,h.stateNode=e,n=yu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:a,cache:n},ku(h),e}function K0(e){return e?(e=Qi,e):Qi}function Y0(e,n,a,l,f,h){f=K0(f),l.context===null?l.context=f:l.pendingContext=f,l=ba(n),l.payload={element:a},h=h===void 0?null:h,h!==null&&(l.callback=h),a=xa(e,l,n),a!==null&&(Tn(a,e,n),cr(a,e,n))}function J0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Uf(e,n){J0(e,n),(e=e.alternate)&&J0(e,n)}function W0(e){if(e.tag===13||e.tag===31){var n=oi(e,67108864);n!==null&&Tn(n,e,67108864),Uf(e,67108864)}}function X0(e){if(e.tag===13||e.tag===31){var n=Dn();n=Se(n);var a=oi(e,n);a!==null&&Tn(a,e,n),Uf(e,n)}}var wc=!0;function dT(e,n,a,l){var f=M.T;M.T=null;var h=O.p;try{O.p=2,Hf(e,n,a,l)}finally{O.p=h,M.T=f}}function uT(e,n,a,l){var f=M.T;M.T=null;var h=O.p;try{O.p=8,Hf(e,n,a,l)}finally{O.p=h,M.T=f}}function Hf(e,n,a,l){if(wc){var f=Vf(l);if(f===null)Cf(e,n,l,Nc,a),ey(e,l);else if(pT(f,e,n,a,l))l.stopPropagation();else if(ey(e,l),n&4&&-1<fT.indexOf(e)){for(;f!==null;){var h=Hi(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var _=bs(h.pendingLanes);if(_!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;_;){var R=1<<31-Xt(_);w.entanglements[1]|=R,_&=~R}Ts(h),(at&6)===0&&(cc=Jt()+500,jr(0))}}break;case 31:case 13:w=oi(h,2),w!==null&&Tn(w,h,2),uc(),Uf(h,2)}if(h=Vf(l),h===null&&Cf(e,n,l,Nc,a),h===f)break;f=h}f!==null&&l.stopPropagation()}else Cf(e,n,l,null,a)}}function Vf(e){return e=qd(e),qf(e)}var Nc=null;function qf(e){if(Nc=null,e=Ui(e),e!==null){var n=d(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=u(n),e!==null)return e;e=null}else if(a===31){if(e=p(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Nc=e,null}function Q0(e){switch(e){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Bi()){case ua:return 2;case Wa:return 8;case ys:case Li:return 32;case $n:return 268435456;default:return 32}default:return 32}}var Gf=!1,Da=null,Ma=null,Ra=null,Mr=new Map,Rr=new Map,Ia=[],fT="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".split(" ");function ey(e,n){switch(e){case"focusin":case"focusout":Da=null;break;case"dragenter":case"dragleave":Ma=null;break;case"mouseover":case"mouseout":Ra=null;break;case"pointerover":case"pointerout":Mr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rr.delete(n.pointerId)}}function Ir(e,n,a,l,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:a,eventSystemFlags:l,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Hi(n),n!==null&&W0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function pT(e,n,a,l,f){switch(n){case"focusin":return Da=Ir(Da,e,n,a,l,f),!0;case"dragenter":return Ma=Ir(Ma,e,n,a,l,f),!0;case"mouseover":return Ra=Ir(Ra,e,n,a,l,f),!0;case"pointerover":var h=f.pointerId;return Mr.set(h,Ir(Mr.get(h)||null,e,n,a,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Rr.set(h,Ir(Rr.get(h)||null,e,n,a,l,f)),!0}return!1}function ty(e){var n=Ui(e.target);if(n!==null){var a=d(n);if(a!==null){if(n=a.tag,n===13){if(n=u(a),n!==null){e.blockedOn=n,ht(e.priority,function(){X0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,ht(e.priority,function(){X0(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Cc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Vf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Vd=l,a.target.dispatchEvent(l),Vd=null}else return n=Hi(a),n!==null&&W0(n),e.blockedOn=a,!1;n.shift()}return!0}function ny(e,n,a){Cc(e)&&a.delete(n)}function mT(){Gf=!1,Da!==null&&Cc(Da)&&(Da=null),Ma!==null&&Cc(Ma)&&(Ma=null),Ra!==null&&Cc(Ra)&&(Ra=null),Mr.forEach(ny),Rr.forEach(ny)}function Ec(e,n){e.blockedOn===n&&(e.blockedOn=null,Gf||(Gf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,mT)))}var Ac=null;function sy(e){Ac!==e&&(Ac=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ac===e&&(Ac=null);for(var n=0;n<e.length;n+=3){var a=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if(qf(l||a)===null)continue;break}var h=Hi(a);h!==null&&(e.splice(n,3),n-=3,Hu(h,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function To(e){function n(R){return Ec(R,e)}Da!==null&&Ec(Da,e),Ma!==null&&Ec(Ma,e),Ra!==null&&Ec(Ra,e),Mr.forEach(n),Rr.forEach(n);for(var a=0;a<Ia.length;a++){var l=Ia[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ia.length&&(a=Ia[0],a.blockedOn===null);)ty(a),a.blockedOn===null&&Ia.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],h=a[l+1],_=f[rt]||null;if(typeof h=="function")_||sy(a);else if(_){var w=null;if(h&&h.hasAttribute("formAction")){if(f=h,_=h[rt]||null)w=_.formAction;else if(qf(f)!==null)continue}else w=_.action;typeof w=="function"?a[l+1]=w:(a.splice(l,3),l-=3),sy(a)}}}function ay(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(_){return f=_})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Ff(e){this._internalRoot=e}Dc.prototype.render=Ff.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,l=Dn();Y0(a,l,e,n,null,null)},Dc.prototype.unmount=Ff.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Y0(e.current,2,null,e,null,null),uc(),n[vt]=null}};function Dc(e){this._internalRoot=e}Dc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Xe();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Ia.length&&n!==0&&n<Ia[a].priority;a++);Ia.splice(a,0,e),a===0&&ty(e)}};var iy=s.version;if(iy!=="19.2.4")throw Error(r(527,iy,"19.2.4"));O.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var hT={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Mc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Mc.isDisabled&&Mc.supportsFiber)try{Wt=Mc.inject(hT),St=Mc}catch{}}return Br.createRoot=function(e,n){if(!c(e))throw Error(r(299));var a=!1,l="",f=fv,h=pv,_=mv;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=Z0(e,1,!1,null,null,a,l,null,f,h,_,ay),e[vt]=n.current,Nf(e),new Ff(n)},Br.hydrateRoot=function(e,n,a){if(!c(e))throw Error(r(299));var l=!1,f="",h=fv,_=pv,w=mv,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=Z0(e,1,!0,n,a??null,l,f,R,h,_,w,ay),n.context=K0(null),a=n.current,l=Dn(),l=Se(l),f=ba(l),f.callback=null,xa(a,f,l),a=l,n.current.lanes=a,te(n,a),Ts(n),e[vt]=n.current,Nf(e),new Dc(n)},Br.version="19.2.4",Br}var py;function GT(){if(py)return Zf.exports;py=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),Zf.exports=qT(),Zf.exports}var FT=GT();const ZT="modulepreload",KT=function(t){return"/"+t},my={},YT=function(s,o,r){let c=Promise.resolve();if(o&&o.length>0){let u=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),m=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=u(o.map(g=>{if(g=KT(g),g in my)return;my[g]=!0;const v=g.endsWith(".css"),x=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${x}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":ZT,v||(b.as="script"),b.crossOrigin="",b.href=g,m&&b.setAttribute("nonce",m),document.head.appendChild(b),v)return new Promise((k,S)=>{b.addEventListener("load",k),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(u){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=u,window.dispatchEvent(p),!p.defaultPrevented)throw u}return c.then(u=>{for(const p of u||[])p.status==="rejected"&&d(p.reason);return s().catch(d)})},JT=new Proxy(globalThis.fetch,{apply(t,s,o){return Reflect.apply(globalThis.fetch,s,o)}}),jd=jT({baseUrl:"/",fetch:JT}),Ye=kd(wT,jd),dn=kd(NT,jd),Oc=kd(CT,jd),Bc=kd(ET,jd),WT="_bar_1xhb4_1",XT="_input_1xhb4_32",QT="_select_1xhb4_67",e2="_btnPrimary_1xhb4_103",t2="_btnGhost_1xhb4_173",n2="_badge_1xhb4_195",s2="_disconnectHint_1xhb4_205",Rn={bar:WT,input:XT,select:QT,btnPrimary:e2,btnGhost:t2,badge:n2,disconnectHint:s2};function a2(t,s){if(!t)return!1;const o=s.find(r=>r.id===t);return o!==void 0&&(o.status==="disconnected"||o.status==="error")}function i2({environmentId:t,onReconnect:s}){return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:Rn.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),i.jsx("button",{type:"button",onClick:()=>s(t),className:Rn.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function nl({mode:t,sessionId:s,environmentId:o,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:p,onSpawn:m,onStartTask:g,onProvisionEnvironment:v,onShowToast:x}){const[b,k]=y.useState(""),[S,j]=y.useState(""),N=a2(o,u),T=C=>{if(C.preventDefault(),!!b.trim())if(t==="send"){if(!s||N)return;p(s,b),k("")}else if(t==="spawn"){if(!o)return;m(o,b,S),x==null||x("Session started","success"),k(""),j("")}else{if(!r)return;g(r,void 0,o,b),k("")}};return t==="spawn"?i.jsxs("form",{onSubmit:T,className:Rn.bar,children:[i.jsx("span",{className:Rn.badge,children:"new chat"}),i.jsx("input",{type:"text",value:b,onChange:C=>k(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:Rn.input,"aria-label":"Enter prompt"}),c&&i.jsxs("select",{value:S,onChange:C=>j(C.target.value),className:Rn.select,"aria-label":"Select persona",children:[i.jsx("option",{value:"",children:"(Default)"}),d.map(C=>i.jsx("option",{value:C.id,children:C.name},C.id))]}),i.jsx("button",{type:"submit",disabled:!b.trim()||!o,className:Rn.btnPrimary,children:"Go"})]}):t==="start"?i.jsxs("form",{onSubmit:T,className:Rn.bar,children:[i.jsx("input",{type:"text",value:b,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:Rn.input,"aria-label":"Type a message"}),i.jsx("button",{type:"submit",disabled:!b.trim(),className:Rn.btnPrimary,children:"Send"})]}):i.jsxs("form",{onSubmit:T,className:Rn.bar,children:[N&&o&&i.jsx(i2,{environmentId:o,onReconnect:v}),i.jsx("input",{type:"text",value:b,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!N,disabled:N,className:Rn.input,"aria-label":"Type a message"}),i.jsx("span",{title:N?"Environment is unavailable — reconnect first":void 0,children:i.jsx("button",{type:"submit",disabled:!b.trim()||N,className:Rn.btnPrimary,children:"Send"})})]})}const hy=220,gy=70,o2=40,r2=60,l2="hierarchy",c2="dependency";function d2(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new oy.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:o2,ranksep:r2});const o=new Map(t.map(u=>[u.id,u])),r=new Map;for(const u of t)if(u.parentTaskId&&o.has(u.parentTaskId)){const p=r.get(u.parentTaskId)||[];p.push(u),r.set(u.parentTaskId,p)}for(const u of t)s.setNode(u.id,{width:hy,height:gy});const c=[];for(const u of t){if(u.parentTaskId&&o.has(u.parentTaskId)){const p=`hierarchy-${u.parentTaskId}-${u.id}`;s.setEdge(u.parentTaskId,u.id,{},p),c.push({id:p,source:u.parentTaskId,target:u.id,type:"smoothstep",data:{edgeType:l2},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of u.dependsOn)if(o.has(p)){const m=`dependency-${p}-${u.id}`;s.setEdge(p,u.id,{},m),c.push({id:m,source:p,target:u.id,type:"smoothstep",data:{edgeType:c2},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return oy.layout(s),{nodes:t.map(u=>{const p=s.node(u.id),m=r.get(u.id)||[];return{id:u.id,type:"task",position:{x:p.x-hy/2,y:p.y-gy/2},data:{task:u,childCount:m.length,doneChildCount:m.filter(g=>g.status==="complete").length,hasDependencies:u.dependsOn.length>0}}}),edges:c}},[t])}/**
27
- * @license lucide-react v0.474.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const u2=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),jx=(...t)=>t.filter((s,o,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===o).join(" ").trim();/**
32
- * @license lucide-react v0.474.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */var f2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
37
- * @license lucide-react v0.474.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const p2=y.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...p},m)=>y.createElement("svg",{ref:m,...f2,width:s,height:s,stroke:t,strokeWidth:r?Number(o)*24/Number(s):o,className:jx("lucide",c),...p},[...u.map(([g,v])=>y.createElement(g,v)),...Array.isArray(d)?d:[d]]));/**
42
- * @license lucide-react v0.474.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const Ge=(t,s)=>{const o=y.forwardRef(({className:r,...c},d)=>y.createElement(p2,{ref:d,iconNode:s,className:jx(`lucide-${u2(t)}`,r),...c}));return o.displayName=`${t}`,o};/**
47
- * @license lucide-react v0.474.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const m2=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],vy=Ge("ArrowDown",m2);/**
52
- * @license lucide-react v0.474.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const h2=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],yy=Ge("ArrowUp",h2);/**
57
- * @license lucide-react v0.474.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const g2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],v2=Ge("Ban",g2);/**
62
- * @license lucide-react v0.474.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const y2=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],b2=Ge("Brain",y2);/**
67
- * @license lucide-react v0.474.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */const x2=[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],_2=Ge("CalendarClock",x2);/**
72
- * @license lucide-react v0.474.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const k2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Mi=Ge("Check",k2);/**
77
- * @license lucide-react v0.474.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const S2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],wx=Ge("ChevronDown",S2);/**
82
- * @license lucide-react v0.474.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */const T2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],la=Ge("ChevronRight",T2);/**
87
- * @license lucide-react v0.474.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const j2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Va=Ge("Circle",j2);/**
92
- * @license lucide-react v0.474.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const w2=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],N2=Ge("ClipboardList",w2);/**
97
- * @license lucide-react v0.474.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const C2=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Nx=Ge("Clipboard",C2);/**
102
- * @license lucide-react v0.474.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const E2=[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]],A2=Ge("Cog",E2);/**
107
- * @license lucide-react v0.474.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const D2=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],M2=Ge("Copy",D2);/**
112
- * @license lucide-react v0.474.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */const R2=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],I2=Ge("CornerDownRight",R2);/**
117
- * @license lucide-react v0.474.0 - ISC
118
- *
119
- * This source code is licensed under the ISC license.
120
- * See the LICENSE file in the root directory of this source tree.
121
- */const O2=[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]],B2=Ge("FilePen",O2);/**
122
- * @license lucide-react v0.474.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */const L2=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],z2=Ge("FileText",L2);/**
127
- * @license lucide-react v0.474.0 - ISC
128
- *
129
- * This source code is licensed under the ISC license.
130
- * See the LICENSE file in the root directory of this source tree.
131
- */const $2=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],P2=Ge("House",$2);/**
132
- * @license lucide-react v0.474.0 - ISC
133
- *
134
- * This source code is licensed under the ISC license.
135
- * See the LICENSE file in the root directory of this source tree.
136
- */const U2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],gm=Ge("Info",U2);/**
137
- * @license lucide-react v0.474.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const H2=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],V2=Ge("Key",H2);/**
142
- * @license lucide-react v0.474.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- */const q2=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],G2=Ge("Keyboard",q2);/**
147
- * @license lucide-react v0.474.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */const F2=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],Z2=Ge("ListChecks",F2);/**
152
- * @license lucide-react v0.474.0 - ISC
153
- *
154
- * This source code is licensed under the ISC license.
155
- * See the LICENSE file in the root directory of this source tree.
156
- */const K2=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],Y2=Ge("List",K2);/**
157
- * @license lucide-react v0.474.0 - ISC
158
- *
159
- * This source code is licensed under the ISC license.
160
- * See the LICENSE file in the root directory of this source tree.
161
- */const J2=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],W2=Ge("Loader",J2);/**
162
- * @license lucide-react v0.474.0 - ISC
163
- *
164
- * This source code is licensed under the ISC license.
165
- * See the LICENSE file in the root directory of this source tree.
166
- */const X2=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],Q2=Ge("Menu",X2);/**
167
- * @license lucide-react v0.474.0 - ISC
168
- *
169
- * This source code is licensed under the ISC license.
170
- * See the LICENSE file in the root directory of this source tree.
171
- */const ej=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],tj=Ge("MessageSquare",ej);/**
172
- * @license lucide-react v0.474.0 - ISC
173
- *
174
- * This source code is licensed under the ISC license.
175
- * See the LICENSE file in the root directory of this source tree.
176
- */const nj=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],sj=Ge("Monitor",nj);/**
177
- * @license lucide-react v0.474.0 - ISC
178
- *
179
- * This source code is licensed under the ISC license.
180
- * See the LICENSE file in the root directory of this source tree.
181
- */const aj=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],ij=Ge("Palette",aj);/**
182
- * @license lucide-react v0.474.0 - ISC
183
- *
184
- * This source code is licensed under the ISC license.
185
- * See the LICENSE file in the root directory of this source tree.
186
- */const oj=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],rj=Ge("Pause",oj);/**
187
- * @license lucide-react v0.474.0 - ISC
188
- *
189
- * This source code is licensed under the ISC license.
190
- * See the LICENSE file in the root directory of this source tree.
191
- */const lj=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],cj=Ge("Pencil",lj);/**
192
- * @license lucide-react v0.474.0 - ISC
193
- *
194
- * This source code is licensed under the ISC license.
195
- * See the LICENSE file in the root directory of this source tree.
196
- */const dj=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],uj=Ge("Puzzle",dj);/**
197
- * @license lucide-react v0.474.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */const fj=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Cx=Ge("Search",fj);/**
202
- * @license lucide-react v0.474.0 - ISC
203
- *
204
- * This source code is licensed under the ISC license.
205
- * See the LICENSE file in the root directory of this source tree.
206
- */const pj=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],mj=Ge("Settings",pj);/**
207
- * @license lucide-react v0.474.0 - ISC
208
- *
209
- * This source code is licensed under the ISC license.
210
- * See the LICENSE file in the root directory of this source tree.
211
- */const hj=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],gj=Ge("SquareCheckBig",hj);/**
212
- * @license lucide-react v0.474.0 - ISC
213
- *
214
- * This source code is licensed under the ISC license.
215
- * See the LICENSE file in the root directory of this source tree.
216
- */const vj=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],vm=Ge("TriangleAlert",vj);/**
217
- * @license lucide-react v0.474.0 - ISC
218
- *
219
- * This source code is licensed under the ISC license.
220
- * See the LICENSE file in the root directory of this source tree.
221
- */const yj=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],bj=Ge("User",yj);/**
222
- * @license lucide-react v0.474.0 - ISC
223
- *
224
- * This source code is licensed under the ISC license.
225
- * See the LICENSE file in the root directory of this source tree.
226
- */const xj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Za=Ge("X",xj),ym=8,dt=12,nn=14,Nt=16,Pp={not_started:{color:"var(--text-tertiary)",icon:i.jsx(Va,{size:dt}),label:"Not Started"},working:{color:"var(--accent-green)",icon:i.jsx(Va,{size:dt,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:i.jsx(rj,{size:dt}),label:"Paused"},complete:{color:"var(--accent-green)",icon:i.jsx(Mi,{size:dt}),label:"Complete"},failed:{color:"var(--accent-red)",icon:i.jsx(Za,{size:dt}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:i.jsx(v2,{size:dt}),label:"Blocked"}};function qa(t){return t==="blocked"?Pp.blocked:Pp[ul(t)]}const _j={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function kj(t){return _j[ul(t)]??"statusPending"}const Sj=["working","paused","failed","not_started","blocked","complete"],by=["not_started","working","paused","complete","failed"],Tj={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function ul(t){return t in Pp&&t!=="blocked"?t:Tj[t]??"not_started"}const jj={not_started:"--text-tertiary",working:"--accent-green",paused:"--accent-yellow",complete:"--accent-green",failed:"--accent-red",pending:"--text-tertiary",assigned:"--text-tertiary",in_progress:"--accent-green",review:"--accent-yellow",done:"--accent-green",waiting_input:"--accent-yellow"},wj="_dagContainer_js4w6_1",Nj="_taskNode_js4w6_26",Cj="_taskNodeBorder_js4w6_54",Ej="_taskNodeContent_js4w6_60",Aj="_taskNodeHeader_js4w6_70",Dj="_taskNodeIcon_js4w6_77",Mj="_taskNodeTitle_js4w6_82",Rj="_taskNodeBadges_js4w6_90",Ij="_childBadge_js4w6_95",Oj="_depBadge_js4w6_107",Bj="_handle_js4w6_119",Lj="_emptyCta_js4w6_126",zj="_ctaDescription_js4w6_137",$j="_ctaButton_js4w6_144",yn={dagContainer:wj,taskNode:Nj,taskNodeBorder:Cj,taskNodeContent:Ej,taskNodeHeader:Aj,taskNodeIcon:Dj,taskNodeTitle:Mj,taskNodeBadges:Rj,childBadge:Ij,depBadge:Oj,handle:Bj,emptyCta:Lj,ctaDescription:zj,ctaButton:$j};function Pj({data:t}){const{task:s,childCount:o,doneChildCount:r,hasDependencies:c}=t,d=qa(s.status);return i.jsxs("div",{className:yn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[i.jsx(ry,{type:"target",position:ly.Top,className:yn.handle}),i.jsx("div",{className:yn.taskNodeBorder,style:{backgroundColor:d.color}}),i.jsxs("div",{className:yn.taskNodeContent,children:[i.jsxs("div",{className:yn.taskNodeHeader,children:[i.jsx("span",{className:yn.taskNodeIcon,style:{color:d.color},children:d.icon}),i.jsx("span",{className:yn.taskNodeTitle,children:s.title})]}),i.jsxs("div",{className:yn.taskNodeBadges,children:[o>0&&i.jsxs("span",{className:yn.childBadge,children:[r,"/",o]}),c&&i.jsx("span",{className:yn.depBadge,children:"dep"})]})]}),i.jsx(ry,{type:"source",position:ly.Bottom,className:yn.handle})]})}/**
227
- * react-router v7.13.2
228
- *
229
- * Copyright (c) Remix Software Inc.
230
- *
231
- * This source code is licensed under the MIT license found in the
232
- * LICENSE.md file in the root directory of this source tree.
233
- *
234
- * @license MIT
235
- */var xy="popstate";function _y(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function Uj(t={}){function s(r,c){var g;let d=(g=c.state)==null?void 0:g.masked,{pathname:u,search:p,hash:m}=d||r.location;return Up("",{pathname:u,search:p,hash:m},c.state&&c.state.usr||null,c.state&&c.state.key||"default",d?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function o(r,c){return typeof c=="string"?c:sl(c)}return Vj(s,o,null,t)}function _t(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function ns(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function Hj(){return Math.random().toString(36).substring(2,10)}function ky(t,s){return{usr:t.state,key:t.key,idx:s,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Up(t,s,o=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?Po(s):s,state:o,key:s&&s.key||r||Hj(),unstable_mask:c}}function sl({pathname:t="/",search:s="",hash:o=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),o&&o!=="#"&&(t+=o.charAt(0)==="#"?o:"#"+o),t}function Po(t){let s={};if(t){let o=t.indexOf("#");o>=0&&(s.hash=t.substring(o),t=t.substring(0,o));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function Vj(t,s,o,r={}){let{window:c=document.defaultView,v5Compat:d=!1}=r,u=c.history,p="POP",m=null,g=v();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function v(){return(u.state||{idx:null}).idx}function x(){p="POP";let N=v(),T=N==null?null:N-g;g=N,m&&m({action:p,location:j.location,delta:T})}function b(N,T){p="PUSH";let C=_y(N)?N:Up(j.location,N,T);g=v()+1;let D=ky(C,g),B=j.createHref(C.unstable_mask||C);try{u.pushState(D,"",B)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;c.location.assign(B)}d&&m&&m({action:p,location:j.location,delta:1})}function k(N,T){p="REPLACE";let C=_y(N)?N:Up(j.location,N,T);g=v();let D=ky(C,g),B=j.createHref(C.unstable_mask||C);u.replaceState(D,"",B),d&&m&&m({action:p,location:j.location,delta:0})}function S(N){return qj(N)}let j={get action(){return p},get location(){return t(c,u)},listen(N){if(m)throw new Error("A history only accepts one active listener");return c.addEventListener(xy,x),m=N,()=>{c.removeEventListener(xy,x),m=null}},createHref(N){return s(c,N)},createURL:S,encodeLocation(N){let T=S(N);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:b,replace:k,go(N){return u.go(N)}};return j}function qj(t,s=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),_t(o,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:sl(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=o+r),new URL(r,o)}function Ex(t,s,o="/"){return Gj(t,s,o,!1)}function Gj(t,s,o,r){let c=typeof s=="string"?Po(s):s,d=aa(c.pathname||"/",o);if(d==null)return null;let u=Ax(t);Fj(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=Mx(d);p=tw(u[m],g,r)}return p}function Ax(t,s=[],o=[],r="",c=!1){let d=(u,p,m=c,g)=>{let v={relativePath:g===void 0?u.path||"":g,caseSensitive:u.caseSensitive===!0,childrenIndex:p,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(r)&&m)return;_t(v.relativePath.startsWith(r),`Absolute route path "${v.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(r.length)}let x=Es([r,v.relativePath]),b=o.concat(v);u.children&&u.children.length>0&&(_t(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${x}".`),Ax(u.children,s,b,x,m)),!(u.path==null&&!u.index)&&s.push({path:x,score:Qj(x,u.index),routesMeta:b})};return t.forEach((u,p)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))d(u,p);else for(let g of Dx(u.path))d(u,p,!0,g)}),s}function Dx(t){let s=t.split("/");if(s.length===0)return[];let[o,...r]=s,c=o.endsWith("?"),d=o.replace(/\?$/,"");if(r.length===0)return c?[d,""]:[d];let u=Dx(r.join("/")),p=[];return p.push(...u.map(m=>m===""?d:[d,m].join("/"))),c&&p.push(...u),p.map(m=>t.startsWith("/")&&m===""?"/":m)}function Fj(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:ew(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var Zj=/^:[\w-]+$/,Kj=3,Yj=2,Jj=1,Wj=10,Xj=-2,Sy=t=>t==="*";function Qj(t,s){let o=t.split("/"),r=o.length;return o.some(Sy)&&(r+=Xj),s&&(r+=Yj),o.filter(c=>!Sy(c)).reduce((c,d)=>c+(Zj.test(d)?Kj:d===""?Jj:Wj),r)}function ew(t,s){return t.length===s.length&&t.slice(0,-1).every((r,c)=>r===s[c])?t[t.length-1]-s[s.length-1]:0}function tw(t,s,o=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let p=0;p<r.length;++p){let m=r[p],g=p===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",x=al({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),b=m.route;if(!x&&g&&o&&!r[r.length-1].route.index&&(x=al({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!x)return null;Object.assign(c,x.params),u.push({params:c,pathname:Es([d,x.pathname]),pathnameBase:ow(Es([d,x.pathnameBase])),route:b}),x.pathnameBase!=="/"&&(d=Es([d,x.pathnameBase]))}return u}function al(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=nw(t.path,t.caseSensitive,t.end),c=s.match(o);if(!c)return null;let d=c[0],u=d.replace(/(.)\/+$/,"$1"),p=c.slice(1);return{params:r.reduce((g,{paramName:v,isOptional:x},b)=>{if(v==="*"){let S=p[b]||"";u=d.slice(0,d.length-S.length).replace(/(.)\/+$/,"$1")}const k=p[b];return x&&!k?g[v]=void 0:g[v]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function nw(t,s=!1,o=!0){ns(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,p,m,g,v)=>{if(r.push({paramName:p,isOptional:m!=null}),m){let x=v.charAt(g+u.length);return x&&x!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),r]}function Mx(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return ns(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),t}}function aa(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let o=s.endsWith("/")?s.length-1:s.length,r=t.charAt(o);return r&&r!=="/"?null:t.slice(o)||"/"}var sw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function aw(t,s="/"){let{pathname:o,search:r="",hash:c=""}=typeof t=="string"?Po(t):t,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=Ty(o.substring(1),"/"):d=Ty(o,s)):d=s,{pathname:d,search:rw(r),hash:lw(c)}}function Ty(t,s){let o=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?o.length>1&&o.pop():c!=="."&&o.push(c)}),o.length>1?o.join("/"):"/"}function Jf(t,s,o,r){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function iw(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function bm(t){let s=iw(t);return s.map((o,r)=>r===s.length-1?o.pathname:o.pathnameBase)}function wd(t,s,o,r=!1){let c;typeof t=="string"?c=Po(t):(c={...t},_t(!c.pathname||!c.pathname.includes("?"),Jf("?","pathname","search",c)),_t(!c.pathname||!c.pathname.includes("#"),Jf("#","pathname","hash",c)),_t(!c.search||!c.search.includes("#"),Jf("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=o;else{let x=s.length-1;if(!r&&u.startsWith("..")){let b=u.split("/");for(;b[0]==="..";)b.shift(),x-=1;c.pathname=b.join("/")}p=x>=0?s[x]:"/"}let m=aw(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&o.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var Es=t=>t.join("/").replace(/\/\/+/g,"/"),ow=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),rw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,lw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,cw=class{constructor(t,s,o,r=!1){this.status=t,this.statusText=s||"",this.internal=r,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function dw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function uw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Rx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ix(t,s){let o=t;if(typeof o!="string"||!sw.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let r=o,c=!1;if(Rx)try{let d=new URL(window.location.href),u=o.startsWith("//")?new URL(d.protocol+o):new URL(o),p=aa(u.pathname,s);u.origin===d.origin&&p!=null?o=p+u.search+u.hash:c=!0}catch{ns(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:c,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ox=["POST","PUT","PATCH","DELETE"];new Set(Ox);var fw=["GET",...Ox];new Set(fw);var Uo=y.createContext(null);Uo.displayName="DataRouter";var Nd=y.createContext(null);Nd.displayName="DataRouterState";var pw=y.createContext(!1),Bx=y.createContext({isTransitioning:!1});Bx.displayName="ViewTransition";var mw=y.createContext(new Map);mw.displayName="Fetchers";var hw=y.createContext(null);hw.displayName="Await";var Ln=y.createContext(null);Ln.displayName="Navigation";var fl=y.createContext(null);fl.displayName="Location";var ss=y.createContext({outlet:null,matches:[],isDataRoute:!1});ss.displayName="Route";var xm=y.createContext(null);xm.displayName="RouteError";var Lx="REACT_ROUTER_ERROR",gw="REDIRECT",vw="ROUTE_ERROR_RESPONSE";function yw(t){if(t.startsWith(`${Lx}:${gw}:{`))try{let s=JSON.parse(t.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function bw(t){if(t.startsWith(`${Lx}:${vw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new cw(s.status,s.statusText,s.data)}catch{}}function xw(t,{relative:s}={}){_t(Ri(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=y.useContext(Ln),{hash:c,pathname:d,search:u}=pl(t,{relative:s}),p=d;return o!=="/"&&(p=d==="/"?o:Es([o,d])),r.createHref({pathname:p,search:u,hash:c})}function Ri(){return y.useContext(fl)!=null}function Yt(){return _t(Ri(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(fl).location}function Dt(t){_t(Ri(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Yt();return y.useMemo(()=>al(t,Mx(s)),[s,t])}var zx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function $x(t){y.useContext(Ln).static||y.useLayoutEffect(t)}function Cd(){let{isDataRoute:t}=y.useContext(ss);return t?Ow():_w()}function _w(){_t(Ri(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Uo),{basename:s,navigator:o}=y.useContext(Ln),{matches:r}=y.useContext(ss),{pathname:c}=Yt(),d=JSON.stringify(bm(r)),u=y.useRef(!1);return $x(()=>{u.current=!0}),y.useCallback((m,g={})=>{if(ns(u.current,zx),!u.current)return;if(typeof m=="number"){o.go(m);return}let v=wd(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Es([s,v.pathname])),(g.replace?o.replace:o.push)(v,g.state,g)},[s,o,d,c,t])}var kw=y.createContext(null);function Sw(t){let s=y.useContext(ss).outlet;return y.useMemo(()=>s&&y.createElement(kw.Provider,{value:t},s),[s,t])}function as(){let{matches:t}=y.useContext(ss),s=t[t.length-1];return s?s.params:{}}function pl(t,{relative:s}={}){let{matches:o}=y.useContext(ss),{pathname:r}=Yt(),c=JSON.stringify(bm(o));return y.useMemo(()=>wd(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function Tw(t,s){return Px(t,s)}function Px(t,s,o){var N;_t(Ri(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Ln),{matches:c}=y.useContext(ss),d=c[c.length-1],u=d?d.params:{},p=d?d.pathname:"/",m=d?d.pathnameBase:"/",g=d&&d.route;{let T=g&&g.path||"";Hx(p,!g||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${T}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
236
-
237
- Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let v=Yt(),x;if(s){let T=typeof s=="string"?Po(s):s;_t(m==="/"||((N=T.pathname)==null?void 0:N.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${T.pathname}" was given in the \`location\` prop.`),x=T}else x=v;let b=x.pathname||"/",k=b;if(m!=="/"){let T=m.replace(/^\//,"").split("/");k="/"+b.replace(/^\//,"").split("/").slice(T.length).join("/")}let S=Ex(t,{pathname:k});ns(g||S!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),ns(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=Ew(S&&S.map(T=>Object.assign({},T,{params:Object.assign({},u,T.params),pathname:Es([m,r.encodeLocation?r.encodeLocation(T.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?m:Es([m,r.encodeLocation?r.encodeLocation(T.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),c,o);return s&&j?y.createElement(fl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...x},navigationType:"POP"}},j):j}function jw(){let t=Iw(),s=dw(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),o=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:r},d={padding:"2px 4px",backgroundColor:r},u=null;return console.error("Error handled by React Router default ErrorBoundary:",t),u=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:d},"ErrorBoundary")," or"," ",y.createElement("code",{style:d},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},s),o?y.createElement("pre",{style:c},o):null,u)}var ww=y.createElement(jw,null),Ux=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){this.props.onError?this.props.onError(t,s):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const o=bw(t.digest);o&&(t=o)}let s=t!==void 0?y.createElement(ss.Provider,{value:this.props.routeContext},y.createElement(xm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(Nw,{error:t},s):s}};Ux.contextType=pw;var Wf=new WeakMap;function Nw({children:t,error:s}){let{basename:o}=y.useContext(Ln);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=yw(s.digest);if(r){let c=Wf.get(s);if(c)throw c;let d=Ix(r.location,o);if(Rx&&!Wf.get(s))if(d.isExternal||r.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:r.replace}));throw Wf.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function Cw({routeContext:t,match:s,children:o}){let r=y.useContext(Uo);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(ss.Provider,{value:t},o)}function Ew(t,s=[],o){let r=o==null?void 0:o.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(s.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let c=t,d=r==null?void 0:r.errors;if(d!=null){let v=c.findIndex(x=>x.route.id&&(d==null?void 0:d[x.route.id])!==void 0);_t(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let u=!1,p=-1;if(o&&r){u=r.renderFallback;for(let v=0;v<c.length;v++){let x=c[v];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(p=v),x.route.id){let{loaderData:b,errors:k}=r,S=x.route.loader&&!b.hasOwnProperty(x.route.id)&&(!k||k[x.route.id]===void 0);if(x.route.lazy||S){o.isStatic&&(u=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let m=o==null?void 0:o.onError,g=r&&m?(v,x)=>{var b,k;m(v,{location:r.location,params:((k=(b=r.matches)==null?void 0:b[0])==null?void 0:k.params)??{},unstable_pattern:uw(r.matches),errorInfo:x})}:void 0;return c.reduceRight((v,x,b)=>{let k,S=!1,j=null,N=null;r&&(k=d&&x.route.id?d[x.route.id]:void 0,j=x.route.errorElement||ww,u&&(p<0&&b===0?(Hx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,N=null):p===b&&(S=!0,N=x.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,b+1)),C=()=>{let D;return k?D=j:S?D=N:x.route.Component?D=y.createElement(x.route.Component,null):x.route.element?D=x.route.element:D=v,y.createElement(Cw,{match:x,routeContext:{outlet:v,matches:T,isDataRoute:r!=null},children:D})};return r&&(x.route.ErrorBoundary||x.route.errorElement||b===0)?y.createElement(Ux,{location:r.location,revalidation:r.revalidation,component:j,error:k,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:g}):C()},null)}function _m(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Aw(t){let s=y.useContext(Uo);return _t(s,_m(t)),s}function Dw(t){let s=y.useContext(Nd);return _t(s,_m(t)),s}function Mw(t){let s=y.useContext(ss);return _t(s,_m(t)),s}function km(t){let s=Mw(t),o=s.matches[s.matches.length-1];return _t(o.route.id,`${t} can only be used on routes that contain a unique "id"`),o.route.id}function Rw(){return km("useRouteId")}function Iw(){var r;let t=y.useContext(xm),s=Dw("useRouteError"),o=km("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function Ow(){let{router:t}=Aw("useNavigate"),s=km("useNavigate"),o=y.useRef(!1);return $x(()=>{o.current=!0}),y.useCallback(async(c,d={})=>{ns(o.current,zx),o.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var jy={};function Hx(t,s,o){!s&&!jy[t]&&(jy[t]=!0,ns(!1,o))}y.memo(Bw);function Bw({routes:t,future:s,state:o,isStatic:r,onError:c}){return Px(t,void 0,{state:o,isStatic:r,onError:c})}function ts({to:t,replace:s,state:o,relative:r}){_t(Ri(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Ln);ns(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=y.useContext(ss),{pathname:u}=Yt(),p=Cd(),m=wd(t,bm(d),u,r==="path"),g=JSON.stringify(m);return y.useEffect(()=>{p(JSON.parse(g),{replace:s,state:o,relative:r})},[p,g,r,s,o]),null}function Ka(t){return Sw(t.context)}function we(t){_t(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Lw({basename:t="/",children:s=null,location:o,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){_t(!Ri(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=t.replace(/^\/*/,"/"),m=y.useMemo(()=>({basename:p,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[p,c,d,u]);typeof o=="string"&&(o=Po(o));let{pathname:g="/",search:v="",hash:x="",state:b=null,key:k="default",unstable_mask:S}=o,j=y.useMemo(()=>{let N=aa(g,p);return N==null?null:{location:{pathname:N,search:v,hash:x,state:b,key:k,unstable_mask:S},navigationType:r}},[p,g,v,x,b,k,r,S]);return ns(j!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${x}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:y.createElement(Ln.Provider,{value:m},y.createElement(fl.Provider,{children:s,value:j}))}function zw({children:t,location:s}){return Tw(Hp(t),s)}function Hp(t,s=[]){let o=[];return y.Children.forEach(t,(r,c)=>{if(!y.isValidElement(r))return;let d=[...s,c];if(r.type===y.Fragment){o.push.apply(o,Hp(r.props.children,d));return}_t(r.type===we,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),_t(!r.props.index||!r.props.children,"An index route cannot have child routes.");let u={id:r.props.id||d.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(u.children=Hp(r.props.children,d)),o.push(u)}),o}var Xc="get",Qc="application/x-www-form-urlencoded";function Ed(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function $w(t){return Ed(t)&&t.tagName.toLowerCase()==="button"}function Pw(t){return Ed(t)&&t.tagName.toLowerCase()==="form"}function Uw(t){return Ed(t)&&t.tagName.toLowerCase()==="input"}function Hw(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Vw(t,s){return t.button===0&&(!s||s==="_self")&&!Hw(t)}function Vp(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((s,o)=>{let r=t[o];return s.concat(Array.isArray(r)?r.map(c=>[o,c]):[[o,r]])},[]))}function qw(t,s){let o=Vp(t);return s&&s.forEach((r,c)=>{o.has(c)||s.getAll(c).forEach(d=>{o.append(c,d)})}),o}var Lc=null;function Gw(){if(Lc===null)try{new FormData(document.createElement("form"),0),Lc=!1}catch{Lc=!0}return Lc}var Fw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Xf(t){return t!=null&&!Fw.has(t)?(ns(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Qc}"`),null):t}function Zw(t,s){let o,r,c,d,u;if(Pw(t)){let p=t.getAttribute("action");r=p?aa(p,s):null,o=t.getAttribute("method")||Xc,c=Xf(t.getAttribute("enctype"))||Qc,d=new FormData(t)}else if($w(t)||Uw(t)&&(t.type==="submit"||t.type==="image")){let p=t.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||p.getAttribute("action");if(r=m?aa(m,s):null,o=t.getAttribute("formmethod")||p.getAttribute("method")||Xc,c=Xf(t.getAttribute("formenctype"))||Xf(p.getAttribute("enctype"))||Qc,d=new FormData(p,t),!Gw()){let{name:g,type:v,value:x}=t;if(v==="image"){let b=g?`${g}.`:"";d.append(`${b}x`,"0"),d.append(`${b}y`,"0")}else g&&d.append(g,x)}}else{if(Ed(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Xc,r=null,c=Qc,u=t}return d&&c==="text/plain"&&(u=d,d=void 0),{action:r,method:o.toLowerCase(),encType:c,formData:d,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Sm(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Kw(t,s,o,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return o?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&aa(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function Yw(t,s){if(t.id in s)return s[t.id];try{let o=await import(t.module);return s[t.id]=o,o}catch(o){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Jw(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function Ww(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await Yw(d,o);return u.links?u.links():[]}return[]}));return tN(r.flat(1).filter(Jw).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function wy(t,s,o,r,c,d){let u=(m,g)=>o[g]?m.route.id!==o[g].route.id:!0,p=(m,g)=>{var v;return o[g].pathname!==m.pathname||((v=o[g].route.path)==null?void 0:v.endsWith("*"))&&o[g].params["*"]!==m.params["*"]};return d==="assets"?s.filter((m,g)=>u(m,g)||p(m,g)):d==="data"?s.filter((m,g)=>{var x;let v=r.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,g)||p(m,g))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((x=o[0])==null?void 0:x.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function Xw(t,s,{includeHydrateFallback:o}={}){return Qw(t.map(r=>{let c=s.routes[r.route.id];if(!c)return[];let d=[c.module];return c.clientActionModule&&(d=d.concat(c.clientActionModule)),c.clientLoaderModule&&(d=d.concat(c.clientLoaderModule)),o&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function Qw(t){return[...new Set(t)]}function eN(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function tN(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(eN(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function Vx(){let t=y.useContext(Uo);return Sm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function nN(){let t=y.useContext(Nd);return Sm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Tm=y.createContext(void 0);Tm.displayName="FrameworkContext";function qx(){let t=y.useContext(Tm);return Sm(t,"You must render this element inside a <HydratedRouter> element"),t}function sN(t,s){let o=y.useContext(Tm),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:v,onTouchStart:x}=s,b=y.useRef(null);y.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let j=T=>{T.forEach(C=>{u(C.isIntersecting)})},N=new IntersectionObserver(j,{threshold:.5});return b.current&&N.observe(b.current),()=>{N.disconnect()}}},[t]),y.useEffect(()=>{if(r){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[r]);let k=()=>{c(!0)},S=()=>{c(!1),u(!1)};return o?t!=="intent"?[d,b,{}]:[d,b,{onFocus:Lr(p,k),onBlur:Lr(m,S),onMouseEnter:Lr(g,k),onMouseLeave:Lr(v,S),onTouchStart:Lr(x,k)}]:[!1,b,{}]}function Lr(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function aN({page:t,...s}){let{router:o}=Vx(),r=y.useMemo(()=>Ex(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?y.createElement(oN,{page:t,matches:r,...s}):null}function iN(t){let{manifest:s,routeModules:o}=qx(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return Ww(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function oN({page:t,matches:s,...o}){let r=Yt(),{future:c,manifest:d,routeModules:u}=qx(),{basename:p}=Vx(),{loaderData:m,matches:g}=nN(),v=y.useMemo(()=>wy(t,s,g,d,r,"data"),[t,s,g,d,r]),x=y.useMemo(()=>wy(t,s,g,d,r,"assets"),[t,s,g,d,r]),b=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let j=new Set,N=!1;if(s.forEach(C=>{var B;let D=d.routes[C.route.id];!D||!D.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((B=u[C.route.id])!=null&&B.shouldRevalidate)||D.hasClientLoader?N=!0:j.add(C.route.id))}),j.size===0)return[];let T=Kw(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return N&&j.size>0&&T.searchParams.set("_routes",s.filter(C=>j.has(C.route.id)).map(C=>C.route.id).join(",")),[T.pathname+T.search]},[p,c.unstable_trailingSlashAwareDataRequests,m,r,d,v,s,t,u]),k=y.useMemo(()=>Xw(x,d),[x,d]),S=iN(x);return y.createElement(y.Fragment,null,b.map(j=>y.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...o})),k.map(j=>y.createElement("link",{key:j,rel:"modulepreload",href:j,...o})),S.map(({key:j,link:N})=>y.createElement("link",{key:j,nonce:o.nonce,...N,crossOrigin:N.crossOrigin??o.crossOrigin})))}function rN(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var lN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{lN&&(window.__reactRouterVersion="7.13.2")}catch{}function cN({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=y.useRef();c.current==null&&(c.current=Uj({window:r,v5Compat:!0}));let d=c.current,[u,p]=y.useState({action:d.action,location:d.location}),m=y.useCallback(g=>{o===!1?p(g):y.startTransition(()=>p(g))},[o]);return y.useLayoutEffect(()=>d.listen(m),[d,m]),y.createElement(Lw,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var Gx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,jm=y.forwardRef(function({onClick:s,discover:o="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:p,state:m,target:g,to:v,preventScrollReset:x,viewTransition:b,unstable_defaultShouldRevalidate:k,...S},j){let{basename:N,navigator:T,unstable_useTransitions:C}=y.useContext(Ln),D=typeof v=="string"&&Gx.test(v),B=Ix(v,N);v=B.to;let E=xw(v,{relative:c}),A=Yt(),$=null;if(p){let ie=wd(p,[],A.unstable_mask?A.unstable_mask.pathname:"/",!0);N!=="/"&&(ie.pathname=ie.pathname==="/"?N:Es([N,ie.pathname])),$=T.createHref(ie)}let[L,U,J]=sN(r,S),V=pN(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:x,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:k,unstable_useTransitions:C});function K(ie){s&&s(ie),ie.defaultPrevented||V(ie)}let de=!(B.isExternal||d),ee=y.createElement("a",{...S,...J,href:(de?$:void 0)||B.absoluteURL||E,onClick:de?K:s,ref:rN(j,U),target:g,"data-discover":!D&&o==="render"?"true":void 0});return L&&!D?y.createElement(y.Fragment,null,ee,y.createElement(aN,{page:E})):ee});jm.displayName="Link";var dN=y.forwardRef(function({"aria-current":s="page",caseSensitive:o=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:p,children:m,...g},v){let x=pl(u,{relative:g.relative}),b=Yt(),k=y.useContext(Nd),{navigator:S,basename:j}=y.useContext(Ln),N=k!=null&&yN(x)&&p===!0,T=S.encodeLocation?S.encodeLocation(x).pathname:x.pathname,C=b.pathname,D=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;o||(C=C.toLowerCase(),D=D?D.toLowerCase():null,T=T.toLowerCase()),D&&j&&(D=aa(D,j)||D);const B=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let E=C===T||!c&&C.startsWith(T)&&C.charAt(B)==="/",A=D!=null&&(D===T||!c&&D.startsWith(T)&&D.charAt(T.length)==="/"),$={isActive:E,isPending:A,isTransitioning:N},L=E?s:void 0,U;typeof r=="function"?U=r($):U=[r,E?"active":null,A?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let J=typeof d=="function"?d($):d;return y.createElement(jm,{...g,"aria-current":L,className:U,ref:v,style:J,to:u,viewTransition:p},typeof m=="function"?m($):m)});dN.displayName="NavLink";var uN=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:o,reloadDocument:r,replace:c,state:d,method:u=Xc,action:p,onSubmit:m,relative:g,preventScrollReset:v,viewTransition:x,unstable_defaultShouldRevalidate:b,...k},S)=>{let{unstable_useTransitions:j}=y.useContext(Ln),N=gN(),T=vN(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",D=typeof p=="string"&&Gx.test(p),B=E=>{if(m&&m(E),E.defaultPrevented)return;E.preventDefault();let A=E.nativeEvent.submitter,$=(A==null?void 0:A.getAttribute("formmethod"))||u,L=()=>N(A||E.currentTarget,{fetcherKey:s,method:$,navigate:o,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:x,unstable_defaultShouldRevalidate:b});j&&o!==!1?y.startTransition(()=>L()):L()};return y.createElement("form",{ref:S,method:C,action:T,onSubmit:r?m:B,...k,"data-discover":!D&&t==="render"?"true":void 0})});uN.displayName="Form";function fN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Fx(t){let s=y.useContext(Uo);return _t(s,fN(t)),s}function pN(t,{target:s,replace:o,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=Cd(),x=Yt(),b=pl(t,{relative:u});return y.useCallback(k=>{if(Vw(k,s)){k.preventDefault();let S=o!==void 0?o:sl(x)===sl(b),j=()=>v(t,{replace:S,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m});g?y.startTransition(()=>j()):j()}},[x,v,b,o,r,c,s,t,d,u,p,m,g])}function wm(t){ns(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let s=y.useRef(Vp(t)),o=y.useRef(!1),r=Yt(),c=y.useMemo(()=>qw(r.search,o.current?null:s.current),[r.search]),d=Cd(),u=y.useCallback((p,m)=>{const g=Vp(typeof p=="function"?p(new URLSearchParams(c)):p);o.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var mN=0,hN=()=>`__${String(++mN)}__`;function gN(){let{router:t}=Fx("useSubmit"),{basename:s}=y.useContext(Ln),o=Rw(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:x}=Zw(d,s);if(u.navigate===!1){let b=u.fetcherKey||hN();await r(b,o,u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:x,formMethod:u.method||m,formEncType:u.encType||g,flushSync:u.flushSync})}else await c(u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:x,formMethod:u.method||m,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:o,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,o])}function vN(t,{relative:s}={}){let{basename:o}=y.useContext(Ln),r=y.useContext(ss);_t(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...pl(t||".",{relative:s})},u=Yt();if(t==null){d.search=u.search;let p=new URLSearchParams(d.search),m=p.getAll("index");if(m.some(v=>v==="")){p.delete("index"),m.filter(x=>x).forEach(x=>p.append("index",x));let v=p.toString();d.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:Es([o,d.pathname])),sl(d)}function yN(t,{relative:s}={}){let o=y.useContext(Bx);_t(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Fx("useViewTransitionState"),c=pl(t,{relative:s});if(!o.isTransitioning)return!1;let d=aa(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=aa(o.nextLocation.pathname,r)||o.nextLocation.pathname;return al(c.pathname,u)!=null||al(c.pathname,d)!=null}function mt(){const t=Cd();return y.useCallback((s,o)=>{typeof s=="number"?t(s):t(s,o)},[t])}function Nm(t){return`/sessions/${encodeURIComponent(t)}`}function Ei(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function On(t,s,o,r){const c=encodeURIComponent(t);let d;return o&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(o)}/tasks/${c}`:o?d=`/workspaces/${encodeURIComponent(o)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Ii(t,s,o){const r=new URLSearchParams;t&&r.set("workspace",t),s&&r.set("parent",s);const c=r.toString();if(t&&o){const d=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${d}?parent=${encodeURIComponent(s)}`:d}return c?`/tasks/new?${c}`:"/tasks/new"}function Zx(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const Ro="/environments",bN="/environments/new";function Ai(t){return`/environments/${encodeURIComponent(t)}`}function xN(t){return`/environments/${encodeURIComponent(t)}/edit`}const wi="/settings",_N="/settings/credentials",Qf="/settings/personas",kN="/settings/personas/new";function Kx(t){return`/settings/personas/${encodeURIComponent(t)}`}const ep="/settings/schedules",SN="/settings/schedules/new";function Yx(t){return`/settings/schedules/${encodeURIComponent(t)}`}const TN="/settings/shortcuts",jN="/pair",wN="/chat",Di="/",NN="/tasks",Jx="/workspaces/new",Wx="/knowledge",Ad="/findings";function CN(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:Ad}function qp(t,s,o){const r=encodeURIComponent(t);return s&&o?`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(s)}/findings/${r}`:`/findings/${r}`}const EN=jj,AN={task:Pj};function DN({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=mt(),d=y.useMemo(()=>o.filter(x=>x.workspaceId===t),[o,t]),{nodes:u,edges:p}=d2(d),m=y.useMemo(()=>{const x=getComputedStyle(document.documentElement),b={};for(const[k,S]of Object.entries(EN))b[k]=x.getPropertyValue(S).trim()||"#6b7a8d";return b},[r]),g=y.useCallback((x,b)=>{c(On(b.id,void 0,t,s))},[c,t,s]),v=y.useCallback(x=>{const b=x.data;return m[b.task.status]||m.pending},[m]);return d.length===0?i.jsxs("div",{className:yn.emptyCta,children:[i.jsx("button",{className:yn.ctaButton,onClick:()=>c(Ii(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:yn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):i.jsx("div",{className:yn.dagContainer,children:i.jsxs(bT,{nodes:u,edges:p,nodeTypes:AN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[i.jsx(xT,{variant:_T.Dots,gap:24,size:1,color:"var(--text-disabled)"}),i.jsx(kT,{showInteractive:!1}),i.jsx(ST,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const MN="_breadcrumbs_17or2_1",RN="_list_17or2_11",IN="_item_17or2_21",ON="_separator_17or2_28",BN="_link_17or2_34",LN="_current_17or2_57",jo={breadcrumbs:MN,list:RN,item:IN,separator:ON,link:BN,current:LN};function vs({segments:t}){return i.jsx("nav",{className:jo.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:i.jsx("ol",{className:jo.list,children:t.map((s,o)=>{const r=o===t.length-1;return i.jsxs("li",{className:jo.item,children:[o>0&&i.jsx("span",{className:jo.separator,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),s.url&&!r?i.jsx(jm,{className:jo.link,to:s.url,title:s.label,children:s.label}):i.jsx("span",{className:jo.current,"aria-current":"page",title:s.label,children:s.label})]},o)})})})}const zN="_btn_dwk2o_1",$N="_sm_dwk2o_22",PN="_md_dwk2o_28",UN="_lg_dwk2o_34",HN="_primary_dwk2o_40",VN="_danger_dwk2o_55",qN="_outline_dwk2o_70",GN="_ghost_dwk2o_80",tp={btn:zN,sm:$N,md:PN,lg:UN,primary:HN,danger:VN,outline:qN,ghost:GN},tn=y.forwardRef(function({variant:s="primary",size:o="md",className:r,children:c,...d},u){const p=[tp.btn,tp[s],tp[o],r].filter(Boolean).join(" ");return i.jsx("button",{ref:u,className:p,...d,children:c})}),FN="_copyButton_1bqk0_1",ZN={copyButton:FN},KN=2e3;function YN({text:t,className:s,"data-testid":o}){const[r,c]=y.useState(!1),d=y.useRef(void 0);y.useEffect(()=>()=>{d.current!==void 0&&clearTimeout(d.current)},[]);const u=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),c(!0),d.current!==void 0&&clearTimeout(d.current),d.current=setTimeout(()=>{c(!1),d.current=void 0},KN)}catch{}},[t]);return i.jsx("button",{type:"button",className:`${ZN.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":o??"copy-button",children:r?i.jsx(Mi,{size:nn,"aria-hidden":"true"}):i.jsx(Nx,{size:nn,"aria-hidden":"true"})})}const JN="_banner_bxqlh_1",WN="_label_bxqlh_15",XN="_text_bxqlh_25",QN="_link_bxqlh_29",zc={banner:JN,label:WN,text:XN,link:QN};function eC(){return i.jsxs("div",{className:zc.banner,"data-testid":"demo-banner",children:[i.jsx("span",{className:zc.label,children:"DEMO"}),i.jsxs("span",{className:zc.text,children:["This is an interactive demo with mock data."," ",i.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:zc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const tC="_container_og0yp_1",nC="_chevronButton_og0yp_6",sC="_mainButton_og0yp_6",aC="_sm_og0yp_34",iC="_md_og0yp_34",oC="_lg_og0yp_34",rC="_primary_og0yp_57",lC="_danger_og0yp_70",cC="_outline_og0yp_83",dC="_ghost_og0yp_92",uC="_dropdown_og0yp_100",fC="_option_og0yp_113",pC="_optionLabel_og0yp_130",mC="_optionDesc_og0yp_135",Xs={container:tC,chevronButton:nC,mainButton:sC,sm:aC,md:iC,lg:oC,primary:rC,danger:lC,outline:cC,ghost:dC,dropdown:uC,option:fC,optionLabel:pC,optionDesc:mC};function Xx({label:t,onClick:s,options:o,variant:r="primary",size:c="md","data-testid":d}){const[u,p]=y.useState(!1),m=y.useRef(null);y.useEffect(()=>{if(!u)return;function b(k){m.current&&k.target instanceof Node&&!m.current.contains(k.target)&&p(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[u]),y.useEffect(()=>{if(!u)return;function b(k){k.key==="Escape"&&p(!1)}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[u]);const g=Xs[r]||"",v=Xs[c]||"",x=()=>{u&&p(!1),s()};return i.jsxs("div",{ref:m,className:Xs.container,"data-testid":d,children:[i.jsx("button",{type:"button",className:`${Xs.mainButton} ${g} ${v}`,onClick:x,"data-testid":d?`${d}-main`:void 0,children:t}),i.jsx("button",{type:"button",className:`${Xs.chevronButton} ${g} ${v}`,onClick:()=>p(b=>!b),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:i.jsx(wx,{size:nn,"aria-hidden":"true"})}),u&&i.jsx("div",{className:Xs.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((b,k)=>i.jsxs("button",{type:"button",className:Xs.option,onClick:()=>{b.onClick(),p(!1)},children:[i.jsx("span",{className:Xs.optionLabel,children:b.label}),b.description&&i.jsx("span",{className:Xs.optionDesc,children:b.description})]},k))})]})}function Gp(){Gp=function(c,d){return new o(c,void 0,d)};var t=RegExp.prototype,s=new WeakMap;function o(c,d,u){var p=new RegExp(c,d);return s.set(p,u||s.get(c)),rd(p,o.prototype)}function r(c,d){var u=s.get(d);return Object.keys(u).reduce(function(p,m){var g=u[m];if(typeof g=="number")p[m]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;p[m]=c[g[v]]}return p},Object.create(null))}return(function(c,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(d&&d.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),d&&rd(c,d)})(o,RegExp),o.prototype.exec=function(c){var d=t.exec.call(this,c);if(d){d.groups=r(d,this);var u=d.indices;u&&(u.groups=r(u,this))}return d},o.prototype[Symbol.replace]=function(c,d){if(typeof d=="string"){var u=s.get(this);return t[Symbol.replace].call(this,c,d.replace(/\$<([^>]+)>/g,function(m,g){var v=u[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof d=="function"){var p=this;return t[Symbol.replace].call(this,c,function(){var m=arguments;return typeof m[m.length-1]!="object"&&(m=[].slice.call(m)).push(r(m,p)),d.apply(this,m)})}return t[Symbol.replace].call(this,c,d)},Gp.apply(this,arguments)}function rd(t,s){return rd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},rd(t,s)}function Ny(t,s){(s==null||s>t.length)&&(s=t.length);for(var o=0,r=new Array(s);o<s;o++)r[o]=t[o];return r}function np(t,s){var o=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(o)return(o=o.call(t)).next.bind(o);if(Array.isArray(t)||(o=(function(c,d){if(c){if(typeof c=="string")return Ny(c,d);var u=Object.prototype.toString.call(c).slice(8,-1);return u==="Object"&&c.constructor&&(u=c.constructor.name),u==="Map"||u==="Set"?Array.from(c):u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?Ny(c,d):void 0}})(t))||s){o&&(t=o);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
238
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var hC=(function(t){return function(s){return s===void 0&&(s={}),(function(r,c){if(c&&!r.registered(c))throw new Error('The default language "'+c+'" is not registered with refractor.')})(t,s.defaultLanguage),function(r){zT(r,"element",o)};function o(r,c,d){var u,p;if(d&&d.tagName==="pre"&&r.tagName==="code"){var m=(r==null||(u=r.data)==null?void 0:u.meta)||(r==null||(p=r.properties)==null?void 0:p.metastring)||"";r.properties.className?typeof r.properties.className=="boolean"?r.properties.className=[]:Array.isArray(r.properties.className)||(r.properties.className=[r.properties.className]):r.properties.className=[];var g,v,x=(function(E){for(var A,$=np(E.properties.className);!(A=$()).done;){var L=A.value;if(L.slice(0,9)==="language-")return L.slice(9).toLowerCase()}return null})(r);if(!x&&s.defaultLanguage&&r.properties.className.push("language-"+(x=s.defaultLanguage)),r.properties.className.push("code-highlight"),x)try{var b,k;k=(b=x)!=null&&b.includes("diff-")?x.split("-")[1]:x,g=t.highlight(Ic(r),k),d.properties.className=(d.properties.className||[]).concat("language-"+k)}catch(E){if(!s.ignoreMissing||!/Unknown language/.test(E.message))throw E;g=r}else g=r;g.children=(v=1,function E(A){return A.reduce(function($,L){if(L.type==="text"){var U=L.value,J=(U.match(/\n/g)||"").length;if(J===0)L.position={start:{line:v,column:1},end:{line:v,column:1}},$.push(L);else for(var V,K=U.split(`
239
- `),de=np(K.entries());!(V=de()).done;){var ee=V.value,ie=ee[0],M=ee[1];$.push({type:"text",value:ie===K.length-1?M:M+`
240
- `,position:{start:{line:v+ie,column:1},end:{line:v+ie,column:1}}})}return v+=J,$}if(Object.prototype.hasOwnProperty.call(L,"children")){var O=v;return L.children=E(L.children),$.push(L),L.position={start:{line:O,column:1},end:{line:v,column:1}},$}return $.push(L),$},[])})(g.children),g.position=g.children.length>0?{start:{line:g.children[0].position.start.line,column:0},end:{line:g.children[g.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var S,j=(function(E){var A=/{([\d,-]+)}/,$=E.split(",").map(function(J){return J.trim()}).join();if(A.test($)){var L=A.exec($)[1],U=PT(L);return function(J){return U.includes(J+1)}}return function(){return!1}})(m),N=(function(E){var A=Gp(/showLineNumbers=(\d+)/i,{lines:1});if(A.test(E)){var $=A.exec(E);return Number($.groups.lines)}return 1})(m),T=(function(E){for(var A=new Array(E),$=0;$<E;$++)A[$]={type:"element",tagName:"span",properties:{className:[]},children:[]};return A})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],D=function(){var E,A,$=S.value,L=$[0],U=$[1];U.properties.className=["code-line"];var J=UT(g,function(V){return V.position.start.line<=L+1&&V.position.end.line>=L+1});U.children=J.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(x))&&!C.some(function(V){return m.toLowerCase().includes(V)})&&(U.properties.line=[(L+N).toString()],U.properties.className.push("line-number")),j(L)&&U.properties.className.push("highlight-line"),(x==="diff"||(E=x)!=null&&E.includes("diff-"))&&Ic(U).substring(0,1)==="-"?U.properties.className.push("deleted"):(x==="diff"||(A=x)!=null&&A.includes("diff-"))&&Ic(U).substring(0,1)==="+"&&U.properties.className.push("inserted")},B=np(T.entries());!(S=B()).done;)D();T.length>0&&Ic(T[T.length-1]).trim()===""&&T.pop(),r.children=T}}}})($T);function Io(t){if(t>=1e6)return`${(t/1e6).toFixed(1)}M`;if(t>=1e3){const s=Number((t/1e3).toFixed(1));return s>=1e3?`${(t/1e6).toFixed(1)}M`:`${s.toFixed(1)}k`}return String(t)}function Cs(t){if(t===0)return"-";const s=t/1e5;if(s<.01){const o=t<5?5:4;return`$${s.toFixed(o)}`}return`$${s.toFixed(2)}`}const Cy=new Set(["grackle"]);function Ho(t){if(t.startsWith("mcp__")){const o=t.indexOf("__",5);if(o>5){const r=t.slice(5,o);if(Cy.has(r))return t.slice(o+2)}}const s=t.indexOf("-");if(s>0){const o=t.slice(0,s);if(Cy.has(o))return t.slice(s+1)}return t}const gC={read:"file-read",view:"file-read",edit:"file-edit",file_change:"file-edit",write:"file-write",bash:"shell",powershell:"shell",command_execution:"shell",grep:"search",glob:"search",todowrite:"todo",update_plan:"todo",todo_write:"todo",report_intent:"metadata",finding_post:"finding",finding_list:"finding",task_list:"task",task_create:"task",task_show:"task",task_update:"task",task_start:"task",task_complete:"task",task_resume:"task",task_delete:"task",workpad_write:"workpad",workpad_read:"workpad",knowledge_search:"knowledge",knowledge_get_node:"knowledge",knowledge_create_node:"knowledge",ipc_spawn:"ipc",ipc_write:"ipc",ipc_close:"ipc",ipc_list_fds:"ipc",ipc_terminate:"ipc",ipc_create_stream:"ipc",ipc_attach:"ipc",ipc_share_stream:"ipc",ipc_list_streams:"ipc",toolsearch:"tool-search",agent:"agent",task:"agent",read_agent:"agent"};function vC(t){const s=Ho(t);return gC[s.toLowerCase()]??"generic"}const yC="_card_qkm9i_2",bC="_cardBlue_qkm9i_20",xC="_cardOrange_qkm9i_24",_C="_cardGreen_qkm9i_28",kC="_cardPurple_qkm9i_32",SC="_cardNeutral_qkm9i_36",TC="_cardRed_qkm9i_40",jC="_cardTeal_qkm9i_44",wC="_header_qkm9i_48",NC="_icon_qkm9i_55",CC="_toolName_qkm9i_64",EC="_fileName_qkm9i_71",AC="_badge_qkm9i_80",DC="_spacer_qkm9i_87",MC="_bodyToggle_qkm9i_91",RC="_chevron_qkm9i_109",IC="_chevronExpanded_qkm9i_115",OC="_pre_qkm9i_119",BC="_diffAdd_qkm9i_143",LC="_diffRemove_qkm9i_155",zC="_diffContext_qkm9i_167",$C="_diffHeader_qkm9i_176",PC="_diffLine_qkm9i_182",UC="_exitOk_qkm9i_188",HC="_exitError_qkm9i_194",VC="_exitPending_qkm9i_200",qC="_inProgress_qkm9i_228",GC="_metadata_qkm9i_232",FC="_metadataPrefix_qkm9i_239",I={card:yC,cardBlue:bC,cardOrange:xC,cardGreen:_C,cardPurple:kC,cardNeutral:SC,cardRed:TC,cardTeal:jC,header:wC,icon:NC,toolName:CC,fileName:EC,badge:AC,spacer:DC,bodyToggle:MC,chevron:RC,chevronExpanded:IC,pre:OC,diffAdd:BC,diffRemove:LC,diffContext:zC,diffHeader:$C,diffLine:PC,exitOk:UC,exitError:HC,exitPending:VC,inProgress:qC,metadata:GC,metadataPrefix:FC};function ZC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.file_path=="string"?s.file_path:typeof s.path=="string"?s.path:""}function KC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const sp=5;function Ey({tool:t,args:s,result:o,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=ZC(s),m=KC(p),g=o===void 0,v=r?I.cardRed:c?I.cardGreen:I.cardBlue,x=c?"var(--accent-green)":"var(--accent-blue)",b=c?i.jsx(B2,{size:nn}):i.jsx(z2,{size:nn}),k=c?"tool-card-file-write":"tool-card-file-read",S=(o==null?void 0:o.split(`
241
- `))??[],j=S.length>sp,N=d?S:S.slice(0,sp);return i.jsxs("div",{className:`${I.card} ${v} ${g?I.inProgress:""}`,"data-testid":k,children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,children:b}),i.jsx("span",{className:I.toolName,style:{color:x},children:t}),m&&i.jsx("span",{className:I.fileName,title:p,children:m}),!g&&S.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,children:[S.length," lines"]})]})]}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&S.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:N.map((T,C)=>i.jsxs("span",{className:I.diffLine,children:[i.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),T]},C))}),j&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(T=>!T)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${d?I.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),d?"collapse":`${S.length-sp} more lines`]})]})]})}function YC(t){const s=t.split(`
242
- `),o=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?o.push({type:"header",content:r}):r.startsWith("+")?o.push({type:"add",content:r.slice(1)}):r.startsWith("-")?o.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?o.push({type:"context",content:r.slice(1)}):r===""&&o.push({type:"context",content:""}));return o}function JC(t,s){const o=t.split(`
243
- `),r=s.split(`
244
- `),c=[];for(const d of o)c.push({type:"remove",content:d});for(const d of r)c.push({type:"add",content:d});return c}function WC(t){let s=0,o=0;for(const r of t)r.type==="add"&&s++,r.type==="remove"&&o++;return{added:s,removed:o}}function XC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.file_path=="string"&&s.file_path||typeof s.path=="string"&&s.path||""}function QC(t){if(t===void 0||typeof t!="object"||t===null)return;const s=t,o=(typeof s.old_string=="string"?s.old_string:void 0)??(typeof s.old_str=="string"?s.old_str:void 0),r=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(o!==void 0&&r!==void 0)return{oldStr:o,newStr:r}}function eE(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function tE(t,s){if(s){let r=s;if(s.trimStart().startsWith("{"))try{const c=JSON.parse(s);typeof c.detailedContent=="string"&&(r=c.detailedContent)}catch{}if(r.includes("@@")||r.startsWith("diff ")){const c=YC(r);if(c.length>0)return c}}const o=QC(t);if(o)return JC(o.oldStr,o.newStr)}const ap=5;function nE({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=XC(s),m=eE(p),g=o===void 0,v=tE(s,c),x=v?WC(v):null,b=((v==null?void 0:v.length)??0)>ap,k=d?v:v==null?void 0:v.slice(0,ap);return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardOrange} ${g?I.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,children:i.jsx(cj,{size:nn})}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&i.jsx("span",{className:I.fileName,title:p,children:m}),x&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-diff-stats",children:[i.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",x.added]})," ",i.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",x.removed]})]})]})]}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&k&&k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-diff",children:k.map((S,j)=>{let N=I.diffContext;return S.type==="add"&&(N=I.diffAdd),S.type==="remove"&&(N=I.diffRemove),S.type==="header"&&(N=I.diffHeader),i.jsx("span",{className:`${I.diffLine} ${N}`,children:S.content},j)})}),b&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${d?I.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),d?"collapse":`${((v==null?void 0:v.length)??0)-ap} more lines`]})]}),!r&&!v&&!g&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:o})]})}const sE=/^\[exit (\d+)\]\s*/;function aE(t){const s=sE.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function iE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function oE(t){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'([^']*)'\s*$/i.exec(t);if(s)return s[1];const o=/pwsh(?:\.exe)?["']?\s+-Command\s+"([^"]*)"\s*$/i.exec(t);return o?o[1]:t}const ip=3;function rE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=iE(s),p=oE(u),m=o===void 0,g=o?aE(o):null,v=(g==null?void 0:g.output.split(`
245
- `))??[],x=v.length>ip,b=c?v:v.slice(0,ip),k=g==null?void 0:g.exitCode,S=r||k!==void 0&&k!==0;return i.jsxs("div",{className:`${I.card} ${S?I.cardRed:I.cardNeutral}`,"data-testid":"tool-card-shell",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),i.jsx("span",{className:I.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==p?u:void 0,"data-testid":"tool-card-command",children:p}),k!==void 0&&i.jsxs("span",{className:k===0?I.exitOk:I.exitError,"data-testid":"tool-card-exit-code",children:[k===0?i.jsx(Mi,{size:dt,"aria-hidden":"true"}):i.jsx(Za,{size:dt,"aria-hidden":"true"})," ","exit ",k]}),m&&i.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:i.jsx(W2,{size:dt,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-output",children:b.join(`
246
- `)}),x&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),c?"collapse":`${v.length-ip} more lines`]})]})]})}function lE(t){if(t==null||typeof t!="object")return{pattern:"",path:""};const s=t,o=typeof s.pattern=="string"?s.pattern:"",r=typeof s.path=="string"?s.path:"";return{pattern:o,path:r}}const op=5;function cE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=lE(s),m=o===void 0,g=(o==null?void 0:o.split(`
247
- `).filter(b=>b.length>0))??[],v=g.length>op,x=c?g:g.slice(0,op);return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${m?I.inProgress:""}`,"data-testid":"tool-card-search",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,children:i.jsx(Cx,{size:nn})}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&i.jsxs("span",{className:I.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&i.jsxs("span",{className:I.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!m&&!r&&g.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&x.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-results",children:x.join(`
248
- `)}),v&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),c?"collapse":`${g.length-op} more matches`]})]})]})}const dE="_progressBar_14f5c_1",uE="_progressFill_14f5c_9",fE="_activeTask_14f5c_16",pE="_activeIcon_14f5c_27",mE="_todoPulse_14f5c_1",hE="_activeText_14f5c_34",gE="_checklist_14f5c_48",vE="_item_14f5c_55",yE="_itemIcon_14f5c_65",bE="_itemText_14f5c_73",xE="_pending_14f5c_78",_E="_in_progress_14f5c_85",kE="_completed_14f5c_97",SE="_emptyMessage_14f5c_108",cs={progressBar:dE,progressFill:uE,activeTask:fE,activeIcon:pE,todoPulse:mE,activeText:hE,checklist:gE,item:vE,itemIcon:yE,itemText:bE,pending:xE,in_progress:_E,completed:kE,emptyMessage:SE},TE=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function jE(t){if(t===void 0||typeof t!="object"||t===null)return[];const s=t;return Array.isArray(s.todos)?s.todos.filter(o=>typeof o=="object"&&o!==null&&typeof o.content=="string"&&typeof o.status=="string").map(o=>({content:o.content,activeForm:typeof o.activeForm=="string"?o.activeForm:void 0,status:Ay(o.status)})):Array.isArray(s.plan)?s.plan.filter(o=>typeof o=="object"&&o!==null&&typeof o.step=="string"&&typeof o.status=="string").map(o=>({content:o.step,status:Ay(o.status)})):typeof s.content=="string"?wE(s.content):[]}function Ay(t){switch(t.toLowerCase()){case"completed":case"done":case"complete":return"completed";case"in_progress":case"in-progress":case"working":case"active":return"in_progress";default:return"pending"}}function wE(t){const s=t.split(`
249
- `),o=[];for(const r of s){const c=TE.exec(r.trim());if(c){const d=c[1],u=c[2].trim();let p="pending";d==="x"||d==="X"?p="completed":(d==="~"||d==="/"||d==="!")&&(p="in_progress"),o.push({content:u,status:p})}}return o}function NE(t){switch(t){case"completed":return i.jsx(Mi,{size:dt});case"in_progress":return i.jsx(Va,{size:dt,fill:"currentColor"});default:return i.jsx(Va,{size:dt})}}function CE({args:t}){const s=jE(t),o=s.filter(d=>d.status==="completed").length,r=s.find(d=>d.status==="in_progress"),c=s.length===0;return i.jsxs("div",{className:`${I.card} ${I.cardBlue}`,"data-testid":"tool-card-todo",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,children:i.jsx(Z2,{size:nn})}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-todo-progress",children:[o,"/",s.length]})]})]}),!c&&i.jsx("div",{className:cs.progressBar,"data-testid":"tool-card-todo-bar",children:i.jsx("div",{className:cs.progressFill,style:{width:`${o/s.length*100}%`}})}),r&&i.jsxs("div",{className:cs.activeTask,"data-testid":"tool-card-todo-active",children:[i.jsx("span",{className:cs.activeIcon,children:i.jsx(Va,{size:dt,fill:"currentColor"})}),i.jsx("span",{className:cs.activeText,children:r.activeForm||r.content})]}),!c&&i.jsx("div",{className:cs.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>i.jsxs("div",{className:`${cs.item} ${cs[d.status]}`,"data-testid":"tool-card-todo-item",children:[i.jsx("span",{className:cs.itemIcon,children:NE(d.status)}),i.jsx("span",{className:cs.itemText,children:d.content})]},u))}),c&&i.jsx("div",{className:cs.emptyMessage,children:"All items completed and cleared."})]})}function EE(t,s){if(s==null||typeof s!="object")return"";const o=s;if(typeof o.intent=="string")return o.intent;for(const r of Object.values(o))if(typeof r=="string")return r;return t}function AE({tool:t,args:s}){const o=EE(t,s);return i.jsxs("div",{className:I.metadata,"data-testid":"tool-card-metadata",children:[i.jsx("span",{className:I.metadataPrefix,children:i.jsx(I2,{size:dt})}),o]})}function DE(t){if(t==null||typeof t!="object")return{};const s=t;return{title:typeof s.title=="string"?s.title:void 0,category:typeof s.category=="string"?s.category:void 0,tags:Array.isArray(s.tags)?s.tags:void 0}}function ME(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(o=>o!==null&&typeof o=="object")};if(typeof s=="object"&&s!==null)return{single:s}}catch{}return{}}const rp=5,lp=5;function RE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Ho(t),p=DE(s),m=o===void 0,{single:g,list:v}=ME(o),x=(g==null?void 0:g.title)??p.title,b=v?void 0:(g==null?void 0:g.category)??p.category,k=v?void 0:(g==null?void 0:g.tags)??p.tags;return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${m?I.inProgress:""}`,"data-testid":"tool-card-finding",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"💡"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),x&&i.jsxs("span",{className:I.fileName,"data-testid":"tool-card-finding-title",children:['"',x,'"']}),b&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsx("span",{className:I.badge,"data-testid":"tool-card-finding-category",children:b})]}),v&&!b&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]})]}),k&&k.length>0&&i.jsx("div",{className:I.pre,style:{padding:"4px 8px",whiteSpace:"normal"},"data-testid":"tool-card-finding-tags",children:k.map((S,j)=>i.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",S]},j))}),m&&!x&&s!==null&&s!==void 0&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&(g==null?void 0:g.content)&&i.jsx(i.Fragment,{children:(()=>{const S=g.content.split(`
250
- `),j=S.length>lp,N=c?g.content:S.slice(0,lp).join(`
251
- `);return i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-finding-content",children:N}),j&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${S.length-lp} more lines`]})]})})()}),!r&&v&&v.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-finding-list",children:(c?v:v.slice(0,rp)).map((S,j)=>`${S.category?`[${S.category}] `:""}${S.title??S.id??`Finding ${j+1}`}`).join(`
252
- `)}),v.length>rp&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-rp} more findings`]})]})]})}function IE(t){if(t==null||typeof t!="object")return{};const s=t;return{taskId:typeof s.taskId=="string"?s.taskId:void 0,title:typeof s.title=="string"?s.title:void 0,status:typeof s.status=="string"?s.status:void 0}}function OE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(o=>o!==null&&typeof o=="object")};if(typeof s=="object"&&s!==null){const o=s;return typeof o.sessionId=="string"?{sessionId:o.sessionId,single:o}:{single:o}}}catch{}return{}}function Dy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function BE(t){switch(t){case"complete":case"completed":return"var(--accent-green, #4ade80)";case"working":case"in_progress":return"var(--accent-blue, #60a5fa)";case"failed":return"var(--accent-red, #f87171)";case"paused":return"var(--text-tertiary, #888)";default:return"var(--text-secondary, #aaa)"}}const cp=5;function LE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Ho(t),p=IE(s),m=o===void 0,{single:g,list:v,sessionId:x}=OE(o),b=(g==null?void 0:g.title)??p.title,k=(g==null?void 0:g.status)??p.status;return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardBlue} ${m?I.inProgress:""}`,"data-testid":"tool-card-task",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"📋"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:u}),b&&i.jsxs("span",{className:I.fileName,"data-testid":"tool-card-task-title",children:['"',b,'"']}),!b&&p.taskId&&i.jsx("span",{className:I.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),k&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,style:{color:BE(k)},"data-testid":"tool-card-task-status",children:[Dy(k)," ",k]})]}),v&&!k&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),m&&!b&&!p.taskId&&s!==null&&s!==void 0&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&x&&i.jsxs("div",{className:I.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",x]}),!r&&g&&!v&&!x&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-task-detail",children:[g.id?`id: ${g.id}`:null,g.status?`status: ${g.status}`:null,g.branch?`branch: ${g.branch}`:null,g.latestSessionId?`session: ${g.latestSessionId}`:null].filter(Boolean).join(`
253
- `)}),!r&&v&&v.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,cp)).map(S=>{const j=Dy(S.status),N=S.title??S.id??"untitled";return`${j} ${N}`}).join(`
254
- `)}),v.length>cp&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-cp} more tasks`]})]})]})}function zE(t){if(t==null||typeof t!="object")return{};const s=t;return{status:typeof s.status=="string"?s.status:void 0,summary:typeof s.summary=="string"?s.summary:void 0}}function $E(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s,r=typeof o.workpad=="object"&&o.workpad!==null?o.workpad:o;return{status:typeof r.status=="string"?r.status:void 0,summary:typeof r.summary=="string"?r.summary:void 0,extra:typeof r.extra=="object"&&r.extra!==null?r.extra:void 0}}catch{}return{}}function PE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Ho(t),p=zE(s),m=o===void 0,g=$E(o),v=g.status??p.status,x=g.summary??p.summary;return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardGreen} ${m?I.inProgress:""}`,"data-testid":"tool-card-workpad",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"📓"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsx("span",{className:I.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),x&&i.jsx("pre",{className:I.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:x}),m&&!x&&s!==null&&s!==void 0&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&!x&&!v&&!g.extra&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:o}),!r&&g.extra&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function UE(t){if(t==null||typeof t!="object")return{};const s=t;return{query:typeof s.query=="string"?s.query:void 0,id:typeof s.id=="string"?s.id:void 0}}function HE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s;if(Array.isArray(o.results))return{results:o.results.filter(r=>r!==null&&typeof r=="object")};if(typeof o.node=="object"&&o.node!==null){const r=Array.isArray(o.edges)?o.edges.length:0;return{node:o.node,edgeCount:r}}if(typeof o.id=="string")return{node:o}}catch{}return{}}const dp=5;function VE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Ho(t),p=UE(s),m=o===void 0,g=HE(o);return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${m?I.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🧠"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&i.jsxs("span",{className:I.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&i.jsx("span",{className:I.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-knowledge-count",children:[g.results.length," ",g.results.length===1?"result":"results"]})]}),g.node&&g.edgeCount!==void 0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-knowledge-edges",children:[g.edgeCount," ",g.edgeCount===1?"edge":"edges"]})]})]}),m&&s!==null&&s!==void 0&&!p.query&&!p.id&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&g.results&&g.results.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,dp)).map(v=>{var k,S,j;const x=((k=v.node)==null?void 0:k.title)??((S=v.node)==null?void 0:S.label)??((j=v.node)==null?void 0:j.id)??"node",b=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${x}${b}`}).join(`
255
- `)}),g.results.length>dp&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-dp} more results`]})]}),!r&&g.node&&!g.results&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-knowledge-node",children:[g.node.id?`id: ${g.node.id}`:null,g.node.title?`title: ${g.node.title}`:null,g.node.category?`category: ${g.node.category}`:null,g.node.kind?`kind: ${g.node.kind}`:null,g.node.content?`content: ${g.node.content.length>100?g.node.content.slice(0,100)+"...":g.node.content}`:null].filter(Boolean).join(`
256
- `)})]})}function qE(t){if(t==null||typeof t!="object")return{};const s=t;return{fd:typeof s.fd=="number"?s.fd:void 0,pipe:typeof s.pipe=="string"?s.pipe:void 0,prompt:typeof s.prompt=="string"?s.prompt:void 0,name:typeof s.name=="string"?s.name:void 0,message:typeof s.message=="string"?s.message:void 0}}function GE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s;return{sessionId:typeof o.sessionId=="string"?o.sessionId:void 0,fd:typeof o.fd=="number"?o.fd:void 0,fds:Array.isArray(o.fds)?o.fds.filter(r=>r!==null&&typeof r=="object"):void 0,success:typeof o.success=="boolean"?o.success:void 0,output:typeof o.output=="string"?o.output:void 0}}catch{}return{}}function FE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Ho(t),p=qE(s),m=o===void 0,g=GE(o);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const x=p.prompt?p.prompt.length>60?`${p.prompt.slice(0,60)}...`:p.prompt:void 0;return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardOrange} ${m?I.inProgress:""}`,"data-testid":"tool-card-ipc",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🔀"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&i.jsx("span",{className:I.fileName,"data-testid":"tool-card-ipc-info",children:v}),x&&i.jsx("span",{className:I.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:x}),g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-ipc-fd-count",children:[g.fds.length," ",g.fds.length===1?"fd":"fds"]})]}),g.success!==void 0&&!g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsx("span",{className:I.badge,style:{color:g.success?"var(--accent-green, #4ade80)":"var(--accent-red, #f87171)"},"data-testid":"tool-card-ipc-success",children:g.success?"✓ ok":"✗ failed"})]})]}),m&&!x&&!v&&s!==null&&s!==void 0&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&g.sessionId&&i.jsxs("div",{className:I.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-ipc-session",children:["session: ",g.sessionId,g.fd!==void 0&&` | fd: ${g.fd}`]}),!r&&g.output&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(b=>{const k=[`fd:${b.fd??"?"}`,b.permission??"",b.deliveryMode??""];return b.streamName&&k.push(b.streamName),b.owned&&k.push("(owned)"),k.filter(Boolean).join(" ")}).join(`
257
- `)}),g.fds.length>5&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function ZE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const up=8;function KE({args:t,result:s,isError:o}){const[r,c]=y.useState(!1),d=ZE(t),u=s===void 0,p=(s==null?void 0:s.split(`
258
- `))??[],m=p.length>up,g=r?s:p.slice(0,up).join(`
259
- `);return i.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardNeutral} ${u?I.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🔧"}),i.jsx("span",{className:I.toolName,children:"ToolSearch"}),d&&i.jsxs("span",{className:I.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!o&&s&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),o&&s&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:s}),!o&&!u&&s&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${r?I.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-up} more lines`]})]})]})}function YE(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function JE(t){if(t==null)return"";if(typeof t!="object")return String(t);const s=t;if(typeof s.command=="string")return s.command;if(typeof s.file_path=="string")return s.file_path;if(typeof s.path=="string")return s.path;if(typeof s.query=="string")return s.query;if(typeof s.url=="string")return s.url;try{const o=JSON.stringify(t);return o.length>120?`${o.slice(0,120)}…`:o}catch{return""}}const fp=5;function WE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{display:u}=YE(t),p=JE(s),m=o===void 0,g=(o==null?void 0:o.split(`
260
- `))??[],v=g.length>fp,x=c?o:g.slice(0,fp).join(`
261
- `);let b="";if(s!=null)try{b=JSON.stringify(s,null,2)}catch{b=String(s)}return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardBlue} ${m?I.inProgress:""}`,"data-testid":"tool-card-generic",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,children:i.jsx(A2,{size:nn,"aria-hidden":"true"})}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&i.jsx("span",{className:I.fileName,children:p})]}),m&&b&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:b}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:x}),v&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),c?"collapse":`${g.length-fp} more lines`]})]})]})}const XE="_badgePill_o7eqc_1",QE="_modelBadge_o7eqc_14",eA="_backgroundBadge_o7eqc_26",tA="_backgroundDot_o7eqc_36",nA="_backgroundDotPulsing_o7eqc_41",sA="_description_o7eqc_55",aA="_statusLine_o7eqc_62",iA="_statusCompleted_o7eqc_72",oA="_statusRunning_o7eqc_77",rA="_statusError_o7eqc_83",lA="_promptToggle_o7eqc_88",ds={badgePill:XE,modelBadge:QE,backgroundBadge:eA,backgroundDot:tA,backgroundDotPulsing:nA,description:sA,statusLine:aA,statusCompleted:iA,statusRunning:oA,statusError:rA,promptToggle:lA};function cA(t,s){if(s==null||typeof s!="object")return{};const o=s;return t.toLowerCase()==="read_agent"?{agentId:typeof o.agent_id=="string"?o.agent_id:void 0,isPoll:!0}:typeof o.agent_type=="string"||typeof o.name=="string"?{agentType:typeof o.agent_type=="string"?o.agent_type:void 0,description:typeof o.description=="string"?o.description:void 0,prompt:typeof o.prompt=="string"?o.prompt:void 0,isBackground:o.mode==="background",agentName:typeof o.name=="string"?o.name:void 0}:{agentType:typeof o.subagent_type=="string"?o.subagent_type:void 0,description:typeof o.description=="string"?o.description:void 0,prompt:typeof o.prompt=="string"?o.prompt:void 0,isBackground:o.run_in_background===!0,model:typeof o.model=="string"?o.model:void 0,isResume:typeof o.resume=="string"&&o.resume.length>0}}const dA=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function uA(t){const s=dA.exec(t);if(!s)return;const o=s[4];return{status:s[1].toLowerCase(),agentId:s[2].replace(/,$/,""),metadata:s[3].trim(),content:o?o.trim():void 0}}const pp=5;function fA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),m=cA(t,s),g=o===void 0,v=m.isPoll&&o?uA(o):void 0,x=(v==null?void 0:v.content)??o,b=(x==null?void 0:x.split(`
262
- `))??[],k=b.length>pp,S=c?x:b.slice(0,pp).join(`
263
- `),j=m.isPoll?"Subagent":"Agent";return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardTeal} ${g?I.inProgress:""}`,"data-testid":"tool-card-agent",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:j}),m.agentType&&i.jsx("span",{className:ds.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&i.jsx("span",{className:ds.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&i.jsxs("span",{className:ds.backgroundBadge,"data-testid":"tool-card-agent-background",children:[i.jsx("span",{className:g?ds.backgroundDotPulsing:ds.backgroundDot,children:"●"}),"BG"]}),m.agentName&&i.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&i.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),i.jsx("span",{className:I.spacer}),g&&!m.isBackground&&i.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&i.jsx("div",{className:ds.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&i.jsxs("div",{className:ds.statusLine,"data-testid":"tool-card-agent-status",children:[i.jsx("span",{className:v.status==="completed"?ds.statusCompleted:v.status==="running"?ds.statusRunning:ds.statusError,children:v.status}),v.metadata&&i.jsx("span",{children:v.metadata})]}),m.prompt&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:ds.promptToggle,onClick:()=>{p(N=>!N)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[i.jsx("span",{className:`${I.chevron} ${u?I.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&x&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:S}),k&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${b.length-pp} more lines`]})]})]})}function mp(t){switch(vC(t.tool)){case"file-read":return i.jsx(Ey,{...t});case"file-edit":return i.jsx(nE,{...t});case"file-write":return i.jsx(Ey,{...t,writeVariant:!0});case"shell":return i.jsx(rE,{...t});case"search":return i.jsx(cE,{...t});case"todo":return i.jsx(CE,{...t});case"metadata":return i.jsx(AE,{...t});case"finding":return i.jsx(RE,{...t});case"task":return i.jsx(LE,{...t});case"workpad":return i.jsx(PE,{...t});case"knowledge":return i.jsx(VE,{...t});case"ipc":return i.jsx(FE,{...t});case"tool-search":return i.jsx(KE,{...t});case"agent":return i.jsx(fA,{...t});default:return i.jsx(WE,{...t})}}const pA="_systemContextEvent_hmqlm_1",mA="_systemContextHeader_hmqlm_7",hA="_systemContextBadge_hmqlm_28",gA="_systemContextToggle_hmqlm_37",vA="_systemContextPre_hmqlm_43",yA="_systemContextEllipsis_hmqlm_54",bA="_systemEvent_hmqlm_58",xA="_systemTimestamp_hmqlm_65",_A="_textEvent_hmqlm_69",kA="_codeBlockWrapper_hmqlm_156",SA="_codeBlockCopyButton_hmqlm_159",TA="_errorEvent_hmqlm_163",jA="_statusEvent_hmqlm_171",wA="_userInputEvent_hmqlm_180",NA="_userInputContent_hmqlm_186",CA="_signalEvent_hmqlm_203",EA="_signalBadge_hmqlm_214",AA="_signalContent_hmqlm_223",DA="_usageEvent_hmqlm_228",MA="_usageBadge_hmqlm_235",RA="_defaultEvent_hmqlm_244",Pt={systemContextEvent:pA,systemContextHeader:mA,systemContextBadge:hA,systemContextToggle:gA,systemContextPre:vA,systemContextEllipsis:yA,systemEvent:bA,systemTimestamp:xA,textEvent:_A,codeBlockWrapper:kA,codeBlockCopyButton:SA,errorEvent:TA,statusEvent:jA,userInputEvent:wA,userInputContent:NA,signalEvent:CA,signalBadge:EA,signalContent:AA,usageEvent:DA,usageBadge:MA,defaultEvent:RA},My=3;function IA({content:t}){const[s,o]=y.useState(!1),r=t.split(`
264
- `),c=r.length>My,d=s?t:r.slice(0,My).join(`
265
- `);return i.jsxs("div",{className:Pt.systemContextEvent,"data-testid":"system-context-event",children:[i.jsxs("button",{type:"button",className:Pt.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[i.jsx("span",{className:Pt.systemContextBadge,children:"SYSTEM PROMPT"}),c&&i.jsx("span",{className:Pt.systemContextToggle,"aria-hidden":"true",children:s?i.jsx(wx,{size:dt}):i.jsx(la,{size:dt})})]}),i.jsxs("pre",{className:Pt.systemContextPre,children:[d,!s&&c&&i.jsx("span",{className:Pt.systemContextEllipsis,children:"…"})]})]})}function OA({time:t,content:s}){return i.jsxs("div",{className:Pt.systemEvent,children:[i.jsxs("span",{className:Pt.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Fp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Fp).join(""):t!=null&&typeof t=="object"&&"props"in t?Fp(t.props.children):""}function BA({children:t,node:s,...o}){const r=Fp(t);return i.jsxs("div",{className:Pt.codeBlockWrapper,children:[i.jsx("pre",{...o,children:t}),i.jsx(YN,{text:r,"data-testid":"copy-code-block",className:Pt.codeBlockCopyButton})]})}const LA={pre:BA};function zA({content:t}){return i.jsx("div",{className:Pt.textEvent,children:i.jsx(Sd,{remarkPlugins:[Td],rehypePlugins:[hC],components:LA,children:t})})}function $A({content:t}){return i.jsxs("div",{className:Pt.errorEvent,children:["Error: ",t]})}function PA({content:t}){return i.jsxs("div",{className:Pt.statusEvent,children:["--- ",t," ---"]})}function UA({content:t}){return i.jsx("div",{className:Pt.userInputEvent,children:i.jsx("span",{className:Pt.userInputContent,children:t})})}function HA({content:t}){return i.jsxs("div",{className:Pt.signalEvent,"data-testid":"signal-event",children:[i.jsx("span",{className:Pt.signalBadge,children:"SIGNAL"}),i.jsx("span",{className:Pt.signalContent,children:t})]})}function VA({content:t}){let s=t;try{const o=JSON.parse(t),r=Number(o.input_tokens)||0,c=Number(o.output_tokens)||0,d=Io(r+c),u=Cs(Number(o.cost_millicents)||0);s=`${d} tokens · ${u}`}catch{}return i.jsx("div",{className:Pt.usageEvent,"data-testid":"usage-event",children:i.jsx("span",{className:Pt.usageBadge,children:s})})}function qA({content:t}){return i.jsx("div",{className:Pt.defaultEvent,children:t})}function GA({event:t,toolUseCtx:s,settled:o}){const r=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return i.jsx(IA,{content:t.content})}catch{}return i.jsx(OA,{time:r,content:t.content})}case"text":case"output":return i.jsx(zA,{content:t.content});case"tool_use":{let c="",d={};try{const u=JSON.parse(t.content);c=u.tool||"",d=u.args}catch{}return i.jsx(mp,{tool:c,args:d,result:o?"":void 0})}case"tool_result":{let c=!1;if(t.raw)try{c=JSON.parse(t.raw).is_error===!0}catch{}let d=t.content;if(t.content.trimStart().startsWith("{"))try{const u=JSON.parse(t.content);typeof u.content=="string"&&(d=u.content)}catch{}return s?i.jsx(mp,{tool:s.tool,args:s.args,result:d,isError:c,detailedResult:s.detailedResult}):i.jsx(mp,{tool:"Tool output",args:void 0,result:d,isError:c})}case"error":return i.jsx($A,{content:t.content});case"status":return i.jsx(PA,{content:t.content});case"user_input":return i.jsx(UA,{content:t.content});case"signal":return i.jsx(HA,{content:t.content});case"usage":return i.jsx(VA,{content:t.content});default:return i.jsx(qA,{content:t.content})}}const Cm=y.createContext({});function Em(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const Dd=y.createContext(null),Am=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class FA extends y.Component{getSnapshotBeforeUpdate(s){const o=this.props.childRef.current;if(o&&s.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=o.offsetHeight||0,r.width=o.offsetWidth||0,r.top=o.offsetTop,r.left=o.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function ZA({children:t,isPresent:s}){const o=y.useId(),r=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0}),{nonce:d}=y.useContext(Am);return y.useInsertionEffect(()=>{const{width:u,height:p,top:m,left:g}=c.current;if(s||!r.current||!u||!p)return;r.current.dataset.motionPopId=o;const v=document.createElement("style");return d&&(v.nonce=d),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
266
- [data-motion-pop-id="${o}"] {
267
- position: absolute !important;
268
- width: ${u}px !important;
269
- height: ${p}px !important;
270
- top: ${m}px !important;
271
- left: ${g}px !important;
272
- }
273
- `),()=>{document.head.removeChild(v)}},[s]),i.jsx(FA,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const KA=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=Em(YA),m=y.useId(),g=y.useCallback(x=>{p.set(x,!0);for(const b of p.values())if(!b)return;r&&r()},[p,r]),v=y.useMemo(()=>({id:m,initial:s,isPresent:o,custom:c,onExitComplete:g,register:x=>(p.set(x,!1),()=>p.delete(x))}),d?[Math.random(),g]:[o,g]);return y.useMemo(()=>{p.forEach((x,b)=>p.set(b,!1))},[o]),y.useEffect(()=>{!o&&!p.size&&r&&r()},[o]),u==="popLayout"&&(t=i.jsx(ZA,{isPresent:o,children:t})),i.jsx(Dd.Provider,{value:v,children:t})};function YA(){return new Map}function Qx(t=!0){const s=y.useContext(Dd);if(s===null)return[!0,null];const{isPresent:o,onExitComplete:r,register:c}=s,d=y.useId();y.useEffect(()=>{t&&c(d)},[t]);const u=y.useCallback(()=>t&&r&&r(d),[d,r,t]);return!o&&r?[!1,u]:[!0]}const $c=t=>t.key||"";function Ry(t){const s=[];return y.Children.forEach(t,o=>{y.isValidElement(o)&&s.push(o)}),s}const Dm=typeof window<"u",e_=Dm?y.useLayoutEffect:y.useEffect,gs=({children:t,custom:s,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=Qx(u),g=y.useMemo(()=>Ry(t),[t]),v=u&&!p?[]:g.map($c),x=y.useRef(!0),b=y.useRef(g),k=Em(()=>new Map),[S,j]=y.useState(g),[N,T]=y.useState(g);e_(()=>{x.current=!1,b.current=g;for(let B=0;B<N.length;B++){const E=$c(N[B]);v.includes(E)?k.delete(E):k.get(E)!==!0&&k.set(E,!1)}},[N,v.length,v.join("-")]);const C=[];if(g!==S){let B=[...g];for(let E=0;E<N.length;E++){const A=N[E],$=$c(A);v.includes($)||(B.splice(E,0,A),C.push(A))}d==="wait"&&C.length&&(B=C),T(Ry(B)),j(g);return}const{forceRender:D}=y.useContext(Cm);return i.jsx(i.Fragment,{children:N.map(B=>{const E=$c(B),A=u&&!p?!1:g===N||v.includes(E),$=()=>{if(k.has(E))k.set(E,!0);else return;let L=!0;k.forEach(U=>{U||(L=!1)}),L&&(D==null||D(),T(b.current),u&&(m==null||m()),r&&r())};return i.jsx(KA,{isPresent:A,initial:!x.current||o?void 0:!1,custom:A?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:A?void 0:$,children:B},E)})})},In=t=>t;let t_=In;const JA={useManualTiming:!1};function WA(t){let s=new Set,o=new Set,r=!1,c=!1;const d=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function p(g){d.has(g)&&(m.schedule(g),t()),g(u)}const m={schedule:(g,v=!1,x=!1)=>{const k=x&&r?s:o;return v&&d.add(g),k.has(g)||k.add(g),g},cancel:g=>{o.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,o]=[o,s],s.forEach(p),s.clear(),r=!1,c&&(c=!1,m.process(g))}};return m}const Pc=["read","resolveKeyframes","update","preRender","render","postRender"],XA=40;function n_(t,s){let o=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>o=!0,u=Pc.reduce((T,C)=>(T[C]=WA(d),T),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:x,postRender:b}=u,k=()=>{const T=performance.now();o=!1,c.delta=r?1e3/60:Math.max(Math.min(T-c.timestamp,XA),1),c.timestamp=T,c.isProcessing=!0,p.process(c),m.process(c),g.process(c),v.process(c),x.process(c),b.process(c),c.isProcessing=!1,o&&s&&(r=!1,t(k))},S=()=>{o=!0,r=!0,c.isProcessing||t(k)};return{schedule:Pc.reduce((T,C)=>{const D=u[C];return T[C]=(B,E=!1,A=!1)=>(o||S(),D.schedule(B,E,A)),T},{}),cancel:T=>{for(let C=0;C<Pc.length;C++)u[Pc[C]].cancel(T)},state:c,steps:u}}const{schedule:kt,cancel:Ga,state:cn,steps:hp}=n_(typeof requestAnimationFrame<"u"?requestAnimationFrame:In,!0),s_=y.createContext({strict:!1}),Iy={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Oo={};for(const t in Iy)Oo[t]={isEnabled:s=>Iy[t].some(o=>!!s[o])};function QA(t){for(const s in t)Oo[s]={...Oo[s],...t[s]}}const eD=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ld(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||eD.has(t)}let a_=t=>!ld(t);function tD(t){t&&(a_=s=>s.startsWith("on")?!ld(s):t(s))}try{tD(require("@emotion/is-prop-valid").default)}catch{}function nD(t,s,o){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(a_(c)||o===!0&&ld(c)||!s&&!ld(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function sD(t){if(typeof Proxy>"u")return t;const s=new Map,o=(...r)=>t(...r);return new Proxy(o,{get:(r,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const Md=y.createContext({});function il(t){return typeof t=="string"||Array.isArray(t)}function Rd(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Mm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Rm=["initial",...Mm];function Id(t){return Rd(t.animate)||Rm.some(s=>il(t[s]))}function i_(t){return!!(Id(t)||t.variants)}function aD(t,s){if(Id(t)){const{initial:o,animate:r}=t;return{initial:o===!1||il(o)?o:void 0,animate:il(r)?r:void 0}}return t.inherit!==!1?s:{}}function iD(t){const{initial:s,animate:o}=aD(t,y.useContext(Md));return y.useMemo(()=>({initial:s,animate:o}),[Oy(s),Oy(o)])}function Oy(t){return Array.isArray(t)?t.join(" "):t}const oD=Symbol.for("motionComponentSymbol");function Co(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function rD(t,s,o){return y.useCallback(r=>{r&&t.onMount&&t.onMount(r),s&&(r?s.mount(r):s.unmount()),o&&(typeof o=="function"?o(r):Co(o)&&(o.current=r))},[s])}const Im=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),lD="framerAppearId",o_="data-"+Im(lD),{schedule:Om}=n_(queueMicrotask,!1),r_=y.createContext({});function cD(t,s,o,r,c){var d,u;const{visualElement:p}=y.useContext(Md),m=y.useContext(s_),g=y.useContext(Dd),v=y.useContext(Am).reducedMotion,x=y.useRef(null);r=r||m.renderer,!x.current&&r&&(x.current=r(t,{visualState:s,parent:p,props:o,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const b=x.current,k=y.useContext(r_);b&&!b.projection&&c&&(b.type==="html"||b.type==="svg")&&dD(x.current,o,c,k);const S=y.useRef(!1);y.useInsertionEffect(()=>{b&&S.current&&b.update(o,g)});const j=o[o_],N=y.useRef(!!j&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,j))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,j)));return e_(()=>{b&&(S.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),Om.render(b.render),N.current&&b.animationState&&b.animationState.animateChanges())}),y.useEffect(()=>{b&&(!N.current&&b.animationState&&b.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,j)}),N.current=!1))}),b}function dD(t,s,o,r){const{layoutId:c,layout:d,drag:u,dragConstraints:p,layoutScroll:m,layoutRoot:g}=s;t.projection=new o(t.latestValues,s["data-framer-portal-id"]?void 0:l_(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&Co(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function l_(t){if(t)return t.options.allowProjection!==!1?t.projection:l_(t.parent)}function uD({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&QA(t);function p(g,v){let x;const b={...y.useContext(Am),...g,layoutId:fD(g)},{isStatic:k}=b,S=iD(g),j=r(g,k);if(!k&&Dm){pD();const N=mD(b);x=N.MeasureLayout,S.visualElement=cD(c,j,b,s,N.ProjectionNode)}return i.jsxs(Md.Provider,{value:S,children:[x&&S.visualElement?i.jsx(x,{visualElement:S.visualElement,...b}):null,o(c,g,rD(j,S.visualElement,v),j,k,S.visualElement)]})}p.displayName=`motion.${typeof c=="string"?c:`create(${(u=(d=c.displayName)!==null&&d!==void 0?d:c.name)!==null&&u!==void 0?u:""})`}`;const m=y.forwardRef(p);return m[oD]=c,m}function fD({layoutId:t}){const s=y.useContext(Cm).id;return s&&t!==void 0?s+"-"+t:t}function pD(t,s){y.useContext(s_).strict}function mD(t){const{drag:s,layout:o}=Oo;if(!s&&!o)return{};const r={...s,...o};return{MeasureLayout:s!=null&&s.isEnabled(t)||o!=null&&o.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const hD=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Bm(t){return typeof t!="string"||t.includes("-")?!1:!!(hD.indexOf(t)>-1||/[A-Z]/u.test(t))}function By(t){const s=[{},{}];return t==null||t.values.forEach((o,r)=>{s[0][r]=o.get(),s[1][r]=o.getVelocity()}),s}function Lm(t,s,o,r){if(typeof s=="function"){const[c,d]=By(r);s=s(o!==void 0?o:t.custom,c,d)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,d]=By(r);s=s(o!==void 0?o:t.custom,c,d)}return s}const Zp=t=>Array.isArray(t),gD=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),vD=t=>Zp(t)?t[t.length-1]||0:t,fn=t=>!!(t&&t.getVelocity);function ed(t){const s=fn(t)?t.get():t;return gD(s)?s.toValue():s}function yD({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:bD(r,c,d,t),renderState:s()};return o&&(u.onMount=p=>o({props:r,current:p,...u}),u.onUpdate=p=>o(p)),u}const c_=t=>(s,o)=>{const r=y.useContext(Md),c=y.useContext(Dd),d=()=>yD(t,s,r,c);return o?d():Em(d)};function bD(t,s,o,r){const c={},d=r(t,{});for(const b in d)c[b]=ed(d[b]);let{initial:u,animate:p}=t;const m=Id(t),g=i_(t);s&&g&&!m&&t.inherit!==!1&&(u===void 0&&(u=s.initial),p===void 0&&(p=s.animate));let v=o?o.initial===!1:!1;v=v||u===!1;const x=v?p:u;if(x&&typeof x!="boolean"&&!Rd(x)){const b=Array.isArray(x)?x:[x];for(let k=0;k<b.length;k++){const S=Lm(t,b[k]);if(S){const{transitionEnd:j,transition:N,...T}=S;for(const C in T){let D=T[C];if(Array.isArray(D)){const B=v?D.length-1:0;D=D[B]}D!==null&&(c[C]=D)}for(const C in j)c[C]=j[C]}}}return c}const Vo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Oi=new Set(Vo),d_=t=>s=>typeof s=="string"&&s.startsWith(t),u_=d_("--"),xD=d_("var(--"),zm=t=>xD(t)?_D.test(t.split("/*")[0].trim()):!1,_D=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,f_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,ia=(t,s,o)=>o>s?s:o<t?t:o,qo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},ol={...qo,transform:t=>ia(0,1,t)},Uc={...qo,default:1},ml=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Ua=ml("deg"),As=ml("%"),Ee=ml("px"),kD=ml("vh"),SD=ml("vw"),Ly={...As,parse:t=>As.parse(t)/100,transform:t=>As.transform(t*100)},TD={borderWidth:Ee,borderTopWidth:Ee,borderRightWidth:Ee,borderBottomWidth:Ee,borderLeftWidth:Ee,borderRadius:Ee,radius:Ee,borderTopLeftRadius:Ee,borderTopRightRadius:Ee,borderBottomRightRadius:Ee,borderBottomLeftRadius:Ee,width:Ee,maxWidth:Ee,height:Ee,maxHeight:Ee,top:Ee,right:Ee,bottom:Ee,left:Ee,padding:Ee,paddingTop:Ee,paddingRight:Ee,paddingBottom:Ee,paddingLeft:Ee,margin:Ee,marginTop:Ee,marginRight:Ee,marginBottom:Ee,marginLeft:Ee,backgroundPositionX:Ee,backgroundPositionY:Ee},jD={rotate:Ua,rotateX:Ua,rotateY:Ua,rotateZ:Ua,scale:Uc,scaleX:Uc,scaleY:Uc,scaleZ:Uc,skew:Ua,skewX:Ua,skewY:Ua,distance:Ee,translateX:Ee,translateY:Ee,translateZ:Ee,x:Ee,y:Ee,z:Ee,perspective:Ee,transformPerspective:Ee,opacity:ol,originX:Ly,originY:Ly,originZ:Ee},zy={...qo,transform:Math.round},$m={...TD,...jD,zIndex:zy,size:Ee,fillOpacity:ol,strokeOpacity:ol,numOctaves:zy},wD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ND=Vo.length;function CD(t,s,o){let r="",c=!0;for(let d=0;d<ND;d++){const u=Vo[d],p=t[u];if(p===void 0)continue;let m=!0;if(typeof p=="number"?m=p===(u.startsWith("scale")?1:0):m=parseFloat(p)===0,!m||o){const g=f_(p,$m[u]);if(!m){c=!1;const v=wD[u]||u;r+=`${v}(${g}) `}o&&(s[u]=g)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Pm(t,s,o){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,p=!1;for(const m in s){const g=s[m];if(Oi.has(m)){u=!0;continue}else if(u_(m)){c[m]=g;continue}else{const v=f_(g,$m[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||o?r.transform=CD(s,t.transform,o):r.transform&&(r.transform="none")),p){const{originX:m="50%",originY:g="50%",originZ:v=0}=d;r.transformOrigin=`${m} ${g} ${v}`}}const ED={offset:"stroke-dashoffset",array:"stroke-dasharray"},AD={offset:"strokeDashoffset",array:"strokeDasharray"};function DD(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?ED:AD;t[d.offset]=Ee.transform(-r);const u=Ee.transform(s),p=Ee.transform(o);t[d.array]=`${u} ${p}`}function $y(t,s,o){return typeof t=="string"?t:Ee.transform(s+o*t)}function MD(t,s,o){const r=$y(s,t.x,t.width),c=$y(o,t.y,t.height);return`${r} ${c}`}function Um(t,{attrX:s,attrY:o,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,x){if(Pm(t,g,x),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:b,style:k,dimensions:S}=t;b.transform&&(S&&(k.transform=b.transform),delete b.transform),S&&(c!==void 0||d!==void 0||k.transform)&&(k.transformOrigin=MD(S,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(b.x=s),o!==void 0&&(b.y=o),r!==void 0&&(b.scale=r),u!==void 0&&DD(b,u,p,m,!1)}const Hm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),p_=()=>({...Hm(),attrs:{}}),Vm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function m_(t,{style:s,vars:o},r,c){Object.assign(t.style,s,c&&c.getProjectionStyles(r));for(const d in o)t.style.setProperty(d,o[d])}const h_=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function g_(t,s,o,r){m_(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(h_.has(c)?c:Im(c),s.attrs[c])}const cd={};function RD(t){Object.assign(cd,t)}function v_(t,{layout:s,layoutId:o}){return Oi.has(t)||t.startsWith("origin")||(s||o!==void 0)&&(!!cd[t]||t==="opacity")}function qm(t,s,o){var r;const{style:c}=t,d={};for(const u in c)(fn(c[u])||s.style&&fn(s.style[u])||v_(u,t)||((r=o==null?void 0:o.getValue(u))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(d[u]=c[u]);return d}function y_(t,s,o){const r=qm(t,s,o);for(const c in t)if(fn(t[c])||fn(s[c])){const d=Vo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function ID(t,s){try{s.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{s.dimensions={x:0,y:0,width:0,height:0}}}const Py=["x","y","width","height","cx","cy","r"],OD={useVisualState:c_({scrapeMotionValuesFromProps:y_,createRenderState:p_,onUpdate:({props:t,prevProps:s,current:o,renderState:r,latestValues:c})=>{if(!o)return;let d=!!t.drag;if(!d){for(const p in c)if(Oi.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<Py.length;p++){const m=Py[p];t[m]!==s[m]&&(u=!0)}u&&kt.read(()=>{ID(o,r),kt.render(()=>{Um(r,c,Vm(o.tagName),t.transformTemplate),g_(o,r)})})}})},BD={useVisualState:c_({scrapeMotionValuesFromProps:qm,createRenderState:Hm})};function b_(t,s,o){for(const r in s)!fn(s[r])&&!v_(r,o)&&(t[r]=s[r])}function LD({transformTemplate:t},s){return y.useMemo(()=>{const o=Hm();return Pm(o,s,t),Object.assign({},o.vars,o.style)},[s])}function zD(t,s){const o=t.style||{},r={};return b_(r,o,t),Object.assign(r,LD(t,s)),r}function $D(t,s){const o={},r=zD(t,s);return t.drag&&t.dragListener!==!1&&(o.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(o.tabIndex=0),o.style=r,o}function PD(t,s,o,r){const c=y.useMemo(()=>{const d=p_();return Um(d,s,Vm(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};b_(d,t.style,t),c.style={...d,...c.style}}return c}function UD(t=!1){return(o,r,c,{latestValues:d},u)=>{const m=(Bm(o)?PD:$D)(r,d,u,o),g=nD(r,typeof o=="string",t),v=o!==y.Fragment?{...g,...m,ref:c}:{},{children:x}=r,b=y.useMemo(()=>fn(x)?x.get():x,[x]);return y.createElement(o,{...v,children:b})}}function HD(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Bm(r)?OD:BD,preloadedFeatures:t,useRender:UD(c),createVisualElement:s,Component:r};return uD(u)}}function x_(t,s){if(!Array.isArray(s))return!1;const o=s.length;if(o!==t.length)return!1;for(let r=0;r<o;r++)if(s[r]!==t[r])return!1;return!0}function Od(t,s,o){const r=t.getProps();return Lm(r,s,o!==void 0?o:r.custom,t)}function Gm(t,s){return t?t[s]||t.default||t:void 0}const __=new Set(["width","height","top","left","right","bottom",...Vo]);let td;function VD(){td=void 0}const Ds={now:()=>(td===void 0&&Ds.set(cn.isProcessing||JA.useManualTiming?cn.timestamp:performance.now()),td),set:t=>{td=t,queueMicrotask(VD)}};function Fm(t,s){t.indexOf(s)===-1&&t.push(s)}function Zm(t,s){const o=t.indexOf(s);o>-1&&t.splice(o,1)}class Km{constructor(){this.subscriptions=[]}add(s){return Fm(this.subscriptions,s),()=>Zm(this.subscriptions,s)}notify(s,o,r){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,o,r);else for(let d=0;d<c;d++){const u=this.subscriptions[d];u&&u(s,o,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function k_(t,s){return s?t*(1e3/s):0}const Uy=30,qD=t=>!isNaN(parseFloat(t));class GD{constructor(s,o={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=Ds.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=o.owner}setCurrent(s){this.current=s,this.updatedAt=Ds.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=qD(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,o){this.events[s]||(this.events[s]=new Km);const r=this.events[s].add(o);return s==="change"?()=>{r(),kt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,o){this.passiveEffect=s,this.stopPassiveEffect=o}set(s,o=!0){!o||!this.passiveEffect?this.updateAndNotify(s,o):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,o,r){this.set(o),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,o=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=Ds.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Uy)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,Uy);return k_(parseFloat(this.current)-parseFloat(this.prevFrameValue),o)}start(s){return this.stop(),new Promise(o=>{this.hasAnimated=!0,this.animation=s(o),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function rl(t,s){return new GD(t,s)}function FD(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,rl(o))}function ZD(t,s){const o=Od(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const p=vD(d[u]);FD(t,u,p)}}function KD(t){return!!(fn(t)&&t.add)}function Kp(t,s){const o=t.getValue("willChange");if(KD(o))return o.add(s)}function S_(t){return t.props[o_]}function Ym(t){let s;return()=>(s===void 0&&(s=t()),s)}const YD=Ym(()=>window.ScrollTimeline!==void 0);class JD{constructor(s){this.stop=()=>this.runAll("stop"),this.animations=s.filter(Boolean)}get finished(){return Promise.all(this.animations.map(s=>"finished"in s?s.finished:s))}getAll(s){return this.animations[0][s]}setAll(s,o){for(let r=0;r<this.animations.length;r++)this.animations[r][s]=o}attachTimeline(s,o){const r=this.animations.map(c=>{if(YD()&&c.attachTimeline)return c.attachTimeline(s);if(typeof o=="function")return o(c)});return()=>{r.forEach((c,d)=>{c&&c(),this.animations[d].stop()})}}get time(){return this.getAll("time")}set time(s){this.setAll("time",s)}get speed(){return this.getAll("speed")}set speed(s){this.setAll("speed",s)}get startTime(){return this.getAll("startTime")}get duration(){let s=0;for(let o=0;o<this.animations.length;o++)s=Math.max(s,this.animations[o].duration);return s}runAll(s){this.animations.forEach(o=>o[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class WD extends JD{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const ta=t=>t*1e3,na=t=>t/1e3;function Jm(t){return typeof t=="function"}function Hy(t,s){t.timeline=s,t.onfinish=null}const Wm=t=>Array.isArray(t)&&typeof t[0]=="number",XD={linearEasing:void 0};function QD(t,s){const o=Ym(t);return()=>{var r;return(r=XD[s])!==null&&r!==void 0?r:o()}}const dd=QD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Bo=(t,s,o)=>{const r=s-t;return r===0?1:(o-t)/r},T_=(t,s,o=10)=>{let r="";const c=Math.max(Math.round(s/o),2);for(let d=0;d<c;d++)r+=t(Bo(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function j_(t){return!!(typeof t=="function"&&dd()||!t||typeof t=="string"&&(t in Yp||dd())||Wm(t)||Array.isArray(t)&&t.every(j_))}const Gr=([t,s,o,r])=>`cubic-bezier(${t}, ${s}, ${o}, ${r})`,Yp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Gr([0,.65,.55,1]),circOut:Gr([.55,0,1,.45]),backIn:Gr([.31,.01,.66,-.59]),backOut:Gr([.33,1.53,.69,.99])};function w_(t,s){if(t)return typeof t=="function"&&dd()?T_(t,s):Wm(t)?Gr(t):Array.isArray(t)?t.map(o=>w_(o,s)||Yp.easeOut):Yp[t]}const N_=(t,s,o)=>(((1-3*o+3*s)*t+(3*o-6*s))*t+3*s)*t,e4=1e-7,t4=12;function n4(t,s,o,r,c){let d,u,p=0;do u=s+(o-s)/2,d=N_(u,r,c)-t,d>0?o=u:s=u;while(Math.abs(d)>e4&&++p<t4);return u}function hl(t,s,o,r){if(t===s&&o===r)return In;const c=d=>n4(d,0,1,t,o);return d=>d===0||d===1?d:N_(c(d),s,r)}const C_=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,E_=t=>s=>1-t(1-s),A_=hl(.33,1.53,.69,.99),Xm=E_(A_),D_=C_(Xm),M_=t=>(t*=2)<1?.5*Xm(t):.5*(2-Math.pow(2,-10*(t-1))),Qm=t=>1-Math.sin(Math.acos(t)),R_=E_(Qm),I_=C_(Qm),O_=t=>/^0[^.\s]+$/u.test(t);function s4(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||O_(t):!0}const Jr=t=>Math.round(t*1e5)/1e5,eh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function a4(t){return t==null}const i4=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,th=(t,s)=>o=>!!(typeof o=="string"&&i4.test(o)&&o.startsWith(t)||s&&!a4(o)&&Object.prototype.hasOwnProperty.call(o,s)),B_=(t,s,o)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(eh);return{[t]:parseFloat(c),[s]:parseFloat(d),[o]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},o4=t=>ia(0,255,t),gp={...qo,transform:t=>Math.round(o4(t))},ji={test:th("rgb","red"),parse:B_("red","green","blue"),transform:({red:t,green:s,blue:o,alpha:r=1})=>"rgba("+gp.transform(t)+", "+gp.transform(s)+", "+gp.transform(o)+", "+Jr(ol.transform(r))+")"};function r4(t){let s="",o="",r="",c="";return t.length>5?(s=t.substring(1,3),o=t.substring(3,5),r=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),o=t.substring(2,3),r=t.substring(3,4),c=t.substring(4,5),s+=s,o+=o,r+=r,c+=c),{red:parseInt(s,16),green:parseInt(o,16),blue:parseInt(r,16),alpha:c?parseInt(c,16)/255:1}}const Jp={test:th("#"),parse:r4,transform:ji.transform},Eo={test:th("hsl","hue"),parse:B_("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:o,alpha:r=1})=>"hsla("+Math.round(t)+", "+As.transform(Jr(s))+", "+As.transform(Jr(o))+", "+Jr(ol.transform(r))+")"},un={test:t=>ji.test(t)||Jp.test(t)||Eo.test(t),parse:t=>ji.test(t)?ji.parse(t):Eo.test(t)?Eo.parse(t):Jp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?ji.transform(t):Eo.transform(t)},l4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function c4(t){var s,o;return isNaN(t)&&typeof t=="string"&&(((s=t.match(eh))===null||s===void 0?void 0:s.length)||0)+(((o=t.match(l4))===null||o===void 0?void 0:o.length)||0)>0}const L_="number",z_="color",d4="var",u4="var(",Vy="${}",f4=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ll(t){const s=t.toString(),o=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace(f4,m=>(un.test(m)?(r.color.push(d),c.push(z_),o.push(un.parse(m))):m.startsWith(u4)?(r.var.push(d),c.push(d4),o.push(m)):(r.number.push(d),c.push(L_),o.push(parseFloat(m))),++d,Vy)).split(Vy);return{values:o,split:p,indexes:r,types:c}}function $_(t){return ll(t).values}function P_(t){const{split:s,types:o}=ll(t),r=s.length;return c=>{let d="";for(let u=0;u<r;u++)if(d+=s[u],c[u]!==void 0){const p=o[u];p===L_?d+=Jr(c[u]):p===z_?d+=un.transform(c[u]):d+=c[u]}return d}}const p4=t=>typeof t=="number"?0:t;function m4(t){const s=$_(t);return P_(t)(s.map(p4))}const Fa={test:c4,parse:$_,createTransformer:P_,getAnimatableNone:m4},h4=new Set(["brightness","contrast","saturate","opacity"]);function g4(t){const[s,o]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=o.match(eh)||[];if(!r)return t;const c=o.replace(r,"");let d=h4.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const v4=/\b([a-z-]*)\(.*?\)/gu,Wp={...Fa,getAnimatableNone:t=>{const s=t.match(v4);return s?s.map(g4).join(" "):t}},y4={...$m,color:un,backgroundColor:un,outlineColor:un,fill:un,stroke:un,borderColor:un,borderTopColor:un,borderRightColor:un,borderBottomColor:un,borderLeftColor:un,filter:Wp,WebkitFilter:Wp},nh=t=>y4[t];function U_(t,s){let o=nh(t);return o!==Wp&&(o=Fa),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const b4=new Set(["auto","none","0"]);function x4(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!b4.has(d)&&ll(d).values.length&&(c=t[r]),r++}if(c&&o)for(const d of s)t[d]=U_(o,c)}const qy=t=>t===qo||t===Ee,Gy=(t,s)=>parseFloat(t.split(", ")[s]),Fy=(t,s)=>(o,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return Gy(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?Gy(d[1],t):0}},_4=new Set(["x","y","z"]),k4=Vo.filter(t=>!_4.has(t));function S4(t){const s=[];return k4.forEach(o=>{const r=t.getValue(o);r!==void 0&&(s.push([o,r.get()]),r.set(o.startsWith("scale")?1:0))}),s}const Lo={width:({x:t},{paddingLeft:s="0",paddingRight:o="0"})=>t.max-t.min-parseFloat(s)-parseFloat(o),height:({y:t},{paddingTop:s="0",paddingBottom:o="0"})=>t.max-t.min-parseFloat(s)-parseFloat(o),top:(t,{top:s})=>parseFloat(s),left:(t,{left:s})=>parseFloat(s),bottom:({y:t},{top:s})=>parseFloat(s)+(t.max-t.min),right:({x:t},{left:s})=>parseFloat(s)+(t.max-t.min),x:Fy(4,13),y:Fy(5,14)};Lo.translateX=Lo.x;Lo.translateY=Lo.y;const Ni=new Set;let Xp=!1,Qp=!1;function H_(){if(Qp){const t=Array.from(Ni).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),o=new Map;s.forEach(r=>{const c=S4(r);c.length&&(o.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=o.get(r);c&&c.forEach(([d,u])=>{var p;(p=r.getValue(d))===null||p===void 0||p.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Qp=!1,Xp=!1,Ni.forEach(t=>t.complete()),Ni.clear()}function V_(){Ni.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Qp=!0)})}function T4(){V_(),H_()}class sh{constructor(s,o,r,c,d,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=o,this.name=r,this.motionValue=c,this.element=d,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ni.add(this),Xp||(Xp=!0,kt.read(V_),kt.resolveKeyframes(H_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:o,element:r,motionValue:c}=this;for(let d=0;d<s.length;d++)if(s[d]===null)if(d===0){const u=c==null?void 0:c.get(),p=s[s.length-1];if(u!==void 0)s[0]=u;else if(r&&o){const m=r.readValue(o,p);m!=null&&(s[0]=m)}s[0]===void 0&&(s[0]=p),c&&u===void 0&&c.set(s[0])}else s[d]=s[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ni.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ni.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const q_=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),j4=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function w4(t){const s=j4.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function G_(t,s,o=1){const[r,c]=w4(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return q_(u)?parseFloat(u):u}return zm(c)?G_(c,s,o+1):c}const F_=t=>s=>s.test(t),N4={test:t=>t==="auto",parse:t=>t},Z_=[qo,Ee,As,Ua,SD,kD,N4],Zy=t=>Z_.find(F_(t));class K_ extends sh{constructor(s,o,r,c,d){super(s,o,r,c,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:o,name:r}=this;if(!o||!o.current)return;super.readKeyframes();for(let m=0;m<s.length;m++){let g=s[m];if(typeof g=="string"&&(g=g.trim(),zm(g))){const v=G_(g,o.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!__.has(r)||s.length!==2)return;const[c,d]=s,u=Zy(c),p=Zy(d);if(u!==p)if(qy(u)&&qy(p))for(let m=0;m<s.length;m++){const g=s[m];typeof g=="string"&&(s[m]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:o}=this,r=[];for(let c=0;c<s.length;c++)s4(s[c])&&r.push(c);r.length&&x4(s,r,o)}measureInitialState(){const{element:s,unresolvedKeyframes:o,name:r}=this;if(!s||!s.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Lo[r](s.measureViewportBox(),window.getComputedStyle(s.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&s.getValue(r,c).jump(c,!1)}measureEndState(){var s;const{element:o,name:r,unresolvedKeyframes:c}=this;if(!o||!o.current)return;const d=o.getValue(r);d&&d.jump(this.measuredOrigin,!1);const u=c.length-1,p=c[u];c[u]=Lo[r](o.measureViewportBox(),window.getComputedStyle(o.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([m,g])=>{o.getValue(m).set(g)}),this.resolveNoneKeyframes()}}const Ky=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Fa.test(t)||t==="0")&&!t.startsWith("url("));function C4(t){const s=t[0];if(t.length===1)return!0;for(let o=0;o<t.length;o++)if(t[o]!==s)return!0}function E4(t,s,o,r){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const d=t[t.length-1],u=Ky(c,s),p=Ky(d,s);return!u||!p?!1:C4(t)||(o==="spring"||Jm(o))&&r}const A4=t=>t!==null;function Bd(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(A4),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const D4=40;class Y_{constructor({autoplay:s=!0,delay:o=0,type:r="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:u="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Ds.now(),this.options={autoplay:s,delay:o,type:r,repeat:c,repeatDelay:d,repeatType:u,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>D4?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&T4(),this._resolved}onKeyframesResolved(s,o){this.resolvedAt=Ds.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!E4(s,r,c,d))if(u)this.options.duration=0;else{m&&m(Bd(s,this.options,o)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,o);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:o,...v},this.onPostResolved())}onPostResolved(){}then(s,o){return this.currentFinishedPromise.then(s,o)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const em=2e4;function J_(t){let s=0;const o=50;let r=t.next(s);for(;!r.done&&s<em;)s+=o,r=t.next(s);return s>=em?1/0:s}const Ct=(t,s,o)=>t+(s-t)*o;function vp(t,s,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+(s-t)*6*o:o<1/2?s:o<2/3?t+(s-t)*(2/3-o)*6:t}function M4({hue:t,saturation:s,lightness:o,alpha:r}){t/=360,s/=100,o/=100;let c=0,d=0,u=0;if(!s)c=d=u=o;else{const p=o<.5?o*(1+s):o+s-o*s,m=2*o-p;c=vp(m,p,t+1/3),d=vp(m,p,t),u=vp(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function ud(t,s){return o=>o>0?s:t}const yp=(t,s,o)=>{const r=t*t,c=o*(s*s-r)+r;return c<0?0:Math.sqrt(c)},R4=[Jp,ji,Eo],I4=t=>R4.find(s=>s.test(t));function Yy(t){const s=I4(t);if(!s)return!1;let o=s.parse(t);return s===Eo&&(o=M4(o)),o}const Jy=(t,s)=>{const o=Yy(t),r=Yy(s);if(!o||!r)return ud(t,s);const c={...o};return d=>(c.red=yp(o.red,r.red,d),c.green=yp(o.green,r.green,d),c.blue=yp(o.blue,r.blue,d),c.alpha=Ct(o.alpha,r.alpha,d),ji.transform(c))},O4=(t,s)=>o=>s(t(o)),gl=(...t)=>t.reduce(O4),tm=new Set(["none","hidden"]);function B4(t,s){return tm.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function L4(t,s){return o=>Ct(t,s,o)}function ah(t){return typeof t=="number"?L4:typeof t=="string"?zm(t)?ud:un.test(t)?Jy:P4:Array.isArray(t)?W_:typeof t=="object"?un.test(t)?Jy:z4:ud}function W_(t,s){const o=[...t],r=o.length,c=t.map((d,u)=>ah(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)o[u]=c[u](d);return o}}function z4(t,s){const o={...t,...s},r={};for(const c in o)t[c]!==void 0&&s[c]!==void 0&&(r[c]=ah(t[c])(t[c],s[c]));return c=>{for(const d in r)o[d]=r[d](c);return o}}function $4(t,s){var o;const r=[],c={color:0,var:0,number:0};for(let d=0;d<s.values.length;d++){const u=s.types[d],p=t.indexes[u][c[u]],m=(o=t.values[p])!==null&&o!==void 0?o:0;r[d]=m,c[u]++}return r}const P4=(t,s)=>{const o=Fa.createTransformer(s),r=ll(t),c=ll(s);return r.indexes.var.length===c.indexes.var.length&&r.indexes.color.length===c.indexes.color.length&&r.indexes.number.length>=c.indexes.number.length?tm.has(t)&&!c.values.length||tm.has(s)&&!r.values.length?B4(t,s):gl(W_($4(r,c),c.values),o):ud(t,s)};function X_(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?Ct(t,s,o):ah(t)(t,s)}const U4=5;function Q_(t,s,o){const r=Math.max(s-U4,0);return k_(o-t(r),s-r)}const Mt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},bp=.001;function H4({duration:t=Mt.duration,bounce:s=Mt.bounce,velocity:o=Mt.velocity,mass:r=Mt.mass}){let c,d,u=1-s;u=ia(Mt.minDamping,Mt.maxDamping,u),t=ia(Mt.minDuration,Mt.maxDuration,na(t)),u<1?(c=g=>{const v=g*u,x=v*t,b=v-o,k=nm(g,u),S=Math.exp(-x);return bp-b/k*S},d=g=>{const x=g*u*t,b=x*o+o,k=Math.pow(u,2)*Math.pow(g,2)*t,S=Math.exp(-x),j=nm(Math.pow(g,2),u);return(-c(g)+bp>0?-1:1)*((b-k)*S)/j}):(c=g=>{const v=Math.exp(-g*t),x=(g-o)*t+1;return-bp+v*x},d=g=>{const v=Math.exp(-g*t),x=(o-g)*(t*t);return v*x});const p=5/t,m=q4(c,d,p);if(t=ta(t),isNaN(m))return{stiffness:Mt.stiffness,damping:Mt.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const V4=12;function q4(t,s,o){let r=o;for(let c=1;c<V4;c++)r=r-t(r)/s(r);return r}function nm(t,s){return t*Math.sqrt(1-s*s)}const G4=["duration","bounce"],F4=["stiffness","damping","mass"];function Wy(t,s){return s.some(o=>t[o]!==void 0)}function Z4(t){let s={velocity:Mt.velocity,stiffness:Mt.stiffness,damping:Mt.damping,mass:Mt.mass,isResolvedFromDuration:!1,...t};if(!Wy(t,F4)&&Wy(t,G4))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*ia(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Mt.mass,stiffness:c,damping:d}}else{const o=H4(t);s={...s,...o,mass:Mt.mass},s.isResolvedFromDuration=!0}return s}function e1(t=Mt.visualDuration,s=Mt.bounce){const o=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=o;const d=o.keyframes[0],u=o.keyframes[o.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:v,duration:x,velocity:b,isResolvedFromDuration:k}=Z4({...o,velocity:-na(o.velocity||0)}),S=b||0,j=g/(2*Math.sqrt(m*v)),N=u-d,T=na(Math.sqrt(m/v)),C=Math.abs(N)<5;r||(r=C?Mt.restSpeed.granular:Mt.restSpeed.default),c||(c=C?Mt.restDelta.granular:Mt.restDelta.default);let D;if(j<1){const E=nm(T,j);D=A=>{const $=Math.exp(-j*T*A);return u-$*((S+j*T*N)/E*Math.sin(E*A)+N*Math.cos(E*A))}}else if(j===1)D=E=>u-Math.exp(-T*E)*(N+(S+T*N)*E);else{const E=T*Math.sqrt(j*j-1);D=A=>{const $=Math.exp(-j*T*A),L=Math.min(E*A,300);return u-$*((S+j*T*N)*Math.sinh(L)+E*N*Math.cosh(L))/E}}const B={calculatedDuration:k&&x||null,next:E=>{const A=D(E);if(k)p.done=E>=x;else{let $=0;j<1&&($=E===0?ta(S):Q_(D,E,A));const L=Math.abs($)<=r,U=Math.abs(u-A)<=c;p.done=L&&U}return p.value=p.done?u:A,p},toString:()=>{const E=Math.min(J_(B),em),A=T_($=>B.next(E*$).value,E,30);return E+"ms "+A}};return B}function Xy({keyframes:t,velocity:s=0,power:o=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:p,max:m,restDelta:g=.5,restSpeed:v}){const x=t[0],b={done:!1,value:x},k=L=>p!==void 0&&L<p||m!==void 0&&L>m,S=L=>p===void 0?m:m===void 0||Math.abs(p-L)<Math.abs(m-L)?p:m;let j=o*s;const N=x+j,T=u===void 0?N:u(N);T!==N&&(j=T-x);const C=L=>-j*Math.exp(-L/r),D=L=>T+C(L),B=L=>{const U=C(L),J=D(L);b.done=Math.abs(U)<=g,b.value=b.done?T:J};let E,A;const $=L=>{k(b.value)&&(E=L,A=e1({keyframes:[b.value,S(b.value)],velocity:Q_(D,L,b.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return $(0),{calculatedDuration:null,next:L=>{let U=!1;return!A&&E===void 0&&(U=!0,B(L),$(L)),E!==void 0&&L>=E?A.next(L-E):(!U&&B(L),b)}}}const K4=hl(.42,0,1,1),Y4=hl(0,0,.58,1),t1=hl(.42,0,.58,1),J4=t=>Array.isArray(t)&&typeof t[0]!="number",W4={linear:In,easeIn:K4,easeInOut:t1,easeOut:Y4,circIn:Qm,circInOut:I_,circOut:R_,backIn:Xm,backInOut:D_,backOut:A_,anticipate:M_},Qy=t=>{if(Wm(t)){t_(t.length===4);const[s,o,r,c]=t;return hl(s,o,r,c)}else if(typeof t=="string")return W4[t];return t};function X4(t,s,o){const r=[],c=o||X_,d=t.length-1;for(let u=0;u<d;u++){let p=c(t[u],t[u+1]);if(s){const m=Array.isArray(s)?s[u]||In:s;p=gl(m,p)}r.push(p)}return r}function Q4(t,s,{clamp:o=!0,ease:r,mixer:c}={}){const d=t.length;if(t_(d===s.length),d===1)return()=>s[0];if(d===2&&s[0]===s[1])return()=>s[1];const u=t[0]===t[1];t[0]>t[d-1]&&(t=[...t].reverse(),s=[...s].reverse());const p=X4(s,r,c),m=p.length,g=v=>{if(u&&v<t[0])return s[0];let x=0;if(m>1)for(;x<t.length-2&&!(v<t[x+1]);x++);const b=Bo(t[x],t[x+1],v);return p[x](b)};return o?v=>g(ia(t[0],t[d-1],v)):g}function eM(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=Bo(0,s,r);t.push(Ct(o,1,c))}}function tM(t){const s=[0];return eM(s,t.length-1),s}function nM(t,s){return t.map(o=>o*s)}function sM(t,s){return t.map(()=>s||t1).splice(0,t.length-1)}function fd({duration:t=300,keyframes:s,times:o,ease:r="easeInOut"}){const c=J4(r)?r.map(Qy):Qy(r),d={done:!1,value:s[0]},u=nM(o&&o.length===s.length?o:tM(s),t),p=Q4(u,s,{ease:Array.isArray(c)?c:sM(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const aM=t=>{const s=({timestamp:o})=>t(o);return{start:()=>kt.update(s,!0),stop:()=>Ga(s),now:()=>cn.isProcessing?cn.timestamp:Ds.now()}},iM={decay:Xy,inertia:Xy,tween:fd,keyframes:fd,spring:e1},oM=t=>t/100;class ih extends Y_{constructor(s){super(s),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:m}=this.options;m&&m()};const{name:o,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||sh,p=(m,g)=>this.onKeyframesResolved(m,g);this.resolver=new u(d,p,o,r,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:o="keyframes",repeat:r=0,repeatDelay:c=0,repeatType:d,velocity:u=0}=this.options,p=Jm(o)?o:iM[o]||fd;let m,g;p!==fd&&typeof s[0]!="number"&&(m=gl(oM,X_(s[0],s[1])),s=[0,100]);const v=p({...this.options,keyframes:s});d==="mirror"&&(g=p({...this.options,keyframes:[...s].reverse(),velocity:-u})),v.calculatedDuration===null&&(v.calculatedDuration=J_(v));const{calculatedDuration:x}=v,b=x+c,k=b*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:x,resolvedDuration:b,totalDuration:k}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,o=!1){const{resolved:r}=this;if(!r){const{keyframes:L}=this.options;return{done:!0,value:L[L.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:p,keyframes:m,calculatedDuration:g,totalDuration:v,resolvedDuration:x}=r;if(this.startTime===null)return d.next(0);const{delay:b,repeat:k,repeatType:S,repeatDelay:j,onUpdate:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),o?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const T=this.currentTime-b*(this.speed>=0?1:-1),C=this.speed>=0?T<0:T>v;this.currentTime=Math.max(T,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let D=this.currentTime,B=d;if(k){const L=Math.min(this.currentTime,v)/x;let U=Math.floor(L),J=L%1;!J&&L>=1&&(J=1),J===1&&U--,U=Math.min(U,k+1),!!(U%2)&&(S==="reverse"?(J=1-J,j&&(J-=j/x)):S==="mirror"&&(B=u)),D=ia(0,1,J)*x}const E=C?{done:!1,value:m[0]}:B.next(D);p&&(E.value=p(E.value));let{done:A}=E;!C&&g!==null&&(A=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return $&&c!==void 0&&(E.value=Bd(m,this.options,c)),N&&N(E.value),$&&this.finish(),E}get duration(){const{resolved:s}=this;return s?na(s.calculatedDuration):0}get time(){return na(this.currentTime)}set time(s){s=ta(s),this.currentTime=s,this.holdTime!==null||this.speed===0?this.holdTime=s:this.driver&&(this.startTime=this.driver.now()-s/this.speed)}get speed(){return this.playbackSpeed}set speed(s){const o=this.playbackSpeed!==s;this.playbackSpeed=s,o&&(this.time=na(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=aM,onPlay:o,startTime:r}=this.options;this.driver||(this.driver=s(d=>this.tick(d))),o&&o();const c=this.driver.now();this.holdTime!==null?this.startTime=c-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=c):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var s;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(s=this.currentTime)!==null&&s!==void 0?s:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:s}=this.options;s&&s()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(s){return this.startTime=0,this.tick(s,!0)}}const rM=new Set(["opacity","clipPath","filter","transform"]);function lM(t,s,o,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:p="easeInOut",times:m}={}){const g={[s]:o};m&&(g.offset=m);const v=w_(p,c);return Array.isArray(v)&&(g.easing=v),t.animate(g,{delay:r,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:d+1,direction:u==="reverse"?"alternate":"normal"})}const cM=Ym(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),pd=10,dM=2e4;function uM(t){return Jm(t.type)||t.type==="spring"||!j_(t.ease)}function fM(t,s){const o=new ih({...s,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const c=[];let d=0;for(;!r.done&&d<dM;)r=o.sample(d),c.push(r.value),d+=pd;return{times:void 0,keyframes:c,duration:d-pd,ease:"linear"}}const n1={anticipate:M_,backInOut:D_,circInOut:I_};function pM(t){return t in n1}class eb extends Y_{constructor(s){super(s);const{name:o,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new K_(d,(u,p)=>this.onKeyframesResolved(u,p),o,r,c),this.resolver.scheduleResolve()}initPlayback(s,o){let{duration:r=300,times:c,ease:d,type:u,motionValue:p,name:m,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof d=="string"&&dd()&&pM(d)&&(d=n1[d]),uM(this.options)){const{onComplete:x,onUpdate:b,motionValue:k,element:S,...j}=this.options,N=fM(s,j);s=N.keyframes,s.length===1&&(s[1]=s[0]),r=N.duration,c=N.times,d=N.ease,u="keyframes"}const v=lM(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(Hy(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:x}=this.options;p.set(Bd(s,this.options,o)),x&&x(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:r,times:c,type:u,ease:d,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:o}=s;return na(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return na(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=ta(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:o}=s;return o.playbackRate}set speed(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:o}=s;return o.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:o}=s;return o.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:o}=this;if(!o)return In;const{animation:r}=o;Hy(r,s)}return In}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:o,keyframes:r,duration:c,type:d,ease:u,times:p}=s;if(o.playState==="idle"||o.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:x,element:b,...k}=this.options,S=new ih({...k,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),j=ta(this.time);g.setWithVelocity(S.sample(j-pd).value,S.sample(j).value,pd)}const{onStop:m}=this.options;m&&m(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:o,name:r,repeatDelay:c,repeatType:d,damping:u,type:p}=s;if(!o||!o.owner||!(o.owner.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:g}=o.owner.getProps();return cM()&&r&&rM.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const mM={type:"spring",stiffness:500,damping:25,restSpeed:10},hM=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),gM={type:"keyframes",duration:.8},vM={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},yM=(t,{keyframes:s})=>s.length>2?gM:Oi.has(t)?t.startsWith("scale")?hM(s[1]):mM:vM;function bM({when:t,delay:s,delayChildren:o,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:p,from:m,elapsed:g,...v}){return!!Object.keys(v).length}const oh=(t,s,o,r={},c,d)=>u=>{const p=Gm(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-ta(m);let v={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:b=>{s.set(b),p.onUpdate&&p.onUpdate(b)},onComplete:()=>{u(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:d?void 0:c};bM(p)||(v={...v,...yM(t,v)}),v.duration&&(v.duration=ta(v.duration)),v.repeatDelay&&(v.repeatDelay=ta(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let x=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(x=!0)),x&&!d&&s.get()!==void 0){const b=Bd(v.keyframes,p);if(b!==void 0)return kt.update(()=>{v.onUpdate(b),v.onComplete()}),new WD([])}return!d&&eb.supports(v)?new eb(v):new ih(v)};function xM({protectedKeys:t,needsAnimating:s},o){const r=t.hasOwnProperty(o)&&s[o]!==!0;return s[o]=!1,r}function s1(t,s,{delay:o=0,transitionOverride:r,type:c}={}){var d;let{transition:u=t.getDefaultTransition(),transitionEnd:p,...m}=s;r&&(u=r);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const x in m){const b=t.getValue(x,(d=t.latestValues[x])!==null&&d!==void 0?d:null),k=m[x];if(k===void 0||v&&xM(v,x))continue;const S={delay:o,...Gm(u||{},x)};let j=!1;if(window.MotionHandoffAnimation){const T=S_(t);if(T){const C=window.MotionHandoffAnimation(T,x,kt);C!==null&&(S.startTime=C,j=!0)}}Kp(t,x),b.start(oh(x,b,k,t.shouldReduceMotion&&__.has(x)?{type:!1}:S,t,j));const N=b.animation;N&&g.push(N)}return p&&Promise.all(g).then(()=>{kt.update(()=>{p&&ZD(t,p)})}),g}function sm(t,s,o={}){var r;const c=Od(t,s,o.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(d=o.transitionOverride);const u=c?()=>Promise.all(s1(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:x,staggerDirection:b}=d;return _M(t,s,v+g,x,b,o)}:()=>Promise.resolve(),{when:m}=d;if(m){const[g,v]=m==="beforeChildren"?[u,p]:[p,u];return g().then(()=>v())}else return Promise.all([u(),p(o.delay)])}function _M(t,s,o=0,r=0,c=1,d){const u=[],p=(t.variantChildren.size-1)*r,m=c===1?(g=0)=>g*r:(g=0)=>p-g*r;return Array.from(t.variantChildren).sort(kM).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(sm(g,s,{...d,delay:o+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function kM(t,s){return t.sortNodePosition(s)}function SM(t,s,o={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>sm(t,d,o));r=Promise.all(c)}else if(typeof s=="string")r=sm(t,s,o);else{const c=typeof s=="function"?Od(t,s,o.custom):s;r=Promise.all(s1(t,c,o))}return r.then(()=>{t.notify("AnimationComplete",s)})}const TM=Rm.length;function a1(t){if(!t)return;if(!t.isControllingVariants){const o=t.parent?a1(t.parent)||{}:{};return t.props.initial!==void 0&&(o.initial=t.props.initial),o}const s={};for(let o=0;o<TM;o++){const r=Rm[o],c=t.props[r];(il(c)||c===!1)&&(s[r]=c)}return s}const jM=[...Mm].reverse(),wM=Mm.length;function NM(t){return s=>Promise.all(s.map(({animation:o,options:r})=>SM(t,o,r)))}function CM(t){let s=NM(t),o=tb(),r=!0;const c=m=>(g,v)=>{var x;const b=Od(t,v,m==="exit"?(x=t.presenceContext)===null||x===void 0?void 0:x.custom:void 0);if(b){const{transition:k,transitionEnd:S,...j}=b;g={...g,...j,...S}}return g};function d(m){s=m(t)}function u(m){const{props:g}=t,v=a1(t.parent)||{},x=[],b=new Set;let k={},S=1/0;for(let N=0;N<wM;N++){const T=jM[N],C=o[T],D=g[T]!==void 0?g[T]:v[T],B=il(D),E=T===m?C.isActive:null;E===!1&&(S=N);let A=D===v[T]&&D!==g[T]&&B;if(A&&r&&t.manuallyAnimateOnMount&&(A=!1),C.protectedKeys={...k},!C.isActive&&E===null||!D&&!C.prevProp||Rd(D)||typeof D=="boolean")continue;const $=EM(C.prevProp,D);let L=$||T===m&&C.isActive&&!A&&B||N>S&&B,U=!1;const J=Array.isArray(D)?D:[D];let V=J.reduce(c(T),{});E===!1&&(V={});const{prevResolvedValues:K={}}=C,de={...K,...V},ee=O=>{L=!0,b.has(O)&&(U=!0,b.delete(O)),C.needsAnimating[O]=!0;const X=t.getValue(O);X&&(X.liveStyle=!1)};for(const O in de){const X=V[O],he=K[O];if(k.hasOwnProperty(O))continue;let W=!1;Zp(X)&&Zp(he)?W=!x_(X,he):W=X!==he,W?X!=null?ee(O):b.add(O):X!==void 0&&b.has(O)?ee(O):C.protectedKeys[O]=!0}C.prevProp=D,C.prevResolvedValues=V,C.isActive&&(k={...k,...V}),r&&t.blockInitialAnimation&&(L=!1),L&&(!(A&&$)||U)&&x.push(...J.map(O=>({animation:O,options:{type:T}})))}if(b.size){const N={};b.forEach(T=>{const C=t.getBaseTarget(T),D=t.getValue(T);D&&(D.liveStyle=!0),N[T]=C??null}),x.push({animation:N})}let j=!!x.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(j=!1),r=!1,j?s(x):Promise.resolve()}function p(m,g){var v;if(o[m].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(b=>{var k;return(k=b.animationState)===null||k===void 0?void 0:k.setActive(m,g)}),o[m].isActive=g;const x=u(m);for(const b in o)o[b].protectedKeys={};return x}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>o,reset:()=>{o=tb(),r=!0}}}function EM(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!x_(s,t):!1}function bi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function tb(){return{animate:bi(!0),whileInView:bi(),whileHover:bi(),whileTap:bi(),whileDrag:bi(),whileFocus:bi(),exit:bi()}}class Ya{constructor(s){this.isMounted=!1,this.node=s}update(){}}class AM extends Ya{constructor(s){super(s),s.animationState||(s.animationState=CM(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Rd(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:o}=this.node.prevProps||{};s!==o&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let DM=0;class MM extends Ya{constructor(){super(...arguments),this.id=DM++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:o}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===r)return;const c=this.node.animationState.setActive("exit",!s);o&&!s&&c.then(()=>o(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const RM={animation:{Feature:AM},exit:{Feature:MM}},hs={x:!1,y:!1};function i1(){return hs.x||hs.y}function IM(t){return t==="x"||t==="y"?hs[t]?null:(hs[t]=!0,()=>{hs[t]=!1}):hs.x||hs.y?null:(hs.x=hs.y=!0,()=>{hs.x=hs.y=!1})}const rh=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function cl(t,s,o,r={passive:!0}){return t.addEventListener(s,o,r),()=>t.removeEventListener(s,o)}function vl(t){return{point:{x:t.pageX,y:t.pageY}}}const OM=t=>s=>rh(s)&&t(s,vl(s));function Wr(t,s,o,r){return cl(t,s,OM(o),r)}const nb=(t,s)=>Math.abs(t-s);function BM(t,s){const o=nb(t.x,s.x),r=nb(t.y,s.y);return Math.sqrt(o**2+r**2)}class o1{constructor(s,o,{transformPagePoint:r,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=_p(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,k=BM(x.offset,{x:0,y:0})>=3;if(!b&&!k)return;const{point:S}=x,{timestamp:j}=cn;this.history.push({...S,timestamp:j});const{onStart:N,onMove:T}=this.handlers;b||(N&&N(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,x)},this.handlePointerMove=(x,b)=>{this.lastMoveEvent=x,this.lastMoveEventInfo=xp(b,this.transformPagePoint),kt.update(this.updatePoint,!0)},this.handlePointerUp=(x,b)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:j}=this.handlers;if(this.dragSnapToOrigin&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=_p(x.type==="pointercancel"?this.lastMoveEventInfo:xp(b,this.transformPagePoint),this.history);this.startEvent&&k&&k(x,N),S&&S(x,N)},!rh(s))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=r,this.contextWindow=c||window;const u=vl(s),p=xp(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=cn;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=o;v&&v(s,_p(p,this.history)),this.removeListeners=gl(Wr(this.contextWindow,"pointermove",this.handlePointerMove),Wr(this.contextWindow,"pointerup",this.handlePointerUp),Wr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Ga(this.updatePoint)}}function xp(t,s){return s?{point:s(t.point)}:t}function sb(t,s){return{x:t.x-s.x,y:t.y-s.y}}function _p({point:t},s){return{point:t,delta:sb(t,r1(s)),offset:sb(t,LM(s)),velocity:zM(s,.1)}}function LM(t){return t[0]}function r1(t){return t[t.length-1]}function zM(t,s){if(t.length<2)return{x:0,y:0};let o=t.length-1,r=null;const c=r1(t);for(;o>=0&&(r=t[o],!(c.timestamp-r.timestamp>ta(s)));)o--;if(!r)return{x:0,y:0};const d=na(c.timestamp-r.timestamp);if(d===0)return{x:0,y:0};const u={x:(c.x-r.x)/d,y:(c.y-r.y)/d};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}const l1=1e-4,$M=1-l1,PM=1+l1,c1=.01,UM=0-c1,HM=0+c1;function Bn(t){return t.max-t.min}function VM(t,s,o){return Math.abs(t-s)<=o}function ab(t,s,o,r=.5){t.origin=r,t.originPoint=Ct(s.min,s.max,t.origin),t.scale=Bn(o)/Bn(s),t.translate=Ct(o.min,o.max,t.origin)-t.originPoint,(t.scale>=$M&&t.scale<=PM||isNaN(t.scale))&&(t.scale=1),(t.translate>=UM&&t.translate<=HM||isNaN(t.translate))&&(t.translate=0)}function Xr(t,s,o,r){ab(t.x,s.x,o.x,r?r.originX:void 0),ab(t.y,s.y,o.y,r?r.originY:void 0)}function ib(t,s,o){t.min=o.min+s.min,t.max=t.min+Bn(s)}function qM(t,s,o){ib(t.x,s.x,o.x),ib(t.y,s.y,o.y)}function ob(t,s,o){t.min=s.min-o.min,t.max=t.min+Bn(s)}function Qr(t,s,o){ob(t.x,s.x,o.x),ob(t.y,s.y,o.y)}function GM(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?Ct(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?Ct(o,t,r.max):Math.min(t,o)),t}function rb(t,s,o){return{min:s!==void 0?t.min+s:void 0,max:o!==void 0?t.max+o-(t.max-t.min):void 0}}function FM(t,{top:s,left:o,bottom:r,right:c}){return{x:rb(t.x,o,c),y:rb(t.y,s,r)}}function lb(t,s){let o=s.min-t.min,r=s.max-t.max;return s.max-s.min<t.max-t.min&&([o,r]=[r,o]),{min:o,max:r}}function ZM(t,s){return{x:lb(t.x,s.x),y:lb(t.y,s.y)}}function KM(t,s){let o=.5;const r=Bn(t),c=Bn(s);return c>r?o=Bo(s.min,s.max-r,t.min):r>c&&(o=Bo(t.min,t.max-c,s.min)),ia(0,1,o)}function YM(t,s){const o={};return s.min!==void 0&&(o.min=s.min-t.min),s.max!==void 0&&(o.max=s.max-t.min),o}const am=.35;function JM(t=am){return t===!1?t=0:t===!0&&(t=am),{x:cb(t,"left","right"),y:cb(t,"top","bottom")}}function cb(t,s,o){return{min:db(t,s),max:db(t,o)}}function db(t,s){return typeof t=="number"?t:t[s]||0}const ub=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ao=()=>({x:ub(),y:ub()}),fb=()=>({min:0,max:0}),$t=()=>({x:fb(),y:fb()});function es(t){return[t("x"),t("y")]}function d1({top:t,left:s,right:o,bottom:r}){return{x:{min:s,max:o},y:{min:t,max:r}}}function WM({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function XM(t,s){if(!s)return t;const o=s({x:t.left,y:t.top}),r=s({x:t.right,y:t.bottom});return{top:o.y,left:o.x,bottom:r.y,right:r.x}}function kp(t){return t===void 0||t===1}function im({scale:t,scaleX:s,scaleY:o}){return!kp(t)||!kp(s)||!kp(o)}function Si(t){return im(t)||u1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function u1(t){return pb(t.x)||pb(t.y)}function pb(t){return t&&t!=="0%"}function md(t,s,o){const r=t-o,c=s*r;return o+c}function mb(t,s,o,r,c){return c!==void 0&&(t=md(t,c,r)),md(t,o,r)+s}function om(t,s=0,o=1,r,c){t.min=mb(t.min,s,o,r,c),t.max=mb(t.max,s,o,r,c)}function f1(t,{x:s,y:o}){om(t.x,s.translate,s.scale,s.originPoint),om(t.y,o.translate,o.scale,o.originPoint)}const hb=.999999999999,gb=1.0000000000001;function QM(t,s,o,r=!1){const c=o.length;if(!c)return;s.x=s.y=1;let d,u;for(let p=0;p<c;p++){d=o[p],u=d.projectionDelta;const{visualElement:m}=d.options;m&&m.props.style&&m.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Mo(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,f1(t,u)),r&&Si(d.latestValues)&&Mo(t,d.latestValues))}s.x<gb&&s.x>hb&&(s.x=1),s.y<gb&&s.y>hb&&(s.y=1)}function Do(t,s){t.min=t.min+s,t.max=t.max+s}function vb(t,s,o,r,c=.5){const d=Ct(t.min,t.max,c);om(t,s,o,d,r)}function Mo(t,s){vb(t.x,s.x,s.scaleX,s.scale,s.originX),vb(t.y,s.y,s.scaleY,s.scale,s.originY)}function p1(t,s){return d1(XM(t.getBoundingClientRect(),s))}function eR(t,s,o){const r=p1(t,o),{scroll:c}=s;return c&&(Do(r.x,c.offset.x),Do(r.y,c.offset.y)),r}const m1=({current:t})=>t?t.ownerDocument.defaultView:null,tR=new WeakMap;class nR{constructor(s){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=$t(),this.visualElement=s}start(s,{snapToCursor:o=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:x}=this.getProps();x?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(vl(v).point)},d=(v,x)=>{const{drag:b,dragPropagation:k,onDragStart:S}=this.getProps();if(b&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=IM(b),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),es(N=>{let T=this.getAxisMotionValue(N).get()||0;if(As.test(T)){const{projection:C}=this.visualElement;if(C&&C.layout){const D=C.layout.layoutBox[N];D&&(T=Bn(D)*(parseFloat(T)/100))}}this.originPoint[N]=T}),S&&kt.postRender(()=>S(v,x)),Kp(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},u=(v,x)=>{const{dragPropagation:b,dragDirectionLock:k,onDirectionLock:S,onDrag:j}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:N}=x;if(k&&this.currentDirection===null){this.currentDirection=sR(N),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",x.point,N),this.updateAxis("y",x.point,N),this.visualElement.render(),j&&j(v,x)},p=(v,x)=>this.stop(v,x),m=()=>es(v=>{var x;return this.getAnimationState(v)==="paused"&&((x=this.getAxisMotionValue(v).animation)===null||x===void 0?void 0:x.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new o1(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:m1(this.visualElement)})}stop(s,o){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&kt.postRender(()=>d(s,o))}cancel(){this.isDragging=!1;const{projection:s,animationState:o}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(s,o,r){const{drag:c}=this.getProps();if(!r||!Hc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=GM(u,this.constraints[s],this.elastic[s])),d.set(u)}resolveConstraints(){var s;const{dragConstraints:o,dragElastic:r}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)===null||s===void 0?void 0:s.layout,d=this.constraints;o&&Co(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=FM(c.layoutBox,o):this.constraints=!1,this.elastic=JM(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&es(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=YM(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:o}=this.getProps();if(!s||!Co(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=eR(r,c.root,this.visualElement.getTransformPagePoint());let u=ZM(c.layout.layoutBox,d);if(o){const p=o(WM(u));this.hasMutatedConstraints=!!p,p&&(u=d1(p))}return u}startAnimation(s){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=es(v=>{if(!Hc(v,o,this.currentDirection))return;let x=m&&m[v]||{};u&&(x={min:0,max:0});const b=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:r?s[v]:0,bounceStiffness:b,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...d,...x};return this.startAxisValueAnimation(v,S)});return Promise.all(g).then(p)}startAxisValueAnimation(s,o){const r=this.getAxisMotionValue(s);return Kp(this.visualElement,s),r.start(oh(s,r,0,o,this.visualElement,!1))}stopAnimation(){es(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){es(s=>{var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(s){var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(s){const o=`_drag${s.toUpperCase()}`,r=this.visualElement.getProps(),c=r[o];return c||this.visualElement.getValue(s,(r.initial?r.initial[s]:void 0)||0)}snapToCursor(s){es(o=>{const{drag:r}=this.getProps();if(!Hc(o,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:u,max:p}=c.layout.layoutBox[o];d.set(s[o]-Ct(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!Co(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};es(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=KM({min:m,max:m},this.constraints[u])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),es(u=>{if(!Hc(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(Ct(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;tR.set(this.visualElement,this);const s=this.visualElement.current,o=Wr(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();Co(m)&&m.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",r);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),kt.read(r);const u=cl(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(es(v=>{const x=this.getAxisMotionValue(v);x&&(this.originPoint[v]+=m[v].translate,x.set(x.get()+m[v].translate))}),this.visualElement.render())}));return()=>{u(),o(),d(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:u=am,dragMomentum:p=!0}=s;return{...s,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function Hc(t,s,o){return(s===!0||s===t)&&(o===null||o===t)}function sR(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class aR extends Ya{constructor(s){super(s),this.removeGroupControls=In,this.removeListeners=In,this.controls=new nR(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||In}unmount(){this.removeGroupControls(),this.removeListeners()}}const yb=t=>(s,o)=>{t&&kt.postRender(()=>t(s,o))};class iR extends Ya{constructor(){super(...arguments),this.removePointerDownListener=In}onPointerDown(s){this.session=new o1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:m1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:o,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:yb(s),onStart:yb(o),onMove:r,onEnd:(d,u)=>{delete this.session,c&&kt.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Wr(this.node.current,"pointerdown",s=>this.onPointerDown(s))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const nd={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function bb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const zr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ee.test(t))t=parseFloat(t);else return t;const o=bb(t,s.target.x),r=bb(t,s.target.y);return`${o}% ${r}%`}},oR={correct:(t,{treeScale:s,projectionDelta:o})=>{const r=t,c=Fa.parse(t);if(c.length>5)return r;const d=Fa.createTransformer(t),u=typeof c[0]!="number"?1:0,p=o.x.scale*s.x,m=o.y.scale*s.y;c[0+u]/=p,c[1+u]/=m;const g=Ct(p,m,.5);return typeof c[2+u]=="number"&&(c[2+u]/=g),typeof c[3+u]=="number"&&(c[3+u]/=g),d(c)}};class rR extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;RD(lR),d&&(o.group&&o.group.add(d),r&&r.register&&c&&r.register(d),d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,onExitComplete:()=>this.safeToRemove()})),nd.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:o,visualElement:r,drag:c,isPresent:d}=this.props,u=r.projection;return u&&(u.isPresent=d,c||s.layoutDependency!==o||o===void 0?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||kt.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Om.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),r&&r.deregister&&r.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function h1(t){const[s,o]=Qx(),r=y.useContext(Cm);return i.jsx(rR,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(r_),isPresent:s,safeToRemove:o})}const lR={borderRadius:{...zr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:zr,borderTopRightRadius:zr,borderBottomLeftRadius:zr,borderBottomRightRadius:zr,boxShadow:oR};function cR(t,s,o){const r=fn(t)?t:rl(t);return r.start(oh("",r,s,o)),r.animation}function dR(t){return t instanceof SVGElement&&t.tagName!=="svg"}const uR=(t,s)=>t.depth-s.depth;class fR{constructor(){this.children=[],this.isDirty=!1}add(s){Fm(this.children,s),this.isDirty=!0}remove(s){Zm(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(uR),this.isDirty=!1,this.children.forEach(s)}}function pR(t,s){const o=Ds.now(),r=({timestamp:c})=>{const d=c-o;d>=s&&(Ga(r),t(d-s))};return kt.read(r,!0),()=>Ga(r)}const g1=["TopLeft","TopRight","BottomLeft","BottomRight"],mR=g1.length,xb=t=>typeof t=="string"?parseFloat(t):t,_b=t=>typeof t=="number"||Ee.test(t);function hR(t,s,o,r,c,d){c?(t.opacity=Ct(0,o.opacity!==void 0?o.opacity:1,gR(r)),t.opacityExit=Ct(s.opacity!==void 0?s.opacity:1,0,vR(r))):d&&(t.opacity=Ct(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<mR;u++){const p=`border${g1[u]}Radius`;let m=kb(s,p),g=kb(o,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||_b(m)===_b(g)?(t[p]=Math.max(Ct(xb(m),xb(g),r),0),(As.test(g)||As.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||o.rotate)&&(t.rotate=Ct(s.rotate||0,o.rotate||0,r))}function kb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const gR=v1(0,.5,R_),vR=v1(.5,.95,In);function v1(t,s,o){return r=>r<t?0:r>s?1:o(Bo(t,s,r))}function Sb(t,s){t.min=s.min,t.max=s.max}function Jn(t,s){Sb(t.x,s.x),Sb(t.y,s.y)}function Tb(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function jb(t,s,o,r,c){return t-=s,t=md(t,1/o,r),c!==void 0&&(t=md(t,1/c,r)),t}function yR(t,s=0,o=1,r=.5,c,d=t,u=t){if(As.test(s)&&(s=parseFloat(s),s=Ct(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=Ct(d.min,d.max,r);t===d&&(p-=s),t.min=jb(t.min,s,o,p,c),t.max=jb(t.max,s,o,p,c)}function wb(t,s,[o,r,c],d,u){yR(t,s[o],s[r],s[c],s.scale,d,u)}const bR=["x","scaleX","originX"],xR=["y","scaleY","originY"];function Nb(t,s,o,r){wb(t.x,s,bR,o?o.x:void 0,r?r.x:void 0),wb(t.y,s,xR,o?o.y:void 0,r?r.y:void 0)}function Cb(t){return t.translate===0&&t.scale===1}function y1(t){return Cb(t.x)&&Cb(t.y)}function Eb(t,s){return t.min===s.min&&t.max===s.max}function _R(t,s){return Eb(t.x,s.x)&&Eb(t.y,s.y)}function Ab(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function b1(t,s){return Ab(t.x,s.x)&&Ab(t.y,s.y)}function Db(t){return Bn(t.x)/Bn(t.y)}function Mb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class kR{constructor(){this.members=[]}add(s){Fm(this.members,s),s.scheduleRender()}remove(s){if(Zm(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const o=this.members[this.members.length-1];o&&this.promote(o)}}relegate(s){const o=this.members.findIndex(c=>s===c);if(o===0)return!1;let r;for(let c=o;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){r=d;break}}return r?(this.promote(r),!0):!1}promote(s,o){const r=this.lead;if(s!==r&&(this.prevLead=r,this.lead=s,s.show(),r)){r.instance&&r.scheduleRender(),s.scheduleRender(),s.resumeFrom=r,o&&(s.resumeFrom.preserveOpacity=!0),r.snapshot&&(s.snapshot=r.snapshot,s.snapshot.latestValues=r.animationValues||r.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:o,resumingFrom:r}=s;o.onExitComplete&&o.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function SR(t,s,o){let r="";const c=t.x.translate/s.x,d=t.y.translate/s.y,u=(o==null?void 0:o.z)||0;if((c||d||u)&&(r=`translate3d(${c}px, ${d}px, ${u}px) `),(s.x!==1||s.y!==1)&&(r+=`scale(${1/s.x}, ${1/s.y}) `),o){const{transformPerspective:g,rotate:v,rotateX:x,rotateY:b,skewX:k,skewY:S}=o;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),x&&(r+=`rotateX(${x}deg) `),b&&(r+=`rotateY(${b}deg) `),k&&(r+=`skewX(${k}deg) `),S&&(r+=`skewY(${S}deg) `)}const p=t.x.scale*s.x,m=t.y.scale*s.y;return(p!==1||m!==1)&&(r+=`scale(${p}, ${m})`),r||"none"}const Ti={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Fr=typeof window<"u"&&window.MotionDebug!==void 0,Sp=["","X","Y","Z"],TR={visibility:"hidden"},Rb=1e3;let jR=0;function Tp(t,s,o,r){const{latestValues:c}=s;c[t]&&(o[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function x1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const o=S_(s);if(window.MotionHasOptimisedAnimation(o,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(o,"transform",kt,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&x1(r)}function _1({attachResizeListener:t,defaultParent:s,measureScroll:o,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=jR++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Fr&&(Ti.totalNodes=Ti.resolvedTargetDeltas=Ti.recalculatedProjection=0),this.nodes.forEach(CR),this.nodes.forEach(RR),this.nodes.forEach(IR),this.nodes.forEach(ER),Fr&&window.MotionDebug.record(Ti)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new fR)}addEventListener(u,p){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Km),this.eventHandlers.get(u).add(p)}notifyListeners(u,...p){const m=this.eventHandlers.get(u);m&&m.notify(...p)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=dR(u),this.instance=u;const{layoutId:m,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(g||m)&&(this.isLayoutDirty=!0),t){let x;const b=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,x&&x(),x=pR(b,250),nd.hasAnimatedSinceResize&&(nd.hasAnimatedSinceResize=!1,this.nodes.forEach(Ob))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||g)&&this.addEventListener("didUpdate",({delta:x,hasLayoutChanged:b,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||v.getDefaultTransition()||$R,{onLayoutAnimationStart:N,onLayoutAnimationComplete:T}=v.getProps(),C=!this.targetLayout||!b1(this.targetLayout,S)||k,D=!b&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||D||b&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(x,D);const B={...Gm(j,"layout"),onPlay:N,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(B.delay=0,B.type=!1),this.startAnimation(B)}else b||Ob(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ga(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(OR),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&x1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const x=this.path[v];x.shouldResetTransform=!0,x.updateScroll("snapshot"),x.options.layoutRoot&&x.willUpdate(!1)}const{layoutId:p,layout:m}=this.options;if(p===void 0&&!m)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ib);return}this.isUpdating||this.nodes.forEach(DR),this.isUpdating=!1,this.nodes.forEach(MR),this.nodes.forEach(wR),this.nodes.forEach(NR),this.clearAllSnapshots();const p=Ds.now();cn.delta=ia(0,1e3/60,p-cn.timestamp),cn.timestamp=p,cn.isProcessing=!0,hp.update.process(cn),hp.preRender.process(cn),hp.render.process(cn),cn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Om.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(AR),this.sharedNodes.forEach(BR)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,kt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){kt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=$t(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(p=!1),p){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:o(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!y1(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||Si(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const p=this.measurePageBox();let m=this.removeElementScroll(p);return u&&(m=this.removeTransform(m)),PR(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return $t();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(UR))){const{scroll:v}=this.root;v&&(Do(m.x,v.offset.x),Do(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=$t();if(Jn(m,u),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return m;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:x,options:b}=v;v!==this.root&&x&&b.layoutScroll&&(x.wasRoot&&Jn(m,u),Do(m.x,x.offset.x),Do(m.y,x.offset.y))}return m}applyTransform(u,p=!1){const m=$t();Jn(m,u);for(let g=0;g<this.path.length;g++){const v=this.path[g];!p&&v.options.layoutScroll&&v.scroll&&v!==v.root&&Mo(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Si(v.latestValues)&&Mo(m,v.latestValues)}return Si(this.latestValues)&&Mo(m,this.latestValues),m}removeTransform(u){const p=$t();Jn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!Si(g.latestValues))continue;im(g.latestValues)&&g.updateSnapshot();const v=$t(),x=g.measurePageBox();Jn(v,x),Nb(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return Si(this.latestValues)&&Nb(p,this.latestValues),p}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==cn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var p;const m=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=m.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=m.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=m.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==m;if(!(u||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:x,layoutId:b}=this.options;if(!(!this.layout||!(x||b))){if(this.resolvedRelativeTargetAt=cn.timestamp,!this.targetDelta&&!this.relativeTarget){const k=this.getClosestProjectingParent();k&&k.layout&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=$t(),this.relativeTargetOrigin=$t(),Qr(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),Jn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=$t(),this.targetWithTransforms=$t()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),qM(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Jn(this.target,this.layout.layoutBox),f1(this.target,this.targetDelta)):Jn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const k=this.getClosestProjectingParent();k&&!!k.resumingFrom==!!this.resumingFrom&&!k.options.layoutScroll&&k.target&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=$t(),this.relativeTargetOrigin=$t(),Qr(this.relativeTargetOrigin,this.target,k.target),Jn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Fr&&Ti.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||im(this.parent.latestValues)||u1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var u;const p=this.getLead(),m=!!this.resumingFrom||this!==p;let g=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(g=!1),m&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===cn.timestamp&&(g=!1),g)return;const{layout:v,layoutId:x}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(v||x))return;Jn(this.layoutCorrected,this.layout.layoutBox);const b=this.treeScale.x,k=this.treeScale.y;QM(this.layoutCorrected,this.treeScale,this.path,m),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=$t());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Tb(this.prevProjectionDelta.x,this.projectionDelta.x),Tb(this.prevProjectionDelta.y,this.projectionDelta.y)),Xr(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==b||this.treeScale.y!==k||!Mb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Mb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Fr&&Ti.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var p;if((p=this.options.visualElement)===null||p===void 0||p.scheduleRender(),u){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ao(),this.projectionDelta=Ao(),this.projectionDeltaWithTransform=Ao()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},x=Ao();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const b=$t(),k=m?m.source:void 0,S=this.layout?this.layout.source:void 0,j=k!==S,N=this.getStack(),T=!N||N.members.length<=1,C=!!(j&&!T&&this.options.crossfade===!0&&!this.path.some(zR));this.animationProgress=0;let D;this.mixTargetDelta=B=>{const E=B/1e3;Bb(x.x,u.x,E),Bb(x.y,u.y,E),this.setTargetDelta(x),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Qr(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),LR(this.relativeTarget,this.relativeTargetOrigin,b,E),D&&_R(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=$t()),Jn(D,this.relativeTarget)),j&&(this.animationValues=v,hR(v,g,this.latestValues,E,C,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ga(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=kt.update(()=>{nd.hasAnimatedSinceResize=!0,this.currentAnimation=cR(0,Rb,{...u,onUpdate:p=>{this.mixTargetDelta(p),u.onUpdate&&u.onUpdate(p)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Rb),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:p,target:m,layout:g,latestValues:v}=u;if(!(!p||!m||!g)){if(this!==u&&this.layout&&g&&k1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||$t();const x=Bn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+x;const b=Bn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+b}Jn(p,m),Mo(p,v),Xr(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new kR),this.sharedNodes.get(u).add(p);const g=p.options.initialPromotionConfig;p.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(p):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:p}=this.options;return p?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:p}=this.options;return p?(u=this.getStack())===null||u===void 0?void 0:u.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:p,preserveFollowOpacity:m}={}){const g=this.getStack();g&&g.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let p=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(p=!0),!p)return;const g={};m.z&&Tp("z",u,g,this.animationValues);for(let v=0;v<Sp.length;v++)Tp(`rotate${Sp[v]}`,u,g,this.animationValues),Tp(`skew${Sp[v]}`,u,g,this.animationValues);u.render();for(const v in g)u.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);u.scheduleRender()}getProjectionStyles(u){var p,m;if(!this.instance||this.isSVG)return;if(!this.isVisible)return TR;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=ed(u==null?void 0:u.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const x=this.getLead();if(!this.projectionDelta||!this.layout||!x.target){const j={};return this.options.layoutId&&(j.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,j.pointerEvents=ed(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!Si(this.latestValues)&&(j.transform=v?v({},""):"none",this.hasProjected=!1),j}const b=x.animationValues||x.latestValues;this.applyTransformsToTarget(),g.transform=SR(this.projectionDeltaWithTransform,this.treeScale,b),v&&(g.transform=v(b,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,x.animationValues?g.opacity=x===this?(m=(p=b.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:b.opacityExit:g.opacity=x===this?b.opacity!==void 0?b.opacity:"":b.opacityExit!==void 0?b.opacityExit:0;for(const j in cd){if(b[j]===void 0)continue;const{correct:N,applyTo:T}=cd[j],C=g.transform==="none"?b[j]:N(b[j],x);if(T){const D=T.length;for(let B=0;B<D;B++)g[T[B]]=C}else g[j]=C}return this.options.layoutId&&(g.pointerEvents=x===this?ed(u==null?void 0:u.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var p;return(p=u.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(Ib),this.root.sharedNodes.clear()}}}function wR(t){t.updateLayout()}function NR(t){var s;const o=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:c}=t.layout,{animationType:d}=t.options,u=o.source!==t.layout.source;d==="size"?es(x=>{const b=u?o.measuredBox[x]:o.layoutBox[x],k=Bn(b);b.min=r[x].min,b.max=b.min+k}):k1(d,o.layoutBox,r)&&es(x=>{const b=u?o.measuredBox[x]:o.layoutBox[x],k=Bn(r[x]);b.max=b.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[x].max=t.relativeTarget[x].min+k)});const p=Ao();Xr(p,r,o.layoutBox);const m=Ao();u?Xr(m,t.applyTransform(c,!0),o.measuredBox):Xr(m,r,o.layoutBox);const g=!y1(p);let v=!1;if(!t.resumeFrom){const x=t.getClosestProjectingParent();if(x&&!x.resumeFrom){const{snapshot:b,layout:k}=x;if(b&&k){const S=$t();Qr(S,o.layoutBox,b.layoutBox);const j=$t();Qr(j,r,k.layoutBox),b1(S,j)||(v=!0),x.options.layoutRoot&&(t.relativeTarget=j,t.relativeTargetOrigin=S,t.relativeParent=x)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:o,delta:m,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function CR(t){Fr&&Ti.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function ER(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function AR(t){t.clearSnapshot()}function Ib(t){t.clearMeasurements()}function DR(t){t.isLayoutDirty=!1}function MR(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function Ob(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function RR(t){t.resolveTargetDelta()}function IR(t){t.calcProjection()}function OR(t){t.resetSkewAndRotation()}function BR(t){t.removeLeadSnapshot()}function Bb(t,s,o){t.translate=Ct(s.translate,0,o),t.scale=Ct(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function Lb(t,s,o,r){t.min=Ct(s.min,o.min,r),t.max=Ct(s.max,o.max,r)}function LR(t,s,o,r){Lb(t.x,s.x,o.x,r),Lb(t.y,s.y,o.y,r)}function zR(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const $R={duration:.45,ease:[.4,0,.1,1]},zb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),$b=zb("applewebkit/")&&!zb("chrome/")?Math.round:In;function Pb(t){t.min=$b(t.min),t.max=$b(t.max)}function PR(t){Pb(t.x),Pb(t.y)}function k1(t,s,o){return t==="position"||t==="preserve-aspect"&&!VM(Db(s),Db(o),.2)}function UR(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const HR=_1({attachResizeListener:(t,s)=>cl(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),jp={current:void 0},S1=_1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!jp.current){const t=new HR({});t.mount(window),t.setOptions({layoutScroll:!0}),jp.current=t}return jp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),VR={pan:{Feature:iR},drag:{Feature:aR,ProjectionNode:S1,MeasureLayout:h1}};function qR(t,s,o){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let c=document;const d=(r=void 0)!==null&&r!==void 0?r:c.querySelectorAll(t);return d?Array.from(d):[]}return Array.from(t)}function T1(t,s){const o=qR(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[o,c,()=>r.abort()]}function Ub(t){return s=>{s.pointerType==="touch"||i1()||t(s)}}function GR(t,s,o={}){const[r,c,d]=T1(t,o),u=Ub(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=Ub(x=>{g(x),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function Hb(t,s,o){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",o==="Start");const c="onHover"+o,d=r[c];d&&kt.postRender(()=>d(s,vl(s)))}class FR extends Ya{mount(){const{current:s}=this.node;s&&(this.unmount=GR(s,o=>(Hb(this.node,o,"Start"),r=>Hb(this.node,r,"End"))))}unmount(){}}class ZR extends Ya{constructor(){super(...arguments),this.isActive=!1}onFocus(){let s=!1;try{s=this.node.current.matches(":focus-visible")}catch{s=!0}!s||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=gl(cl(this.node.current,"focus",()=>this.onFocus()),cl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const j1=(t,s)=>s?t===s?!0:j1(t,s.parentElement):!1,KR=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function YR(t){return KR.has(t.tagName)||t.tabIndex!==-1}const Zr=new WeakSet;function Vb(t){return s=>{s.key==="Enter"&&t(s)}}function wp(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const JR=(t,s)=>{const o=t.currentTarget;if(!o)return;const r=Vb(()=>{if(Zr.has(o))return;wp(o,"down");const c=Vb(()=>{wp(o,"up")}),d=()=>wp(o,"cancel");o.addEventListener("keyup",c,s),o.addEventListener("blur",d,s)});o.addEventListener("keydown",r,s),o.addEventListener("blur",()=>o.removeEventListener("keydown",r),s)};function qb(t){return rh(t)&&!i1()}function WR(t,s,o={}){const[r,c,d]=T1(t,o),u=p=>{const m=p.currentTarget;if(!qb(p)||Zr.has(m))return;Zr.add(m);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",b),!(!qb(k)||!Zr.has(m))&&(Zr.delete(m),typeof g=="function"&&g(k,{success:S}))},x=k=>{v(k,o.useGlobalTarget||j1(m,k.target))},b=k=>{v(k,!1)};window.addEventListener("pointerup",x,c),window.addEventListener("pointercancel",b,c)};return r.forEach(p=>{!YR(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(o.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>JR(g,c),c)}),d}function Gb(t,s,o){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",o==="Start");const c="onTap"+(o==="End"?"":o),d=r[c];d&&kt.postRender(()=>d(s,vl(s)))}class XR extends Ya{mount(){const{current:s}=this.node;s&&(this.unmount=WR(s,o=>(Gb(this.node,o,"Start"),(r,{success:c})=>Gb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const rm=new WeakMap,Np=new WeakMap,QR=t=>{const s=rm.get(t.target);s&&s(t)},e3=t=>{t.forEach(QR)};function t3({root:t,...s}){const o=t||document;Np.has(o)||Np.set(o,{});const r=Np.get(o),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(e3,{root:t,...s})),r[c]}function n3(t,s,o){const r=t3(s);return rm.set(t,o),r.observe(t),()=>{rm.delete(t),r.unobserve(t)}}const s3={some:0,all:1};class a3 extends Ya{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:o,margin:r,amount:c="some",once:d}=s,u={root:o?o.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:s3[c]},p=m=>{const{isIntersecting:g}=m;if(this.isInView===g||(this.isInView=g,d&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:x}=this.node.getProps(),b=g?v:x;b&&b(m)};return n3(this.node.current,u,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:o}=this.node;["amount","margin","root"].some(i3(s,o))&&this.startObserver()}unmount(){}}function i3({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const o3={inView:{Feature:a3},tap:{Feature:XR},focus:{Feature:ZR},hover:{Feature:FR}},r3={layout:{ProjectionNode:S1,MeasureLayout:h1}},hd={current:null},lh={current:!1};function w1(){if(lh.current=!0,!!Dm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>hd.current=t.matches;t.addListener(s),s()}else hd.current=!1}const l3=[...Z_,un,Fa],c3=t=>l3.find(F_(t)),Fb=new WeakMap;function d3(t,s,o){for(const r in s){const c=s[r],d=o[r];if(fn(c))t.addValue(r,c);else if(fn(d))t.addValue(r,rl(c,{owner:t}));else if(d!==c)if(t.hasValue(r)){const u=t.getValue(r);u.liveStyle===!0?u.jump(c):u.hasAnimated||u.set(c)}else{const u=t.getStaticValue(r);t.addValue(r,rl(u!==void 0?u:c,{owner:t}))}}for(const r in o)s[r]===void 0&&t.removeValue(r);return s}const Zb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class u3{scrapeMotionValuesFromProps(s,o,r){return{}}constructor({parent:s,props:o,presenceContext:r,reducedMotionConfig:c,blockInitialAnimation:d,visualState:u},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=sh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const k=Ds.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,kt.render(this.render,!1,!0))};const{latestValues:m,renderState:g,onUpdate:v}=u;this.onUpdate=v,this.latestValues=m,this.baseTarget={...m},this.initialValues=o.initial?{...m}:{},this.renderState=g,this.parent=s,this.props=o,this.presenceContext=r,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=Id(o),this.isVariantNode=i_(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:x,...b}=this.scrapeMotionValuesFromProps(o,{},this);for(const k in b){const S=b[k];m[k]!==void 0&&fn(S)&&S.set(m[k],!1)}}mount(s){this.current=s,Fb.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,r)=>this.bindToMotionValue(r,o)),lh.current||w1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:hd.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Fb.delete(this.current),this.projection&&this.projection.unmount(),Ga(this.notifyUpdate),Ga(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const o=this.features[s];o&&(o.unmount(),o.isMounted=!1)}this.current=null}bindToMotionValue(s,o){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const r=Oi.has(s),c=o.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&kt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,s,o)),this.valueSubscriptions.set(s,()=>{c(),d(),u&&u(),o.owner&&o.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in Oo){const o=Oo[s];if(!o)continue;const{isEnabled:r,Feature:c}=o;if(!this.features[s]&&c&&r(this.props)&&(this.features[s]=new c(this)),this.features[s]){const d=this.features[s];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):$t()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,o){this.latestValues[s]=o}update(s,o){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let r=0;r<Zb.length;r++){const c=Zb[r];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const d="on"+c,u=s[d];u&&(this.propEventSubscriptions[c]=this.on(c,u))}this.prevMotionValues=d3(this,this.scrapeMotionValuesFromProps(s,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const o=this.getClosestVariantNode();if(o)return o.variantChildren&&o.variantChildren.add(s),()=>o.variantChildren.delete(s)}addValue(s,o){const r=this.values.get(s);o!==r&&(r&&this.removeValue(s),this.bindToMotionValue(s,o),this.values.set(s,o),this.latestValues[s]=o.get())}removeValue(s){this.values.delete(s);const o=this.valueSubscriptions.get(s);o&&(o(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,o){if(this.props.values&&this.props.values[s])return this.props.values[s];let r=this.values.get(s);return r===void 0&&o!==void 0&&(r=rl(o===null?void 0:o,{owner:this}),this.addValue(s,r)),r}readValue(s,o){var r;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(r=this.getBaseTargetFromProps(this.props,s))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(q_(c)||O_(c))?c=parseFloat(c):!c3(c)&&Fa.test(o)&&(c=U_(s,o)),this.setBaseTarget(s,fn(c)?c.get():c)),fn(c)?c.get():c}setBaseTarget(s,o){this.baseTarget[s]=o}getBaseTarget(s){var o;const{initial:r}=this.props;let c;if(typeof r=="string"||typeof r=="object"){const u=Lm(this.props,r,(o=this.presenceContext)===null||o===void 0?void 0:o.custom);u&&(c=u[s])}if(r&&c!==void 0)return c;const d=this.getBaseTargetFromProps(this.props,s);return d!==void 0&&!fn(d)?d:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,o){return this.events[s]||(this.events[s]=new Km),this.events[s].add(o)}notify(s,...o){this.events[s]&&this.events[s].notify(...o)}}class N1 extends u3{constructor(){super(...arguments),this.KeyframeResolver=K_}sortInstanceNodePosition(s,o){return s.compareDocumentPosition(o)&2?1:-1}getBaseTargetFromProps(s,o){return s.style?s.style[o]:void 0}removeValueFromRenderState(s,{vars:o,style:r}){delete o[s],delete r[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;fn(s)&&(this.childSubscription=s.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}}function f3(t){return window.getComputedStyle(t)}class p3 extends N1{constructor(){super(...arguments),this.type="html",this.renderInstance=m_}readValueFromInstance(s,o){if(Oi.has(o)){const r=nh(o);return r&&r.default||0}else{const r=f3(s),c=(u_(o)?r.getPropertyValue(o):r[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:o}){return p1(s,o)}build(s,o,r){Pm(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return qm(s,o,r)}}class m3 extends N1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=$t}getBaseTargetFromProps(s,o){return s[o]}readValueFromInstance(s,o){if(Oi.has(o)){const r=nh(o);return r&&r.default||0}return o=h_.has(o)?o:Im(o),s.getAttribute(o)}scrapeMotionValuesFromProps(s,o,r){return y_(s,o,r)}build(s,o,r){Um(s,o,this.isSVGTag,r.transformTemplate)}renderInstance(s,o,r,c){g_(s,o,r,c)}mount(s){this.isSVGTag=Vm(s.tagName),super.mount(s)}}const h3=(t,s)=>Bm(t)?new m3(s):new p3(s,{allowProjection:t!==y.Fragment}),g3=HD({...RM,...o3,...VR,...r3},h3),Rt=sD(g3);function v3(){!lh.current&&w1();const[t]=y.useState(hd.current);return t}const y3="_overlay_cmicx_1",b3="_dialog_cmicx_11",x3="_title_cmicx_30",_3="_description_cmicx_38",k3="_actions_cmicx_45",S3="_cancelButton_cmicx_52",T3="_confirmButton_cmicx_79",xi={overlay:y3,dialog:b3,title:x3,description:_3,actions:k3,cancelButton:S3,confirmButton:T3};function oa({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return i.jsx(gs,{children:t&&i.jsx(Rt.div,{className:xi.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:m=>{m.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":o?p:void 0,children:i.jsxs(Rt.div,{className:xi.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:m=>m.stopPropagation(),children:[i.jsx("h3",{id:u,className:xi.title,children:s}),o&&i.jsx("p",{id:p,className:xi.description,children:o}),i.jsxs("div",{className:xi.actions,children:[i.jsx("button",{type:"button",className:xi.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),i.jsx("button",{type:"button",className:xi.confirmButton,onClick:c,children:r})]})]})})})}const j3="_skeleton_1gqp4_9",w3="_circular_1gqp4_17",N3="_textContainer_1gqp4_26",C3="_card_1gqp4_31",gd={skeleton:j3,circular:w3,textContainer:N3,card:C3};function Te({width:t="100%",height:s="1rem",borderRadius:o,variant:r="rectangular",className:c}){const d=[gd.skeleton,r==="circular"?gd.circular:"",c??""].filter(Boolean).join(" ");return i.jsx("div",{className:d,style:{width:t,height:s,...o&&r!=="circular"?{borderRadius:o}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function lm({lines:t=3,lastLineWidth:s="60%",lineHeight:o="0.75rem",gap:r="var(--space-sm)",className:c}){return i.jsx("div",{className:`${gd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>i.jsx(Te,{width:u===t-1&&t>1?s:"100%",height:o},u))})}function vd({lines:t=2,className:s}){return i.jsxs("div",{className:`${gd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[i.jsx(Te,{width:"40%",height:"1.25rem"}),i.jsx(lm,{lines:t})]})}const E3="_spinner_1uyt1_1",A3="_spin_1uyt1_1",D3="_sm_1uyt1_14",M3="_md_1uyt1_20",R3="_lg_1uyt1_26",I3="_xl_1uyt1_32",Kb={spinner:E3,spin:A3,sm:D3,md:M3,lg:R3,xl:I3};function C1({size:t="md",className:s,label:o="Loading",liveRegion:r=!1}){return i.jsx("span",{className:`${Kb.spinner} ${Kb[t]} ${s??""}`,role:r?"status":void 0,"aria-label":o,"aria-hidden":r?void 0:!0})}const O3="_splash_1bn1g_1",B3="_logo_1bn1g_11",Yb={splash:O3,logo:B3};function E1(){return i.jsxs("div",{className:Yb.splash,"data-testid":"splash-screen",children:[i.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Yb.logo}),i.jsx(C1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const L3="_wrapper_4e5yt_1",z3="_wrapperBlock_4e5yt_6",$3="_tooltip_4e5yt_11",P3="_visible_4e5yt_31",U3="_top_4e5yt_41",H3="_bottom_4e5yt_48",V3="_left_4e5yt_55",q3="_right_4e5yt_62",$r={wrapper:L3,wrapperBlock:z3,tooltip:$3,visible:P3,top:U3,bottom:H3,left:V3,right:q3},G3=300,Vc=6;function zo({text:t,placement:s="top",delayMs:o=G3,inline:r=!0,children:c,className:d,"data-testid":u}){const[p,m]=y.useState(!1),[g,v]=y.useState({top:0,left:0}),x=y.useRef(null),b=y.useRef(null),k=y.useRef(void 0),S=y.useId(),j=typeof document<"u",N=y.useCallback(()=>{if(!x.current||!b.current)return;const U=x.current.getBoundingClientRect(),J=b.current.getBoundingClientRect();let V=0,K=0;switch(s){case"top":V=U.top-J.height-Vc,K=U.left+U.width/2-J.width/2;break;case"bottom":V=U.bottom+Vc,K=U.left+U.width/2-J.width/2;break;case"left":V=U.top+U.height/2-J.height/2,K=U.left-J.width-Vc;break;case"right":V=U.top+U.height/2-J.height/2,K=U.right+Vc;break}v({top:V,left:K})},[s]),T=y.useCallback(U=>{k.current!==void 0&&clearTimeout(k.current),k.current=setTimeout(()=>{N(),m(!0),k.current=void 0},U)},[N]),C=y.useCallback(()=>{T(o)},[o,T]),D=y.useCallback(()=>{T(0)},[T]),B=y.useCallback(()=>{k.current!==void 0&&(clearTimeout(k.current),k.current=void 0),m(!1)},[]);y.useEffect(()=>{if(!p)return;const U=J=>{J.key==="Escape"&&B()};return document.addEventListener("keydown",U),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{document.removeEventListener("keydown",U),window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[p,B,N]),y.useEffect(()=>()=>{k.current!==void 0&&clearTimeout(k.current)},[]);const E=r?"span":"div",A=[r?$r.wrapper:$r.wrapperBlock,d].filter(Boolean).join(" ");let $=c;if(y.isValidElement(c)){const U=c,J=U.props["aria-describedby"],V=p?J?`${J} ${S}`:S:J;$=y.cloneElement(U,{"aria-describedby":V})}const L=i.jsx("div",{ref:b,id:S,role:"tooltip",className:`${$r.tooltip} ${$r[s]} ${p?$r.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return i.jsxs(E,{ref:x,className:A,onMouseEnter:C,onMouseLeave:B,onFocus:D,onBlur:B,children:[$,j?TT.createPortal(L,document.body):null]})}const F3="_attemptSelector_ggigl_1",Z3="_attemptLabel_ggigl_17",K3="_attemptButton_ggigl_21",Y3="_attemptActive_ggigl_38",J3="_attemptStatus_ggigl_44",Pr={attemptSelector:F3,attemptLabel:Z3,attemptButton:K3,attemptActive:Y3,attemptStatus:J3};function W3({taskSessions:t,selectedSessionId:s,onSelect:o}){if(!(t.length<2))return i.jsxs("div",{className:Pr.attemptSelector,"data-testid":"attempt-selector",children:[i.jsx("span",{className:Pr.attemptLabel,children:"Attempts:"}),t.map((r,c)=>{const d=r.id===s,u=r.status==="stopped"&&r.endReason==="completed"?"✓":r.status==="stopped"?"✗":r.status==="running"||r.status==="idle"?"●":"";return i.jsxs("button",{className:`${Pr.attemptButton} ${d?Pr.attemptActive:""}`,onClick:()=>o(r.id),title:`Attempt #${c+1} — ${r.status}`,"aria-label":`Attempt #${c+1}, ${r.status}`,"aria-pressed":d,"data-testid":`attempt-${c+1}`,children:["#",c+1,u&&i.jsx("span",{className:Pr.attemptStatus,children:u})]},r.id)})]})}const X3="_row_ldkru_1",Q3="_hoverActions_ldkru_5",e6="_hoverButton_ldkru_31",t6="_selectingRow_ldkru_72",n6="_selected_ldkru_83",s6="_checkboxArea_ldkru_90",a6="_checkbox_ldkru_90",i6="_contentArea_ldkru_106",us={row:X3,hoverActions:Q3,hoverButton:e6,selectingRow:t6,selected:n6,checkboxArea:s6,checkbox:a6,contentArea:i6};function o6({copyText:t,isContentBearing:s,isSelecting:o,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:p,children:m}){const[g,v]=y.useState(!1),x=y.useRef(void 0);y.useEffect(()=>()=>{x.current!==void 0&&clearTimeout(x.current)},[]);const b=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),p==null||p(),x.current!==void 0&&clearTimeout(x.current),x.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,p]),k=y.useCallback(S=>{!o||S.target.closest("a, button, input, textarea, select, [role=button]")||(S.preventDefault(),u(S.shiftKey))},[o,u]);return s?o?i.jsxs("div",{className:`${us.row} ${us.selectingRow} ${r?us.selected:""}`,onClick:k,"data-testid":"event-selectable-row",children:[i.jsx("div",{className:us.checkboxArea,children:i.jsx("input",{type:"checkbox",checked:r,onChange:S=>{u(S.nativeEvent.shiftKey)},onClick:S=>{S.stopPropagation()},className:us.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),i.jsx("div",{className:us.contentArea,children:m})]}):i.jsxs("div",{className:us.row,"data-testid":"event-hover-row",children:[i.jsxs("div",{className:us.hoverActions,"data-testid":"event-hover-actions",children:[i.jsx("button",{type:"button",className:us.hoverButton,onClick:()=>{b().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?i.jsx(Mi,{size:dt,"aria-hidden":"true"}):i.jsx(Nx,{size:dt,"aria-hidden":"true"})}),i.jsx("button",{type:"button",className:us.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:i.jsx(gj,{size:dt,"aria-hidden":"true"})})]}),m]}):i.jsx("div",{className:us.row,children:m})}const r6="_bar_1vah7_1",l6="_left_1vah7_21",c6="_right_1vah7_27",d6="_count_1vah7_33",u6="_toggleButton_1vah7_40",f6="_copyButton_1vah7_68",p6="_cancelButton_1vah7_108",_i={bar:r6,left:l6,right:c6,count:d6,toggleButton:u6,copyButton:f6,cancelButton:p6};function m6({selectedCount:t,totalSelectable:s,onSelectAll:o,onDeselectAll:r,onCopy:c,onCancel:d}){const u=t>0&&t>=s;return i.jsxs(Rt.div,{className:_i.bar,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.15},"data-testid":"floating-action-bar",children:[i.jsxs("div",{className:_i.left,children:[i.jsxs("span",{className:_i.count,"data-testid":"floating-bar-count",children:[t," selected"]}),i.jsx("button",{type:"button",className:_i.toggleButton,onClick:u?r:o,"data-testid":"floating-bar-select-all",children:u?"Deselect all":"Select all"})]}),i.jsxs("div",{className:_i.right,children:[i.jsxs("button",{type:"button",className:_i.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[i.jsx(M2,{size:dt,"aria-hidden":"true"}),"Copy"]}),i.jsx("button",{type:"button",className:_i.cancelButton,onClick:d,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:i.jsx(Za,{size:dt,"aria-hidden":"true"})})]})]})}const A1=50;function h6(t,s,o,r,c=A1){return r?t<c:s-t-o<c}function g6(t,s){const o=s-t;return o>0?o:0}function v6({scrollRef:t,contentLength:s,isReversed:o,paused:r}){const[c,d]=y.useState(!0),u=y.useRef(0),p=y.useRef(!1),m=y.useRef(0);y.useEffect(()=>{const v=t.current;if(!v)return;let x=!0;const b=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const k=h6(v.scrollTop,v.scrollHeight,v.clientHeight,o,A1);k!==x&&(x=k,d(k))}))};return v.addEventListener("scroll",b,{passive:!0}),()=>{v.removeEventListener("scroll",b),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[t,o]),y.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,o?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,o]),y.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(o&&!c){const x=g6(u.current,v.scrollHeight);x>0&&(v.scrollTop+=x)}c&&(o?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),u.current=v.scrollHeight}},[s,c,o,r,t]);const g=y.useCallback(()=>{const v=t.current;if(!v)return;const x=o?0:v.scrollHeight;v.scrollTo({top:x,behavior:"smooth"}),d(!0)},[t,o]);return{isAtAnchor:c,scrollToAnchor:g}}const y6=new Set(["text","output","user_input","tool_use","tool_result","error"]);function dl(t){return y6.has(t.eventType)}function b6(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let o=t.content;if(t.content.trimStart().startsWith("{"))try{const r=JSON.parse(t.content);typeof r.content=="string"&&(o=r.content)}catch{}return o}case"tool_use":try{const o=JSON.parse(t.content),r=o.tool??"tool",c=o.args!==void 0?JSON.stringify(o.args,void 0,2):"";return`${r}
274
- ${c}`}catch{return t.content}default:return t.content}}function Jb(t){if(t==null)return"";if(typeof t!="object")return String(t);const s=t;return typeof s.command=="string"?`\`${s.command}\``:typeof s.file_path=="string"||typeof s.filePath=="string"?`\`${s.file_path??s.filePath}\``:typeof s.path=="string"?`\`${s.path}\``:typeof s.query=="string"?`\`${s.query}\``:typeof s.pattern=="string"?`\`${s.pattern}\``:""}function x6(t){var o;const s=[];for(const r of t){if(!dl(r))continue;const c=new Date(r.timestamp).toLocaleTimeString();switch(r.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
275
- ${r.content}`);break}case"user_input":{s.push(`**User** (${c}):
276
- ${r.content}`);break}case"tool_result":{let d=((o=r.toolUseCtx)==null?void 0:o.detailedResult)??void 0;if(!d&&(d=r.content,r.content.trimStart().startsWith("{")))try{const u=JSON.parse(r.content);typeof u.content=="string"&&(d=u.content)}catch{}if(r.toolUseCtx){const u=Jb(r.toolUseCtx.args),p=u?`**Tool: ${r.toolUseCtx.tool}** ${u}`:`**Tool: ${r.toolUseCtx.tool}**`;s.push(`${p} (${c}):
277
- ${d}`)}else s.push(`**Tool output** (${c}):
278
- ${d}`);break}case"tool_use":{let d="tool",u;try{const g=JSON.parse(r.content);d=g.tool??"tool",u=g.args}catch{}const p=Jb(u),m=p?`**Tool: ${d}** ${p}`:`**Tool: ${d}**`;u!==void 0?s.push(`${m} (${c}):
279
- \`\`\`json
280
- ${JSON.stringify(u,void 0,2)}
281
- \`\`\``):s.push(`${m} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
282
- ${r.content}`);break}}}return s.join(`
283
-
284
- `)}function _6({events:t,formatForClipboard:s}){const[o,r]=y.useState(!1),[c,d]=y.useState(new Set),u=y.useRef(void 0),p=y.useMemo(()=>c.size,[c]),m=y.useCallback(S=>{r(!0),S!==void 0?(d(new Set([S])),u.current=S):(d(new Set),u.current=void 0)},[]),g=y.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=y.useCallback((S,j)=>{if(j&&u.current!==void 0){const N=Math.min(u.current,S),T=Math.max(u.current,S);d(C=>{const D=new Set(C);for(let B=N;B<=T;B++)B<t.length&&dl(t[B])&&D.add(B);return D})}else d(N=>{const T=new Set(N);return T.has(S)?T.delete(S):T.add(S),T.size===0?(r(!1),u.current=void 0):u.current=S,T})},[t]),x=y.useCallback(()=>{const S=new Set;for(let j=0;j<t.length;j++)dl(t[j])&&S.add(j);d(S)},[t]),b=y.useCallback(()=>{d(new Set)},[]),k=y.useCallback(async()=>{const j=[...c].sort((T,C)=>T-C).filter(T=>T<t.length).map(T=>t[T]);if(j.length===0)return!1;const N=s(j);try{return await navigator.clipboard.writeText(N),!0}catch{return!1}},[c,t,s]);return{isSelecting:o,selectedIndices:c,selectedCount:p,enterSelectionMode:m,cancelSelection:g,toggleEvent:v,selectAll:x,deselectAll:b,copySelected:k}}const k6="_wrapper_1cdza_1",S6="_scrollContainer_1cdza_9",T6="_selectingPadding_1cdza_16",j6="_toolbar_1cdza_20",w6="_directionToggle_1cdza_27",N6="_scrollToAnchor_1cdza_65",C6="_scrollToAnchorBottom_1cdza_89",E6="_scrollToAnchorTop_1cdza_93",A6="_eventOverflowWarning_1cdza_97",ea={wrapper:k6,scrollContainer:S6,selectingPadding:T6,toolbar:j6,directionToggle:w6,scrollToAnchor:N6,scrollToAnchorBottom:C6,scrollToAnchorTop:E6,eventOverflowWarning:A6};function D6(t){const s=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"text":case"output":return`Select message from assistant at ${s}`;case"user_input":return`Select message from user at ${s}`;case"tool_result":case"tool_use":return`Select tool event at ${s}`;case"error":return`Select error at ${s}`;default:return`Select event at ${s}`}}const D1="grackle-stream-direction";function M6(){try{return localStorage.getItem(D1)==="reversed"}catch{return!1}}function R6({eventsDropped:t}){return t<=0?i.jsx(i.Fragment,{}):i.jsxs("div",{className:ea.eventOverflowWarning,role:"alert",children:[i.jsx(vm,{size:nn,"aria-hidden":"true"})," ",t.toLocaleString()," older event",t===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function ch({events:t,eventsDropped:s,emptyState:o,onShowToast:r}){const c=y.useRef(null),[d,u]=y.useState(M6),p=v3(),m=_6({events:t,formatForClipboard:x6}),g=y.useMemo(()=>t.filter(dl).length,[t]),v=y.useMemo(()=>d?[...t].reverse():t,[t,d]),{isAtAnchor:x,scrollToAnchor:b}=v6({scrollRef:c,contentLength:t.length,isReversed:d,paused:m.isSelecting}),k=()=>{const T=!d;u(T);try{localStorage.setItem(D1,T?"reversed":"default")}catch{}};y.useEffect(()=>{if(!m.isSelecting)return;const T=C=>{C.key==="Escape"&&m.cancelSelection()};return window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T)}},[m.isSelecting,m.cancelSelection]);const S=y.useCallback(async()=>{await m.copySelected()&&(r==null||r(`Copied ${m.selectedCount} message${m.selectedCount===1?"":"s"} to clipboard`,"success"))},[m,r]),j=p?0:.2,N=d?-8:8;return i.jsxs("div",{className:ea.wrapper,children:[i.jsx("div",{className:ea.toolbar,children:i.jsx(zo,{text:d?"Showing newest first":"Showing oldest first",children:i.jsx("button",{className:ea.directionToggle,onClick:k,"aria-label":d?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:d?i.jsx(vy,{size:nn,"aria-hidden":"true"}):i.jsx(yy,{size:nn,"aria-hidden":"true"})})})}),i.jsxs("div",{ref:c,className:`${ea.scrollContainer} ${m.isSelecting?ea.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,i.jsx(R6,{eventsDropped:s}),i.jsx(gs,{initial:!1,children:v.map((T,C)=>{const D=d?t.length-1-C:C;return i.jsx(Rt.div,{initial:{opacity:0,y:N},animate:{opacity:1,y:0},transition:{duration:j,ease:"easeOut"},children:i.jsx(o6,{copyText:b6(T),isContentBearing:dl(T),isSelecting:m.isSelecting,isSelected:m.selectedIndices.has(D),checkboxLabel:D6(T),onSelect:()=>{m.enterSelectionMode(D)},onToggle:B=>{m.toggleEvent(D,B)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:i.jsx(GA,{event:T,toolUseCtx:T.toolUseCtx,settled:T.settled})})},`${T.sessionId}-${T.timestamp}-${D}`)})})]}),i.jsx(gs,{children:m.isSelecting&&i.jsx(m6,{selectedCount:m.selectedCount,totalSelectable:g,onSelectAll:m.selectAll,onDeselectAll:m.deselectAll,onCopy:()=>{S().catch(()=>{})},onCancel:m.cancelSelection})}),i.jsx(gs,{children:!x&&i.jsxs(Rt.button,{className:`${ea.scrollToAnchor} ${d?ea.scrollToAnchorTop:ea.scrollToAnchorBottom}`,onClick:b,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[d?i.jsx(yy,{size:nn,"aria-hidden":"true"}):i.jsx(vy,{size:nn,"aria-hidden":"true"})," New events"]})})]})}function dh(t){const{value:s,onSave:o,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:p=!0,trimOnSave:m=!0}=t,[g,v]=y.useState(""),[x,b]=y.useState(""),k=y.useRef(!1),S=d===c,j=y.useCallback($=>{v($),b("")},[]),N=y.useCallback(()=>{b("")},[]),T=y.useCallback(()=>{k.current=!1,u==null||u(null),v(""),b("")},[u]),C=y.useCallback(()=>{const $=m?g.trim():g;if(r){const U=r(g);if(U){b(U);return}}const L=m?s.trim():s;if($===L){T();return}o($),T()},[g,s,m,r,o,T]),D=y.useCallback(()=>{k.current=!0,u==null||u(c),v(s),b("")},[c,s,u]),B=y.useCallback($=>{if(k.current){k.current=!1;return}$.relatedTarget instanceof HTMLElement&&$.relatedTarget.dataset.editAction===c||C()},[c,C]),E=y.useCallback($=>{$.key==="Escape"?T():$.key==="Enter"&&p&&C()},[T,p,C]),A=(()=>{if(!S)return!1;const $=m?s.trim():s;return(m?g.trim():g)!==$})();return y.useEffect(()=>{!S&&(g!==""||x!=="")&&(v(""),b(""))},[S,g,x]),{isEditing:S,draft:g,error:x,isDirty:A,startEdit:D,cancelEdit:T,save:C,setDraft:j,clearError:N,handleBlur:B,handleKeyDown:E,ignoreInitialBlurRef:k}}const I6="_editFieldWrapper_yuzty_1",O6="_editInput_yuzty_10",B6="_editTextarea_yuzty_42",L6="_editSelect_yuzty_78",z6="_editError_yuzty_111",$6="_editInputInvalid_yuzty_118",P6="_editHint_yuzty_123",U6="_unsavedDot_yuzty_132",H6="_metaValueClickable_yuzty_140",V6="_editButton_yuzty_159",q6="_metaPlaceholder_yuzty_175",G6="_worktreeToggle_yuzty_180",st={editFieldWrapper:I6,editInput:O6,editTextarea:B6,editSelect:L6,editError:z6,editInputInvalid:$6,editHint:P6,unsavedDot:U6,metaValueClickable:H6,editButton:V6,metaPlaceholder:q6,worktreeToggle:G6};function Ft(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,maxLength:x,ariaLabel:b,"data-testid":k}=t,S=y.useRef(null),j=dh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(j.isEditing){const T=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(T)}},[j.isEditing]),c==="create"){const T=D=>{m==null||m(D.target.value)},C=r==null?void 0:r(s);return i.jsxs("div",{className:st.editFieldWrapper,children:[i.jsx("input",{className:`${st.editInput} ${C?st.editInputInvalid:""}`,value:s,onChange:T,maxLength:x,placeholder:v,"aria-label":b,"data-testid":k?`${k}-input`:void 0}),C&&i.jsx("span",{className:st.editError,"data-testid":"edit-error",children:C})]})}if(j.isEditing)return i.jsxs("div",{className:st.editFieldWrapper,children:[i.jsx("input",{ref:S,className:`${st.editInput} ${j.error?st.editInputInvalid:""}`,value:j.draft,onChange:T=>j.setDraft(T.target.value),onBlur:j.handleBlur,onKeyDown:j.handleKeyDown,maxLength:x,placeholder:v,"aria-label":b,"data-testid":k?`${k}-input`:void 0}),j.isDirty&&i.jsx("span",{className:st.unsavedDot,title:"Unsaved changes"}),j.error&&i.jsx("span",{className:st.editError,"data-testid":"edit-error",children:j.error}),i.jsx("span",{className:st.editHint,children:"Enter to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:st.metaValueClickable,onClick:()=>j.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),j.startEdit())},title:"Click to edit","aria-label":b,"data-testid":k?`${k}-button`:void 0,children:[N!==void 0?N:s?i.jsx("span",{children:s}):i.jsx("span",{className:st.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:st.editButton,"aria-hidden":"true",children:"✏️"})]})}function cm(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:x,"data-testid":b}=t,k=y.useRef(null),S=dh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(S.isEditing){const N=window.setTimeout(()=>{var T;(T=k.current)==null||T.focus()},0);return()=>window.clearTimeout(N)}},[S.isEditing]),c==="create"){const N=C=>{m==null||m(C.target.value)},T=r==null?void 0:r(s);return i.jsxs("div",{className:st.editFieldWrapper,children:[i.jsx("textarea",{className:`${st.editTextarea} ${T?st.editInputInvalid:""}`,value:s,onChange:N,placeholder:v,"aria-label":x,"data-testid":b?`${b}-input`:void 0}),T&&i.jsx("span",{className:st.editError,"data-testid":"edit-error",children:T})]})}if(S.isEditing)return i.jsxs("div",{className:st.editFieldWrapper,children:[i.jsx("textarea",{ref:k,className:`${st.editTextarea} ${S.error?st.editInputInvalid:""}`,value:S.draft,onChange:N=>S.setDraft(N.target.value),onBlur:S.handleBlur,onKeyDown:S.handleKeyDown,title:x,"aria-label":x,"data-testid":b?`${b}-input`:void 0}),S.isDirty&&i.jsx("span",{className:st.unsavedDot,title:"Unsaved changes"}),S.error&&i.jsx("span",{className:st.editError,"data-testid":"edit-error",children:S.error}),i.jsx("span",{className:st.editHint,children:"Tab to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:st.metaValueClickable,onClick:()=>S.startEdit(),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),S.startEdit())},title:"Click to edit","aria-label":x,"data-testid":b?`${b}-button`:void 0,children:[j!==void 0?j:s?i.jsx("span",{children:s}):i.jsx("span",{className:st.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:st.editButton,"aria-hidden":"true",children:"✏️"})]})}function yd(t){var D;const{value:s,onSave:o,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:x,"data-testid":b}=t,k=y.useRef(null),S=dh({value:s,onSave:o,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(S.isEditing){const B=window.setTimeout(()=>{var E;(E=k.current)==null||E.focus()},0);return()=>window.clearTimeout(B)}},[S.isEditing]);const j=y.useCallback(B=>{const E=B.target.value;S.ignoreInitialBlurRef.current=!1,E!==s&&o(E),S.cancelEdit()},[s,o,S]),N=y.useCallback(B=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}B.relatedTarget instanceof HTMLElement&&B.relatedTarget.dataset.editAction===d||S.cancelEdit()},[d,S]);if(r==="create")return i.jsx("select",{className:st.editSelect,value:s,onChange:B=>m==null?void 0:m(B.target.value),"aria-label":x,"data-testid":b?`${b}-select`:void 0,children:c.map(B=>i.jsx("option",{value:B.value,children:B.label},B.value))});if(S.isEditing)return i.jsx("select",{ref:k,className:st.editSelect,value:S.draft,onChange:j,onBlur:N,title:x,"aria-label":x,"data-testid":b?`${b}-select`:void 0,children:c.map(B=>i.jsx("option",{value:B.value,children:B.label},B.value))});const T=g==null?void 0:g(s),C=(D=c.find(B=>B.value===s))==null?void 0:D.label;return i.jsxs("button",{type:"button",className:st.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":x,"data-testid":b?`${b}-button`:void 0,children:[T!==void 0?T:C?i.jsx("span",{children:C}):i.jsx("span",{className:st.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:st.editButton,"aria-hidden":"true",children:"✏️"})]})}function F6(t){const{checked:s,onChange:o,label:r,ariaLabel:c,"data-testid":d}=t;return i.jsxs("label",{className:st.worktreeToggle,"data-testid":d,children:[i.jsx("input",{type:"checkbox",checked:s,onChange:u=>o(u.target.checked),"aria-label":c}),i.jsx("span",{children:r})]})}const Z6="_nav_1snmp_1",K6="_searchForm_1snmp_8",Y6="_searchInput_1snmp_15",J6="_searchButton_1snmp_33",W6="_clearButton_1snmp_68",X6="_workspaceSelect_1snmp_85",Q6="_listHeader_1snmp_99",e5="_nodeList_1snmp_108",t5="_nodeItem_1snmp_116",n5="_indicator_1snmp_129",s5="_label_1snmp_136",a5="_badge_1snmp_145",Wn={nav:Z6,searchForm:K6,searchInput:Y6,searchButton:J6,clearButton:W6,workspaceSelect:X6,listHeader:Q6,nodeList:e5,nodeItem:t5,indicator:n5,label:s5,badge:a5};function i5({nodes:t,workspaces:s,loading:o,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:p}){const[m,g]=y.useState(""),v=y.useCallback(S=>{S.preventDefault(),m.trim()&&c(m.trim())},[m,c]),x=y.useCallback(()=>{g(""),d()},[d]),b=y.useCallback(S=>{u(S)},[u]),k=y.useCallback(S=>{g(""),p(S)},[p]);return i.jsxs("div",{className:Wn.nav,"data-testid":"knowledge-nav",children:[i.jsxs("form",{className:Wn.searchForm,onSubmit:v,children:[i.jsx("input",{className:Wn.searchInput,type:"text",placeholder:"Search...",value:m,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),i.jsx("button",{type:"submit",className:Wn.searchButton,disabled:o,children:"Go"})]}),r&&i.jsx("button",{type:"button",className:Wn.clearButton,onClick:x,children:"Clear search"}),i.jsxs("select",{className:Wn.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[i.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>i.jsx("option",{value:S.id,children:S.name},S.id))]}),i.jsxs("div",{className:Wn.listHeader,children:["Nodes (",t.length,")"]}),i.jsx("ul",{className:Wn.nodeList,children:t.map(S=>i.jsxs("li",{className:Wn.nodeItem,onClick:()=>{b(S.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),b(S.id))},role:"button",tabIndex:0,children:[i.jsx("span",{className:Wn.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),i.jsx("span",{className:Wn.label,children:S.label}),i.jsx("span",{className:Wn.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const o5="_container_bwu10_1",r5="_hamburger_bwu10_33",l5="_brand_bwu10_49",c5="_brandLogo_bwu10_68",d5="_info_bwu10_75",u5="_connectionLabel_bwu10_90",f5="_connectionDot_bwu10_103",p5="_connected_bwu10_106",m5="_disconnected_bwu10_110",h5="_connecting_bwu10_113",Ns={container:o5,hamburger:r5,brand:l5,brandLogo:c5,info:d5,connectionLabel:u5,connectionDot:f5,connected:p5,disconnected:m5,connecting:h5},g5={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},v5={connected:Ns.connected,connecting:Ns.connecting,disconnected:Ns.disconnected};function y5({connectionStatus:t,environments:s,sessions:o,onToggleSidebar:r,sidebarOpen:c}){const d=mt(),u=s.length,p=s.filter(v=>v.status==="connected").length,m=o.filter(v=>["running","idle"].includes(v.status)).length,g=g5[t];return i.jsxs("div",{className:Ns.container,children:[r&&i.jsx("button",{type:"button",className:Ns.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:i.jsx(Q2,{size:Nt,"aria-hidden":"true"})}),i.jsx(zo,{text:"Home",placement:"bottom",children:i.jsxs("button",{type:"button",className:Ns.brand,onClick:()=>d(Di),"data-testid":"statusbar-brand",children:[i.jsx("img",{src:"/icon-192x192.png",alt:"",className:Ns.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),i.jsxs("div",{className:Ns.info,children:[i.jsxs("span",{"aria-label":g,children:[i.jsx("span",{className:`${Ns.connectionDot} ${v5[t]}`,"aria-hidden":"true",children:i.jsx(Va,{size:ym,fill:"currentColor"})})," ",i.jsx("span",{className:Ns.connectionLabel,"aria-hidden":"true",children:g})]}),i.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),i.jsxs("span",{children:[m," active"]})]})]})}const b5="_nav_13gkc_1",x5="_tab_13gkc_35",_5="_tabIcon_13gkc_68",k5="_tabLabel_13gkc_79",S5="_tabActive_13gkc_84",Ur={nav:b5,tab:x5,tabIcon:_5,tabLabel:k5,tabActive:S5},sd=[{view:"dashboard",label:"Dashboard",icon:i.jsx(P2,{size:Nt}),route:Di,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:i.jsx(tj,{size:Nt}),route:wN,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:i.jsx(N2,{size:Nt}),route:NN,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:i.jsx(sj,{size:Nt}),route:Ro,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:i.jsx(b2,{size:Nt}),route:Wx,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:i.jsx(Cx,{size:Nt}),route:Ad,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:i.jsx(mj,{size:Nt}),route:_N,testId:"sidebar-tab-settings"}];function T5(t){return t===Di||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(Wx)?"knowledge":t.startsWith(Ad)?"findings":t.startsWith(wi)?"settings":"tasks"}function j5({tabs:t=sd}){const s=Yt(),o=mt(),r=y.useRef(null),c=T5(s.pathname),d=y.useCallback(p=>{o(p.route)},[o]),u=y.useCallback(p=>{var b,k;const m=(b=r.current)==null?void 0:b.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(S=>S===document.activeElement),v=g>=0?g:t.findIndex(S=>S.view===c);let x=v;if(p.key==="ArrowRight"||p.key==="j"||p.key==="J")p.preventDefault(),x=(v+1)%t.length;else if(p.key==="ArrowLeft"||p.key==="k"||p.key==="K")p.preventDefault(),x=(v-1+t.length)%t.length;else if(p.key==="Home")p.preventDefault(),x=0;else if(p.key==="End")p.preventDefault(),x=t.length-1;else return;o(t[x].route),(k=m[x])==null||k.focus()},[c,o,t]);return i.jsx("nav",{className:Ur.nav,ref:r,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:t.map(p=>{const m=p.view===c;return i.jsx(zo,{text:p.label,placement:"bottom",children:i.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Ur.tab} ${m?Ur.tabActive:""}`,onClick:()=>d(p),"data-testid":p.testId,"aria-label":p.label,children:[i.jsx("span",{className:Ur.tabIcon,"aria-hidden":"true",children:p.icon}),i.jsx("span",{className:Ur.tabLabel,children:p.label})]})},p.view)})})}const w5="_container_pi6ii_1",N5="_content_pi6ii_66",Wb={container:w5,content:N5},C5=320,M1=220,R1=600,I1="grackle-sidebar-width";function E5(){try{const t=localStorage.getItem(I1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=M1&&s<=R1)return s}}catch{}return C5}function A5(t){try{localStorage.setItem(I1,String(t))}catch{}}function D5({content:t}){const[s]=y.useState(E5),o=y.useRef(null);if(y.useEffect(()=>{const r=o.current;if(!r)return;const c=new ResizeObserver(d=>{for(const u of d){const p=u.borderBoxSize[0];if(p){const m=Math.round(p.inlineSize);m>=M1&&m<=R1&&A5(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return i.jsx("div",{className:Wb.container,ref:o,"data-testid":"sidebar",style:{width:s},children:i.jsx("div",{className:Wb.content,children:t})})}const M5="_bar_tnfsh_1",R5="_btnPrimary_tnfsh_32",I5="_statusText_tnfsh_85",O5="_statusCompleted_tnfsh_90",B5="_statusFailed_tnfsh_94",L5="_statusBlocked_tnfsh_98",z5="_hintText_tnfsh_103",jt={bar:M5,btnPrimary:R5,statusText:I5,statusCompleted:O5,statusFailed:B5,statusBlocked:L5,hintText:z5};function $5({sessions:t,tasks:s,environments:o}){const r=mt(),c=Yt(),d=Dt("/sessions/:sessionId"),u=Dt("/tasks/:taskId"),p=Dt("/tasks/:taskId/stream"),m=Dt("/tasks/:taskId/findings"),g=Dt("/tasks/:taskId/edit"),v=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),x=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),b=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),k=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),S=Dt("/sessions/new"),j=Dt("/environments/:environmentId/workspaces/:workspaceId"),N=Dt("/tasks/new"),T=Dt("/chat"),C=Dt("/"),D=Dt("/settings/*"),B=d==null?void 0:d.params.sessionId,E=(u==null?void 0:u.params.taskId)??(p==null?void 0:p.params.taskId)??(m==null?void 0:m.params.taskId)??(v==null?void 0:v.params.taskId)??(x==null?void 0:x.params.taskId)??(b==null?void 0:b.params.taskId)??(k==null?void 0:k.params.taskId),A=v??x??b??k,$=(A==null?void 0:A.params.environmentId)??(j==null?void 0:j.params.environmentId),L=c.pathname.startsWith("/environments")&&!j&&!A,U=!!T,J=!!S,V=!!j&&!v&&!x&&!b&&!k,K=!!N;if(!!C&&!J&&!V&&!K||!!D||(!!g||!!k)||K||L||J)return i.jsx(i.Fragment,{});if(U)return o.find(O=>O.adapterType==="local"&&O.status==="connected")?i.jsx(i.Fragment,{}):i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Add a local environment to start chatting"})});if(V)return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Select a task or click + to create one"})});if(E){const M=s.find(he=>he.id===E);if(!M)return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Loading..."})});const O=new Map(s.map(he=>[he.id,he])),X=M.dependsOn.some(he=>{const W=O.get(he);return W!==void 0&&W.status!=="complete"});if(M.status==="not_started"){const he=X?M.dependsOn.map(W=>O.get(W)).filter(W=>W&&W.status!=="complete").map(W=>W.title):[];return i.jsx("div",{className:jt.bar,children:X?i.jsxs("span",{className:jt.statusBlocked,children:["Blocked by: ",he.join(", ")]}):i.jsx("span",{className:jt.hintText,children:"Use the buttons above to start or manage this task"})})}if(M.status==="working"||M.status==="paused"){const he=M.latestSessionId||void 0,W=he?t.find(fe=>fe.id===he):void 0;return W&&W.status!=="stopped"?i.jsx(i.Fragment,{}):i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Waiting for agent..."})})}if(M.status==="complete")return i.jsxs("div",{className:jt.bar,children:[i.jsx("span",{className:`${jt.statusText} ${jt.statusCompleted}`,children:"Task completed"}),i.jsx("button",{onClick:()=>r(Ii(M.workspaceId,void 0,$)),className:jt.btnPrimary,children:"+ New Task"})]});if(M.status==="failed")return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:`${jt.statusText} ${jt.statusFailed}`,children:"Task failed"})})}if(B){const M=t.find(he=>he.id===B),O=(M==null?void 0:M.status)==="stopped";if(M!==void 0&&!O)return i.jsx(i.Fragment,{});if(O)return i.jsxs("div",{className:jt.bar,children:[i.jsxs("span",{className:`${jt.statusText} ${jt.hintText}`,children:["Session ",M.endReason||M.status]}),i.jsx("button",{onClick:()=>r(Zx(M.environmentId)),className:jt.btnPrimary,children:"+ New Chat"})]})}return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Loading..."})})}const P5="_nav_14i94_1",U5="_tab_14i94_24",H5="_tabActive_14i94_62",V5="_tabLabel_14i94_75",q5="_statusDot_14i94_81",G5="_pulse_14i94_87",F5="_addButton_14i94_99",Z5="_empty_14i94_132",Ba={nav:P5,tab:U5,tabActive:H5,tabLabel:V5,statusDot:q5,pulse:G5,addButton:F5,empty:Z5},K5={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function Y5({environments:t}){const s=mt(),o=y.useRef(null),r=Dt("/environments/:environmentId"),c=Dt("/environments/:environmentId/edit"),d=Dt("/environments/:environmentId/workspaces/:workspaceId"),u=Dt("/environments/:environmentId/workspaces/:workspaceId/*"),p=(r==null?void 0:r.params.environmentId)??(c==null?void 0:c.params.environmentId)??(d==null?void 0:d.params.environmentId)??(u==null?void 0:u.params.environmentId),m=p==="new"?void 0:p,g=y.useCallback(b=>{s(Ai(b))},[s]),v=y.useCallback(b=>{var T;const k=(T=o.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),j=S>=0?S:t.findIndex(C=>C.id===m);let N=j;if(b.key==="ArrowDown"||b.key==="j"||b.key==="J")b.preventDefault(),N=(j+1)%k.length;else if(b.key==="ArrowUp"||b.key==="k"||b.key==="K")b.preventDefault(),N=(j-1+k.length)%k.length;else if(b.key==="Home")b.preventDefault(),N=0;else if(b.key==="End")b.preventDefault(),N=k.length-1;else return;N<t.length&&s(Ai(t[N].id)),k[N].focus()},[m,t,s]),x=m??(t.length>0?t[0].id:void 0);return i.jsxs("div",{className:Ba.nav,"data-testid":"environment-nav",children:[i.jsx("nav",{ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(b=>{const k=b.id===m,S=b.id===x,j=K5[b.status]||"var(--text-tertiary)",N=b.status==="connected";return i.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${Ba.tab} ${k?Ba.tabActive:""}`,onClick:()=>g(b.id),"data-testid":"env-nav-item",children:[i.jsx("span",{className:`${Ba.statusDot} ${N?Ba.pulse:""}`,style:{color:j},"aria-hidden":"true",children:i.jsx(Va,{size:ym,fill:"currentColor"})}),i.jsx("span",{className:Ba.tabLabel,title:b.displayName||b.id,children:b.displayName||b.id})]},b.id)})}),i.jsx("button",{type:"button",className:Ba.addButton,onClick:()=>s(bN),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&i.jsx("div",{className:Ba.empty,children:"No environments yet."})]})}function $o(t){const s=new Date(t),o=new Date,r=o.getTime()-s.getTime(),c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return"just now";if(d<60)return`${d}m ago`;if(u<24)return`${u}h ago`;if(p===1)return"yesterday";if(p<7)return`${p} days ago`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}function O1(t){const s=new Date(t);if(Number.isNaN(s.getTime()))return"—";const o=new Date,r=s.getTime()-o.getTime();if(r<=0)return"overdue";const c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return`in ${c}s`;if(d<60)return`in ${d}m`;if(u<24)return`in ${u}h`;if(p<7)return`in ${p} day${p===1?"":"s"}`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Xb={architecture:{text:"var(--accent-blue)",bg:"var(--accent-blue-dim)"},api:{text:"var(--accent-green)",bg:"var(--accent-green-dim)"},bug:{text:"var(--accent-red)",bg:"var(--accent-red-dim)"},decision:{text:"var(--accent-yellow)",bg:"var(--accent-yellow-dim)"},dependency:{text:"var(--accent-purple)",bg:"var(--accent-purple-dim)"},pattern:{text:"var(--accent-cyan)",bg:"var(--accent-cyan-dim)"},general:{text:"var(--text-secondary)",bg:"var(--bg-elevated)"}};function bd(t){return Xb[t]||Xb.general}const J5="_nav_dlm8m_1",W5="_categoryPills_dlm8m_24",X5="_categoryPill_dlm8m_24",Q5="_tab_dlm8m_42",eI="_tabActive_dlm8m_80",tI="_tabContent_dlm8m_93",nI="_tabLabel_dlm8m_100",sI="_tabMeta_dlm8m_106",aI="_categoryDot_dlm8m_111",iI="_empty_dlm8m_118",js={nav:J5,categoryPills:W5,categoryPill:X5,tab:Q5,tabActive:eI,tabContent:tI,tabLabel:nI,tabMeta:sI,categoryDot:aI,empty:iI};function oI({findings:t,workspaceId:s,environmentId:o}){const r=mt(),c=y.useRef(null),d=Dt("/findings/:findingId"),u=Dt("/environments/:environmentId/workspaces/:workspaceId/findings/:findingId"),p=(d==null?void 0:d.params.findingId)??(u==null?void 0:u.params.findingId),m=y.useMemo(()=>{const b=new Set(t.map(k=>k.category).filter(Boolean));return Array.from(b).sort()},[t]),g=y.useCallback(b=>{r(qp(b,s,o))},[r,s,o]),v=y.useCallback(b=>{var T;const k=(T=c.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),j=S>=0?S:t.findIndex(C=>C.id===p);let N=j;if(b.key==="ArrowDown"||b.key==="j"||b.key==="J")b.preventDefault(),N=(j+1)%k.length;else if(b.key==="ArrowUp"||b.key==="k"||b.key==="K")b.preventDefault(),N=(j-1+k.length)%k.length;else if(b.key==="Home")b.preventDefault(),N=0;else if(b.key==="End")b.preventDefault(),N=k.length-1;else return;N<t.length&&r(qp(t[N].id,s,o)),k[N].focus()},[p,t,r,s,o]),x=p??(t.length>0?t[0].id:void 0);return i.jsxs("div",{className:js.nav,"data-testid":"findings-nav",children:[m.length>1&&i.jsx("div",{className:js.categoryPills,"data-testid":"findings-nav-categories",children:m.map(b=>i.jsx("span",{className:js.categoryPill,style:{color:bd(b).text},children:b},b))}),i.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(b=>{const k=b.id===p,S=b.id===x;return i.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${js.tab} ${k?js.tabActive:""}`,onClick:()=>g(b.id),"data-testid":"finding-nav-item",children:[i.jsx("span",{className:js.categoryDot,style:{color:bd(b.category).text},"aria-hidden":"true",children:i.jsx(Va,{size:ym,fill:"currentColor"})}),i.jsxs("span",{className:js.tabContent,children:[i.jsx("span",{className:js.tabLabel,title:b.title,children:b.title}),i.jsx("span",{className:js.tabMeta,title:b.createdAt,children:$o(b.createdAt)})]})]},b.id)})}),t.length===0&&i.jsx("div",{className:js.empty,children:"No findings yet. Agents will post discoveries here."})]})}function rI(t){if(t.length===0)return[];const s=[...t].sort((r,c)=>r[0]-c[0]),o=[[s[0][0],s[0][1]]];for(let r=1;r<s.length;r++){const c=o[o.length-1],[d,u]=s[r];d<=c[1]+1?c[1]=Math.max(c[1],u):o.push([d,u])}return o}function B1({text:t,indices:s,highlightClass:o}){if(!s||s.length===0)return i.jsx(i.Fragment,{children:t});const r=rI(s),c=[];let d=0;for(const[u,p]of r)u>d&&c.push(i.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(i.jsx("mark",{className:o,children:t.slice(u,p+1)},`m${u}`)),d=p+1;return d<t.length&&c.push(i.jsx("span",{children:t.slice(d)},`p${d}`)),i.jsx(i.Fragment,{children:c})}function lI(t){const s=new Map(t.map(r=>[r.id,{...r,children:[]}])),o=[];for(const r of s.values())r.parentTaskId&&s.has(r.parentTaskId)?s.get(r.parentTaskId).children.push(r):o.push(r);for(const r of s.values())r.children.sort((c,d)=>c.sortOrder-d.sortOrder);return o.sort((r,c)=>r.sortOrder-c.sortOrder)}function cI(t,s){const o=new Map;for(const d of t){const p=d.dependsOn.length>0&&d.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":d.status,m=o.get(p);m?m.push(d):o.set(p,[d])}const r=[],c=new Set;for(const d of Sj){c.add(d);const u=o.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=qa(d);r.push({status:d,label:p.label,style:p,tasks:u})}}for(const[d,u]of o)if(!c.has(d)&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=qa(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const dI="_container_z4i38_1",uI="_header_z4i38_5",fI="_headerActions_z4i38_17",pI="_searchInput_z4i38_23",mI="_searchHighlight_z4i38_56",hI="_groupToggle_z4i38_62",gI="_groupToggleActive_z4i38_89",vI="_addButton_z4i38_93",yI="_taskRow_z4i38_120",bI="_selected_z4i38_140",xI="_expandArrow_z4i38_150",_I="_expanded_z4i38_157",kI="_leafSpacer_z4i38_161",SI="_taskStatusIcon_z4i38_166",TI="_taskTitle_z4i38_170",jI="_workspaceBadge_z4i38_177",wI="_childCountBadge_z4i38_195",NI="_dependencyBadge_z4i38_208",CI="_blockedBadge_z4i38_220",EI="_addChildButton_z4i38_225",AI="_emptyState_z4i38_268",DI="_statusGroupHeader_z4i38_275",MI="_statusGroupIcon_z4i38_294",RI="_statusGroupLabel_z4i38_298",II="_statusGroupCount_z4i38_303",Ze={container:dI,header:uI,headerActions:fI,searchInput:pI,searchHighlight:mI,groupToggle:hI,groupToggleActive:gI,addButton:vI,taskRow:yI,selected:bI,expandArrow:xI,expanded:_I,leafSpacer:kI,taskStatusIcon:SI,taskTitle:TI,workspaceBadge:jI,childCountBadge:wI,dependencyBadge:NI,blockedBadge:CI,addChildButton:EI,emptyState:AI,statusGroupHeader:DI,statusGroupIcon:MI,statusGroupLabel:RI,statusGroupCount:II},OI=[{name:"title",weight:2},{name:"description",weight:1}],L1=16,BI=16,z1="grackle-task-group-by-status";function Qb(){try{return localStorage.getItem(z1)==="true"}catch{return!1}}function LI(t){try{localStorage.setItem(z1,String(t))}catch{}}function zI({group:t,isExpanded:s,onToggle:o,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return i.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[i.jsxs("div",{className:Ze.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:o,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o())},children:[i.jsx("span",{className:`${Ze.expandArrow} ${s?Ze.expanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),i.jsx("span",{className:Ze.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),i.jsx("span",{className:Ze.statusGroupLabel,children:t.label}),i.jsx("span",{className:Ze.statusGroupCount,children:t.tasks.length})]}),i.jsx(gs,{children:s&&i.jsx(Rt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:t.tasks.map(p=>{const m=qa(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return i.jsxs("div",{onClick:()=>c(On(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:x=>{x.currentTarget===x.target&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),c(On(p.id)))},className:`${Ze.taskRow} ${g?Ze.selected:""}`,style:{"--task-indent":`${L1}px`},"data-task-id":p.id,children:[i.jsx("span",{className:Ze.leafSpacer}),i.jsx("span",{className:Ze.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${ul(p.status)}`,children:m.icon}),i.jsx("span",{className:Ze.taskTitle,title:p.title,children:i.jsx(B1,{text:p.title,indices:d.get(p.id),highlightClass:Ze.searchHighlight})}),v&&i.jsx("span",{className:Ze.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function $1({node:t,depth:s,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=qa(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(T=>u.get(T)!=="complete"),x=o.has(t.id),b=t.children.length>0,k=c===t.id,S=L1+s*BI,N=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{onClick:()=>d(On(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:T=>{T.currentTarget===T.target&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),d(On(t.id)))},className:`${Ze.taskRow} ${k?Ze.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[b&&i.jsx("span",{className:`${Ze.expandArrow} ${x?Ze.expanded:""}`,role:"button",tabIndex:0,"aria-label":x?"Collapse task":"Expand task",onClick:T=>{T.stopPropagation(),r(t.id)},onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),r(t.id))},children:i.jsx(la,{size:dt,"aria-hidden":"true"})}),!b&&i.jsx("span",{className:Ze.leafSpacer}),i.jsx("span",{className:Ze.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${ul(t.status)}`,children:g.icon}),i.jsx("span",{className:Ze.taskTitle,title:t.title,children:i.jsx(B1,{text:t.title,indices:p.get(t.id),highlightClass:Ze.searchHighlight})}),N&&i.jsx("span",{className:Ze.workspaceBadge,title:N,children:N}),b&&i.jsxs("span",{className:Ze.childCountBadge,children:[t.children.filter(T=>T.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&i.jsx("span",{className:`${Ze.dependencyBadge} ${v?Ze.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<DT&&i.jsx(zo,{text:"Add child task",children:i.jsx("button",{onClick:T=>{T.stopPropagation(),d(Ii(t.workspaceId,t.id))},"aria-label":"Add child task",className:Ze.addChildButton,children:"+"})})]}),i.jsx(gs,{children:b&&x&&i.jsx(Rt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:t.children.map(T=>i.jsx($1,{node:T,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},T.id))})})]})}function $I({workspaces:t,tasks:s}){const o=mt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,m]=y.useState(Qb),[g,v]=y.useState(Qb),[x,b]=y.useState(new Map),k=Dt("/tasks/:taskId/*"),S=(k==null?void 0:k.params.taskId)!=="new"?k==null?void 0:k.params.taskId:void 0,j=y.useMemo(()=>new Map(s.map(ee=>[ee.id,ee.status])),[s]),N=y.useMemo(()=>new Map(t.map(ee=>[ee.id,ee.name])),[t]),T=()=>{const ee=!p;LI(ee),m(ee),ee&&(v(!0),b(new Map))},C=ee=>{b(ie=>{const M=new Map(ie),O=M.has(ee)?M.get(ee):g;return M.set(ee,!O),M})},D=ee=>x.has(ee)?x.get(ee):g,B=ee=>{c(ie=>{const M=new Set(ie);return M.has(ee)?(M.delete(ee),u(O=>new Set(O).add(ee))):(M.add(ee),u(O=>{const X=new Set(O);return X.delete(ee),X})),M})};y.useEffect(()=>{const ee=new Set(s.filter(ie=>ie.parentTaskId).map(ie=>ie.parentTaskId));ee.size>0&&c(ie=>{const M=new Set(ie);for(const O of ee)d.has(O)||M.add(O);return M})},[s,d]);const[E,A]=y.useState(""),{directMatchTaskIds:$,treeMatchTaskIds:L,titleHighlights:U}=y.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const ee=AT(s,E,OI),ie=new Set(ee.map(he=>he.item.id)),M=new Map;for(const he of ee){const W=he.matches.find(ye=>ye.key==="title");W&&M.set(he.item.id,W.indices)}const O=new Set(ie),X=new Map(s.map(he=>[he.id,he]));for(const he of[...ie]){let W=X.get(he);for(;W!=null&&W.parentTaskId;)O.add(W.parentTaskId),W=X.get(W.parentTaskId)}return{directMatchTaskIds:ie,treeMatchTaskIds:O,titleHighlights:M}},[E,s]),J=$!==null,V=J?p?$:L:null,K=V?s.filter(ee=>V.has(ee.id)):s,de=p?[]:lI(K);return i.jsxs("div",{className:Ze.container,children:[i.jsxs("div",{className:Ze.header,children:[i.jsx("span",{children:"Tasks"}),i.jsxs("div",{className:Ze.headerActions,children:[i.jsx(zo,{text:p?"Switch to tree view":"Group tasks by status",children:i.jsx("button",{className:`${Ze.groupToggle} ${p?Ze.groupToggleActive:""}`,onClick:T,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,"data-testid":"task-group-by-status-toggle",children:i.jsx(Y2,{size:nn})})}),i.jsx(zo,{text:"New task",children:i.jsx("button",{className:Ze.addButton,onClick:()=>o(Ii()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&i.jsx("input",{type:"text",value:E,onChange:ee=>A(ee.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Ze.searchInput,"data-testid":"sidebar-search"}),p?cI(K,j).map(ee=>i.jsx(zI,{group:ee,isExpanded:D(ee.status),onToggle:()=>C(ee.status),selectedTaskId:S,navigate:o,titleHighlights:U,workspaceNames:N},ee.status)):de.map(ee=>i.jsx($1,{node:ee,depth:0,expandedTasks:r,toggleTask:B,selectedTaskId:S,navigate:o,taskStatusById:j,titleHighlights:U,workspaceNames:N},ee.id)),K.length===0&&!J&&i.jsx("div",{className:Ze.emptyState,children:"No tasks yet. Click + to create one."}),K.length===0&&J&&i.jsx("div",{className:Ze.emptyState,children:"No matching tasks"})]})}const PI="_toast_ed2dk_1",UI="_success_ed2dk_18",HI="_icon_ed2dk_22",VI="_error_ed2dk_25",qI="_warning_ed2dk_32",GI="_info_ed2dk_38",FI="_message_ed2dk_53",ZI="_close_ed2dk_60",Hr={toast:PI,success:UI,icon:HI,error:VI,warning:qI,info:GI,message:FI,close:ZI},KI={success:i.jsx(Mi,{size:Nt}),error:i.jsx(Za,{size:Nt}),warning:i.jsx(vm,{size:Nt}),info:i.jsx(gm,{size:Nt})};function YI({toast:t,onDismiss:s}){return y.useEffect(()=>{const o=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(o)},[t.id,t.duration,s]),i.jsxs(Rt.div,{className:`${Hr.toast} ${Hr[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[i.jsx("span",{className:Hr.icon,"aria-hidden":"true",children:KI[t.variant]}),i.jsx("span",{className:Hr.message,children:t.message}),i.jsx("button",{type:"button",className:Hr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:i.jsx(Za,{size:nn,"aria-hidden":"true"})})]})}const JI="_container_qqse2_1",WI={container:JI};function XI({toasts:t,onDismiss:s}){return i.jsx("div",{className:WI.container,"data-testid":"toast-container",children:i.jsx(gs,{children:t.map(o=>i.jsx(YI,{toast:o,onDismiss:s},o.id))})})}const QI="_callout_e5awm_1",eO="_success_e5awm_11",tO="_icon_e5awm_15",nO="_error_e5awm_18",sO="_warning_e5awm_25",aO="_info_e5awm_32",iO="_content_e5awm_48",oO="_close_e5awm_53",Vr={callout:QI,success:eO,icon:tO,error:nO,warning:sO,info:aO,content:iO,close:oO},rO={success:i.jsx(Mi,{size:Nt}),error:i.jsx(Za,{size:Nt}),warning:i.jsx(vm,{size:Nt}),info:i.jsx(gm,{size:Nt})};function lO({variant:t="info",children:s,dismissible:o=!1,className:r}){const[c,d]=y.useState(!1);return i.jsx(i.Fragment,{children:!c&&i.jsxs("div",{className:[Vr.callout,Vr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[i.jsx("span",{className:Vr.icon,"aria-hidden":"true",children:rO[t]}),i.jsx("span",{className:Vr.content,children:s}),o&&i.jsx("button",{type:"button",className:Vr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:i.jsx(Za,{size:nn,"aria-hidden":"true"})})]})})}function cO({currentVersion:t,latestVersion:s,updateAvailable:o,isDocker:r}){if(!o)return i.jsx(i.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return i.jsx("div",{"data-testid":"update-banner",children:i.jsxs(lO,{variant:"info",dismissible:!0,children:[i.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",i.jsx("code",{children:c})]})})}const dO="_container_de44x_1",uO="_emptyState_de44x_8",fO="_card_de44x_14",pO="_cardClickable_de44x_34",mO="_cardHeader_de44x_42",hO="_categoryBadge_de44x_54",gO="_findingTitle_de44x_62",vO="_findingDate_de44x_68",yO="_findingContent_de44x_80",bO="_tags_de44x_86",xO="_tag_de44x_86",fs={container:dO,emptyState:uO,card:fO,cardClickable:pO,cardHeader:mO,categoryBadge:hO,findingTitle:gO,findingDate:vO,findingContent:yO,tags:bO,tag:xO};function P1({findings:t,onFindingClick:s}){return t.length===0?i.jsx("div",{className:fs.emptyState,children:"No findings yet. Agents will post discoveries here."}):i.jsx("div",{className:fs.container,children:t.map((o,r)=>{const c=bd(o.category),d=s?Rt.button:Rt.div;return i.jsxs(d,{type:s?"button":void 0,className:`${fs.card} ${s?fs.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},onClick:s?()=>{s(o.id)}:void 0,children:[i.jsxs("div",{className:fs.cardHeader,children:[i.jsx("span",{className:fs.categoryBadge,style:{background:c.bg,color:c.text},children:o.category}),i.jsx("span",{className:fs.findingTitle,children:o.title}),i.jsx("span",{className:fs.findingDate,title:o.createdAt,children:$o(o.createdAt)})]}),i.jsx("div",{className:fs.findingContent,children:o.content.length>300?o.content.slice(0,300)+"...":o.content}),o.tags.length>0&&i.jsx("div",{className:fs.tags,children:o.tags.map(u=>i.jsx("span",{className:fs.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:u},u))})]},o.id)})})}const _O="_container_m1fsr_1",kO="_heading_m1fsr_7",SO="_section_m1fsr_14",TO="_sectionTitle_m1fsr_26",jO="_sectionDescription_m1fsr_35",wO="_emptyState_m1fsr_41",NO="_tokenList_m1fsr_48",CO="_tokenRow_m1fsr_55",EO="_tokenBadge_m1fsr_68",AO="_tokenName_m1fsr_83",DO="_tokenTarget_m1fsr_90",MO="_deleteButton_m1fsr_99",RO="_addForm_m1fsr_113",IO="_formRow_m1fsr_119",OO="_input_m1fsr_125",BO="_select_m1fsr_155",LO="_addButton_m1fsr_187",zO="_emptyStateInfo_m1fsr_221",$O="_themeOptions_m1fsr_229",PO="_themeOption_m1fsr_229",UO="_themeOptionSelected_m1fsr_254",HO="_themeOptionHeader_m1fsr_259",VO="_themeOptionLabel_m1fsr_266",qO="_themeOptionDesc_m1fsr_273",GO="_variantToggle_m1fsr_279",FO="_variantButton_m1fsr_286",ZO="_variantActive_m1fsr_305",KO="_themeSwatches_m1fsr_311",YO="_themeSwatch_m1fsr_311",JO="_systemToggle_m1fsr_325",WO="_systemToggleHint_m1fsr_341",XO="_themeActive_m1fsr_348",QO="_aboutGrid_m1fsr_354",eB="_aboutItem_m1fsr_360",tB="_aboutLabel_m1fsr_373",nB="_aboutValue_m1fsr_379",sB="_aboutDot_m1fsr_387",aB="_aboutDotConnected_m1fsr_394",iB="_aboutDotDisconnected_m1fsr_398",oB="_aboutDotConnecting_m1fsr_402",pe={container:_O,heading:kO,section:SO,sectionTitle:TO,sectionDescription:jO,emptyState:wO,tokenList:NO,tokenRow:CO,tokenBadge:EO,tokenName:AO,tokenTarget:DO,deleteButton:MO,addForm:RO,formRow:IO,input:OO,select:BO,addButton:LO,emptyStateInfo:zO,themeOptions:$O,themeOption:PO,themeOptionSelected:UO,themeOptionHeader:HO,themeOptionLabel:VO,themeOptionDesc:qO,variantToggle:GO,variantButton:FO,variantActive:ZO,themeSwatches:KO,themeSwatch:YO,systemToggle:JO,systemToggleHint:WO,themeActive:XO,aboutGrid:QO,aboutItem:eB,aboutLabel:tB,aboutValue:nB,aboutDot:sB,aboutDotConnected:aB,aboutDotDisconnected:iB,aboutDotConnecting:oB},rB=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function lB({tokens:t,onSetToken:s,onDeleteToken:o,onShowToast:r}){const[c,d]=y.useState(""),[u,p]=y.useState(""),[m,g]=y.useState("env_var"),[v,x]=y.useState(""),[b,k]=y.useState(null),S=T=>{if(T.preventDefault(),!c||!u)return;const C=m==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,u,m,C,m==="file"?v:""),r==null||r("Token saved successfully","success"),d(""),p(""),x("")},j=T=>{k(T)},N=()=>{b&&(o(b),r==null||r("Token deleted","info")),k(null)};return i.jsxs(i.Fragment,{children:[i.jsx(oa,{isOpen:b!==null,title:"Delete Token?",description:b?`"${b}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>k(null)}),i.jsxs("section",{className:pe.section,children:[i.jsx("h3",{className:pe.sectionTitle,children:"Tokens"}),i.jsx("p",{className:pe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?i.jsx("div",{className:pe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):i.jsx("div",{className:pe.tokenList,children:t.map(T=>i.jsxs("div",{className:pe.tokenRow,children:[i.jsx("span",{className:pe.tokenBadge,children:T.tokenType}),i.jsx("span",{className:pe.tokenName,children:T.name}),i.jsx("span",{className:pe.tokenTarget,children:T.tokenType==="env_var"?T.envVar:T.filePath}),i.jsx("button",{className:pe.deleteButton,onClick:()=>j(T.name),title:`Delete ${T.name}`,"aria-label":`Delete ${T.name}`,children:i.jsx(Za,{size:nn,"aria-hidden":"true"})})]},T.name))}),i.jsxs("form",{className:pe.addForm,onSubmit:S,children:[i.jsxs("div",{className:pe.formRow,children:[i.jsx("input",{className:pe.input,type:"text",placeholder:"Token name",value:c,onChange:T=>d(T.target.value)}),i.jsx("input",{className:pe.input,type:"password",placeholder:"Value",value:u,onChange:T=>p(T.target.value)})]}),i.jsxs("div",{className:pe.formRow,children:[i.jsx("select",{className:pe.select,value:m,onChange:T=>g(T.target.value),children:rB.map(T=>i.jsx("option",{value:T.value,children:T.label},T.value))}),i.jsx("input",{className:pe.input,type:"text",placeholder:m==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:T=>x(T.target.value)}),i.jsx("button",{className:pe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const Ld=[{id:"grackle",label:"Grackle",description:"The default Grackle theme — iridescent purple on clean dark.",swatches:["#0e1218","#8b5cf6","#60a5fa","#e5e7eb","#34d399"],variantLightId:"grackle-light",variantDarkId:"grackle-dark"},{id:"grackle-light",label:"Grackle Light",description:"Light Grackle variant.",hidden:!0},{id:"grackle-dark",label:"Grackle Dark",description:"Dark Grackle variant.",hidden:!0},{id:"glass",label:"Glassmorphism",description:"Dark frosted-glass aesthetic with backdrop blur effects.",swatches:["#0a0c14","#4ecca3","#70a1ff","#e2e8f0","#a855f7"]},{id:"matrix",label:"Matrix",description:"Phosphor-green CRT terminal with scanlines and glow.",swatches:["#050505","#00ff41","#00bfff","#33ff77","#ffb000"]},{id:"brutalist",label:"Neubrutalism",description:"Thick borders, raw colors, bold type — ugly on purpose.",swatches:["#f5f0e8","#ff5757","#5ce1e6","#1a1a1a","#ffde59"],variantLightId:"brutalist-light",variantDarkId:"brutalist-dark"},{id:"brutalist-light",label:"Neubrutalism Light",description:"Light neubrutalism variant.",hidden:!0},{id:"brutalist-dark",label:"Neubrutalism Dark",description:"Dark neubrutalism variant.",hidden:!0},{id:"monokai",label:"Monokai",description:"Classic warm editor palette — pink, green, and purple.",swatches:["#272822","#f92672","#a6e22e","#f8f8f2","#ae81ff"],variantLightId:"monokai-light",variantDarkId:"monokai-dark"},{id:"monokai-dark",label:"Monokai Dark",description:"Dark Monokai variant.",hidden:!0},{id:"monokai-light",label:"Monokai Light",description:"Light Monokai variant.",hidden:!0},{id:"ubuntu",label:"Ubuntu",description:"Aubergine terminal with the GNOME Tango palette.",swatches:["#300a24","#8ae234","#ef2929","#eeeeec","#fce94f"]},{id:"sandstone",label:"Sandstone",description:"Warm terracotta accent on dark brown, in the style of Claude Code.",swatches:["#1a1815","#C15F3C","#6b8afd","#e8e6e3","#a78bfa"]},{id:"verdigris",label:"Verdigris",description:"Teal accent on charcoal, in the style of ChatGPT.",swatches:["#141414","#00a67e","#3b82f6","#ececec","#ab68ff"]},{id:"primer",label:"Primer",description:"Blue accent on ink-dark grey, in the style of GitHub.",swatches:["#0d1117","#58a6ff","#3fb950","#c9d1d9","#bc8cff"]}],U1=new Set(Ld.map(t=>t.id)),ex="grackle";function dm(t){return Ld.find(s=>s.id===t)}function cB({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return i.jsxs("section",{className:pe.section,children:[i.jsx("h3",{className:pe.sectionTitle,children:"Appearance"}),i.jsx("p",{className:pe.sectionDescription,children:"Choose how Grackle looks across the app."}),i.jsx("div",{className:pe.themeOptions,children:Ld.filter(d=>!d.hidden).map(d=>{const u=!!(d.variantLightId&&d.variantDarkId),p=u?t===d.id||t===d.variantLightId||t===d.variantDarkId:t===d.id,m=u&&s===d.variantLightId;return i.jsxs("button",{type:"button",className:`${pe.themeOption} ${p?pe.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>o(d.id),children:[i.jsxs("span",{className:pe.themeOptionHeader,children:[i.jsxs("span",{children:[i.jsx("span",{className:pe.themeOptionLabel,children:d.label}),i.jsx("span",{className:pe.themeOptionDesc,children:d.description})]}),u&&i.jsxs("span",{className:pe.variantToggle,children:[i.jsx("span",{role:"button",tabIndex:0,className:`${pe.variantButton} ${p&&m?pe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&m,children:"☼"}),i.jsx("span",{role:"button",tabIndex:0,className:`${pe.variantButton} ${p&&!m?pe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!m,children:"☾"})]})]}),d.swatches&&i.jsx("span",{className:pe.themeSwatches,children:d.swatches.map((g,v)=>i.jsx("span",{className:pe.themeSwatch,style:{background:g}},v))})]},d.id)})}),i.jsxs("label",{className:pe.systemToggle,children:[i.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),i.jsx("span",{children:"Match system light/dark preference"})]}),i.jsx("p",{className:pe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),i.jsxs("p",{className:pe.themeActive,children:["Active theme: ",i.jsx("strong",{children:s})]})]})}const dB={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},uB={connected:pe.aboutDotConnected,connecting:pe.aboutDotConnecting,disconnected:pe.aboutDotDisconnected};function fB({connectionStatus:t,environments:s,sessions:o}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=o.filter(u=>["running","idle"].includes(u.status)).length;return i.jsxs("section",{className:pe.section,"data-testid":"about-panel",children:[i.jsx("h3",{className:pe.sectionTitle,children:"About"}),i.jsx("p",{className:pe.sectionDescription,children:"Connection status and application information."}),i.jsxs("div",{className:pe.aboutGrid,children:[i.jsxs("div",{className:pe.aboutItem,children:[i.jsx("span",{className:pe.aboutLabel,children:"Connection"}),i.jsxs("span",{className:pe.aboutValue,children:[i.jsx("span",{className:`${pe.aboutDot} ${uB[t]}`}),dB[t]]})]}),i.jsxs("div",{className:pe.aboutItem,children:[i.jsx("span",{className:pe.aboutLabel,children:"Environments"}),i.jsxs("span",{className:pe.aboutValue,children:[r,"/",c," connected"]})]}),i.jsxs("div",{className:pe.aboutItem,children:[i.jsx("span",{className:pe.aboutLabel,children:"Active Sessions"}),i.jsx("span",{className:pe.aboutValue,children:d})]}),i.jsxs("div",{className:pe.aboutItem,children:[i.jsx("span",{className:pe.aboutLabel,children:"Version"}),i.jsx("span",{className:pe.aboutValue,children:"0.106.2"})]})]})]})}const pB="_container_cddyd_1",mB="_header_cddyd_8",hB="_headerTitle_cddyd_35",gB="_badge_cddyd_44",vB="_headerActions_cddyd_54",yB="_body_cddyd_61",bB="_formContent_cddyd_73",xB="_section_cddyd_85",_B="_label_cddyd_91",kB="_titleInput_cddyd_98",SB="_descriptionTextarea_cddyd_131",TB="_parentContext_cddyd_167",jB="_parentLabel_cddyd_175",wB="_parentName_cddyd_182",NB="_personaSelect_cddyd_186",CB="_depList_cddyd_220",EB="_depItem_cddyd_226",AB="_depItemSelected_cddyd_248",DB="_noDeps_cddyd_252",MB="_btnPrimary_cddyd_258",RB="_btnGhost_cddyd_289",nt={container:pB,header:mB,headerTitle:hB,badge:gB,headerActions:vB,body:yB,formContent:bB,section:xB,label:_B,titleInput:kB,descriptionTextarea:SB,parentContext:TB,parentLabel:jB,parentName:wB,personaSelect:NB,depList:CB,depItem:EB,depItemSelected:AB,noDeps:DB,btnPrimary:MB,btnGhost:RB};function H1({mode:t,taskId:s,workspaceId:o,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:p,onCreateTask:m,onUpdateTask:g,onEditDone:v,onShowToast:x}){const b=mt(),k=t==="edit",S=k&&s?d.find(xe=>xe.id===s):void 0,j=k?(S==null?void 0:S.workspaceId)??"":o??"",[N,T]=y.useState(j),C=j||N,D=u.find(xe=>xe.id===C),B=c??(D==null?void 0:D.linkedEnvironmentIds[0]),E=!k&&!o,A=k?(S==null?void 0:S.parentTaskId)??"":r??"",$=A?d.find(xe=>xe.id===A):void 0,[L,U]=y.useState((S==null?void 0:S.title)??""),[J,V]=y.useState((S==null?void 0:S.description)??""),[K,de]=y.useState((S==null?void 0:S.dependsOn)??[]),[ee,ie]=y.useState((S==null?void 0:S.defaultPersonaId)??""),[M,O]=y.useState((S==null?void 0:S.canDecompose)??!1),[X,he]=y.useState(!1),W=y.useRef(!1);y.useEffect(()=>{k&&S&&!W.current&&(W.current=!0,U(S.title),V(S.description),de(S.dependsOn),ie(S.defaultPersonaId),O(S.canDecompose))},[k,S]);const ye=d.filter(xe=>xe.workspaceId===C&&(!k||xe.id!==s)&&xe.id!==A),fe=L.trim().length>0&&(!k||S!==void 0)&&C.length>0,Ne=xe=>{de(Be=>Be.includes(xe)?Be.filter(It=>It!==xe):[...Be,xe])},Ue=()=>{!fe||X||k&&S===void 0||(k&&s?(g(s,L.trim(),J,K,ee),x==null||x("Task updated","success"),v?v():b(On(s,void 0,C,B),{replace:!0})):(he(!0),m(C,L.trim(),J,K.length>0?K:void 0,A||void 0,ee,M,()=>{x==null||x("Task created","success"),b(o?Ei(o,B):"/tasks",{replace:!0})},xe=>{x==null||x(xe,"error"),he(!1)})))},ge=()=>{if(v){v();return}b(k&&s?On(s,void 0,C,B):o?Ei(o,B):"/tasks")},ke=k?"edit task":A?"child task":"new task";return i.jsxs("div",{className:nt.container,children:[i.jsxs("div",{className:nt.header,children:[i.jsxs("div",{className:nt.headerTitle,children:[i.jsx("span",{className:nt.badge,children:ke}),$&&i.jsxs("span",{className:nt.parentContext,children:[i.jsx("span",{className:nt.parentLabel,children:"Child of"}),i.jsx("span",{className:nt.parentName,children:$.title})]})]}),i.jsxs("div",{className:nt.headerActions,children:[i.jsx("button",{onClick:Ue,disabled:!fe||X,className:nt.btnPrimary,"data-testid":"task-edit-save",children:X?"Creating…":k?"Save Changes":"Create"}),i.jsx("button",{onClick:ge,className:nt.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:nt.body,children:i.jsxs("div",{className:nt.formContent,children:[E&&i.jsxs("div",{className:nt.section,children:[i.jsx("label",{className:nt.label,htmlFor:"task-edit-workspace",children:"Workspace"}),i.jsxs("select",{id:"task-edit-workspace",value:N,onChange:xe=>T(xe.target.value),className:nt.personaSelect,"data-testid":"task-edit-workspace",children:[i.jsx("option",{value:"",children:"Select a workspace..."}),u.map(xe=>i.jsx("option",{value:xe.id,children:xe.name},xe.id))]})]}),i.jsxs("div",{className:nt.section,children:[i.jsx("label",{className:nt.label,htmlFor:"task-edit-title",children:"Title"}),i.jsx("input",{id:"task-edit-title",type:"text",value:L,onChange:xe=>U(xe.target.value),placeholder:"Task title...",autoFocus:!0,className:nt.titleInput,"data-testid":"task-edit-title",onKeyDown:xe=>{xe.key==="Enter"&&fe&&Ue()}})]}),i.jsxs("div",{className:nt.section,children:[i.jsx("label",{className:nt.label,htmlFor:"task-edit-description",children:"Description"}),i.jsx("textarea",{id:"task-edit-description",value:J,onChange:xe=>V(xe.target.value),placeholder:"Describe the task... (markdown supported)",className:nt.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),i.jsxs("div",{className:nt.section,children:[i.jsx("label",{className:nt.label,htmlFor:"task-edit-persona",children:"Default Persona"}),i.jsxs("select",{id:"task-edit-persona",value:ee,onChange:xe=>ie(xe.target.value),className:nt.personaSelect,"data-testid":"task-edit-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),p.map(xe=>i.jsx("option",{value:xe.id,children:xe.name},xe.id))]})]}),!k&&i.jsx("div",{className:nt.section,children:i.jsxs("label",{className:nt.depItem,"data-testid":"task-edit-can-decompose",children:[i.jsx("input",{type:"checkbox",checked:M,onChange:xe=>O(xe.target.checked)}),"Can spawn subtasks"]})}),i.jsxs("div",{className:nt.section,children:[i.jsx("div",{className:nt.label,children:"Dependencies"}),ye.length===0?i.jsx("div",{className:nt.noDeps,children:"No other tasks in this workspace"}):i.jsx("div",{className:nt.depList,children:ye.map(xe=>{const Be=K.includes(xe.id);return i.jsxs("label",{className:`${nt.depItem} ${Be?nt.depItemSelected:""}`,"data-testid":`dep-option-${xe.id}`,children:[i.jsx("input",{type:"checkbox",checked:Be,onChange:()=>Ne(xe.id)}),xe.title,i.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",xe.status,")"]})]},xe.id)})})]})]})})]})}const IB="_actionButtons_1rjka_1",OB="_btnPrimary_1rjka_8",BB="_btnDanger_1rjka_39",LB="_btnGhost_1rjka_78",Kt={actionButtons:IB,btnPrimary:OB,btnDanger:BB,btnGhost:LB};function zB({task:t,sessionId:s,isBlocked:o,onStart:r,onResume:c,onStop:d,onPause:u,onDelete:p,onEdit:m}){if(t.status==="not_started")return o?i.jsxs("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:m,className:Kt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Kt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):i.jsxs("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{"data-testid":"task-header-start",onClick:r,className:Kt.btnPrimary,children:"Start"}),i.jsx("button",{onClick:m,className:Kt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Kt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return i.jsxs("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Kt.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:u,disabled:!s,className:Kt.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused")return i.jsxs("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Kt.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:c,className:Kt.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),i.jsx("button",{onClick:p,className:Kt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="complete")return i.jsx("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:i.jsx("button",{onClick:p,className:Kt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return i.jsxs("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:r,className:Kt.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),i.jsx("button",{onClick:p,className:Kt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const $B="_workpadSection_y8nj9_1",PB="_workpadLabel_y8nj9_9",UB="_workpadStatus_y8nj9_17",HB="_workpadSummary_y8nj9_23",VB="_workpadExtra_y8nj9_29",La={workpadSection:$B,workpadLabel:PB,workpadStatus:UB,workpadSummary:HB,workpadExtra:VB};function qB({workpad:t}){if(!t)return;let s;try{const o=JSON.parse(t);if(o==null||typeof o!="object"||Array.isArray(o))return;s=o}catch{return i.jsxs("div",{className:La.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:La.workpadLabel,children:"Workpad"}),i.jsx("div",{className:La.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return i.jsxs("div",{className:La.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:La.workpadLabel,children:"Workpad"}),s.status&&i.jsx("div",{className:La.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&i.jsx("div",{className:La.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&i.jsx("div",{className:La.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const GB="_overviewDashboard_r05qm_1",FB="_overviewHero_r05qm_7",ZB="_statusBadge_r05qm_14",KB="_statusPending_r05qm_26",YB="_statusAssigned_r05qm_31",JB="_statusInProgress_r05qm_36",WB="_statusReview_r05qm_41",XB="_statusDone_r05qm_46",QB="_statusFailed_r05qm_51",eL="_statusWaitingInput_r05qm_56",tL="_overviewBranchPill_r05qm_61",nL="_branchLink_r05qm_76",sL="_overviewSection_r05qm_87",aL="_overviewLabel_r05qm_93",iL="_overviewValue_r05qm_100",oL="_overviewMuted_r05qm_105",rL="_overviewMarkdown_r05qm_111",lL="_envRow_r05qm_180",cL="_envDot_r05qm_186",dL="_envDotGreen_r05qm_193",uL="_envDotYellow_r05qm_197",fL="_envDotRed_r05qm_201",pL="_envDotGray_r05qm_205",mL="_depList_r05qm_209",hL="_depItem_r05qm_215",gL="_depBlocked_r05qm_222",vL="_depDone_r05qm_226",yL="_timeline_r05qm_230",bL="_timelineRow_r05qm_236",xL="_timelineKey_r05qm_243",_L="_timelineValue_r05qm_249",kL="_timelineDelta_r05qm_253",SL="_reviewNotes_r05qm_264",ve={overviewDashboard:GB,overviewHero:FB,statusBadge:ZB,statusPending:KB,statusAssigned:YB,statusInProgress:JB,statusReview:WB,statusDone:XB,statusFailed:QB,statusWaitingInput:eL,overviewBranchPill:tL,branchLink:nL,overviewSection:sL,overviewLabel:aL,overviewValue:iL,overviewMuted:oL,overviewMarkdown:rL,envRow:lL,envDot:cL,envDotGreen:dL,envDotYellow:uL,envDotRed:fL,envDotGray:pL,depList:mL,depItem:hL,depBlocked:gL,depDone:vL,timeline:yL,timelineRow:bL,timelineKey:xL,timelineValue:_L,timelineDelta:kL,reviewNotes:SL};function qc(t){if(!t)return"—";const s=new Date(t);return isNaN(s.getTime())?"—":s.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Cp(t,s){if(!t||!s)return;const o=new Date(s).getTime()-new Date(t).getTime();if(isNaN(o)||o<0)return;const r=Math.floor(o/6e4),c=Math.floor(o%6e4/1e3);if(r===0)return`${c}s`;const d=Math.floor(r/60),u=r%60;return d===0?`${r}m ${c}s`:`${d}h ${u}m`}function tx(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?ve.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?ve.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?ve.envDotRed:ve.envDotGray}function TL({status:t}){const s=qa(t),o=kj(t);return i.jsx("span",{className:`${ve.statusBadge} ${ve[o]??ve.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function jL({task:t,tasksById:s,environments:o,workspaces:r,taskSessions:c,selectedEnvId:d,taskUsage:u,treeUsage:p}){const m=c.length>0?c[c.length-1]:void 0,g=(m==null?void 0:m.environmentId)??"",v=g?o.find(S=>S.id===g):void 0,x=r.find(S=>S.id===t.workspaceId),b=o.find(S=>S.id===d),k=t.branch&&(x!=null&&x.repoUrl)?`${x.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return i.jsxs("div",{className:ve.overviewDashboard,"data-testid":"task-overview-panel",children:[i.jsxs("div",{className:ve.overviewHero,children:[i.jsx(TL,{status:t.status}),t.branch&&i.jsx("span",{className:ve.overviewBranchPill,"data-testid":"task-overview-branch",children:k?i.jsxs("a",{href:k,target:"_blank",rel:"noreferrer noopener",className:ve.branchLink,children:["🔗"," ",t.branch]}):i.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-description",children:[i.jsx("div",{className:ve.overviewLabel,children:"Description"}),i.jsx("div",{className:ve.overviewMarkdown,children:i.jsx(Sd,{remarkPlugins:[Td],children:t.description})})]}),t.workpad&&i.jsx(qB,{workpad:t.workpad}),i.jsxs("div",{className:ve.overviewSection,children:[i.jsx("div",{className:ve.overviewLabel,children:"Environment"}),g&&v?i.jsxs("div",{className:ve.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${ve.envDot} ${tx(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),i.jsx("span",{className:ve.overviewValue,children:v.displayName})]}):b?i.jsxs("div",{className:ve.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${ve.envDot} ${tx(b.status)}`,title:b.status,"aria-label":`Status: ${b.status}`,role:"img"}),i.jsx("span",{className:ve.overviewValue,children:b.displayName}),i.jsx("span",{className:ve.overviewMuted,children:"(workspace default)"})]}):i.jsx("div",{className:ve.overviewMuted,children:"Set in workspace settings"})]}),i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-dependencies",children:[i.jsx("div",{className:ve.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?i.jsx("div",{className:ve.overviewMuted,children:"None"}):i.jsx("div",{className:ve.depList,children:t.dependsOn.map(S=>{const j=s.get(S),N=(j==null?void 0:j.status)==="complete";return i.jsxs("div",{className:`${ve.depItem} ${N?ve.depDone:ve.depBlocked}`,children:[i.jsx("span",{children:N?"✓":"○"}),i.jsx("span",{children:(j==null?void 0:j.title)??S})]},S)})})]}),i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-timeline",children:[i.jsx("div",{className:ve.overviewLabel,children:"Timeline"}),i.jsxs("div",{className:ve.timeline,children:[t.createdAt&&i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Created"}),i.jsx("span",{className:ve.timelineValue,children:qc(t.createdAt)})]}),t.assignedAt&&(()=>{const S=Cp(t.createdAt,t.assignedAt);return i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Assigned"}),i.jsx("span",{className:ve.timelineValue,children:qc(t.assignedAt)}),S!==void 0&&i.jsx("span",{className:ve.timelineDelta,children:S})]})})(),t.startedAt&&(()=>{const S=Cp(t.assignedAt??t.createdAt,t.startedAt);return i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Started"}),i.jsx("span",{className:ve.timelineValue,children:qc(t.startedAt)}),S!==void 0&&i.jsx("span",{className:ve.timelineDelta,children:S})]})})(),t.completedAt&&(()=>{const S=Cp(t.startedAt,t.completedAt);return i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Completed"}),i.jsx("span",{className:ve.timelineValue,children:qc(t.completedAt)}),S!==void 0&&i.jsx("span",{className:ve.timelineDelta,children:S})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&i.jsx("div",{className:ve.overviewMuted,children:"No timing data"})]})]}),u&&u.costMillicents>0&&i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-usage",children:[i.jsx("div",{className:ve.overviewLabel,children:"Usage"}),i.jsxs("div",{className:ve.timeline,children:[i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Cost"}),i.jsx("span",{className:ve.timelineValue,children:Cs(u.costMillicents)}),i.jsxs("span",{className:ve.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),p&&p.costMillicents>u.costMillicents&&i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Total (incl. subtasks)"}),i.jsx("span",{className:ve.timelineValue,children:Cs(p.costMillicents)}),i.jsxs("span",{className:ve.timelineDelta,children:[p.sessionCount," session",p.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-budget",children:[i.jsx("div",{className:ve.overviewLabel,children:"Budget"}),i.jsxs("div",{className:ve.timeline,children:[t.tokenBudget>0&&i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Tokens"}),i.jsxs("span",{className:ve.timelineValue,children:[Io(((u==null?void 0:u.inputTokens)??0)+((u==null?void 0:u.outputTokens)??0))," / ",Io(t.tokenBudget)]})]}),t.costBudgetMillicents>0&&i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Cost"}),i.jsxs("span",{className:ve.timelineValue,children:[Cs((u==null?void 0:u.costMillicents)??0)," / ",Cs(t.costBudgetMillicents)]})]})]})]}),t.reviewNotes&&i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-review-notes",children:[i.jsx("div",{className:ve.overviewLabel,children:"Review Notes"}),i.jsx("div",{className:ve.reviewNotes,children:t.reviewNotes})]})]})}function wL({plugins:t,loading:s,onSetPluginEnabled:o}){return i.jsxs("div",{className:pe.container,"data-testid":"plugins-panel",children:[i.jsx("h2",{className:pe.heading,children:"Plugins"}),i.jsxs("div",{className:pe.section,children:[i.jsx("p",{className:pe.sectionDescription,children:"Enable or disable optional Grackle plugins. A server restart is required for changes to take effect."}),s&&i.jsx("p",{className:pe.emptyState,children:"Loading plugins..."}),!s&&t.length===0&&i.jsx("p",{className:pe.emptyState,children:"No plugins found."}),!s&&t.map(r=>{const c=r.enabled!==r.loaded;return i.jsxs("div",{className:pe.tokenRow,"data-testid":`plugin-row-${r.name}`,children:[i.jsxs("div",{style:{flex:1},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("span",{className:pe.tokenName,children:r.name}),r.required&&i.jsx("span",{className:pe.tokenBadge,title:"Required — cannot be disabled",children:"required"})]}),i.jsx("div",{className:pe.tokenTarget,children:r.description}),c&&i.jsx("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--accent-yellow)",marginTop:"2px"},"data-testid":`plugin-restart-notice-${r.name}`,children:"Restart Grackle to apply changes"})]}),i.jsx("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:r.required?"not-allowed":"pointer"},title:r.required?"Core is required and cannot be disabled":void 0,children:i.jsx("input",{type:"checkbox",checked:r.enabled,disabled:r.required,onChange:d=>o(r.name,d.target.checked),"data-testid":`plugin-toggle-${r.name}`,"aria-label":`Enable or disable ${r.name} plugin`,style:{accentColor:"var(--accent-green)",width:"16px",height:"16px"}})})]},r.name)})]})]})}const NL="_container_legrg_1",CL="_header_legrg_8",EL="_headerTitle_legrg_35",AL="_badge_legrg_44",DL="_headerActions_legrg_54",ML="_body_legrg_61",RL="_formContent_legrg_73",IL="_section_legrg_85",OL="_label_legrg_91",BL="_nameInput_legrg_98",LL="_fieldInput_legrg_131",zL="_adapterSelect_legrg_164",$L="_readOnlyValue_legrg_198",PL="_codespaceSection_legrg_204",UL="_codespaceActions_legrg_210",HL="_creatingHint_legrg_216",VL="_errorHint_legrg_222",qL="_btnPrimary_legrg_235",GL="_btnGhost_legrg_266",le={container:NL,header:CL,headerTitle:EL,badge:AL,headerActions:DL,body:ML,formContent:RL,section:IL,label:OL,nameInput:BL,fieldInput:LL,adapterSelect:zL,readOnlyValue:$L,codespaceSection:PL,codespaceActions:UL,creatingHint:HL,errorHint:VL,btnPrimary:qL,btnGhost:GL},ad=1,id=65535;function Ep(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=ad&&s<=id}function Ap(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function FL({codespaceName:t,onCodespaceNameChange:s,envName:o,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:m}){const[g,v]=y.useState("pick"),[x,b]=y.useState(""),[k,S]=y.useState("");return g==="create"?i.jsxs("div",{className:le.codespaceSection,children:[i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Repository"}),i.jsx("input",{type:"text",value:x,onChange:j=>b(j.target.value),placeholder:"owner/repo",className:le.fieldInput,"data-testid":"env-codespace-repo"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Machine Type"}),i.jsx("input",{type:"text",value:k,onChange:j=>S(j.target.value),placeholder:"Machine type (optional)...",className:le.fieldInput,"data-testid":"env-codespace-machine"})]}),i.jsxs("div",{className:le.codespaceActions,children:[i.jsx("button",{onClick:()=>{x.trim()&&(m(x.trim(),k.trim()||void 0),v("pick"),b(""),S(""))},disabled:!x.trim(),className:le.btnPrimary,children:"Create"}),i.jsx("button",{onClick:()=>{v("pick"),b(""),S("")},className:le.btnGhost,children:"Cancel"})]})]}):i.jsx("div",{className:le.codespaceSection,children:i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Codespace"}),!u&&i.jsxs("select",{value:t,onChange:j=>{j.target.value==="__create__"?(v("create"),s("")):(s(j.target.value),j.target.value&&!o.trim()&&r(j.target.value))},disabled:p,className:le.adapterSelect,"data-testid":"env-codespace-select",children:[i.jsx("option",{value:"",children:"Select a codespace..."}),c.map(j=>i.jsxs("option",{value:j.name,children:[j.name," (",j.repository,") — ",j.state]},j.name)),i.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&i.jsx("span",{className:le.creatingHint,children:"Creating codespace..."}),u&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:le.errorHint,children:u}),i.jsx("input",{type:"text",value:t,onChange:j=>s(j.target.value),placeholder:"Or enter codespace name manually...",className:le.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&i.jsx("span",{className:le.errorHint,children:d})]})})}function V1({mode:t,environmentId:s,environments:o,onAddEnvironment:r,onUpdateEnvironment:c,onListCodespaces:d,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v,onShowToast:x}){const b=mt(),k=t==="edit",S=k&&s?o.find(ge=>ge.id===s):void 0,[j,N]=y.useState(""),[T,C]=y.useState("local"),[D,B]=y.useState(""),[E,A]=y.useState(""),[$,L]=y.useState(""),[U,J]=y.useState(""),[V,K]=y.useState(""),[de,ee]=y.useState(""),[ie,M]=y.useState(""),[O,X]=y.useState(null),he=y.useCallback(()=>{const ge={};if(T==="local"){if(D.trim()&&(ge.host=D.trim()),E.trim()){const ke=Number(E);Number.isInteger(ke)&&(ge.port=ke)}}else if(T==="ssh"){if(ge.host=D.trim(),$.trim()&&(ge.user=$.trim()),E.trim()){const ke=Number(E);Number.isInteger(ke)&&(ge.sshPort=ke)}U.trim()&&(ge.identityFile=U.trim())}else T==="docker"?(V.trim()&&(ge.image=V.trim()),de.trim()&&(ge.repo=de.trim())):T==="codespace"&&(ge.codespaceName=ie.trim());return ge},[T,D,E,$,U,V,de,ie]),W=()=>!(!j.trim()||T==="ssh"&&!D.trim()||T==="codespace"&&!ie.trim()||(T==="local"||T==="ssh")&&!Ep(E)),ye=()=>{W()&&(r(j.trim(),T,he()),x==null||x("Environment added successfully","success"),b(Ro,{replace:!0}))},fe=()=>{b(s?Ai(s):Ro)},Ne=y.useCallback((ge,ke)=>{if(!S||!s)return;const xe=Ap(S.adapterConfig),Be=ke.trim();Be?xe[ge]=Be:delete xe[ge],c(s,{adapterConfig:xe})},[S,s,c]),Ue=y.useCallback((ge,ke)=>{if(!S||!s)return;const xe=Ap(S.adapterConfig);if(ke.trim()){const Be=Number(ke);Number.isInteger(Be)&&Be>=ad&&Be<=id&&(xe[ge]=Be)}else delete xe[ge];c(s,{adapterConfig:xe})},[S,s,c]);if(k){if(!S)return i.jsxs("div",{className:le.container,children:[i.jsxs("div",{className:le.header,children:[i.jsx("div",{className:le.headerTitle,children:i.jsx("span",{className:le.badge,children:"edit environment"})}),i.jsx("div",{className:le.headerActions,children:i.jsx("button",{onClick:fe,className:le.btnGhost,children:"Back"})})]}),i.jsx("div",{className:le.body,children:i.jsx("div",{className:le.formContent,children:i.jsx("span",{className:le.readOnlyValue,children:"Environment not found"})})})]});const ge=Ap(S.adapterConfig);return i.jsxs("div",{className:le.container,"data-testid":"env-edit-panel",children:[i.jsxs("div",{className:le.header,children:[i.jsx("div",{className:le.headerTitle,children:i.jsx("span",{className:le.badge,children:"edit environment"})}),i.jsx("div",{className:le.headerActions,children:i.jsx("button",{onClick:fe,className:le.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),i.jsx("div",{className:le.body,children:i.jsxs("div",{className:le.formContent,children:[i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Name"}),i.jsx(Ft,{value:S.displayName,onSave:ke=>{s&&c(s,{displayName:ke})},validate:ke=>ke.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:O,onActivate:X,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Adapter Type"}),i.jsx("span",{className:le.readOnlyValue,"data-testid":"env-edit-adapter-type",children:S.adapterType})]}),S.adapterType==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Host"}),i.jsx(Ft,{value:String(ge.host??""),onSave:ke=>Ne("host",ke),mode:"edit",fieldId:"host",activeFieldId:O,onActivate:X,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Port"}),i.jsx(Ft,{value:String(ge.port??""),onSave:ke=>Ue("port",ke),validate:ke=>Ep(ke)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:O,onActivate:X,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),S.adapterType==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Host"}),i.jsx(Ft,{value:String(ge.host??""),onSave:ke=>Ne("host",ke),validate:ke=>ke.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:O,onActivate:X,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"User"}),i.jsx(Ft,{value:String(ge.user??""),onSave:ke=>Ne("user",ke),mode:"edit",fieldId:"user",activeFieldId:O,onActivate:X,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"SSH Port"}),i.jsx(Ft,{value:String(ge.sshPort??""),onSave:ke=>Ue("sshPort",ke),validate:ke=>Ep(ke)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:O,onActivate:X,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Identity File"}),i.jsx(Ft,{value:String(ge.identityFile??""),onSave:ke=>Ne("identityFile",ke),mode:"edit",fieldId:"identityFile",activeFieldId:O,onActivate:X,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),S.adapterType==="docker"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Image"}),i.jsx(Ft,{value:String(ge.image??""),onSave:ke=>Ne("image",ke),mode:"edit",fieldId:"image",activeFieldId:O,onActivate:X,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Repo"}),i.jsx(Ft,{value:String(ge.repo??""),onSave:ke=>Ne("repo",ke),mode:"edit",fieldId:"repo",activeFieldId:O,onActivate:X,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),S.adapterType==="codespace"&&i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,children:"Codespace Name"}),i.jsx(Ft,{value:String(ge.codespaceName??""),onSave:ke=>Ne("codespaceName",ke),validate:ke=>ke.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:O,onActivate:X,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return i.jsxs("div",{className:le.container,"data-testid":"env-create-panel",children:[i.jsxs("div",{className:le.header,children:[i.jsx("div",{className:le.headerTitle,children:i.jsx("span",{className:le.badge,children:"new environment"})}),i.jsxs("div",{className:le.headerActions,children:[i.jsx("button",{onClick:ye,disabled:!W(),className:le.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),i.jsx("button",{onClick:fe,className:le.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:le.body,children:i.jsxs("div",{className:le.formContent,children:[i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,htmlFor:"env-create-name",children:"Name"}),i.jsx("input",{id:"env-create-name",type:"text",value:j,onChange:ge=>N(ge.target.value),placeholder:"Environment name...",autoFocus:!0,className:le.nameInput,"data-testid":"env-create-name",onKeyDown:ge=>{ge.key==="Enter"&&W()&&ye()}})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),i.jsxs("select",{id:"env-create-adapter",value:T,onChange:ge=>{C(ge.target.value),ge.target.value==="codespace"&&d()},className:le.adapterSelect,"data-testid":"env-create-adapter",children:[i.jsx("option",{value:"local",children:"local"}),i.jsx("option",{value:"ssh",children:"ssh"}),i.jsx("option",{value:"docker",children:"docker"}),i.jsx("option",{value:"codespace",children:"codespace"})]})]}),T==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:D,onChange:ge=>B(ge.target.value),placeholder:"Host (optional)...",className:le.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,htmlFor:"env-create-port",children:"Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:ad,max:id,value:E,onChange:ge=>A(ge.target.value),placeholder:"Port (optional)...",className:le.fieldInput,"data-testid":"env-create-port"})]})]}),T==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:D,onChange:ge=>B(ge.target.value),placeholder:"Host (required)...",className:le.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,htmlFor:"env-create-user",children:"User"}),i.jsx("input",{id:"env-create-user",type:"text",value:$,onChange:ge=>L(ge.target.value),placeholder:"User (optional)...",className:le.fieldInput,"data-testid":"env-create-user"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,htmlFor:"env-create-port",children:"SSH Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:ad,max:id,value:E,onChange:ge=>A(ge.target.value),placeholder:"SSH port (optional)...",className:le.fieldInput,"data-testid":"env-create-port"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,htmlFor:"env-create-identity",children:"Identity File"}),i.jsx("input",{id:"env-create-identity",type:"text",value:U,onChange:ge=>J(ge.target.value),placeholder:"Identity file (optional)...",className:le.fieldInput,"data-testid":"env-create-identity"})]})]}),T==="docker"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,htmlFor:"env-create-image",children:"Image"}),i.jsx("input",{id:"env-create-image",type:"text",value:V,onChange:ge=>K(ge.target.value),placeholder:"Image (optional)...",className:le.fieldInput,"data-testid":"env-create-image"})]}),i.jsxs("div",{className:le.section,children:[i.jsx("label",{className:le.label,htmlFor:"env-create-repo",children:"Repo"}),i.jsx("input",{id:"env-create-repo",type:"text",value:de,onChange:ge=>ee(ge.target.value),placeholder:"Repo (optional)...",className:le.fieldInput,"data-testid":"env-create-repo"})]})]}),T==="codespace"&&i.jsx(FL,{codespaceName:ie,onCodespaceNameChange:M,envName:j,onEnvNameChange:N,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v})]})})]})}const ZL="_group_1iprv_1",KL="_groupTitle_1iprv_8",YL="_shortcutList_1iprv_17",JL="_shortcutRow_1iprv_23",WL="_keys_1iprv_36",XL="_kbd_1iprv_43",QL="_description_1iprv_60",ki={group:ZL,groupTitle:KL,shortcutList:YL,shortcutRow:JL,keys:WL,kbd:XL,description:QL},e8=[{title:"Global",shortcuts:[{keys:["?"],description:"Open keyboard shortcuts reference"},{keys:["N"],description:"Create a new task"},{keys:["Escape"],description:"Close dialog or cancel editing"}]},{title:"Task Page",shortcuts:[{keys:["1"],description:"Switch to Overview tab"},{keys:["2"],description:"Switch to Stream tab"},{keys:["3"],description:"Switch to Findings tab"}]},{title:"Workspace Page",shortcuts:[{keys:["1"],description:"Switch to Graph view"},{keys:["2"],description:"Switch to Board view"},{keys:["3"],description:"Switch to Tasks view"}]},{title:"Navigation Lists",shortcuts:[{keys:["←"],description:"Previous tab (horizontal nav)"},{keys:["→"],description:"Next tab (horizontal nav)"},{keys:["↑"],description:"Previous item (vertical nav)"},{keys:["↓"],description:"Next item (vertical nav)"},{keys:["J"],description:"Next item (alias for arrow down/right)"},{keys:["K"],description:"Previous item (alias for arrow up/left)"},{keys:["Home"],description:"Jump to first item"},{keys:["End"],description:"Jump to last item"}]},{title:"Editing",shortcuts:[{keys:["Enter"],description:"Activate / save inline edit"},{keys:["Space"],description:"Activate button or start editing"},{keys:["Escape"],description:"Cancel edit and discard changes"}]},{title:"Chat",shortcuts:[{keys:["Enter"],description:"Send message (when input is focused)"}]}];function t8(){return i.jsxs("section",{className:pe.section,"data-testid":"keyboard-shortcuts-panel",children:[i.jsx("h3",{className:pe.sectionTitle,children:"Keyboard Shortcuts"}),i.jsx("p",{className:pe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),e8.map(t=>i.jsxs("div",{className:ki.group,children:[i.jsx("h4",{className:ki.groupTitle,children:t.title}),i.jsx("div",{className:ki.shortcutList,children:t.shortcuts.map(s=>i.jsxs("div",{className:ki.shortcutRow,children:[i.jsx("span",{className:ki.keys,children:s.keys.map(o=>i.jsx("kbd",{className:ki.kbd,children:o},o))}),i.jsx("span",{className:ki.description,children:s.description})]},s.description))})]},t.title))]})}const n8=[{key:"claude",label:"Claude",description:"Forward Claude credentials for AI agent access.",options:[{value:"off",label:"Off"},{value:"subscription",label:"Subscription"},{value:"api_key",label:"API Key"}]},{key:"github",label:"GitHub",description:"Forward GITHUB_TOKEN and GH_TOKEN for git operations.",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]},{key:"copilot",label:"Copilot",description:"Forward Copilot tokens (COPILOT_GITHUB_TOKEN, CLI config).",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]},{key:"codex",label:"Codex",description:"Forward OPENAI_API_KEY for Codex/OpenAI access.",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]},{key:"goose",label:"Goose",description:"Forward Goose config and API keys for Goose agent access.",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]}];function s8({credentialProviders:t,onUpdateCredentialProviders:s}){const o=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return i.jsxs("section",{className:pe.section,children:[i.jsx("h3",{className:pe.sectionTitle,children:"Credential Providers"}),i.jsx("p",{className:pe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),i.jsx("div",{className:pe.tokenList,children:n8.map(r=>i.jsxs("div",{className:pe.tokenRow,children:[i.jsx("span",{className:pe.tokenName,children:r.label}),i.jsx("span",{className:pe.tokenTarget,children:r.description}),i.jsx("select",{className:pe.select,value:t[r.key],onChange:c=>o(r.key,c.target.value),children:r.options.map(c=>i.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const a8="_container_10efq_1",i8="_header_10efq_7",o8="_list_10efq_105",r8="_card_10efq_111",l8="_cardHeader_10efq_125",c8="_cardTitle_10efq_135",d8="_defaultBadge_10efq_141",u8="_cardActions_10efq_155",f8="_description_10efq_160",p8="_meta_10efq_166",m8="_empty_10efq_212",h8="_typeBadge_10efq_362",Xn={container:a8,header:i8,list:o8,card:r8,cardHeader:l8,cardTitle:c8,defaultBadge:d8,cardActions:u8,description:f8,meta:p8,empty:m8,typeBadge:h8};function g8({personas:t,appDefaultPersonaId:s,onDeletePersona:o,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,p]=y.useState(null),m=u?t.find(v=>v.id===u):void 0,g=async v=>{await o(v),p(null)};return i.jsxs("div",{className:Xn.container,children:[i.jsxs("div",{className:Xn.header,children:[i.jsx("h2",{children:"Personas"}),i.jsx(tn,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?i.jsx("p",{className:Xn.empty,children:"No personas yet. Create one to get started."}):i.jsx("div",{className:Xn.list,children:t.map(v=>{const x=s===v.id,b=v.type==="script";return i.jsxs("div",{className:Xn.card,"data-testid":`persona-card-${v.id}`,onClick:()=>d(v.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),d(v.id))},children:[i.jsxs("div",{className:Xn.cardHeader,children:[i.jsxs("span",{className:Xn.cardTitle,children:[i.jsx("strong",{children:v.name}),i.jsx("span",{className:Xn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:b?"Script":"Agent"}),x&&i.jsx("span",{className:Xn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),i.jsxs("div",{className:Xn.cardActions,onClick:k=>k.stopPropagation(),children:[!x&&i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>{r(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&i.jsx("p",{className:Xn.description,children:v.description}),i.jsxs("div",{className:Xn.meta,children:[v.runtime&&i.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&i.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&i.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),i.jsx(oa,{isOpen:u!==null,title:"Delete Persona?",description:`"${(m==null?void 0:m.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const v8="_container_uy08i_1",y8="_header_uy08i_7",b8="_count_uy08i_13",x8="_presets_uy08i_18",_8="_presetButton_uy08i_24",k8="_filterInput_uy08i_41",S8="_groups_uy08i_53",T8="_group_uy08i_53",j8="_groupHeader_uy08i_68",w8="_groupName_uy08i_77",N8="_groupCount_uy08i_81",C8="_toolList_uy08i_87",E8="_toolItem_uy08i_95",A8="_toolName_uy08i_103",gn={container:v8,header:y8,count:b8,presets:x8,presetButton:_8,filterInput:k8,groups:S8,group:T8,groupHeader:j8,groupName:w8,groupCount:N8,toolList:C8,toolItem:E8,toolName:A8},D8=(()=>{const t=new Map;for(const s of _x){const o=s==="get_version_status"?"version":s.split("_")[0];t.has(o)||t.set(o,[]),t.get(o).push(s)}return[...t.entries()].sort(([s],[o])=>s.localeCompare(o)).map(([s,o])=>({group:s,tools:o.sort()}))})(),M8=[{name:"default",label:"Default",tools:kx},{name:"worker",label:"Worker",tools:MT},{name:"orchestrator",label:"Orchestrator",tools:RT},{name:"admin",label:"Admin",tools:IT}];function nx({selectedTools:t,onChange:s,disabled:o}){const[r,c]=y.useState(""),d=y.useMemo(()=>new Set(t),[t]),u=y.useCallback(v=>{if(o)return;const x=new Set(d);x.has(v)?x.delete(v):x.add(v),s([...x].sort())},[d,s,o]),p=y.useCallback((v,x)=>{if(o)return;const b=new Set(d);for(const k of v)x?b.delete(k):b.add(k);s([...b].sort())},[d,s,o]),m=y.useCallback(v=>{o||s([...v].sort())},[s,o]),g=r.toLowerCase();return i.jsxs("div",{className:gn.container,"data-testid":"mcp-tool-selector",children:[i.jsx("div",{className:gn.header,children:i.jsx("span",{className:gn.count,children:t.length===0?`Using default (${kx.length} tools)`:`${t.length} of ${_x.size} tools selected`})}),i.jsxs("div",{className:gn.presets,"data-testid":"mcp-tool-presets",children:[M8.map(v=>i.jsx("button",{type:"button",className:gn.presetButton,disabled:o,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),i.jsx("button",{type:"button",className:gn.presetButton,disabled:o,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),i.jsx("input",{type:"text",className:gn.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:o,"data-testid":"mcp-tool-filter"}),i.jsx("div",{className:gn.groups,children:D8.map(({group:v,tools:x})=>{const b=g?x.filter(S=>S.toLowerCase().includes(g)):x;if(b.length===0)return null;const k=b.every(S=>d.has(S));return i.jsxs("div",{className:gn.group,"data-testid":`tool-group-${v}`,children:[i.jsxs("label",{className:gn.groupHeader,children:[i.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(b,k),disabled:o,"data-testid":`group-toggle-${v}`}),i.jsx("span",{className:gn.groupName,children:v}),i.jsxs("span",{className:gn.groupCount,children:["(",b.filter(S=>d.has(S)).length,"/",b.length,")"]})]}),i.jsx("div",{className:gn.toolList,children:b.map(S=>i.jsxs("label",{className:gn.toolItem,children:[i.jsx("input",{type:"checkbox",checked:d.has(S),onChange:()=>u(S),disabled:o,"data-testid":`tool-${S}`}),i.jsx("span",{className:gn.toolName,children:S})]},S))})]},v)})})]})}const R8="_container_1gfuq_1",I8="_header_1gfuq_7",O8="_list_1gfuq_19",B8="_card_1gfuq_25",L8="_cardHeader_1gfuq_40",z8="_cardTitle_1gfuq_46",$8="_statusBadge_1gfuq_56",P8="_enabled_1gfuq_68",U8="_disabled_1gfuq_71",H8="_cardActions_1gfuq_75",V8="_cardMeta_1gfuq_80",q8="_empty_1gfuq_98",Qn={container:R8,header:I8,list:O8,card:B8,cardHeader:L8,cardTitle:z8,statusBadge:$8,enabled:P8,disabled:U8,cardActions:H8,cardMeta:V8,empty:q8};function G8({schedules:t,personas:s,onDeleteSchedule:o,onToggleEnabled:r,onNavigateToNew:c,onNavigateToSchedule:d}){const[u,p]=y.useState(null),m=u?t.find(b=>b.id===u):void 0,g=async b=>{await o(b),p(null)},v=y.useMemo(()=>{const b=new Map;for(const k of s)b.set(k.id,k.name);return b},[s]),x=b=>v.get(b)??b;return i.jsxs("div",{className:Qn.container,children:[i.jsxs("div",{className:Qn.header,children:[i.jsx("h2",{children:"Schedules"}),i.jsx(tn,{variant:"primary",size:"md",onClick:c,"data-testid":"schedule-new-button",children:"+ New Schedule"})]}),t.length===0?i.jsx("p",{className:Qn.empty,"data-testid":"schedule-empty-state",children:"No schedules yet. Create one to run tasks on a recurring cadence."}):i.jsx("div",{className:Qn.list,children:t.map(b=>i.jsxs("div",{className:Qn.card,"data-testid":`schedule-card-${b.id}`,onClick:()=>d(b.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),d(b.id))},children:[i.jsxs("div",{className:Qn.cardHeader,children:[i.jsxs("span",{className:Qn.cardTitle,children:[i.jsx("strong",{children:b.title}),i.jsx("span",{className:`${Qn.statusBadge} ${b.enabled?Qn.enabled:Qn.disabled}`,"data-testid":`schedule-status-badge-${b.id}`,children:b.enabled?"Enabled":"Disabled"})]}),i.jsxs("div",{className:Qn.cardActions,onClick:k=>k.stopPropagation(),children:[i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>{(async()=>{await r(b.id,{enabled:!b.enabled})})().catch(()=>{})},"data-testid":`schedule-toggle-${b.id}`,title:b.enabled?"Disable schedule":"Enable schedule",children:b.enabled?"Disable":"Enable"}),i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>d(b.id),"data-testid":`schedule-edit-${b.id}`,children:"Edit"}),i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>p(b.id),"data-testid":`schedule-delete-${b.id}`,children:"Delete"})]})]}),i.jsxs("div",{className:Qn.cardMeta,children:[i.jsx("span",{"data-testid":`schedule-expression-${b.id}`,children:b.scheduleExpression}),b.personaId&&i.jsxs("span",{"data-testid":`schedule-persona-${b.id}`,children:["Persona: ",x(b.personaId)]}),i.jsxs("span",{"data-testid":`schedule-last-run-${b.id}`,children:["Last run: ",b.lastRunAt?$o(b.lastRunAt):"Never"]}),b.enabled&&b.nextRunAt?i.jsxs("span",{"data-testid":`schedule-next-run-${b.id}`,children:["Next run: ",O1(b.nextRunAt)]}):null,b.runCount>0&&i.jsxs("span",{"data-testid":`schedule-run-count-${b.id}`,children:["Runs: ",b.runCount]})]})]},b.id))}),i.jsx(oa,{isOpen:u!==null,title:"Delete Schedule?",description:`"${(m==null?void 0:m.title)??""}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const F8="_nav_1bhou_1",Z8="_tab_1bhou_24",K8="_tabIcon_1bhou_62",Y8="_tabActive_1bhou_68",Gc={nav:F8,tab:Z8,tabIcon:K8,tabActive:Y8},Qs=[{path:"credentials",label:"Credentials",icon:i.jsx(V2,{size:Nt})},{path:"personas",label:"Personas",icon:i.jsx(bj,{size:Nt})},{path:"schedules",label:"Schedules",icon:i.jsx(_2,{size:Nt})},{path:"appearance",label:"Appearance",icon:i.jsx(ij,{size:Nt})},{path:"shortcuts",label:"Shortcuts",icon:i.jsx(G2,{size:Nt})},{path:"plugins",label:"Plugins",icon:i.jsx(uj,{size:Nt})},{path:"about",label:"About",icon:i.jsx(gm,{size:Nt})}];function J8(){var u;const t=Yt(),s=mt(),o=y.useRef(null),r=((u=Qs.find(p=>{const m=`${wi}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??Qs[0].path,c=y.useCallback(p=>{s(`${wi}/${p}`)},[s]),d=y.useCallback(p=>{var k,S;const m=(k=o.current)==null?void 0:k.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(j=>j===document.activeElement),v=g>=0?g:Qs.findIndex(j=>j.path===r);let x=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),x=(v+1)%Qs.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),x=(v-1+Qs.length)%Qs.length;else if(p.key==="Home")p.preventDefault(),x=0;else if(p.key==="End")p.preventDefault(),x=Qs.length-1;else return;const b=Qs[x].path;s(`${wi}/${b}`),(S=m[x])==null||S.focus()},[r,s]);return i.jsx("nav",{className:Gc.nav,ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:Qs.map(p=>{const m=p.path===r;return i.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Gc.tab} ${m?Gc.tabActive:""}`,onClick:()=>c(p.path),children:[i.jsx("span",{className:Gc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function W8({tasks:t,taskStatusById:s,sessionStatusByTaskId:o}){const r=new Map;for(const d of t)if(d.parentTaskId){const u=r.get(d.parentTaskId);u?u.push(d):r.set(d.parentTaskId,[d])}const c=new Map(by.map(d=>[d,[]]));for(const d of t){const u=ul(d.status),p=d.dependsOn.length>0&&d.dependsOn.some(S=>s.get(S)!=="complete"),m=r.get(d.id)??[],g=m.length,v=m.filter(S=>S.status==="complete").length;let x;if(u==="paused"&&o){const S=o.get(d.id);S==="idle"?x="Needs input":S==="completed"&&(x="Ready to complete")}const b={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:x},k=c.get(u);k?k.push(b):c.get("not_started").push(b)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return by.map(d=>{const u=qa(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const X8="_boardContainer_1c4y1_1",Q8="_column_1c4y1_17",e7="_columnHeader_1c4y1_34",t7="_columnIcon_1c4y1_47",n7="_columnLabel_1c4y1_52",s7="_columnCount_1c4y1_57",a7="_cardList_1c4y1_67",i7="_emptyPlaceholder_1c4y1_76",o7="_card_1c4y1_67",r7="_cardHeader_1c4y1_107",l7="_cardStatusIcon_1c4y1_113",c7="_cardTitle_1c4y1_119",d7="_cardBadges_1c4y1_127",u7="_badge_1c4y1_134",f7="_blockedBadge_1c4y1_146",p7="_childBadge_1c4y1_151",m7="_depBadge_1c4y1_155",h7="_parentBadge_1c4y1_159",g7="_pausedSubBadge_1c4y1_166",v7="_personaBadge_1c4y1_170",y7="_envBadge_1c4y1_174",b7="_emptyCta_1c4y1_178",x7="_ctaButton_1c4y1_188",_7="_ctaDescription_1c4y1_204",it={boardContainer:X8,column:Q8,columnHeader:e7,columnIcon:t7,columnLabel:n7,columnCount:s7,cardList:a7,emptyPlaceholder:i7,card:o7,cardHeader:r7,cardStatusIcon:l7,cardTitle:c7,cardBadges:d7,badge:u7,blockedBadge:f7,childBadge:p7,depBadge:m7,parentBadge:h7,pausedSubBadge:g7,personaBadge:v7,envBadge:y7,emptyCta:b7,ctaButton:x7,ctaDescription:_7};function k7({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=mt(),p=y.useMemo(()=>o.filter(b=>b.workspaceId===t),[o,t]),m=y.useMemo(()=>new Map(o.map(b=>[b.id,b.status])),[o]),g=y.useMemo(()=>new Map(p.map(b=>[b.id,b])),[p]),v=y.useMemo(()=>{const b=new Map(r.map(C=>[C.id,C])),k=new Map(c.map(C=>[C.id,C])),S=new Map(d.map(C=>[C.id,C])),j=new Map,N=new Map,T=new Map;for(const C of p)if(C.latestSessionId){const D=b.get(C.latestSessionId);if(D){if(j.set(C.id,D.endReason||D.status),D.personaId){const B=k.get(D.personaId);B&&N.set(C.id,B.name)}if(D.environmentId){const B=S.get(D.environmentId);B&&T.set(C.id,B.displayName)}}}return{sessionStatusByTaskId:j,personaNameByTaskId:N,environmentNameByTaskId:T}},[p,r,c,d]),x=y.useMemo(()=>W8({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?i.jsxs("div",{className:it.emptyCta,"data-testid":"board-empty-cta",children:[i.jsx("button",{className:it.ctaButton,onClick:()=>u(Ii(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:it.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):i.jsx("div",{className:it.boardContainer,"data-testid":"board-container",children:x.map(b=>i.jsxs("section",{className:it.column,"data-testid":`board-column-${b.status}`,"aria-label":`${b.label}, ${b.tasks.length} ${b.tasks.length===1?"task":"tasks"}`,children:[i.jsxs("div",{className:it.columnHeader,children:[i.jsx("span",{className:it.columnIcon,style:{color:b.style.color},children:b.style.icon}),i.jsx("span",{className:it.columnLabel,children:b.label}),i.jsx("span",{className:it.columnCount,"data-testid":`board-count-${b.status}`,children:b.tasks.length})]}),i.jsx("div",{className:it.cardList,children:b.tasks.length===0?i.jsx("div",{className:it.emptyPlaceholder,children:"No tasks"}):i.jsx(gs,{mode:"popLayout",children:b.tasks.map(k=>i.jsx(Rt.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:i.jsx(S7,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>u(On(k.task.id,void 0,t,s))})},k.task.id))})})]},b.status))})}function S7({boardTask:t,tasksById:s,personaName:o,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=qa(d.status),x=d.parentTaskId?s.get(d.parentTaskId):void 0;return i.jsxs("div",{className:it.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c())},children:[i.jsxs("div",{className:it.cardHeader,children:[i.jsx("span",{className:it.cardStatusIcon,style:{color:v.color},children:v.icon}),i.jsx("span",{className:it.cardTitle,children:d.title})]}),i.jsxs("div",{className:it.cardBadges,children:[x&&i.jsx("span",{className:`${it.badge} ${it.parentBadge}`,title:x.title,children:x.title}),p>0&&i.jsxs("span",{className:`${it.badge} ${it.childBadge}`,children:[m,"/",p]}),u&&i.jsx("span",{className:`${it.badge} ${it.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&i.jsx("span",{className:`${it.badge} ${it.depBadge}`,children:"dep"}),g&&i.jsx("span",{className:`${it.badge} ${it.pausedSubBadge}`,children:g}),o&&i.jsx("span",{className:`${it.badge} ${it.personaBadge}`,children:o}),r&&i.jsx("span",{className:`${it.badge} ${it.envBadge}`,children:r})]})]})}const T7="_formContent_ymnez_1",j7="_section_ymnez_13",w7="_label_ymnez_19",N7="_titleInput_ymnez_26",C7="_descriptionTextarea_ymnez_58",E7="_selectField_ymnez_94",A7="_checkboxRow_ymnez_128",D7="_checkboxLabel_ymnez_141",M7="_fieldError_ymnez_146",xt={formContent:T7,section:j7,label:w7,titleInput:N7,descriptionTextarea:C7,selectField:E7,checkboxRow:A7,checkboxLabel:D7,fieldError:M7};function R7(t,s){return{name:(t==null?void 0:t.name)??"",description:(t==null?void 0:t.description)??"",repoUrl:(t==null?void 0:t.repoUrl)??"",environmentId:(t==null?void 0:t.linkedEnvironmentIds[0])??s??"",defaultPersonaId:(t==null?void 0:t.defaultPersonaId)??"",useWorktrees:(t==null?void 0:t.useWorktrees)??!0,workingDirectory:(t==null?void 0:t.workingDirectory)??""}}const I7=100;function O7({values:t,onChange:s,environments:o,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return i.jsxs("div",{className:xt.formContent,children:[i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-name",children:"Name"}),i.jsx("input",{id:"ws-name",className:xt.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:I7,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-description",children:"Description"}),i.jsx("textarea",{id:"ws-description",className:xt.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-repo",children:"Repository URL"}),i.jsx("input",{id:"ws-repo",className:xt.titleInput,type:"text",value:t.repoUrl,onChange:m=>p("repoUrl",m.target.value),placeholder:"https://github.com/org/repo",disabled:d,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-environment",children:"Environment"}),i.jsxs("select",{id:"ws-environment",className:xt.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[i.jsx("option",{value:"",children:"Select environment…"}),o.map(m=>i.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-persona",children:"Default Persona"}),i.jsxs("select",{id:"ws-persona",className:xt.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>i.jsx("option",{value:m.id,children:m.name},m.id))]})]}),i.jsx("div",{className:xt.section,children:i.jsxs("label",{className:xt.checkboxRow,children:[i.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),i.jsx("span",{className:xt.checkboxLabel,children:"Enable worktree isolation"})]})}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-workdir",children:"Working Directory"}),i.jsx("input",{id:"ws-workdir",className:xt.titleInput,type:"text",value:t.workingDirectory,onChange:m=>p("workingDirectory",m.target.value),placeholder:"Default (server default)",disabled:d,"data-testid":"workspace-form-workdir"})]})]})}const q1=y.createContext(void 0),B7=4e3;function L7({children:t}){const[s,o]=y.useState([]),r=y.useRef(0),c=y.useCallback(u=>{o(p=>p.filter(m=>m.id!==u))},[]),d=y.useCallback((u,p="info",m=B7)=>{const g=`toast-${++r.current}`;o(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return i.jsx(q1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function pn(){const t=y.useContext(q1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const um="grackle-theme",G1="grackle-prefer-system",F1="(prefers-color-scheme: dark)";let Kr=[],od;function Dp(){od=void 0;for(const t of Kr)t()}function fm(){return typeof window>"u"?!1:window.matchMedia(F1).matches}function el(){if(typeof localStorage>"u")return ex;try{const t=localStorage.getItem(um);if(t!==null&&U1.has(t))return t}catch{}return ex}function xd(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(G1)==="true"}catch{return!1}}function pm(t){return Ld.find(s=>s.variantLightId===t||s.variantDarkId===t)}function Z1(t,s){const o=dm(t);if(o!=null&&o.variantDarkId)return s&&o.variantLightId?fm()?o.variantDarkId:o.variantLightId:o.variantDarkId;if(o!=null&&o.hidden&&s){const r=pm(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return fm()?r.variantDarkId:r.variantLightId}return t}function No(t,s,o=!1){o&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=Z1(t,s),o&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&No(el(),xd());function z7(){return od===void 0&&(od={themeId:el(),systemDark:fm(),preferSystem:xd()}),od}function $7(t){return Kr=[...Kr,t],()=>{Kr=Kr.filter(s=>s!==t)}}function P7(){const t=y.useSyncExternalStore($7,z7),{themeId:s,preferSystem:o}=t,r=Z1(s,o),c=y.useCallback(u=>{if(U1.has(u)){try{localStorage.setItem(um,u)}catch{}No(u,xd(),!0),Dp()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(G1,u?"true":"false")}catch{}if(u){const p=el(),m=dm(p);if(m!=null&&m.hidden){const g=pm(p);if(g)try{localStorage.setItem(um,g.id)}catch{}}}No(el(),u,!0),Dp()},[]);return y.useEffect(()=>{No(s,o)},[s,o]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(F1),p=()=>{const m=el(),g=xd();if(g){const v=dm(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&No(m,g),v!=null&&v.hidden){const x=pm(m);x!=null&&x.variantDarkId&&x.variantLightId&&No(m,g)}}Dp()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:o,setPreferSystem:d}}const K1=y.createContext(void 0);function U7({children:t}){const s=P7();return i.jsx(K1.Provider,{value:s,children:t})}function Y1(){const t=y.useContext(K1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const J1=y.createContext(void 0),W1=y.createContext(void 0);function H7({children:t}){const[s,o]=y.useState(void 0),r=y.useCallback(c=>{o(c)},[]);return i.jsx(W1.Provider,{value:r,children:i.jsx(J1.Provider,{value:s,children:t})})}function V7(){return y.useContext(J1)}function q7(){const t=y.useContext(W1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const uh=y.createContext(void 0);function ot(){const t=y.useContext(uh);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function X1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Q1(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function G7(t){return X1(t)&&typeof t.sessionId=="string"&&typeof t.eventType=="string"&&typeof t.timestamp=="string"&&typeof t.content=="string"&&(t.raw===void 0||typeof t.raw=="string")}const F7=new Set(["off","subscription","api_key"]),Fc=new Set(["off","on"]);function Z7(t){return X1(t)&&F7.has(t.claude)&&Fc.has(t.github)&&Fc.has(t.copilot)&&Fc.has(t.codex)&&Fc.has(t.goose)}function ek(t){switch(t){case"waiting_input":return"idle";case"completed":return"stopped";case"killed":return"stopped";case"failed":return"stopped";case"interrupted":return"stopped";case"terminated":return"stopped";default:return t}}function tk(t){switch(t){case"completed":return"completed";case"killed":return"killed";case"failed":return"interrupted";case"interrupted":return"interrupted";case"terminated":return"terminated";default:return}}const wo=5e3;function K7(t,s){const o=[];let r=t;const c=new Set;for(;r&&s.has(r)&&!c.has(r);){c.add(r);const d=s.get(r);o.unshift(d),r=d.parentTaskId||void 0}return o}const ra={label:"Home",url:Di};function Y7(t){return t?[ra,{label:"Settings",url:wi},{label:t,url:void 0}]:[ra,{label:"Settings",url:void 0}]}const fh={label:"Environments",url:Ro};function J7(){return[ra,{label:"Environments",url:void 0}]}function W7(){return[ra,{label:"New Chat",url:void 0}]}function X7(t){return[ra,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function Q7(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[ra,fh,{label:(d==null?void 0:d.displayName)??"Environment",url:Ai(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function ez(t,s,o,r,c){const d=K7(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,m=p?o.find(k=>k.id===p):void 0,g=s??(m==null?void 0:m.linkedEnvironmentIds[0]),v=g?r.find(k=>k.id===g):void 0,x=[ra];v&&g&&(x.push(fh),x.push({label:v.displayName,url:Ai(g)})),m&&g&&x.push({label:m.name,url:Ei(m.id,g)});for(let k=0;k<d.length-1;k++)x.push({label:d[k].title,url:On(d[k].id,void 0,p,g)});const b=d[d.length-1];return x.push({label:(b==null?void 0:b.title)??t,url:void 0}),x}const tz={label:"Findings",url:Ad};function nz(){return[ra,{label:"Findings",url:void 0}]}function nk(t,s,o,r,c){const d=[ra];if(s&&o){const u=r.find(m=>m.id===s),p=c.find(m=>m.id===o);d.push(fh),p&&d.push({label:p.displayName,url:Ai(o)}),u&&d.push({label:u.name,url:Ei(s,o)}),d.push({label:"Findings",url:CN(s,o)})}else d.push(tz);return d.push({label:t,url:void 0}),d}function ph(t){const s=[];for(const o of t){const r=s[s.length-1];o.eventType==="text"&&(r==null?void 0:r.eventType)==="text"?s[s.length-1]={...r,content:r.content+o.content}:s.push(o)}return s}function Zc(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const o=t.item;if(o&&typeof o.id=="string")return o.id}function sz(t){if(typeof t.tool_use_id=="string")return t.tool_use_id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const o=t.item;if(o&&typeof o.id=="string")return o.id}function mh(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const o=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const x=s.get(v),b=x?Zc(x):void 0;if(b)try{const k=JSON.parse(v.content);o.set(b,{tool:k.tool,args:k.args})}catch{}}const r=new Set,c=new Set,d=t.map((v,x)=>{if(v.eventType!=="tool_result")return v;const b=s.get(v),k=b?sz(b):void 0;if(!k)return v;const S=o.get(k);if(!S)return v;r.add(k),c.add(x);let j;const N=v.content.trim();if(N.startsWith("{"))try{const T=JSON.parse(N);typeof T.detailedContent=="string"&&(j=T.detailedContent)}catch{}return{...v,toolUseCtx:{...S,detailedResult:j}}}),u=[];for(let v=0;v<d.length;v++){if(d[v].eventType!=="tool_use")continue;const x=s.get(d[v]),b=x?Zc(x):void 0;b&&r.has(b)||u.push(v)}const p=[];for(let v=0;v<d.length;v++)d[v].eventType!=="tool_result"||c.has(v)||p.push(v);let m=0;for(const v of u){for(;m<p.length&&p[m]<v;)m++;if(m>=p.length)break;const x=p[m];if(x!==v+1)continue;const b=d[v],k=d[x];let S;try{const j=JSON.parse(b.content);S={tool:j.tool,args:j.args}}catch{}if(S){let j;const N=k.content.trim();if(N.startsWith("{"))try{const D=JSON.parse(N);typeof D.detailedContent=="string"&&(j=D.detailedContent)}catch{}d[x]={...k,toolUseCtx:{...S,detailedResult:j}},c.add(x);const T=s.get(b),C=T?Zc(T):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(b,{...T??{},__seqId:`__seq_${v}`})),m++}}const g=d.filter(v=>{if(v.eventType!=="tool_use")return!0;const x=s.get(v);if(!x)return!0;const b=Zc(x);if(b&&r.has(b))return!1;const k=x.__seqId;return!(k&&r.has(k))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let x=!1;for(let b=v+1;b<g.length;b++)if(g[b].eventType!=="tool_use"){x=!0;break}x&&(g[v]={...g[v],settled:!0})}return g}function az(t,s,o){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=sk(s),d=s.filter(m=>mm(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||mm(m,c)).length,p=o.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function sk(t){const s=new Map;for(const o of t)s.set(o.id,o.status);return s}function mm(t,s){return t.dependsOn.some(o=>s.get(o)!=="complete")}function iz(t,s){var u;const o=new Map;for(const p of s)o.set(p.id,p);const r=sk(t),c=[];for(const p of t){const m=p.workspaceId?((u=o.get(p.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:m}):mm(p,r)?c.push({task:p,reason:"blocked",workspaceName:m}):p.status==="paused"&&c.push({task:p,reason:"paused",workspaceName:m})}const d={failed:0,blocked:1,paused:2};return c.sort((p,m)=>(d[p.reason]??3)-(d[m.reason]??3)),c}function oz(t,s){const o=new Map;for(const r of s)o.set(r.id,r);return t.filter(r=>r.status==="running"||r.status==="idle"||r.status==="waiting").map(r=>{var c;return{session:r,environmentName:((c=o.get(r.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function rz(t,s,o){const r=new Map;for(const c of s){if(!c.workspaceId)continue;let d=r.get(c.workspaceId);d||(d={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},r.set(c.workspaceId,d)),d.totalTasks+=1,c.status==="complete"?d.completedTasks+=1:c.status==="working"?d.workingTasks+=1:c.status==="failed"&&(d.failedTasks+=1)}return t.map(c=>{const d=r.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:d.totalTasks,completedTasks:d.completedTasks,workingTasks:d.workingTasks,failedTasks:d.failedTasks}})}const ws=[{id:"kn-auth-flow",label:"Authentication Flow",kind:"knowledge",category:"concept",content:"The application uses JWT Bearer tokens for stateless authentication. Access tokens expire after 24h. Refresh tokens are stored in the database and rotated on use. The auth middleware verifies tokens and attaches the decoded payload to req.user.",tags:["auth","jwt","security"],workspaceId:"proj-alpha",createdAt:"2026-02-25T10:30:00Z",updatedAt:"2026-02-27T08:15:00Z",val:5},{id:"kn-db-schema",label:"Database Schema",kind:"knowledge",category:"concept",content:"PostgreSQL database with tables: users, sessions, refresh_tokens, audit_log. Uses UUID primary keys, TIMESTAMPTZ for all timestamps, and JSONB for flexible metadata columns. Connection pooling via pg-pool with per-tenant isolation.",tags:["database","postgres","schema"],workspaceId:"proj-alpha",createdAt:"2026-02-23T11:00:00Z",updatedAt:"2026-02-26T22:45:00Z",val:4},{id:"kn-error-handling",label:"Error Response Pattern",kind:"knowledge",category:"concept",content:"All API errors follow the shape { error: string, code: string, details?: unknown }. HTTP status codes map to: 400 (validation), 401 (unauthenticated), 403 (forbidden), 404 (not found), 409 (conflict), 429 (rate limited), 500 (internal).",tags:["api","errors","patterns"],workspaceId:"proj-alpha",createdAt:"2026-02-27T08:17:00Z",updatedAt:"2026-02-27T08:17:00Z",val:3},{id:"kn-rate-limiting",label:"Rate Limiting Strategy",kind:"knowledge",category:"concept",content:"Token-bucket algorithm with in-memory state per client IP. Default rate: 100 requests/minute, burst: 20. Returns 429 with Retry-After header. Redis adapter available for multi-instance deployments.",tags:["api","rate-limiting","infrastructure"],workspaceId:"proj-alpha",createdAt:"2026-02-27T09:00:00Z",updatedAt:"2026-02-27T09:00:00Z",val:2},{id:"kn-etl-pipeline",label:"ETL Pipeline Architecture",kind:"knowledge",category:"concept",content:"Data pipelines follow an Extract-Transform-Load pattern with pluggable stages. Each stage reads from a source (Postgres, S3, API), transforms via configurable mappers, and loads into a target (Parquet, BigQuery, S3). Incremental loads use high-watermark tracking.",tags:["etl","pipeline","architecture"],workspaceId:"proj-beta",createdAt:"2026-02-26T08:00:00Z",updatedAt:"2026-02-27T09:05:00Z",val:4},{id:"kn-parquet-format",label:"Parquet Output Format",kind:"knowledge",category:"concept",content:"Parquet files are written with row-group buffering (configurable batch size, default 10000 rows). Supports Snappy, ZSTD, and GZIP compression. Schema is derived from the internal column type system using Arrow type mapping.",tags:["parquet","data-format","compression"],workspaceId:"proj-beta",createdAt:"2026-02-26T08:05:00Z",updatedAt:"2026-02-26T08:15:00Z",val:3},{id:"kn-jwt-over-session",label:"JWT over Session Auth",kind:"knowledge",category:"decision",content:"Chose JWT tokens over server-side sessions for stateless auth. Rationale: (1) no session store needed, (2) works across microservices without shared state, (3) supports mobile clients natively. Trade-off: tokens can't be revoked instantly (mitigated by short expiry + refresh rotation).",tags:["auth","decision","jwt"],workspaceId:"proj-alpha",createdAt:"2026-02-25T10:00:00Z",updatedAt:"2026-02-25T10:00:00Z",val:3},{id:"kn-pg-pool-decision",label:"pg-pool over Knex",kind:"knowledge",category:"decision",content:"Chose pg-pool over Knex for connection pooling. pg-pool gives direct control over idle timeout, max connections, and health check queries. Knex wraps pg-pool and adds query-building overhead we don't need since we write raw SQL with parameterized queries.",tags:["database","decision","postgres"],workspaceId:"proj-alpha",createdAt:"2026-02-23T11:30:00Z",updatedAt:"2026-02-23T11:30:00Z",val:2},{id:"kn-watermark-decision",label:"Local Watermark Storage",kind:"knowledge",category:"decision",content:"Currently using local SQLite for watermark storage. This works for single-worker pipelines but needs to move to a shared store (Redis or Postgres) for production multi-worker scenarios. Tracked as a follow-up task.",tags:["pipeline","decision","watermarks"],workspaceId:"proj-beta",createdAt:"2026-02-27T09:05:00Z",updatedAt:"2026-02-27T09:05:00Z",val:2},{id:"kn-jwt-middleware",label:"JWT Verify Middleware",kind:"knowledge",category:"snippet",content:`\`\`\`typescript
285
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
286
- const header = req.headers.authorization;
287
- if (!header?.startsWith("Bearer ")) {
288
- res.status(401).json({ error: "Missing token" });
289
- return;
290
- }
291
- const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
292
- req.user = decoded;
293
- next();
294
- }
295
- \`\`\``,tags:["auth","jwt","middleware","typescript"],workspaceId:"proj-alpha",createdAt:"2026-02-27T08:15:14Z",updatedAt:"2026-02-27T08:15:14Z",val:2},{id:"kn-audit-schema",label:"Audit Log Schema",kind:"knowledge",category:"snippet",content:`\`\`\`sql
296
- CREATE TABLE audit_log (
297
- id BIGSERIAL PRIMARY KEY,
298
- user_id UUID REFERENCES users(id),
299
- action TEXT NOT NULL,
300
- entity_type TEXT NOT NULL,
301
- entity_id TEXT NOT NULL,
302
- old_value JSONB,
303
- new_value JSONB,
304
- ip_address INET,
305
- created_at TIMESTAMPTZ DEFAULT now()
306
- );
307
- \`\`\``,tags:["database","audit","schema","sql"],workspaceId:"proj-alpha",createdAt:"2026-02-26T22:45:15Z",updatedAt:"2026-02-26T22:45:15Z",val:2},{id:"kn-n1-query",label:"N+1 Query in User List",kind:"knowledge",category:"insight",content:"GET /api/users performs a separate query for each user's role metadata, resulting in N+1 queries. For 500 users this adds ~2 seconds of latency. Solution: use a JOIN or batch lookup to fetch all role data in a single query.",tags:["performance","database","n+1"],workspaceId:"proj-alpha",createdAt:"2026-02-22T09:30:00Z",updatedAt:"2026-02-22T09:30:00Z",val:2},{id:"kn-session-race",label:"Session Cleanup Race Condition",kind:"knowledge",category:"insight",content:"When two concurrent requests hit /api/logout, the second call throws a 500 because the session row has already been deleted. Fix: use DELETE ... RETURNING or add IF EXISTS guard to make the operation idempotent.",tags:["bug","concurrency","sessions"],workspaceId:"proj-alpha",createdAt:"2026-02-26T22:50:00Z",updatedAt:"2026-02-26T22:50:00Z",val:2},{id:"kn-ref-task-001",label:"JWT Auth Task",kind:"reference",sourceType:"task",sourceId:"task-001",content:"Implement JWT authentication across all protected routes, replacing session-based auth.",workspaceId:"proj-alpha",createdAt:"2026-02-25T10:00:00Z",updatedAt:"2026-02-27T08:15:00Z",val:3},{id:"kn-ref-task-006",label:"Parquet Export Task",kind:"reference",sourceType:"task",sourceId:"task-006",content:"Add Parquet export support for pipeline outputs, enabling downstream Spark consumption.",workspaceId:"proj-beta",createdAt:"2026-02-26T08:00:00Z",updatedAt:"2026-02-27T09:00:00Z",val:3},{id:"kn-ref-sess-001",label:"Auth Middleware Session",kind:"reference",sourceType:"session",sourceId:"sess-001",content:"Active session implementing JWT auth middleware, rewrote auth.ts, login.ts, and test suite.",workspaceId:"proj-alpha",createdAt:"2026-02-27T08:15:00Z",updatedAt:"2026-02-27T08:15:42Z",val:2}],za=[{source:"kn-auth-flow",target:"kn-jwt-over-session",type:"decided_by"},{source:"kn-auth-flow",target:"kn-jwt-middleware",type:"implemented_by"},{source:"kn-auth-flow",target:"kn-ref-task-001",type:"tracked_in"},{source:"kn-auth-flow",target:"kn-error-handling",type:"relates_to"},{source:"kn-jwt-over-session",target:"kn-ref-task-001",type:"motivated_by"},{source:"kn-db-schema",target:"kn-pg-pool-decision",type:"decided_by"},{source:"kn-db-schema",target:"kn-audit-schema",type:"contains"},{source:"kn-db-schema",target:"kn-n1-query",type:"affected_by"},{source:"kn-db-schema",target:"kn-session-race",type:"affected_by"},{source:"kn-rate-limiting",target:"kn-error-handling",type:"relates_to"},{source:"kn-rate-limiting",target:"kn-auth-flow",type:"depends_on"},{source:"kn-etl-pipeline",target:"kn-parquet-format",type:"outputs_to"},{source:"kn-etl-pipeline",target:"kn-watermark-decision",type:"decided_by"},{source:"kn-etl-pipeline",target:"kn-ref-task-006",type:"tracked_in"},{source:"kn-parquet-format",target:"kn-ref-task-006",type:"tracked_in"},{source:"kn-watermark-decision",target:"kn-etl-pipeline",type:"relates_to"},{source:"kn-ref-task-001",target:"kn-ref-sess-001",type:"has_session"},{source:"kn-jwt-middleware",target:"kn-ref-sess-001",type:"created_in"},{source:"kn-audit-schema",target:"kn-db-schema",type:"part_of"}],lz=new Map(ws.map(t=>[t.id,t]));function Mp(t){const s=lz.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const sx={"kn-auth-flow":{node:Mp("kn-auth-flow"),edges:[{fromId:"kn-auth-flow",toId:"kn-jwt-over-session",type:"decided_by"},{fromId:"kn-auth-flow",toId:"kn-jwt-middleware",type:"implemented_by"},{fromId:"kn-auth-flow",toId:"kn-ref-task-001",type:"tracked_in"},{fromId:"kn-auth-flow",toId:"kn-error-handling",type:"relates_to"},{fromId:"kn-rate-limiting",toId:"kn-auth-flow",type:"depends_on"}]},"kn-db-schema":{node:Mp("kn-db-schema"),edges:[{fromId:"kn-db-schema",toId:"kn-pg-pool-decision",type:"decided_by"},{fromId:"kn-db-schema",toId:"kn-audit-schema",type:"contains"},{fromId:"kn-db-schema",toId:"kn-n1-query",type:"affected_by"},{fromId:"kn-db-schema",toId:"kn-session-race",type:"affected_by"},{fromId:"kn-audit-schema",toId:"kn-db-schema",type:"part_of"}]},"kn-etl-pipeline":{node:Mp("kn-etl-pipeline"),edges:[{fromId:"kn-etl-pipeline",toId:"kn-parquet-format",type:"outputs_to"},{fromId:"kn-etl-pipeline",toId:"kn-watermark-decision",type:"decided_by"},{fromId:"kn-etl-pipeline",toId:"kn-ref-task-006",type:"tracked_in"},{fromId:"kn-watermark-decision",toId:"kn-etl-pipeline",type:"relates_to"}]}},cz=[{id:"env-local-01",displayName:"Local Dev",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0},{id:"env-docker-01",displayName:"Docker Sandbox",adapterType:"docker",adapterConfig:'{"image":"node:20"}',status:"connected",bootstrapped:!0},{id:"env-cs-01",displayName:"GitHub Codespace",adapterType:"codespace",adapterConfig:'{"codespaceName":"my-codespace"}',status:"connected",bootstrapped:!0},{id:"env-remote-01",displayName:"Staging (SSH)",adapterType:"ssh",adapterConfig:'{"host":"192.168.1.10","user":"deploy","sshPort":22}',status:"disconnected",bootstrapped:!1},{id:"error-env",displayName:"Error Test",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0}],dz=[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z",endedAt:"2026-02-26T15:12:00Z",error:"Context window exceeded before completing implementation",inputTokens:84200,outputTokens:12750,costMillicents:41e3},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Refactor the authentication middleware to use JWT tokens",startedAt:"2026-02-27T08:15:00Z",inputTokens:42600,outputTokens:8100,costMillicents:22e3},{id:"sess-002",environmentId:"env-docker-01",runtime:"copilot",status:"stopped",endReason:"completed",prompt:"Write unit tests for the user registration endpoint",startedAt:"2026-02-27T07:30:00Z",endedAt:"2026-02-27T07:33:00Z",inputTokens:31400,outputTokens:9800,costMillicents:18e3},{id:"sess-003",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Migrate database schema to add audit_log table",startedAt:"2026-02-26T22:45:00Z",endedAt:"2026-02-26T23:10:00Z",inputTokens:56300,outputTokens:14200,costMillicents:31e3},{id:"sess-004",environmentId:"env-docker-01",runtime:"codex",status:"running",prompt:"Implement rate limiting for the public API",startedAt:"2026-02-27T09:00:00Z",inputTokens:18900,outputTokens:4500,costMillicents:1e4},{id:"sess-005",environmentId:"env-cs-01",runtime:"claude-code",status:"suspended",prompt:"Refactor database connection pooling for multi-tenant isolation",startedAt:"2026-02-27T06:00:00Z",inputTokens:67800,outputTokens:19300,costMillicents:38e3}],uz=[{sessionId:"sess-001-prev",eventType:"status",timestamp:"2026-02-26T14:00:01Z",content:"running"},{sessionId:"sess-001-prev",eventType:"system",timestamp:"2026-02-26T14:00:02Z",content:`You are a senior backend engineer. Focus on security best practices and thorough testing.
308
- Project: acme/alpha — Node.js + Express REST API
309
- Task: Implement auth middleware using JWT tokens`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:00:05Z",content:"I'll start by reading the current authentication middleware to understand what needs to change."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:00:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/middleware/auth.ts"}}),raw:JSON.stringify({id:"tu-prev-001",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:00:07Z",content:`import session from "express-session";
310
- import type { Request, Response, NextFunction } from "express";
311
-
312
- export function requireAuth(req: Request, res: Response, next: NextFunction): void {
313
- if (!req.session?.userId) {
314
- res.status(401).json({ error: "Not authenticated" });
315
- return;
316
- }
317
- next();
318
- }`,raw:JSON.stringify({tool_use_id:"tu-prev-001"})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:00:10Z",content:"The current auth uses express-session with server-side session storage. Let me find all files that depend on this pattern."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:00:11Z",content:JSON.stringify({tool:"Grep",args:{pattern:"req\\.session",path:"src/"}}),raw:JSON.stringify({id:"tu-prev-002",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:00:12Z",content:`src/middleware/auth.ts:4: if (!req.session?.userId) {
319
- src/routes/login.ts:18: req.session.userId = user.id;
320
- src/routes/login.ts:19: req.session.role = user.role;
321
- src/routes/protected.ts:7: const userId = req.session.userId;`,raw:JSON.stringify({tool_use_id:"tu-prev-002"})},{sessionId:"sess-001-prev",eventType:"usage",timestamp:"2026-02-26T14:30:00Z",content:JSON.stringify({input_tokens:42100,output_tokens:6350,cost_millicents:21e3})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:30:02Z",content:"Found 3 files using session-based auth. Now let me read the login route and the protected route to understand the full flow before making changes."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:30:03Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/login.ts"}}),raw:JSON.stringify({id:"tu-prev-003",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:30:04Z",content:`import { Router } from "express";
322
- import bcrypt from "bcrypt";
323
- import { db } from "../db.js";
324
-
325
- const router = Router();
326
-
327
- router.post("/login", async (req, res) => {
328
- const { email, password } = req.body;
329
- const user = await db.users.findByEmail(email);
330
- if (!user || !await bcrypt.compare(password, user.passwordHash)) {
331
- return res.status(401).json({ error: "Invalid credentials" });
332
- }
333
- req.session.userId = user.id;
334
- req.session.role = user.role;
335
- res.json({ ok: true });
336
- });
337
-
338
- export default router;`,raw:JSON.stringify({tool_use_id:"tu-prev-003"})},{sessionId:"sess-001-prev",eventType:"error",timestamp:"2026-02-26T15:12:00Z",content:"Context window exceeded before completing implementation"},{sessionId:"sess-001-prev",eventType:"status",timestamp:"2026-02-26T15:12:01Z",content:"interrupted"},{sessionId:"sess-001",eventType:"status",timestamp:"2026-02-27T08:15:01Z",content:"running"},{sessionId:"sess-001",eventType:"system",timestamp:"2026-02-27T08:15:02Z",content:`You are a senior backend engineer. Focus on security best practices and thorough testing.
339
- Project: acme/alpha — Node.js + Express REST API
340
- Task: Implement auth middleware using JWT tokens
341
-
342
- Note: A previous session attempted this task but was interrupted. Pick up where it left off.`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:04Z",content:"I'll pick up the JWT auth migration. The previous session identified 3 files that need updating. Let me verify the current state and start implementing."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:04.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Install jsonwebtoken package",activeForm:"Installing jsonwebtoken",status:"pending"},{content:"Rewrite auth middleware for JWT",activeForm:"Rewriting auth middleware",status:"pending"},{content:"Update login route to issue tokens",activeForm:"Updating login route",status:"pending"},{content:"Update protected routes",activeForm:"Updating protected routes",status:"pending"},{content:"Fix and update tests",activeForm:"Fixing tests",status:"pending"},{content:"Run full test suite",activeForm:"Running tests",status:"pending"}]}})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:05Z",content:JSON.stringify({tool:"Grep",args:{pattern:"express-session|req\\.session",path:"src/",output_mode:"files_with_matches"}}),raw:JSON.stringify({id:"tu-001-01",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:06Z",content:`src/middleware/auth.ts
343
- src/routes/login.ts
344
- src/routes/protected.ts`,raw:JSON.stringify({tool_use_id:"tu-001-01"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:08Z",content:"Good, same 3 files. Let me install the JWT library first, then rewrite the middleware."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:09Z",content:JSON.stringify({tool:"Bash",args:{command:"npm install jsonwebtoken && npm install -D @types/jsonwebtoken"}}),raw:JSON.stringify({id:"tu-001-02",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:11Z",content:`added 12 packages in 3.2s
345
-
346
- added 1 package in 0.8s`,raw:JSON.stringify({tool_use_id:"tu-001-02"})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:11.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Install jsonwebtoken package",activeForm:"Installing jsonwebtoken",status:"completed"},{content:"Rewrite auth middleware for JWT",activeForm:"Rewriting auth middleware",status:"in_progress"},{content:"Update login route to issue tokens",activeForm:"Updating login route",status:"pending"},{content:"Update protected routes",activeForm:"Updating protected routes",status:"pending"},{content:"Fix and update tests",activeForm:"Fixing tests",status:"pending"},{content:"Run full test suite",activeForm:"Running tests",status:"pending"}]}})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:12Z",content:"Now I'll rewrite the auth middleware to use JWT verification instead of session checks."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:13Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/auth.ts",content:`import jwt from "jsonwebtoken";
347
- import type { Request, Response, NextFunction } from "express";
348
-
349
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
350
-
351
- export interface JwtPayload {
352
- userId: string;
353
- role: string;
354
- iat: number;
355
- exp: number;
356
- }
357
-
358
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
359
- const header = req.headers.authorization;
360
- if (!header?.startsWith("Bearer ")) {
361
- res.status(401).json({ error: "Missing or malformed token" });
362
- return;
363
- }
364
- try {
365
- const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
366
- req.user = decoded;
367
- next();
368
- } catch (err) {
369
- if (err instanceof jwt.TokenExpiredError) {
370
- res.status(401).json({ error: "Token expired" });
371
- } else {
372
- res.status(403).json({ error: "Invalid token" });
373
- }
374
- }
375
- }
376
- `}}),raw:JSON.stringify({id:"tu-001-03",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:14Z",content:"File written: src/middleware/auth.ts (32 lines)",raw:JSON.stringify({tool_use_id:"tu-001-03"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:16Z",content:`Now I need to update the login route to issue JWT tokens instead of setting session data.
377
-
378
- The new login flow will:
379
- 1. Validate credentials (unchanged)
380
- 2. Generate a JWT with \`userId\` and \`role\` claims
381
- 3. Return the token in the response body
382
- 4. Include a refresh token for long-lived sessions`},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:17Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/routes/login.ts",content:`import { Router } from "express";
383
- import bcrypt from "bcrypt";
384
- import jwt from "jsonwebtoken";
385
- import crypto from "node:crypto";
386
- import { db } from "../db.js";
387
-
388
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
389
- const ACCESS_TOKEN_EXPIRY = "24h";
390
- const REFRESH_TOKEN_BYTES = 48;
391
-
392
- const router = Router();
393
-
394
- router.post("/login", async (req, res) => {
395
- const { email, password } = req.body;
396
- const user = await db.users.findByEmail(email);
397
- if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
398
- return res.status(401).json({ error: "Invalid credentials" });
399
- }
400
-
401
- const accessToken = jwt.sign(
402
- { userId: user.id, role: user.role },
403
- JWT_SECRET,
404
- { expiresIn: ACCESS_TOKEN_EXPIRY },
405
- );
406
-
407
- const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
408
- await db.refreshTokens.create({ userId: user.id, token: refreshToken });
409
-
410
- res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
411
- });
412
-
413
- export default router;
414
- `}}),raw:JSON.stringify({id:"tu-001-04",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:18Z",content:"File written: src/routes/login.ts (33 lines)",raw:JSON.stringify({tool_use_id:"tu-001-04"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:20Z",content:"Let me update the protected route to use the new `req.user` shape from the JWT payload."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:21Z",content:JSON.stringify({tool:"Edit",args:{file_path:"src/routes/protected.ts",old_string:"const userId = req.session.userId;",new_string:"const { userId } = req.user as JwtPayload;"}}),raw:JSON.stringify({id:"tu-001-05",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:22Z",content:"Updated src/routes/protected.ts",raw:JSON.stringify({tool_use_id:"tu-001-05"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:24Z",content:"Now let me run the existing tests to make sure nothing is broken, then I'll add new JWT-specific tests."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:25Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test"}}),raw:JSON.stringify({id:"tu-001-06",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:30Z",content:` PASS src/routes/__tests__/login.test.ts
415
- PASS src/routes/__tests__/protected.test.ts
416
- FAIL src/middleware/__tests__/auth.test.ts
417
- x should reject missing session (12ms)
418
- x should allow valid session (8ms)
419
-
420
- 2 failed, 12 passed, 14 total
421
-
422
- Test Suites: 1 failed, 2 passed, 3 total`,raw:JSON.stringify({tool_use_id:"tu-001-06",is_error:!0})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:32Z",content:`Two tests failed because they still test the old session-based auth. I need to rewrite those tests for JWT.
423
-
424
- Let me update the auth middleware tests:`},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:33Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/__tests__/auth.test.ts",content:`import { describe, it, expect } from "vitest";
425
- import jwt from "jsonwebtoken";
426
- import { verifyToken } from "../auth.js";
427
- import { createMockReqRes } from "../../test-utils/mock-express.js";
428
-
429
- const SECRET = "test-secret";
430
- process.env.JWT_SECRET = SECRET;
431
-
432
- describe("verifyToken", () => {
433
- it("should reject requests without Authorization header", () => {
434
- const { req, res, next } = createMockReqRes();
435
- verifyToken(req, res, next);
436
- expect(res.status).toHaveBeenCalledWith(401);
437
- });
438
-
439
- it("should reject expired tokens", () => {
440
- const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
441
- const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
442
- verifyToken(req, res, next);
443
- expect(res.status).toHaveBeenCalledWith(401);
444
- });
445
-
446
- it("should accept valid tokens and attach user to request", () => {
447
- const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
448
- const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
449
- verifyToken(req, res, next);
450
- expect(next).toHaveBeenCalled();
451
- expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
452
- });
453
- });
454
- `}}),raw:JSON.stringify({id:"tu-001-07",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:34Z",content:"File written: src/middleware/__tests__/auth.test.ts (32 lines)",raw:JSON.stringify({tool_use_id:"tu-001-07"})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:35Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test"}}),raw:JSON.stringify({id:"tu-001-08",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:40Z",content:` PASS src/routes/__tests__/login.test.ts
455
- PASS src/routes/__tests__/protected.test.ts
456
- PASS src/middleware/__tests__/auth.test.ts
457
-
458
- Test Suites: 3 passed, 3 total
459
- Tests: 14 passed, 14 total`,raw:JSON.stringify({tool_use_id:"tu-001-08"})},{sessionId:"sess-001",eventType:"usage",timestamp:"2026-02-27T08:15:41Z",content:JSON.stringify({input_tokens:42600,output_tokens:8100,cost_millicents:22e3})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:42Z",content:`All 14 tests pass. Here's a summary of the changes:
460
-
461
- ### Changes made
462
-
463
- | File | Action |
464
- |------|--------|
465
- | \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
466
- | \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
467
- | \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
468
- | \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
469
-
470
- ### Key decisions
471
- - **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
472
- - **Refresh tokens**: 48-byte random hex, stored in DB
473
- - **Error handling**: Distinguishes expired tokens (401) from invalid tokens (403)`},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:30:01Z",content:"running"},{sessionId:"sess-002",eventType:"system",timestamp:"2026-02-27T07:30:02Z",content:`You are a QA engineer. Write comprehensive tests covering happy paths, edge cases, error scenarios, and security.
474
- Project: acme/alpha — Node.js + Express REST API
475
- Task: Write unit tests for the user registration endpoint`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:30:04Z",content:"I'll write thorough tests for `POST /api/register`. Let me first read the registration endpoint to understand its behavior."},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:30:05Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/register.ts"}}),raw:JSON.stringify({id:"tu-002-01",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:30:06Z",content:`import { Router } from "express";
476
- import bcrypt from "bcrypt";
477
- import { db } from "../db.js";
478
- import { validateEmail, validatePassword } from "../utils/validators.js";
479
-
480
- const SALT_ROUNDS = 12;
481
- const router = Router();
482
-
483
- router.post("/register", async (req, res) => {
484
- const { name, email, password } = req.body;
485
-
486
- if (!name || !email || !password) {
487
- return res.status(400).json({ error: "Missing required fields" });
488
- }
489
- if (!validateEmail(email)) {
490
- return res.status(400).json({ error: "Invalid email format" });
491
- }
492
- if (!validatePassword(password)) {
493
- return res.status(400).json({ error: "Password too weak" });
494
- }
495
-
496
- const existing = await db.users.findByEmail(email);
497
- if (existing) {
498
- return res.status(409).json({ error: "Email already registered" });
499
- }
500
-
501
- const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
502
- const user = await db.users.create({ name, email, passwordHash });
503
- res.status(201).json({ id: user.id, name: user.name, email: user.email });
504
- });
505
-
506
- export default router;`,raw:JSON.stringify({tool_use_id:"tu-002-01"})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:30:10Z",content:`Good. The endpoint validates input, checks for duplicates, hashes the password, and creates the user. I'll write tests covering:
507
-
508
- 1. **Happy path** - valid registration
509
- 2. **Missing fields** - each required field missing
510
- 3. **Invalid email** - malformed email format
511
- 4. **Weak password** - password validation failure
512
- 5. **Duplicate email** - conflict with existing user
513
- 6. **SQL injection** - malicious email input
514
- 7. **XSS payload** - HTML in the name field
515
- 8. **Response shape** - correct status codes and body structure`},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:30:12Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/routes/__tests__/register.test.ts",content:"// [test content - 8 test cases as described above]"}}),raw:JSON.stringify({id:"tu-002-02",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:30:13Z",content:"File written: src/routes/__tests__/register.test.ts (142 lines)",raw:JSON.stringify({tool_use_id:"tu-002-02"})},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:31:00Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --testPathPattern=register"}}),raw:JSON.stringify({id:"tu-002-03",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:31:30Z",content:` PASS src/routes/__tests__/register.test.ts
516
- POST /api/register
517
- ✓ should register a valid user (28ms)
518
- ✓ should reject missing name (4ms)
519
- ✓ should reject missing email (3ms)
520
- ✓ should reject missing password (3ms)
521
- ✓ should reject invalid email format (5ms)
522
- ✓ should reject weak password (4ms)
523
- ✓ should reject duplicate email (12ms)
524
- ✓ should sanitize HTML in name field (6ms)
525
-
526
- Tests: 8 passed, 8 total`,raw:JSON.stringify({tool_use_id:"tu-002-03"})},{sessionId:"sess-002",eventType:"usage",timestamp:"2026-02-27T07:32:00Z",content:JSON.stringify({input_tokens:31400,output_tokens:9800,cost_millicents:18e3})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:32:30Z",content:"All 8 test cases pass. Created `src/routes/__tests__/register.test.ts` with comprehensive coverage for the registration endpoint including input validation, duplicate detection, and security edge cases."},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:33:00Z",content:"completed"},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T22:45:01Z",content:"running"},{sessionId:"sess-003",eventType:"system",timestamp:"2026-02-26T22:45:02Z",content:`You are a database engineer. Focus on safe migrations, zero-downtime deployments, and data integrity.
527
- Project: acme/alpha — Node.js + Express + PostgreSQL
528
- Task: Add audit_log table and migrate schema`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:45:05Z",content:"I need to add an `audit_log` table for tracking all write operations. Let me review the current schema first."},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:45:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"migrations/001_initial.sql"}}),raw:JSON.stringify({id:"tu-003-01",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:45:07Z",content:`CREATE TABLE users (
529
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
530
- name TEXT NOT NULL,
531
- email TEXT UNIQUE NOT NULL,
532
- password_hash TEXT NOT NULL,
533
- role TEXT DEFAULT 'user',
534
- created_at TIMESTAMPTZ DEFAULT now(),
535
- updated_at TIMESTAMPTZ DEFAULT now()
536
- );
537
-
538
- CREATE TABLE sessions (
539
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
540
- user_id UUID REFERENCES users(id),
541
- expires_at TIMESTAMPTZ NOT NULL,
542
- created_at TIMESTAMPTZ DEFAULT now()
543
- );`,raw:JSON.stringify({tool_use_id:"tu-003-01"})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:45:12Z",content:"I see the schema. I'll create a migration that:\n1. Adds a `last_login_at` column to `users`\n2. Adds an index on `sessions.expires_at` for efficient cleanup queries\n3. Creates the `audit_log` table\n\nLet me write the migration file:"},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:45:14Z",content:JSON.stringify({tool:"Write",args:{file_path:"migrations/002_audit_log.sql",content:`-- Migration: 002_audit_log
544
- -- Add audit logging and user activity tracking
545
-
546
- BEGIN;
547
-
548
- -- 1. Add last_login_at to users
549
- ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
550
-
551
- -- 2. Index for session cleanup queries
552
- CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
553
-
554
- -- 3. Audit log table
555
- CREATE TABLE audit_log (
556
- id BIGSERIAL PRIMARY KEY,
557
- user_id UUID REFERENCES users(id),
558
- action TEXT NOT NULL,
559
- entity_type TEXT NOT NULL,
560
- entity_id TEXT NOT NULL,
561
- old_value JSONB,
562
- new_value JSONB,
563
- ip_address INET,
564
- created_at TIMESTAMPTZ DEFAULT now()
565
- );
566
-
567
- CREATE INDEX idx_audit_log_user ON audit_log (user_id);
568
- CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
569
- CREATE INDEX idx_audit_log_created ON audit_log (created_at);
570
-
571
- COMMIT;
572
- `}}),raw:JSON.stringify({id:"tu-003-02",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:45:15Z",content:"File written: migrations/002_audit_log.sql (29 lines)",raw:JSON.stringify({tool_use_id:"tu-003-02"})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:00Z",content:"Now I need to implement the audit middleware that logs write operations. This will intercept POST, PUT, PATCH, and DELETE requests."},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:46:02Z",content:JSON.stringify({tool:"Bash",args:{command:"npm run migrate -- --dry-run"}}),raw:JSON.stringify({id:"tu-003-03",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:46:10Z",content:`Dry run: would apply 002_audit_log.sql
573
- - ALTER TABLE users ADD COLUMN last_login_at
574
- - CREATE INDEX CONCURRENTLY idx_sessions_expires_at
575
- - CREATE TABLE audit_log
576
- - 3 indexes on audit_log
577
-
578
- WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
579
- Please split this into a separate migration step.`,raw:JSON.stringify({tool_use_id:"tu-003-03",is_error:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:15Z",content:"Good catch from the dry run! `CREATE INDEX CONCURRENTLY` can't run inside a transaction. I need to split the migration into two files: one for the transactional DDL and another for the concurrent index creation."},{sessionId:"sess-003",eventType:"usage",timestamp:"2026-02-26T23:00:00Z",content:JSON.stringify({input_tokens:56300,output_tokens:14200,cost_millicents:31e3})},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T23:10:00Z",content:"interrupted"},{sessionId:"sess-004",eventType:"status",timestamp:"2026-02-27T09:00:01Z",content:"running"},{sessionId:"sess-004",eventType:"system",timestamp:"2026-02-27T09:00:02Z",content:`You are a backend engineer specializing in API infrastructure.
580
- Project: acme/data-pipeline — ETL pipelines for analytics
581
- Task: Implement rate limiting for the public API using a token-bucket algorithm`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:05Z",content:"I'll implement rate limiting using a token-bucket algorithm. Let me first survey the existing API infrastructure to find the right integration point."},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:05.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Survey middleware structure",activeForm:"Surveying middleware",status:"in_progress"},{content:"Implement token-bucket algorithm",activeForm:"Implementing token bucket",status:"pending"},{content:"Add rate limit middleware to app",activeForm:"Adding middleware",status:"pending"},{content:"Write tests for rate limiting",activeForm:"Writing tests",status:"pending"},{content:"Add Redis adapter for multi-instance",activeForm:"Adding Redis adapter",status:"pending"}]}})},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:06Z",content:JSON.stringify({tool:"Glob",args:{pattern:"src/middleware/**/*.ts"}}),raw:JSON.stringify({id:"tu-004-01",type:"tool_use"})},{sessionId:"sess-004",eventType:"tool_result",timestamp:"2026-02-27T09:00:07Z",content:`src/middleware/cors.ts
582
- src/middleware/error-handler.ts
583
- src/middleware/logger.ts
584
- src/middleware/request-id.ts`,raw:JSON.stringify({tool_use_id:"tu-004-01"})},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:09Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Survey middleware structure",activeForm:"Surveying middleware",status:"completed"},{content:"Implement token-bucket algorithm",activeForm:"Implementing token bucket",status:"in_progress"},{content:"Add rate limit middleware to app",activeForm:"Adding middleware",status:"pending"},{content:"Write tests for rate limiting",activeForm:"Writing tests",status:"pending"},{content:"Add Redis adapter for multi-instance",activeForm:"Adding Redis adapter",status:"pending"}]}})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:10Z",content:`Good middleware structure already in place. I'll add a \`rate-limiter.ts\` module that:
585
-
586
- - Uses an **in-memory token bucket** per client IP
587
- - Supports configurable rate (requests/second) and burst size
588
- - Returns \`429 Too Many Requests\` with \`Retry-After\` header
589
- - Has a Redis adapter option for multi-instance deployments
590
-
591
- Let me implement it:`},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:12Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/rate-limiter.ts",content:"// Token bucket rate limiter implementation"}}),raw:JSON.stringify({id:"tu-004-02",type:"tool_use"})},{sessionId:"sess-004",eventType:"tool_result",timestamp:"2026-02-27T09:00:13Z",content:"File written: src/middleware/rate-limiter.ts (87 lines)",raw:JSON.stringify({tool_use_id:"tu-004-02"})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:18Z",content:"Now I need to wire the rate limiter into the Express middleware stack. It should go after the request-ID middleware but before route handlers."},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:00:01Z",content:"running"},{sessionId:"sess-005",eventType:"system",timestamp:"2026-02-27T06:00:02Z",content:`You are a database specialist. Focus on connection management, performance, and multi-tenant isolation.
592
- Project: acme/alpha — Node.js + Express + PostgreSQL
593
- Task: Refactor database connection pooling for multi-tenant isolation`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:05Z",content:"I'll refactor the DB layer to support per-tenant connection pools. This is needed because the current single-pool design means one slow tenant can exhaust connections for everyone."},{sessionId:"sess-005",eventType:"tool_use",timestamp:"2026-02-27T06:00:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/db/pool.ts"}}),raw:JSON.stringify({id:"tu-005-01",type:"tool_use"})},{sessionId:"sess-005",eventType:"tool_result",timestamp:"2026-02-27T06:00:07Z",content:`import pg from "pg";
594
-
595
- const pool = new pg.Pool({
596
- connectionString: process.env.DATABASE_URL,
597
- max: 20,
598
- idleTimeoutMillis: 30000,
599
- });
600
-
601
- export { pool };`,raw:JSON.stringify({tool_use_id:"tu-005-01"})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:12Z",content:`The current pool is a single shared instance with \`max: 20\`. For multi-tenant isolation, I need:
602
-
603
- 1. **A \`PoolManager\` class** that creates and caches per-tenant pools
604
- 2. **Configurable limits** per tenant (max connections, idle timeout)
605
- 3. **Health checks** with automatic pool eviction for unhealthy connections
606
- 4. **Graceful shutdown** that drains all pools`},{sessionId:"sess-005",eventType:"tool_use",timestamp:"2026-02-27T06:00:14Z",content:JSON.stringify({tool:"Grep",args:{pattern:"import.*pool|from.*pool",path:"src/",output_mode:"content"}}),raw:JSON.stringify({id:"tu-005-02",type:"tool_use"})},{sessionId:"sess-005",eventType:"tool_result",timestamp:"2026-02-27T06:00:15Z",content:`src/db/index.ts:1:import { pool } from "./pool.js";
607
- src/routes/users.ts:2:import { pool } from "../db/pool.js";
608
- src/routes/register.ts:3:import { pool } from "../db/pool.js";
609
- src/routes/admin.ts:4:import { pool } from "../db/pool.js";
610
- src/services/billing.ts:2:import { pool } from "../db/pool.js";
611
- src/services/analytics.ts:1:import { pool } from "../db/pool.js";`,raw:JSON.stringify({tool_use_id:"tu-005-02"})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:20Z",content:`Six files import the pool directly. I'll need to:
612
- 1. Create a new \`PoolManager\` abstraction
613
- 2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
614
- 3. Add middleware to extract tenant ID from the request
615
-
616
- This is a significant refactor. Let me start with the PoolManager class.`},{sessionId:"sess-005",eventType:"usage",timestamp:"2026-02-27T06:30:00Z",content:JSON.stringify({input_tokens:67800,output_tokens:19300,cost_millicents:38e3})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],fz=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",linkedEnvironmentIds:["env-local-01","env-docker-01"],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-01-15T10:00:00Z",updatedAt:"2026-01-15T10:00:00Z"},{id:"proj-beta",name:"Data Pipeline",description:"ETL pipelines for analytics and reporting",repoUrl:"https://github.com/acme/data-pipeline",linkedEnvironmentIds:["env-docker-01"],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-02-01T14:30:00Z",updatedAt:"2026-02-01T14:30:00Z"},{id:"proj-gamma",name:"Mobile App",description:"React Native cross-platform mobile application",repoUrl:"",linkedEnvironmentIds:["env-local-01"],status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],pz=[{id:"task-001",workspaceId:"proj-alpha",title:"Implement JWT authentication",description:"Replace session-based auth with JWT tokens across all protected routes",status:"working",branch:"feat/jwt-auth",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-001a","task-001b","task-001c"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Design and implement JWT-based authentication with access/refresh tokens, replacing session-based auth.",extra:{approach:"Replace express-session with JWT Bearer tokens. Access tokens expire in 24h, refresh tokens stored in DB.",files_changed:["src/middleware/auth.ts","src/routes/login.ts","src/routes/protected.ts"],decisions:["Chose jsonwebtoken over jose for consistency with existing codebase","24h access token expiry — long enough for dev sessions, short enough for security","Refresh tokens are 48-byte random hex stored in DB with user association"],blockers:"Need to verify token rotation strategy with security team before merging"}}),tokenBudget:0,costBudgetMillicents:0},{id:"task-001a",workspaceId:"proj-alpha",title:"Design token schema",description:"Define JWT payload structure, expiry, and refresh token strategy",status:"complete",branch:"feat/jwt-auth/design-token-schema",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:10:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-001b",workspaceId:"proj-alpha",title:"Implement auth middleware",description:"Build Express middleware that verifies JWT Bearer tokens",status:"working",branch:"feat/jwt-auth/implement-auth-middleware",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:15:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-001c",workspaceId:"proj-alpha",title:"Write auth integration tests",description:"End-to-end tests for login flow, token refresh, and protected route access",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-25T10:20:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-002",workspaceId:"proj-alpha",title:"Add rate limiting",description:"Implement token-bucket rate limiting for public API endpoints",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:05:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-003",workspaceId:"proj-alpha",title:"Set up OpenAPI documentation",description:"Generate Swagger docs from route decorators and serve at /api/docs",status:"paused",branch:"feat/openapi-docs",latestSessionId:"sess-002",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-24T16:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-004",workspaceId:"proj-alpha",title:"Database connection pooling",description:"Switch from single connection to a connection pool with health checks",status:"complete",branch:"feat/db-pool",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-23T11:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-005",workspaceId:"proj-alpha",title:"Fix N+1 query in user list",description:"Use a JOIN instead of per-row lookups in GET /api/users",status:"not_started",branch:"fix/user-list-n1",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:5,createdAt:"2026-02-22T09:30:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006",workspaceId:"proj-beta",title:"Add Parquet export support",description:"Allow pipeline outputs to be written as Parquet files for Spark consumption",status:"working",branch:"feat/parquet-export",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-006a","task-006b","task-006c","task-006d"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Plan for adding Parquet export support, including compression options and performance benchmarks.",extra:{approach:"Use apache-arrow npm package for Parquet write support. Map internal column types to Arrow type system.",compression:{supported:["snappy","zstd","gzip"],default:"snappy"},benchmarks:{"1M rows snappy":"2.3s","1M rows zstd":"3.1s","1M rows gzip":"4.8s"}}}),tokenBudget:0,costBudgetMillicents:0},{id:"task-006a",workspaceId:"proj-beta",title:"Define Parquet schema mapping",description:"Map internal column types to Arrow/Parquet type system",status:"complete",branch:"feat/parquet-export/define-parquet-schema-mapping",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:05:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006b",workspaceId:"proj-beta",title:"Implement row-group writer",description:"Write buffered row groups with configurable batch size",status:"complete",branch:"feat/parquet-export/implement-row-group-writer",latestSessionId:"",dependsOn:["task-006a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:10:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006c",workspaceId:"proj-beta",title:"Add compression options",description:"Support Snappy, ZSTD, and GZIP compression for Parquet output",status:"working",branch:"feat/parquet-export/add-compression-options",latestSessionId:"sess-004",dependsOn:["task-006b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T08:15:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006d",workspaceId:"proj-beta",title:"Write Parquet integration tests",description:"Round-trip tests: write Parquet, read back with pyarrow, verify data integrity",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-006c"],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-26T08:20:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007",workspaceId:"proj-beta",title:"Implement incremental loads",description:"Track watermarks so pipelines only process new/changed rows",status:"working",branch:"feat/incremental",latestSessionId:"sess-004",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:30:00Z",parentTaskId:"",depth:0,childTaskIds:["task-007a","task-007b"],canDecompose:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007a",workspaceId:"proj-beta",title:"Design watermark storage",description:"Define schema for per-pipeline high-watermark tracking",status:"complete",branch:"feat/incremental/design-watermark-storage",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:35:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007b",workspaceId:"proj-beta",title:"Implement change detection query",description:"Generate WHERE clauses from watermarks to fetch only changed rows",status:"failed",branch:"feat/incremental/implement-change-detection-query",latestSessionId:"",dependsOn:["task-007a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:40:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-008",workspaceId:"proj-beta",title:"Add pipeline monitoring dashboard",description:"Real-time metrics for pipeline throughput, latency, and error rates",status:"paused",branch:"feat/monitoring",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T09:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0}],Kc=[{id:"find-001",workspaceId:"proj-alpha",taskId:"task-001",sessionId:"sess-001",category:"architecture",title:"Auth middleware is tightly coupled to Express",content:"The current auth middleware directly references Express Request/Response types. Consider extracting a framework-agnostic token verification layer so we can reuse it in the WebSocket auth path.",tags:["auth","decoupling","middleware"],createdAt:"2026-02-27T08:16:00Z"},{id:"find-002",workspaceId:"proj-alpha",taskId:"task-003",sessionId:"sess-002",category:"api",title:"Missing pagination on GET /api/users",content:"The users endpoint returns all rows without limit/offset. For datasets over 10k rows this will cause timeouts. Recommend cursor-based pagination with a default page size of 50.",tags:["api","pagination","performance"],createdAt:"2026-02-27T07:31:00Z"},{id:"find-003",workspaceId:"proj-alpha",taskId:"task-005",sessionId:"sess-003",category:"bug",title:"Race condition in session cleanup",content:"When two requests hit /api/logout concurrently, the second call throws a 500 because the session row has already been deleted. Needs an idempotent DELETE or a conditional check.",tags:["bug","concurrency","sessions"],createdAt:"2026-02-26T22:50:00Z"},{id:"find-004",workspaceId:"proj-alpha",taskId:"task-004",sessionId:"",category:"decision",title:"Chose pg-pool over knex connection pool",content:"pg-pool gives us direct control over idle timeout, max connections, and health check queries. Knex wraps pg-pool anyway and adds overhead we don't need since we write raw SQL.",tags:["database","decision","postgres"],createdAt:"2026-02-23T11:30:00Z"},{id:"find-005",workspaceId:"proj-alpha",taskId:"",sessionId:"",category:"dependency",title:"jsonwebtoken has 3 high-severity CVEs",content:"The jsonwebtoken package (v8.x) has known vulnerabilities. Consider migrating to jose which is maintained, supports ESM, and covers the same JWS/JWE surface area with zero dependencies.",tags:["security","dependency","jwt"],createdAt:"2026-02-27T08:20:00Z"},{id:"find-006",workspaceId:"proj-alpha",taskId:"task-001",sessionId:"sess-001",category:"pattern",title:"Consistent error response shape",content:"All error responses should follow the shape `{ error: string, code: string, details?: unknown }`. Currently some routes return `{ message: string }` and others return `{ error: string }`.",tags:["api","consistency","error-handling"],createdAt:"2026-02-27T08:17:00Z"},{id:"find-007",workspaceId:"proj-beta",taskId:"task-007",sessionId:"sess-004",category:"architecture",title:"Watermark storage should be pluggable",content:"The incremental load watermarks are currently stored in a local SQLite file. For production multi-worker scenarios, this needs to be backed by a shared store (Redis or Postgres).",tags:["architecture","pipeline","scalability"],createdAt:"2026-02-27T09:05:00Z"}],mz=[{name:"anthropic",tokenType:"env_var",envVar:"ANTHROPIC_API_KEY",filePath:"",expiresAt:""},{name:"github",tokenType:"env_var",envVar:"GITHUB_TOKEN",filePath:"",expiresAt:"2026-12-31T23:59:59Z"},{name:"gcp-service-account",tokenType:"file",envVar:"",filePath:"/home/user/.config/gcloud/credentials.json",expiresAt:""}],hz=[{id:"persona-arch",name:"Software Architect",description:"Designs system architecture, defines interfaces, and decomposes large features into implementable tasks.",systemPrompt:"You are a senior software architect. Focus on clean interfaces, separation of concerns, and scalable patterns. When decomposing work, create concrete subtasks with clear acceptance criteria.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:50,mcpServers:"[]",createdAt:"2026-02-20T10:00:00Z",updatedAt:"2026-02-20T10:00:00Z",type:"agent",script:"",allowedMcpTools:["task_create","task_update","task_list","finding_post","finding_list","knowledge_search","knowledge_create_node","session_spawn"]},{id:"persona-fe",name:"Frontend Engineer",description:"React specialist — builds UI components, writes CSS, implements routing, and creates Playwright tests.",systemPrompt:"You are a frontend engineer specializing in React, TypeScript, and modern CSS. Follow component composition patterns, use semantic HTML, and write accessible markup.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:100,mcpServers:"[]",createdAt:"2026-02-20T10:05:00Z",updatedAt:"2026-02-20T10:05:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-reviewer",name:"Code Reviewer",description:"Reviews diffs for correctness, security, and style. Posts findings for issues discovered.",systemPrompt:"You are a meticulous code reviewer. Check for security vulnerabilities, performance issues, and style consistency. Post findings for anything noteworthy.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:30,mcpServers:"[]",createdAt:"2026-02-20T10:10:00Z",updatedAt:"2026-02-20T10:10:00Z",type:"agent",script:"",allowedMcpTools:["finding_post","finding_list","knowledge_search"]},{id:"persona-tester",name:"QA Engineer",description:"Writes comprehensive test suites — unit tests, integration tests, and E2E Playwright specs.",systemPrompt:"You are a QA engineer focused on test coverage. Write tests that cover happy paths, edge cases, error scenarios, and accessibility. Use Playwright for E2E tests.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:80,mcpServers:"[]",createdAt:"2026-02-20T10:15:00Z",updatedAt:"2026-02-20T10:15:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-lint",name:"Lint & Format",description:"Scripted persona — runs ESLint and Prettier on changed files, auto-fixes violations, and posts a findings summary.",systemPrompt:"",toolConfig:"{}",runtime:"genaiscript",model:"",maxTurns:1,mcpServers:"[]",createdAt:"2026-02-21T09:00:00Z",updatedAt:"2026-02-21T09:00:00Z",type:"script",script:`const files = env.files.filter(f => /\\.(ts|tsx|js)$/.test(f.filename));
617
- for (const f of files) {
618
- const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);
619
- if (eslintResult.exitCode !== 0) {
620
- env.findings.push({ category: "lint", title: \`Lint issues in \${f.filename}\`, content: eslintResult.stderr });
621
- }
622
- const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);
623
- if (prettierResult.exitCode !== 0) {
624
- env.findings.push({ category: "format", title: \`Prettier issues in \${f.filename}\`, content: prettierResult.stderr });
625
- }
626
- }
627
- env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],gz={"task-001b":[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z"},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Implement auth middleware",startedAt:"2026-02-27T08:15:00Z"}],"task-006c":[{id:"sess-004",environmentId:"env-docker-01",runtime:"claude-code",status:"running",prompt:"Add compression options",startedAt:"2026-02-27T09:00:00Z"}]};function Re(t){return new Date(Date.now()+t).toISOString()}const ax=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Re(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Re(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Re(1200),content:JSON.stringify({tool:"Glob",args:{pattern:"src/routes/**/*.ts"}}),raw:JSON.stringify({id:"stream-a-01",type:"tool_use"})}},{delayMs:1600,event:{eventType:"tool_result",timestamp:Re(1600),content:`src/routes/users.ts
628
- src/routes/auth.ts
629
- src/routes/billing.ts
630
- src/routes/admin.ts
631
- src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Re(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
632
-
633
- \`\`\`typescript
634
- const router = Router();
635
- router.use(authenticate);
636
- router.use(validateBody);
637
-
638
- router.get("/", listUsers);
639
- router.post("/", createUser);
640
- router.get("/:id", getUser);
641
- router.put("/:id", updateUser);
642
- router.delete("/:id", deleteUser);
643
- \`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Re(3200),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --testPathPattern=routes"}}),raw:JSON.stringify({id:"stream-a-02",type:"tool_use"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Re(4e3),content:` PASS src/routes/__tests__/users.test.ts
644
- PASS src/routes/__tests__/auth.test.ts
645
- PASS src/routes/__tests__/billing.test.ts
646
-
647
- Test Suites: 3 passed, 3 total
648
- Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Re(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_millicents:15e3})}},{delayMs:5e3,event:{eventType:"text",timestamp:Re(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Re(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Re(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Re(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Re(1200),content:JSON.stringify({tool:"Read",args:{file_path:"migrations/001_initial.sql"}}),raw:JSON.stringify({id:"stream-b-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Re(1800),content:`CREATE TABLE users (
649
- id UUID PRIMARY KEY,
650
- name TEXT NOT NULL,
651
- email TEXT UNIQUE NOT NULL,
652
- created_at TIMESTAMPTZ DEFAULT now()
653
- );
654
-
655
- CREATE TABLE sessions (
656
- id UUID PRIMARY KEY,
657
- user_id UUID REFERENCES users(id),
658
- expires_at TIMESTAMPTZ NOT NULL
659
- );`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Re(2600),content:`I found the tables to modify:
660
- - **users**: add column \`last_login_at\`
661
- - **sessions**: add index on \`expires_at\`
662
- - **audit_log**: new table
663
-
664
- This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
665
-
666
- Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Re(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Re(700),content:JSON.stringify({tool:"Bash",args:{command:"npm run migrate"}}),raw:JSON.stringify({id:"stream-b-02",type:"tool_use"})}},{delayMs:2200,event:{eventType:"tool_result",timestamp:Re(1700),content:`Applying 002_add_last_login.sql... done
667
- Applying 003_sessions_index.sql... done
668
- Applying 004_audit_log.sql... done
669
-
670
- 3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Re(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Re(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Re(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Re(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Re(1200),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/billing.ts"}}),raw:JSON.stringify({id:"stream-c-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Re(1800),content:`import { StripeClient } from "./stripe-client.js";
671
- import type { Invoice, LineItem } from "../types/billing.js";
672
-
673
- export class BillingService {
674
- constructor(private stripe: StripeClient) {}
675
-
676
- async calculateMonthlyTotal(userId: string): Promise<number> {
677
- const invoices = await this.stripe.listInvoices(userId);
678
- return invoices.reduce((sum, inv) => sum + inv.total, 0);
679
- }
680
- }`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Re(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Re(2800),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/stripe-client.ts"}}),raw:JSON.stringify({id:"stream-c-02",type:"tool_use"})}},{delayMs:3200,event:{eventType:"tool_result",timestamp:Re(3200),content:"Error: ENOENT: no such file or directory, open 'src/services/stripe-client.ts'",raw:JSON.stringify({tool_use_id:"stream-c-02",is_error:!0})}},{delayMs:3600,event:{eventType:"error",timestamp:Re(3600),content:"Cannot resolve import 'src/services/stripe-client.ts' — module not found. The billing service depends on a Stripe client that doesn't exist in this environment."}},{delayMs:4e3,event:{eventType:"status",timestamp:Re(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Re(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Re(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Re(1200),content:JSON.stringify({tool:"Read",args:{file_path:"/src/middleware/auth.ts"}}),raw:JSON.stringify({id:"tool-mock-001"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Re(1800),content:`import jwt from "jsonwebtoken";
681
- import type { Request, Response, NextFunction } from "express";
682
-
683
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
684
-
685
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
686
- const header = req.headers.authorization;
687
- if (!header?.startsWith("Bearer ")) {
688
- res.status(401).json({ error: "Missing token" });
689
- return;
690
- }
691
- try {
692
- const decoded = jwt.verify(header.slice(7), JWT_SECRET);
693
- if (decoded.exp > Date.now() / 1000) {
694
- res.status(403).json({ error: "Token expired" });
695
- return;
696
- }
697
- req.user = decoded;
698
- next();
699
- } catch {
700
- res.status(403).json({ error: "Invalid token" });
701
- }
702
- }`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Re(2600),content:"Found the issue — the token expiry check on line 14 is using `>` instead of `<`. A token is expired when `exp < now`, but the code checks `exp > now` which means it rejects *valid* tokens and accepts *expired* ones. Let me fix it."}},{delayMs:3400,event:{eventType:"tool_use",timestamp:Re(3400),content:JSON.stringify({tool:"Edit",args:{file_path:"/src/middleware/auth.ts",old_string:" if (decoded.exp > Date.now() / 1000) {",new_string:" if (decoded.exp < Date.now() / 1000) {"}}),raw:JSON.stringify({id:"tool-mock-002"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Re(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Re(4600),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --grep auth"}}),raw:JSON.stringify({id:"tool-mock-003"})}},{delayMs:5800,event:{eventType:"tool_result",timestamp:Re(5800),content:`[exit 0] > jest --grep auth
703
-
704
- PASS src/auth.test.ts
705
- ✓ validates JWT token (12ms)
706
- ✓ rejects expired token (3ms)
707
- ✓ handles missing header (1ms)
708
-
709
- Tests: 3 passed, 3 total
710
- Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Re(6400),content:JSON.stringify({tool:"Grep",args:{pattern:"decoded\\.exp",path:"src/"}}),raw:JSON.stringify({id:"tool-mock-004"})}},{delayMs:7e3,event:{eventType:"tool_result",timestamp:Re(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
711
- src/utils/token-refresh.ts:28: const remaining = decoded.exp - Date.now() / 1000;`,raw:JSON.stringify({tool_use_id:"tool-mock-004",is_error:!1})}},{delayMs:7800,event:{eventType:"text",timestamp:Re(7800),content:"Fixed. The token expiry comparison was inverted — `decoded.exp > Date.now()` should have been `<` (a token is expired when its `exp` is in the past). The other occurrence in `token-refresh.ts` uses subtraction (not comparison), so it was already correct. All 3 auth tests pass."}},{delayMs:8400,event:{eventType:"usage",timestamp:Re(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_millicents:12e3})}},{delayMs:8800,event:{eventType:"status",timestamp:Re(8800),content:"completed"}}]}],ps={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1},ix=400;function vz({children:t}){const[s,o]=y.useState(cz),[r,c]=y.useState(dz),[d,u]=y.useState(uz),[p,m]=y.useState(void 0),[g,v]=y.useState(fz),[x,b]=y.useState(""),[k,S]=y.useState(pz),[j,N]=y.useState(Kc),[T,C]=y.useState(void 0),D=!1,[B,E]=y.useState(mz),[A,$]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[L,U]=y.useState(hz),[J,V]=y.useState([]),[K]=y.useState(gz),[de,ee]=y.useState(""),[ie,M]=y.useState(ws),[O,X]=y.useState(za),[he,W]=y.useState(void 0),[ye,fe]=y.useState(void 0),[Ne,Ue]=y.useState(""),ge=y.useRef(void 0),ke=y.useRef(0),xe=y.useRef(0),Be=y.useRef(new Set),It=y.useRef(new Map),zn=y.useRef(k);zn.current=k;const oe=y.useRef(new Map),Je=y.useRef(new Map),Ut=y.useCallback(H=>(ke.current+=1,`mock-${H}-${String(ke.current).padStart(3,"0")}`),[]),ne=y.useCallback(()=>{const H=ax[xe.current%ax.length];return xe.current+=1,H},[]),wt=y.useCallback((H,te,re)=>{const ce=setTimeout(()=>{var me;Be.current.delete(ce),re&&((me=It.current.get(re))==null||me.delete(ce)),H()},te);Be.current.add(ce),re&&(It.current.has(re)||It.current.set(re,new Set),It.current.get(re).add(ce))},[]),Ot=y.useCallback(H=>{const te=It.current.get(H);te&&(te.forEach(re=>{clearTimeout(re),Be.current.delete(re)}),It.current.delete(H))},[]),Bt=y.useCallback((H,te,re)=>{c(ce=>ce.map(me=>me.id===H?{...me,status:te,...re!==void 0?{endReason:re}:{}}:me))},[]),ze=y.useCallback(H=>{u(te=>[...te,H])},[]),sn=y.useCallback((H,te,re)=>{te.forEach((ce,me)=>{wt(()=>{const He={sessionId:H,...ce.event,timestamp:new Date().toISOString()};if(ze(He),ce.event.eventType==="status"){const Se=ek(ce.event.content),Me=tk(ce.event.content);Bt(H,Se,Me)}me===te.length-1&&re&&re()},ce.delayMs,H)})},[wt,ze,Bt]),ca=y.useCallback(async(H,te,re,ce)=>{console.log("[MockGrackle] spawn",{environmentId:H,prompt:te,runtime:ce});const me=Ut("sess"),He={id:me,environmentId:H,runtime:ce||"claude-code",status:"running",prompt:te,startedAt:new Date().toISOString()};c(Me=>[...Me,He]),m(me);const Se=ne();if(console.log(`[MockGrackle] Playing scenario: ${Se.label}`),Se.pauseForInput){const Me=Se.pauseAfterStep??Se.steps.length-1,Xe=Se.steps.slice(0,Me+1),ht=Xe.length>0?Xe[Xe.length-1].delayMs:0;sn(me,Xe),wt(()=>{Bt(me,"idle"),ze({sessionId:me,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ht+ix,me),Se.resumeSteps&&oe.current.set(me,Se.resumeSteps)}else sn(me,Se.steps)},[Ut,ne,sn,wt,Bt,ze]),is=y.useCallback(async H=>{console.log("[MockGrackle] kill",H),Ot(H),oe.current.delete(H),Bt(H,"stopped","killed"),ze({sessionId:H,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),S(te=>te.map(re=>re.latestSessionId===H&&re.status==="working"?{...re,status:"not_started"}:re))},[Ot,Bt,ze]),Ja=y.useCallback(async H=>{console.log("[MockGrackle] stopGraceful",H),Ot(H),oe.current.delete(H),Bt(H,"stopped","terminated"),ze({sessionId:H,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),S(te=>te.map(re=>re.latestSessionId===H&&re.status==="working"?{...re,status:"not_started"}:re))},[Ot,Bt,ze]),da=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Jt=y.useCallback(async H=>{console.log("[MockGrackle] loadSessionEvents",H)},[]),Bi=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),u([])},[]),ua=y.useCallback(async(H,te,re,ce,me,He,Se,Me,Xe)=>{console.log("[MockGrackle] createWorkspace",{name:H,description:te});const ht={id:Ut("proj"),name:H,description:te||"",repoUrl:re||"",linkedEnvironmentIds:ce?[ce]:[],status:"active",workingDirectory:Se||"",useWorktrees:He??!0,defaultPersonaId:me||"",tokenBudget:0,costBudgetMillicents:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Le=>[...Le,ht]),Me&&Me()},[Ut]),Wa=y.useCallback(async H=>{console.log("[MockGrackle] archiveWorkspace",H),v(te=>te.map(re=>re.id===H?{...re,status:"archived"}:re))},[]),ys=y.useCallback(async H=>{console.log("[MockGrackle] loadTasks",H)},[]),Li=y.useCallback(async(H,te,re,ce,me,He,Se,Me,Xe)=>{console.log("[MockGrackle] createTask",{workspaceId:H,title:te,parentTaskId:me}),S(ht=>{const Qe=ht.filter(Rs=>Rs.workspaceId===H).reduce((Rs,Go)=>Math.max(Rs,Go.sortOrder),0),rt=me?ht.find(Rs=>Rs.id===me):void 0;if(me&&!rt)return console.warn("[MockGrackle] Parent task not found:",me),ht;if(rt&&!rt.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",me),ht;const vt=rt?rt.depth+1:0,xs={id:Ut("task"),workspaceId:H,title:te,description:re||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:ce||[],reviewNotes:void 0,sortOrder:Qe+1,createdAt:new Date().toISOString(),parentTaskId:me||"",depth:vt,childTaskIds:[],canDecompose:Se??!me,defaultPersonaId:He||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[...ht,xs]}),Me&&Me()},[Ut]),$n=y.useCallback(async(H,te,re,ce)=>{var ht;console.log("[MockGrackle] startTask",{taskId:H});const me=zn.current.find(Le=>Le.id===H),He=(me==null?void 0:me.title)??"",Se=Ut("sess"),Me={id:Se,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:He||H,startedAt:new Date().toISOString()};c(Le=>[...Le,Me]),S(Le=>Le.map(Qe=>Qe.id===H?{...Qe,status:"working",latestSessionId:Se,branch:`mock/${H.slice(0,8)}`}:Qe));const Xe=ne();if(console.log(`[MockGrackle] Playing task scenario: ${Xe.label}`),Xe.pauseForInput){const Le=Xe.pauseAfterStep??Xe.steps.length-1,Qe=Xe.steps.slice(0,Le+1),rt=Qe.length>0?Qe[Qe.length-1].delayMs:0;if(sn(Se,Qe),wt(()=>{Bt(Se,"idle"),ze({sessionId:Se,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},rt+ix,Se),Xe.resumeSteps){const vt=[...Xe.resumeSteps];oe.current.set(Se,vt);const xs=vt.reduce((Rs,Go)=>Math.max(Rs,Go.delayMs),0);Je.current.set(Se,{taskId:H,delayAfterResume:xs+200})}}else{const Le=Xe.steps.length>0?Xe.steps[Xe.steps.length-1].delayMs:0;sn(Se,Xe.steps);const Qe=(ht=Xe.steps[Xe.steps.length-1])==null?void 0:ht.event.content;wt(()=>{Qe==="completed"?S(rt=>rt.map(vt=>vt.id===H&&vt.status==="working"?{...vt,status:"paused"}:vt)):Qe==="failed"&&S(rt=>rt.map(vt=>vt.id===H&&vt.status==="working"?{...vt,status:"failed"}:vt))},Le+100,Se)}},[Ut,ne,sn,wt,Bt,ze]),Ae=y.useCallback(async(H,te)=>{console.log("[MockGrackle] sendInput",{sessionId:H,text:te}),ze({sessionId:H,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${te}`}),Bt(H,"running"),ze({sessionId:H,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const re=oe.current.get(H);if(re)oe.current.delete(H),sn(H,re);else{const me=[{delayMs:500,event:{eventType:"output",timestamp:new Date().toISOString(),content:"I received your input, continuing..."}},{delayMs:1500,event:{eventType:"status",timestamp:new Date().toISOString(),content:"completed"}}];sn(H,me)}const ce=Je.current.get(H);ce&&(Je.current.delete(H),wt(()=>{S(me=>me.map(He=>He.id===ce.taskId&&He.status==="working"?{...He,status:"paused"}:He))},ce.delayAfterResume,H))},[ze,Bt,sn,wt]),We=y.useCallback(async H=>{console.log("[MockGrackle] completeTask",H),S(te=>te.map(re=>re.id===H?{...re,status:"complete"}:re))},[]),Wt=y.useCallback(async H=>{console.log("[MockGrackle] resumeTask",H)},[]),St=y.useCallback(async(H,te,re,ce,me)=>{console.log("[MockGrackle] updateTask",{taskId:H,title:te}),S(He=>He.map(Se=>Se.id===H?{...Se,title:te.trim()||Se.title,description:re,dependsOn:ce,...me!==void 0?{defaultPersonaId:me}:{}}:Se))},[]),mn=y.useCallback(async H=>{console.log("[MockGrackle] deleteTask",H),S(te=>te.filter(re=>re.id!==H))},[]),Xt=y.useCallback(async H=>{console.log("[MockGrackle] loadFindings",H),N(Kc.filter(te=>te.workspaceId===H))},[]),zi=y.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),N([...Kc])},[]),$i=y.useCallback(async H=>{console.log("[MockGrackle] loadFinding",H);const te=Kc.find(re=>re.id===H);C(te)},[]),Pi=y.useCallback(async(H,te,re,ce,me)=>{console.log("[MockGrackle] postFinding",{workspaceId:H,title:te});const He={id:Ut("find"),workspaceId:H,taskId:"",sessionId:"",category:ce||"general",title:te,content:re,tags:me||[],createdAt:new Date().toISOString()};N(Se=>[...Se,He])},[Ut]),Xa=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),Qa=y.useCallback(async(H,te,re)=>{console.log("[MockGrackle] addEnvironment",{displayName:H,adapterType:te,adapterConfig:re})},[]),ei=y.useCallback(async(H,te)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:H,...te}),o(re=>re.map(ce=>ce.id!==H?ce:{...ce,...te.displayName!==void 0?{displayName:te.displayName}:{},...te.adapterConfig!==void 0?{adapterConfig:JSON.stringify(te.adapterConfig)}:{}}))},[]),bs=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),ti=y.useCallback(async(H,te,re,ce,me)=>{console.log("[MockGrackle] setToken",{name:H,tokenType:re}),E(He=>[...He.filter(Me=>Me.name!==H),{name:H,tokenType:re,envVar:ce,filePath:me,expiresAt:""}])},[]),fa=y.useCallback(async H=>{console.log("[MockGrackle] deleteToken",H),E(te=>te.filter(re=>re.name!==H))},[]),bl=y.useCallback(async H=>{console.log("[MockGrackle] updateCredentialProviders",H),$(H)},[]);y.useEffect(()=>()=>{Be.current.forEach(clearTimeout),Be.current.clear()},[]);const xl=y.useMemo(()=>({connectionStatus:"connected",environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:Xa,addEnvironment:Qa,updateEnvironment:ei,provisionEnvironment:async(H,te)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:ps},sessions:{sessions:r,sessionsLoading:!1,events:d,eventsDropped:0,lastSpawnedId:p,taskSessions:K,spawn:ca,sendInput:Ae,kill:is,stopGraceful:Ja,loadSessionEvents:Jt,clearEvents:Bi,loadTaskSessions:async H=>{console.log("[MockGrackle] loadTaskSessions",H)},domainHook:ps},workspaces:{workspaces:g,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:ua,archiveWorkspace:Wa,updateWorkspace:async(H,te)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:H,...te}),v(re=>re.map(ce=>ce.id!==H?ce:{...ce,...te.name!==void 0?{name:te.name}:{},...te.description!==void 0?{description:te.description}:{},...te.repoUrl!==void 0?{repoUrl:te.repoUrl}:{},...te.environmentId!==void 0?{environmentId:te.environmentId}:{},...te.workingDirectory!==void 0?{workingDirectory:te.workingDirectory}:{},...te.useWorktrees!==void 0?{useWorktrees:te.useWorktrees}:{},...te.defaultPersonaId!==void 0?{defaultPersonaId:te.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},linkEnvironment:async(H,te)=>{if(console.log("[MockGrackle] linkEnvironment",{workspaceId:H,environmentId:te}),te==="error-env"){b("Failed to link environment");return}b(""),v(re=>re.map(ce=>ce.id!==H||ce.linkedEnvironmentIds.includes(te)?ce:{...ce,linkedEnvironmentIds:[...ce.linkedEnvironmentIds,te]}))},unlinkEnvironment:async(H,te)=>{if(console.log("[MockGrackle] unlinkEnvironment",{workspaceId:H,environmentId:te}),te==="error-env"){b("Failed to unlink environment");return}b(""),v(re=>re.map(ce=>ce.id!==H?ce:{...ce,linkedEnvironmentIds:ce.linkedEnvironmentIds.filter(me=>me!==te)}))},linkOperationError:x,clearLinkOperationError:()=>{b("")},domainHook:ps},tasks:{tasks:k,tasksLoading:!1,taskStartingId:void 0,loadTasks:ys,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Li,startTask:$n,stopTask:async H=>{console.log("[MockGrackle] stopTask",{taskId:H}),await We(H)},completeTask:We,resumeTask:Wt,updateTask:St,deleteTask:mn,domainHook:ps},findings:{findings:j,selectedFinding:T,findingLoading:D,findingsLoading:!1,loadFindings:Xt,loadAllFindings:zi,loadFinding:$i,postFinding:Pi,domainHook:ps},tokens:{tokens:B,tokensLoading:!1,loadTokens:bs,setToken:ti,deleteToken:fa,domainHook:ps},credentials:{credentialProviders:A,credentialsLoading:!1,updateCredentialProviders:bl,domainHook:ps},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:ps},personas:{personas:L,personasLoading:!1,createPersona:async(H,te,re,ce,me,He,Se,Me,Xe)=>{console.log("[MockGrackle] createPersona",{name:H});const ht={id:`mock-persona-${Date.now()}`,name:H,description:te,systemPrompt:re,toolConfig:"{}",runtime:ce??"claude-code",model:me||"",maxTurns:He||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:Se||"agent",script:Me||"",allowedMcpTools:Xe||[]};return U(Le=>[...Le,ht]),ht},updatePersona:async(H,te,re,ce,me,He,Se,Me,Xe,ht)=>{console.log("[MockGrackle] updatePersona",{personaId:H,name:te});const Le=L.find(vt=>vt.id===H);if(!Le)throw new Error(`Persona not found: ${H}`);const Qe=new Date().toISOString(),rt={...Le,...te!==void 0?{name:te}:{},...re!==void 0?{description:re}:{},...ce!==void 0?{systemPrompt:ce}:{},...me!==void 0?{runtime:me}:{},...He!==void 0?{model:He}:{},...Se!==void 0?{maxTurns:Se}:{},...Me!==void 0?{type:Me}:{},...Xe!==void 0?{script:Xe}:{},...ht!==void 0?{allowedMcpTools:ht}:{},updatedAt:Qe};return U(vt=>vt.map(xs=>xs.id===H?rt:xs)),rt},deletePersona:async H=>{console.log("[MockGrackle] deletePersona",H),U(te=>te.filter(re=>re.id!==H))},domainHook:ps},schedules:{schedules:J,schedulesLoading:!1,createSchedule:async(H,te,re,ce,me)=>{console.log("[MockGrackle] createSchedule",{title:H});const He={id:`mock-schedule-${Date.now()}`,title:H,description:te,scheduleExpression:re,personaId:ce,workspaceId:me??"",parentTaskId:"",enabled:!0,lastRunAt:"",nextRunAt:new Date(Date.now()+6e4).toISOString(),runCount:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};return V(Se=>[...Se,He]),He},updateSchedule:async(H,te)=>{console.log("[MockGrackle] updateSchedule",{scheduleId:H,fields:te});let re;if(V(ce=>ce.map(me=>me.id!==H?me:(re={...me,...te,updatedAt:new Date().toISOString()},re))),!re)throw new Error(`Schedule not found: ${H}`);return re},deleteSchedule:async H=>{console.log("[MockGrackle] deleteSchedule",H),V(te=>te.filter(re=>re.id!==H))},domainHook:ps},knowledge:{graphData:{nodes:ie,links:O},selectedNode:he,loading:!1,selectedId:ye,searchQuery:Ne,search:async H=>{if(console.log("[MockGrackle] knowledge.search",H),!H.trim()){Ue(H);return}Ue(H);const te=ge.current,re=te?ws.filter(Se=>!Se.workspaceId||Se.workspaceId===te):ws,ce=H.toLowerCase(),me=re.filter(Se=>{var Me,Xe,ht;return Se.label.toLowerCase().includes(ce)||((Me=Se.content)==null?void 0:Me.toLowerCase().includes(ce))||((Xe=Se.tags)==null?void 0:Xe.some(Le=>Le.toLowerCase().includes(ce)))||((ht=Se.category)==null?void 0:ht.toLowerCase().includes(ce))});M(me);const He=new Set(me.map(Se=>Se.id));X(za.filter(Se=>He.has(Se.source)&&He.has(Se.target))),fe(void 0),W(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),Ue("");const H=ge.current,te=H?ws.filter(ce=>!ce.workspaceId||ce.workspaceId===H):ws;M(te);const re=new Set(te.map(ce=>ce.id));X(za.filter(ce=>re.has(ce.source)&&re.has(ce.target)))},selectNode:async H=>{console.log("[MockGrackle] knowledge.selectNode",H),fe(H);const te=H in sx?sx[H]:void 0;if(te)W(te);else{const re=ws.find(ce=>ce.id===H);if(re){const ce=za.filter(me=>me.source===H||me.target===H).map(me=>({fromId:me.source,toId:me.target,type:me.type}));W({node:re,edges:ce})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),fe(void 0),W(void 0)},expandNode:async H=>{console.log("[MockGrackle] knowledge.expandNode",H),M(te=>{const re=new Set(te.map(Me=>Me.id)),ce=za.filter(Me=>Me.source===H||Me.target===H),me=new Set;for(const Me of ce)re.has(Me.source)||me.add(Me.source),re.has(Me.target)||me.add(Me.target);if(me.size===0)return te;const He=ws.filter(Me=>me.has(Me.id)),Se=new Set([...re,...me]);return X(Me=>{const Xe=new Set(Me.map(Le=>`${Le.source}|${Le.target}|${Le.type}`)),ht=za.filter(Le=>Se.has(Le.source)&&Se.has(Le.target)&&!Xe.has(`${Le.source}|${Le.target}|${Le.type}`));return ht.length>0?[...Me,...ht]:Me}),[...te,...He]})},loadRecent:async H=>{if(console.log("[MockGrackle] knowledge.loadRecent",H),ge.current=H,H){const te=ws.filter(ce=>!ce.workspaceId||ce.workspaceId===H);M(te);const re=new Set(te.map(ce=>ce.id));X(za.filter(ce=>re.has(ce.source)&&re.has(ce.target)))}else M(ws),X(za);Ue("")},handleEvent:()=>!1,domainHook:ps},plugins:{plugins:[{name:"core",description:"Core infrastructure",enabled:!0,required:!0,loaded:!0},{name:"orchestration",description:"Task orchestration",enabled:!0,required:!1,loaded:!0},{name:"scheduling",description:"Scheduled triggers",enabled:!0,required:!1,loaded:!0},{name:"knowledge",description:"Knowledge graph",enabled:!1,required:!1,loaded:!1}],pluginsLoading:!1,loadPlugins:async()=>{console.log("[MockGrackle] loadPlugins")},setPluginEnabled:async(H,te)=>{console.log("[MockGrackle] setPluginEnabled",H,te)}},appDefaultPersonaId:de,setAppDefaultPersonaId:async H=>{console.log("[MockGrackle] setAppDefaultPersonaId",H),ee(H)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costMillicents:112e3,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costMillicents:48e3,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1}},loadUsage:async(H,te)=>{console.log(`[MockGrackle] loadUsage(${H}, ${te})`)},refresh:da}),[s,r,d,p,K,g,x,k,j,T,B,A,L,J,de,ie,O,he,ye,Ne,ca,Ae,is,Ja,Jt,Bi,ua,Wa,ys,Li,$n,We,Wt,St,mn,Xt,zi,$i,Pi,Xa,Qa,ei,bs,ti,fa,bl,da]);return i.jsx(uh.Provider,{value:xl,children:t})}const ak=3e3,yz=ak;function bz(t){const[s,o]=y.useState("connecting"),r=y.useRef(t.onSessionEvent);r.current=t.onSessionEvent;const c=y.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const d=y.useRef(t.onConnect);d.current=t.onConnect;const u=y.useRef(t.onDisconnect);return u.current=t.onDisconnect,y.useEffect(()=>{let p=!1,m,g;async function v(){var k,S;if(p)return;Promise.resolve((k=d.current)==null?void 0:k.call(d)).catch(()=>{});let x=!1;const b=()=>{!x&&!p&&(x=!0,o("connected"))};g=setTimeout(b,yz);try{const j=Ye.streamEvents({});for await(const N of j){if(b(),p)break;const T=N.event;if(T.case==="sessionEvent"){const C=T.value;r.current({sessionId:C.sessionId,type:C.type,timestamp:C.timestamp,content:C.content,raw:C.raw})}else if(T.case==="domainEvent"){const C=T.value;c.current({id:C.id,type:C.type,timestamp:C.timestamp,payloadJson:C.payloadJson})}}}catch(j){if(clearTimeout(g),j instanceof Ci&&j.code===Sx.Unauthenticated){window.location.href=jN;return}}clearTimeout(g),p||(o("connecting"),(S=u.current)==null||S.call(u),m=setTimeout(()=>{v().catch(()=>{})},ak))}return v().catch(()=>{}),()=>{p=!0,clearTimeout(m),clearTimeout(g)}},[]),{connectionStatus:s}}const hm=["core","orchestration","scheduling"],ik=y.createContext({pluginNames:[...hm],loading:!1,error:void 0});function xz({children:t}){const[s,o]=y.useState([...hm]),[r,c]=y.useState(!0),[d,u]=y.useState(void 0);return y.useEffect(()=>{let p=!1;return fetch("/api/manifest").then(async m=>{if(!m.ok)throw new Error(`Manifest fetch returned ${m.status}`);return m.json()}).then(m=>{p||(o(m.plugins.map(g=>g.name)),c(!1))}).catch(m=>{p||(o([...hm]),u(m instanceof Error?m:new Error(String(m))),c(!1))}),()=>{p=!0}},[]),i.jsx(ik.Provider,{value:{pluginNames:s,loading:r,error:d},children:t})}function hh(){return y.useContext(ik)}const _z=new Set(["dashboard","chat","environments","settings"]),kz=new Set(["tasks","findings"]),Sz=new Set(["knowledge"]),ok={core:{navItems:sd.filter(t=>_z.has(t.view)),domainHookKeys:["environments","sessions","workspaces","tokens","credentials","codespaces","plugins"]},orchestration:{navItems:sd.filter(t=>kz.has(t.view)),domainHookKeys:["tasks","findings","personas","notifications"]},scheduling:{navItems:[],domainHookKeys:["schedules"]},knowledge:{navItems:sd.filter(t=>Sz.has(t.view)),domainHookKeys:["knowledge"]}};function Tz(t){return t.flatMap(s=>{var o;return((o=ok[s])==null?void 0:o.navItems)??[]})}function jz(t){return new Set(t.flatMap(s=>{var o;return((o=ok[s])==null?void 0:o.domainHookKeys)??[]}))}function wz(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped}}function ox(t){return{id:t.id,environmentId:t.environmentId,runtime:t.runtime,status:t.status,prompt:t.prompt,startedAt:t.startedAt,endedAt:t.endedAt||void 0,error:t.error||void 0,endReason:t.endReason||void 0,personaId:t.personaId||void 0,inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents}}function Nz(t){return{sessionId:t.sessionId,eventType:Tx(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function Cz(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,linkedEnvironmentIds:[...t.linkedEnvironmentIds],status:OT(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents,createdAt:t.createdAt,updatedAt:t.updatedAt}}function rx(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:BT(t.status),branch:t.branch,latestSessionId:t.latestSessionId,dependsOn:[...t.dependsOn],sortOrder:t.sortOrder,createdAt:t.createdAt,startedAt:t.startedAt||void 0,completedAt:t.completedAt||void 0,parentTaskId:t.parentTaskId,depth:t.depth,childTaskIds:[...t.childTaskIds],canDecompose:t.canDecompose,defaultPersonaId:t.defaultPersonaId,workpad:t.workpad,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents}}function Rp(t){return{id:t.id,workspaceId:t.workspaceId,taskId:t.taskId,sessionId:t.sessionId,category:t.category,title:t.title,content:t.content,tags:[...t.tags],createdAt:t.createdAt}}function Ez(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function Az(t){return{claude:LT(t.claude),github:Rc(t.github),copilot:Rc(t.copilot),codex:Rc(t.codex),goose:Rc(t.goose)}}function Dz(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function Ip(t){return{id:t.id,name:t.name,description:t.description,systemPrompt:t.systemPrompt,toolConfig:t.toolConfig?JSON.stringify({allowedTools:[...t.toolConfig.allowedTools],disallowedTools:[...t.toolConfig.disallowedTools]}):"{}",runtime:t.runtime,model:t.model,maxTurns:t.maxTurns,mcpServers:JSON.stringify(t.mcpServers.map(s=>({name:s.name,command:s.command,args:[...s.args],tools:[...s.tools]}))),createdAt:t.createdAt,updatedAt:t.updatedAt,type:t.type||"agent",script:t.script,allowedMcpTools:[...t.allowedMcpTools]}}function Mz(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents,sessionCount:t.sessionCount}}function Op(t){return{id:t.id,title:t.title,description:t.description,scheduleExpression:t.scheduleExpression,personaId:t.personaId,workspaceId:t.workspaceId,parentTaskId:t.parentTaskId,enabled:t.enabled,lastRunAt:t.lastRunAt,nextRunAt:t.nextRunAt,runCount:t.runCount,createdAt:t.createdAt,updatedAt:t.updatedAt}}function Yc(t,s=0){return{id:t.id,label:t.title||t.label||t.id,kind:t.kind,category:t.category||void 0,sourceType:t.sourceType||void 0,sourceId:t.sourceId||void 0,content:t.content||void 0,tags:t.tags.length>0?[...t.tags]:void 0,workspaceId:t.workspaceId||void 0,createdAt:t.createdAt||void 0,updatedAt:t.updatedAt||void 0,val:s}}function Bp(t){return{source:t.fromId,target:t.toId,type:t.type}}function Ms(){const[t,s]=y.useState(!1),o=y.useRef(0),r=y.useCallback(c=>(o.current++,o.current===1&&s(!0),c.finally(()=>{o.current--,o.current===0&&s(!1)})),[]);return{loading:t,track:r}}const lx=5e3;function qr(t){return t instanceof Ci?t.message:"Operation failed"}function Rz(){const[t,s]=y.useState([]),{loading:o,track:r}=Ms(),[c,d]=y.useState({}),[u,p]=y.useState(""),m=y.useCallback(()=>{p("")},[]),g=y.useCallback(async()=>{try{const C=await r(Ye.listEnvironments({}));s(C.environments.map(wz))}catch{}},[r]),v=y.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const D=C.payload.environmentId;return D&&(s(B=>B.filter(E=>E.id!==D)),d(B=>{const E={...B};return delete E[D],E})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const D=C.payload;if(typeof D.environmentId!="string"||typeof D.stage!="string"||typeof D.message!="string"||typeof D.progress!="number")return Q1("environment.provision_progress","invalid payload"),!0;if(d(B=>({...B,[D.environmentId]:{stage:D.stage,message:D.message,progress:D.progress}})),D.stage==="ready"){const B=D.environmentId;setTimeout(()=>{d(E=>{const A={...E};return delete A[B],A})},lx)}return!0}default:return!1}},[g]),x=y.useCallback(C=>{var D;if(C.type==="environments"){const B=Array.isArray((D=C.payload)==null?void 0:D.environments)?C.payload.environments:[];return s(B),!0}return!1},[]),b=y.useCallback(async(C,D,B)=>{p("");try{await Ye.addEnvironment({displayName:C,adapterType:D,adapterConfig:JSON.stringify(B??{})})}catch(E){p(qr(E))}},[]),k=y.useCallback(async(C,D)=>{p("");try{await Ye.updateEnvironment({id:C,displayName:D.displayName,adapterConfig:D.adapterConfig?JSON.stringify(D.adapterConfig):void 0})}catch(B){p(qr(B))}},[]),S=y.useCallback(async(C,D)=>{p("");try{const B=Ye.provisionEnvironment({id:C,force:D??!1});for await(const E of B)d(A=>({...A,[C]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"&&setTimeout(()=>{d(A=>{const $={...A};return delete $[C],$})},lx)}catch(B){d(E=>{const A={...E};return delete A[C],A}),p(qr(B))}},[]),j=y.useCallback(async C=>{p("");try{await Ye.stopEnvironment({id:C})}catch(D){p(qr(D))}},[]),N=y.useCallback(async C=>{p("");try{await Ye.removeEnvironment({id:C})}catch(D){p(qr(D))}},[]);return{environments:t,environmentsLoading:o,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:g,addEnvironment:b,updateEnvironment:k,provisionEnvironment:S,stopEnvironment:j,removeEnvironment:N,handleEvent:v,handleLegacyMessage:x,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const Lp=new Set(["pending","running","idle"]),Iz=new Set(["completed","failed","interrupted","hibernating","suspended"]),cx=["pending","running","idle"];function Oz(){const[t,s]=y.useState([]),{loading:o,track:r}=Ms(),[c,d]=y.useState([]),[u,p]=y.useState(0),[m,g]=y.useState(void 0),[v,x]=y.useState({}),b=y.useCallback(async()=>{try{const U=(await r(Ye.listSessions({}))).sessions.map(ox);s(J=>{const V=new Map(J.map(K=>[K.id,K]));return U.map(K=>{const de=V.get(K.id),ee=de==null?void 0:de.status;return!ee||ee===K.status?K:Iz.has(ee)&&Lp.has(K.status)?{...K,status:ee,...de.endReason!==void 0?{endReason:de.endReason}:{}}:Lp.has(ee)&&Lp.has(K.status)&&cx.indexOf(ee)>cx.indexOf(K.status)?{...K,status:ee}:K})})}catch{}},[r]),k=y.useCallback(L=>{if(L.type!=="session_event")return!1;if(!G7(L.payload))return Q1("session_event","payload is not a valid SessionEvent"),!0;const U=L.payload;let J=0;if(d(V=>{const K=[...V,U];return K.length>wo?(J=K.length-wo,K.slice(-wo)):K}),J>0&&p(V=>V+J),U.eventType==="usage")try{const V=JSON.parse(U.content),K=Number(V.input_tokens)||0,de=Number(V.output_tokens)||0,ee=Number(V.cost_millicents)||0;(K>0||de>0||ee>0)&&s(ie=>ie.map(M=>M.id===U.sessionId?{...M,inputTokens:(M.inputTokens??0)+K,outputTokens:(M.outputTokens??0)+de,costMillicents:(M.costMillicents??0)+ee}:M))}catch{}if(U.eventType==="status"){const V=ek(U.content),K=tk(U.content);s(de=>de.some(ie=>ie.id===U.sessionId)?de.map(ie=>ie.id===U.sessionId?{...ie,status:V,...K!==void 0?{endReason:K}:{}}:ie):[...de,{id:U.sessionId,environmentId:"",runtime:"",status:V,prompt:"",startedAt:U.timestamp,...K!==void 0?{endReason:K}:{}}])}return!0},[]),S=y.useCallback(L=>{k({type:"session_event",payload:L})},[k]),j=y.useCallback(L=>{var U,J,V,K,de;switch(L.type){case"sessions":{const ee=Array.isArray((U=L.payload)==null?void 0:U.sessions)?L.payload.sessions:[];return s(ee),!0}case"spawned":{const ee=(J=L.payload)==null?void 0:J.sessionId;return typeof ee=="string"&&ee&&g(ee),b().catch(()=>{}),!0}case"session_events":{const ee=Array.isArray((V=L.payload)==null?void 0:V.events)?L.payload.events:[];return ee.length>0&&d(ee),!0}case"task_sessions":{const ee=(K=L.payload)==null?void 0:K.taskId;if(typeof ee=="string"&&ee){const ie=Array.isArray((de=L.payload)==null?void 0:de.sessions)?L.payload.sessions:[];x(M=>({...M,[ee]:ie}))}return!0}default:return!1}},[b]),N=y.useCallback(async(L,U,J,V)=>{try{const K=await Ye.spawnAgent({environmentId:L,prompt:U,personaId:J||"",workingDirectory:V||""});g(K.id),await b()}catch{}},[b]),T=y.useCallback(async(L,U)=>{try{await Ye.sendInput({sessionId:L,text:U})}catch{}},[]),C=y.useCallback(async L=>{try{await Ye.killAgent({id:L,graceful:!1})}catch{}},[]),D=y.useCallback(async L=>{try{await Ye.killAgent({id:L,graceful:!0})}catch{}},[]),B=y.useCallback(async L=>{try{const J=(await Ye.getSessionEvents({id:L})).events.map(Nz);if(J.length>0){let V=0;d(K=>{const de=new Set;for(const M of K)M.sessionId===L&&de.add(`${M.timestamp}|${M.eventType}`);const ee=J.filter(M=>!de.has(`${M.timestamp}|${M.eventType}`)),ie=[...K,...ee].sort((M,O)=>M.sessionId!==O.sessionId?0:M.timestamp.localeCompare(O.timestamp));return ie.length>wo?(V=ie.length-wo,ie.slice(-wo)):ie}),V>0&&p(K=>K+V)}}catch{}},[]),E=y.useCallback(()=>{d([]),p(0)},[]),A=y.useCallback(async L=>{try{const J=(await Ye.getTaskSessions({id:L})).sessions.map(ox);x(V=>({...V,[L]:J}))}catch{}},[]);return{sessions:t,sessionsLoading:o,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:b,spawn:N,sendInput:T,kill:C,stopGraceful:D,loadSessionEvents:B,clearEvents:E,loadTaskSessions:A,handleMessage:k,handleSessionEvent:S,handleLegacyMessage:j,domainHook:{onConnect:()=>b(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function dx(t){return t instanceof Ci?t.message:"Operation failed"}function Bz(){const[t,s]=y.useState([]),{loading:o,track:r}=Ms(),[c,d]=y.useState(!1),[u,p]=y.useState(""),m=y.useCallback(async()=>{try{const C=await r(Ye.listWorkspaces({}));s(C.workspaces.map(Cz))}catch{}},[r]),g=y.useCallback(C=>{switch(C.type){case"workspace.created":return d(!1),m().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return m().catch(()=>{}),!0;default:return!1}},[m]),v=y.useCallback(()=>{d(!1)},[]),x=y.useCallback(async(C,D,B,E,A,$,L,U,J)=>{d(!0);try{await Ye.createWorkspace({name:C,description:D||"",repoUrl:B||"",environmentId:E||"",defaultPersonaId:A||void 0,useWorktrees:$??!0,workingDirectory:L||void 0}),d(!1),U==null||U()}catch(V){d(!1);const K=V instanceof Ci?V.message:"Failed to create workspace";J==null||J(K)}},[]),b=y.useCallback(async C=>{try{await Ye.archiveWorkspace({id:C})}catch{}},[]),k=y.useCallback(async(C,D)=>{try{await Ye.updateWorkspace({id:C,...D})}catch{}},[]),S=y.useCallback(()=>{p("")},[]),j=y.useCallback(async(C,D)=>{try{p(""),await Ye.linkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(B){p(dx(B))}},[m]),N=y.useCallback(async(C,D)=>{try{p(""),await Ye.unlinkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(B){p(dx(B))}},[m]);return{workspaces:t,workspacesLoading:o,workspaceCreating:c,loadWorkspaces:m,createWorkspace:x,archiveWorkspace:b,updateWorkspace:k,linkEnvironment:j,unlinkEnvironment:N,linkOperationError:u,clearLinkOperationError:S,handleEvent:g,onDisconnect:v,domainHook:{onConnect:()=>m(),onDisconnect:v,handleEvent:g}}}function Lz(){const[t,s]=y.useState([]),{loading:o,track:r}=Ms(),[c,d]=y.useState(void 0),u=y.useRef({}),p=y.useCallback(async E=>{try{const $=(await dn.listTasks({workspaceId:E})).tasks.map(rx);s(L=>[...L.filter(U=>U.workspaceId!==E),...$])}catch{}},[]),m=y.useCallback(async()=>{try{const A=(await r(dn.listTasks({}))).tasks.map(rx);s($=>{const L=new Set(A.map(U=>U.id));return[...$.filter(U=>!L.has(U.id)),...A]})}catch{}},[r]),g=y.useCallback((E,A)=>{const $=L=>{clearTimeout(u.current[L]),u.current[L]=setTimeout(()=>{delete u.current[L],p(L).catch(()=>{})},200)};E?$(E):A&&s(L=>{const U=L.find(J=>J.id===A);return U!=null&&U.workspaceId?$(U.workspaceId):m().catch(()=>{}),L})},[p,m]),v=y.useCallback(E=>{const A=E.payload;switch(E.type){case"task.created":{const $=typeof A.workspaceId=="string"?A.workspaceId:"";return $&&p($).catch(()=>{}),!0}case"task.started":{const $=typeof A.taskId=="string"?A.taskId:"",L=typeof A.sessionId=="string"?A.sessionId:"",U=typeof A.workspaceId=="string"?A.workspaceId:"";return d(J=>$&&J===$?void 0:J),L&&$&&s(J=>J.map(V=>V.id===$?{...V,latestSessionId:L}:V)),g(U,$),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const $=typeof A.workspaceId=="string"?A.workspaceId:"",L=typeof A.taskId=="string"?A.taskId:"";return d(U=>L&&U===L?void 0:U),g($,L),!0}default:return!1}},[p,g]),x=y.useCallback(()=>{d(void 0)},[]),b=y.useCallback(E=>{var A,$;if(E.type==="tasks"){const L=Array.isArray((A=E.payload)==null?void 0:A.tasks)?E.payload.tasks:[],U=typeof(($=E.payload)==null?void 0:$.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s(U?J=>[...J.filter(V=>V.workspaceId!==U),...L]:J=>{const V=new Set(L.map(K=>K.id));return[...J.filter(K=>!V.has(K.id)),...L]}),!0}return!1},[]),k=y.useCallback(async(E,A,$,L,U,J,V,K,de)=>{try{await dn.createTask({workspaceId:E,title:A,description:$||"",dependsOn:L||[],parentTaskId:U||"",defaultPersonaId:J||void 0,canDecompose:V??void 0}),K==null||K()}catch(ee){const ie=ee instanceof Ci?ee.message:"Failed to create task";de==null||de(ie)}},[]),S=y.useCallback(async(E,A,$,L)=>{d(E);try{await dn.startTask({taskId:E,personaId:A||"",environmentId:$||"",notes:L||""})}catch(U){if(U instanceof Ci&&U.code===Sx.ResourceExhausted)return;d(void 0)}},[]),j=y.useCallback(async E=>{try{await dn.stopTask({id:E})}catch{}},[]),N=y.useCallback(async E=>{try{await dn.completeTask({id:E})}catch{}},[]),T=y.useCallback(async E=>{try{await dn.resumeTask({id:E})}catch{}},[]),C=y.useCallback(async(E,A,$,L,U)=>{try{await dn.updateTask({id:E,title:A,description:$,dependsOn:L,...U!==void 0?{defaultPersonaId:U}:{}})}catch{}},[]),D=y.useCallback(async E=>{try{await dn.deleteTask({id:E})}catch{}},[]);return{tasks:t,tasksLoading:o,taskStartingId:c,loadTasks:p,loadAllTasks:m,createTask:k,startTask:S,stopTask:j,completeTask:N,resumeTask:T,updateTask:C,deleteTask:D,handleEvent:v,onDisconnect:x,handleLegacyMessage:b,domainHook:{onConnect:()=>m(),onDisconnect:x,handleEvent:v}}}function zz(){const[t,s]=y.useState([]),[o,r]=y.useState(void 0),[c,d]=y.useState(!1),{loading:u,track:p}=Ms(),m=y.useCallback(async S=>{try{const j=await p(dn.queryFindings({workspaceId:S}));s(j.findings.map(Rp))}catch{}},[p]),g=y.useCallback(async()=>{try{const S=await p(dn.queryFindings({workspaceId:""}));s(S.findings.map(Rp))}catch{}},[p]),v=y.useCallback(async S=>{r(void 0),d(!0);try{const j=await dn.getFinding({id:S});r(Rp(j))}catch{r(void 0)}finally{d(!1)}},[]),x=y.useCallback(S=>{if(S.type==="finding.posted"){const j=typeof S.payload.workspaceId=="string"?S.payload.workspaceId:"";return j&&m(j).catch(()=>{}),!0}return!1},[m]),b=y.useCallback(async(S,j,N,T,C)=>{try{await dn.postFinding({workspaceId:S,title:j,content:N,category:T??"general",tags:C??[]})}catch{}},[]);return{findings:t,selectedFinding:o,findingLoading:c,findingsLoading:u,loadFindings:m,loadAllFindings:g,loadFinding:v,postFinding:b,handleEvent:x,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:x}}}function $z(){const[t,s]=y.useState([]),{loading:o,track:r}=Ms(),c=y.useCallback(async()=>{try{const g=await r(Ye.listTokens({}));s(g.tokens.map(Ez))}catch{}},[r]),d=y.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(g,v,x,b,k)=>{try{await Ye.setToken({name:g,value:v,type:x,envVar:b,filePath:k})}catch{}},[]),p=y.useCallback(async g=>{try{await Ye.deleteToken({name:g})}catch{}},[]);return{tokens:t,tokensLoading:o,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Pz(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=Ms(),c=y.useCallback(async()=>{try{const m=await r(Ye.getCredentialProviders({}));s(Az(m))}catch{}},[r]),d=y.useCallback(m=>m.type==="credential.providers_changed"?(Z7(m.payload)&&s(m.payload),!0):!1,[]),u=y.useCallback(async m=>{const g=[{provider:"claude",value:m.claude},{provider:"github",value:m.github},{provider:"copilot",value:m.copilot},{provider:"codex",value:m.codex},{provider:"goose",value:m.goose}];await Promise.allSettled(g.map(({provider:v,value:x})=>Ye.setCredentialProvider({provider:v,value:x})))},[]);return{credentialProviders:t,credentialsLoading:o,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Uz(){const[t,s]=y.useState([]),[o,r]=y.useState(""),[c,d]=y.useState(""),[u,p]=y.useState(!1),m=y.useCallback(async()=>{try{const x=await Ye.listCodespaces({});s(x.codespaces.map(Dz)),d(x.error)}catch{}},[]),g=y.useCallback(async(x,b)=>{p(!0),r("");try{await Ye.createCodespace({repo:x,machine:b??""}),p(!1),await m()}catch(k){p(!1);const S=k instanceof Ci?k.message:"Failed to create codespace";r(S)}},[m]);return{codespaces:t,codespaceError:o,codespaceListError:c,codespaceCreating:u,listCodespaces:m,createCodespace:g,domainHook:{onConnect:()=>m(),onDisconnect:()=>{},handleEvent:()=>!1}}}function Hz(){const[t,s]=y.useState([]),{loading:o,track:r}=Ms(),c=y.useCallback(async()=>{try{const v=await r(dn.listPersonas({}));s(v.personas.map(Ip))}catch{}},[r]),d=y.useCallback(v=>{switch(v.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),u=y.useCallback(async(v,x,b,k,S,j,N,T,C)=>{const D=await dn.createPersona({name:v,description:x,systemPrompt:b,runtime:k||"",model:S||"",maxTurns:j||0,type:N||"agent",script:T||"",allowedMcpTools:C||[]}),B=Ip(D);return s(E=>[...E.filter(A=>A.id!==B.id),B]),B},[]),p=y.useCallback(async(v,x,b,k,S,j,N,T,C,D)=>{const B={id:v};x!==void 0&&(B.name=x),b!==void 0&&(B.description=b),k!==void 0&&(B.systemPrompt=k),S!==void 0&&(B.runtime=S),j!==void 0&&(B.model=j),N!==void 0&&(B.maxTurns=N),T!==void 0&&(B.type=T),C!==void 0&&(B.script=C),D!==void 0&&(B.allowedMcpTools={tools:D});const E=await dn.updatePersona(B),A=Ip(E);return s($=>$.map(L=>L.id===A.id?A:L)),A},[]),m=y.useCallback(async v=>{await dn.deletePersona({id:v}),s(x=>x.filter(b=>b.id!==v))},[]);return{personas:t,personasLoading:o,loadPersonas:c,createPersona:u,updatePersona:p,deletePersona:m,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Vz(){const[t,s]=y.useState([]),{loading:o,track:r}=Ms(),c=y.useRef(void 0),d=y.useCallback(async()=>{try{const x=await r(Oc.listSchedules({}));s(x.schedules.map(Op))}catch{}},[r]),u=y.useCallback(x=>{switch(x.type){case"schedule.created":case"schedule.updated":case"schedule.deleted":return d().catch(()=>{}),!0;case"schedule.fired":return clearTimeout(c.current),c.current=setTimeout(()=>{d().catch(()=>{})},500),!0;default:return!1}},[d]),p=y.useCallback(async(x,b,k,S,j,N)=>{const T=await Oc.createSchedule({title:x,description:b,scheduleExpression:k,personaId:S,workspaceId:j||"",parentTaskId:N||""}),C=Op(T);return s(D=>[...D.filter(B=>B.id!==C.id),C]),C},[]),m=y.useCallback(async(x,b)=>{const k={id:x};b.title!==void 0&&(k.title=b.title),b.description!==void 0&&(k.description=b.description),b.scheduleExpression!==void 0&&(k.scheduleExpression=b.scheduleExpression),b.personaId!==void 0&&(k.personaId=b.personaId),b.enabled!==void 0&&(k.enabled=b.enabled);const S=await Oc.updateSchedule(k),j=Op(S);return s(N=>N.map(T=>T.id===j.id?j:T)),j},[]),g=y.useCallback(async x=>{await Oc.deleteSchedule({id:x}),s(b=>b.filter(k=>k.id!==x))},[]);return{schedules:t,schedulesLoading:o,loadSchedules:d,createSchedule:p,updateSchedule:m,deleteSchedule:g,handleEvent:u,domainHook:{onConnect:()=>d(),onDisconnect:()=>{clearTimeout(c.current)},handleEvent:u}}}function qz(t){if(t)try{return JSON.parse(t)}catch{return}}function Gz(){const[t,s]=y.useState(new Map),[o,r]=y.useState([]),[c,d]=y.useState(void 0),[u,p]=y.useState(void 0),[m,g]=y.useState(!1),[v,x]=y.useState(""),b=y.useRef(""),k=y.useCallback(async E=>{const A=E??"";b.current=A,x(""),g(!0);try{const $=await Bc.listRecentKnowledgeNodes({limit:30,workspaceId:A}),L=new Map,U=[];for(const J of $.nodes)L.set(J.id,Yc(J));for(const J of $.edges)U.push(Bp(J));for(const J of U){const V=L.get(J.source);V&&(V.val+=1);const K=L.get(J.target);K&&(K.val+=1)}s(L),r(U)}catch{}finally{g(!1)}},[]),S=y.useCallback(async E=>{if(E.trim()){x(E),p(void 0),d(void 0),g(!0);try{const A=await Bc.searchKnowledge({query:E,limit:20,workspaceId:b.current}),$=new Map,L=[];for(const U of A.results){U.node&&$.set(U.node.id,Yc(U.node,U.edges.length));for(const J of U.edges)L.push(Bp(J))}s($),r(L)}catch{}finally{g(!1)}}},[]),j=y.useCallback(()=>{k(b.current).catch(()=>{})},[k]),N=y.useCallback(async E=>{p(E);try{const A=await Bc.getKnowledgeNode({id:E});if(!A.node){d(void 0);return}d({node:Yc(A.node,A.edges.length),edges:A.edges.map($=>({fromId:$.fromId,toId:$.toId,type:$.type,metadata:qz($.metadataJson)}))})}catch{d(void 0)}},[]),T=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async E=>{try{const A=await Bc.expandKnowledgeNode({id:E,depth:1});s($=>{const L=new Map($);for(const U of A.nodes)L.has(U.id)||L.set(U.id,Yc(U));return L}),r($=>{const L=new Set($.map(J=>`${J.source}:${J.target}:${J.type}`)),U=[];for(const J of A.edges){const V=Bp(J),K=`${V.source}:${V.target}:${V.type}`;L.has(K)||U.push(V)}return[...$,...U]})}catch{}},[]),D=y.useCallback(E=>!1,[]),B={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:D};return{graphData:{nodes:[...t.values()],links:o},selectedNode:c,selectedId:u,loading:m,searchQuery:v,search:S,clearSearch:j,selectNode:N,clearSelection:T,expandNode:C,loadRecent:k,handleEvent:D,domainHook:B}}function Fz(){const t=y.useRef("default");y.useEffect(()=>{typeof Notification>"u"||(t.current=Notification.permission)},[]);function s(r){if(r.type!=="notification.escalated")return!1;if(typeof Notification>"u")return!0;if(t.current==="default")return Notification.requestPermission().then(u=>{t.current=u}).catch(()=>{}),!0;if(t.current!=="granted")return!0;const c=r.payload,d=new Notification(c.title||"Agent needs input",{body:c.message||"An agent is waiting for your input.",tag:c.escalationId,icon:"/icon-192x192.png"});return d.onclick=()=>{window.focus(),c.taskUrl&&(window.location.href=c.taskUrl),d.close()},!0}return{handleEvent:s,domainHook:{onConnect:async()=>{},onDisconnect:()=>{},handleEvent:s}}}function Zz(){const[t,s]=y.useState([]),{loading:o,track:r}=Ms(),c=y.useCallback(async()=>{try{const m=await r(Ye.listPlugins({}));s(m.plugins.map(g=>({name:g.name,description:g.description,enabled:g.enabled,required:g.required,loaded:g.loaded})))}catch{}},[r]),d=y.useCallback(m=>m.type==="plugin.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(m,g)=>{try{const v=await Ye.setPluginEnabled({name:m,enabled:g});s(x=>x.map(b=>b.name===v.name?{...b,enabled:v.enabled}:b))}catch{}},[]);return{plugins:t,pluginsLoading:o,loadPlugins:c,setPluginEnabled:u,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Kz(){const[t,s]=y.useState(""),[o,r]=y.useState(void 0),[c,d]=y.useState({}),{pluginNames:u}=hh(),p=jz(u),m=Rz(),g=Oz(),v=Bz(),x=Lz(),b=zz(),k=$z(),S=Pz(),j=Uz(),N=Hz(),T=Vz(),C=Gz(),D=Fz(),B=Zz(),E=[...p.has("environments")?[m.domainHook]:[],...p.has("sessions")?[g.domainHook]:[],...p.has("workspaces")?[v.domainHook]:[],...p.has("tasks")?[x.domainHook]:[],...p.has("findings")?[b.domainHook]:[],...p.has("tokens")?[k.domainHook]:[],...p.has("credentials")?[S.domainHook]:[],...p.has("codespaces")?[j.domainHook]:[],...p.has("personas")?[N.domainHook]:[],...p.has("schedules")?[T.domainHook]:[],...p.has("knowledge")?[C.domainHook]:[],...p.has("notifications")?[D.domainHook]:[],...p.has("plugins")?[B.domainHook]:[]],{connectionStatus:A}=bz({onSessionEvent:M=>{g.handleSessionEvent({sessionId:M.sessionId,eventType:Tx(M.type),timestamp:M.timestamp,content:M.content,raw:M.raw||void 0})},onDomainEvent:M=>{try{const O=JSON.parse(M.payloadJson);K({id:M.id,type:M.type,timestamp:M.timestamp,payload:O})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",M.payloadJson)}},onConnect:de,onDisconnect:ee}),$="default_persona_id",L="onboarding_completed",U=y.useCallback(async M=>{const O=await Ye.setSetting({key:$,value:M});s(O.value)},[]),J=y.useCallback(async()=>{r(!0);try{await Ye.setSetting({key:L,value:"true"})}catch{}},[]),V=y.useCallback(async(M,O)=>{try{const X=await Ye.getUsage({scope:M,id:O}),he=`${M}:${O}`;d(W=>({...W,[he]:Mz(X)}))}catch{}},[]);function K(M){const O=M.payload.key,X=M.payload.value;if(M.type==="setting.changed"){O===$&&s(X??""),O===L&&r(X==="true");return}for(const he of E)if(he.handleEvent(M))break;(M.type==="environment.removed"||M.type==="environment.changed"||M.type==="task.started")&&g.loadSessions().catch(()=>{})}async function de(){for(const M of E)M.onConnect().catch(()=>{});try{const M=await Ye.getSetting({key:$});s(M.value)}catch{}try{const M=await Ye.getSetting({key:L});r(M.value==="true")}catch{}}function ee(){E.forEach(M=>M.onDisconnect())}const ie=y.useCallback(()=>{m.loadEnvironments().catch(()=>{}),g.loadSessions().catch(()=>{}),v.loadWorkspaces().catch(()=>{}),k.loadTokens().catch(()=>{})},[m.loadEnvironments,g.loadSessions,v.loadWorkspaces,k.loadTokens]);return{connectionStatus:A,environments:{environments:m.environments,environmentsLoading:m.environmentsLoading,provisionStatus:m.provisionStatus,operationError:m.operationError,clearOperationError:m.clearOperationError,loadEnvironments:m.loadEnvironments,addEnvironment:m.addEnvironment,updateEnvironment:m.updateEnvironment,provisionEnvironment:m.provisionEnvironment,stopEnvironment:m.stopEnvironment,removeEnvironment:m.removeEnvironment,domainHook:m.domainHook},sessions:{sessions:g.sessions,sessionsLoading:g.sessionsLoading,events:g.events,eventsDropped:g.eventsDropped,lastSpawnedId:g.lastSpawnedId,taskSessions:g.taskSessions,spawn:g.spawn,sendInput:g.sendInput,kill:g.kill,stopGraceful:g.stopGraceful,loadSessionEvents:g.loadSessionEvents,clearEvents:g.clearEvents,loadTaskSessions:g.loadTaskSessions,domainHook:g.domainHook},workspaces:{workspaces:v.workspaces,workspacesLoading:v.workspacesLoading,workspaceCreating:v.workspaceCreating,loadWorkspaces:v.loadWorkspaces,createWorkspace:v.createWorkspace,archiveWorkspace:v.archiveWorkspace,updateWorkspace:v.updateWorkspace,linkEnvironment:v.linkEnvironment,unlinkEnvironment:v.unlinkEnvironment,linkOperationError:v.linkOperationError,clearLinkOperationError:v.clearLinkOperationError,domainHook:v.domainHook},tasks:{tasks:x.tasks,tasksLoading:x.tasksLoading,taskStartingId:x.taskStartingId,loadTasks:x.loadTasks,loadAllTasks:x.loadAllTasks,createTask:x.createTask,startTask:x.startTask,stopTask:x.stopTask,completeTask:x.completeTask,resumeTask:x.resumeTask,updateTask:x.updateTask,deleteTask:x.deleteTask,domainHook:x.domainHook},findings:{findings:b.findings,selectedFinding:b.selectedFinding,findingLoading:b.findingLoading,findingsLoading:b.findingsLoading,loadFindings:b.loadFindings,loadAllFindings:b.loadAllFindings,loadFinding:b.loadFinding,postFinding:b.postFinding,domainHook:b.domainHook},tokens:{tokens:k.tokens,tokensLoading:k.tokensLoading,loadTokens:k.loadTokens,setToken:k.setToken,deleteToken:k.deleteToken,domainHook:k.domainHook},credentials:{credentialProviders:S.credentialProviders,credentialsLoading:S.credentialsLoading,updateCredentialProviders:S.updateCredentialProviders,domainHook:S.domainHook},codespaces:{codespaces:j.codespaces,codespaceError:j.codespaceError,codespaceListError:j.codespaceListError,codespaceCreating:j.codespaceCreating,listCodespaces:j.listCodespaces,createCodespace:j.createCodespace,domainHook:j.domainHook},personas:{personas:N.personas,personasLoading:N.personasLoading,createPersona:N.createPersona,updatePersona:N.updatePersona,deletePersona:N.deletePersona,domainHook:N.domainHook},schedules:{schedules:T.schedules,schedulesLoading:T.schedulesLoading,createSchedule:T.createSchedule,updateSchedule:T.updateSchedule,deleteSchedule:T.deleteSchedule,domainHook:T.domainHook},knowledge:C,plugins:{plugins:B.plugins,pluginsLoading:B.pluginsLoading,loadPlugins:B.loadPlugins,setPluginEnabled:B.setPluginEnabled},appDefaultPersonaId:t,setAppDefaultPersonaId:U,onboardingCompleted:o,completeOnboarding:J,usageCache:c,loadUsage:V,refresh:ie}}function Yz({children:t}){const s=Kz();return i.jsx(uh.Provider,{value:s,children:t})}function Jz(t,s){const o=y.useRef(null);y.useEffect(()=>{const r=o.current;if(o.current=t,r===null)return;const c=new Map;for(const u of r)c.set(u.id,u);const d=new Set;for(const u of t){d.add(u.id);const p=c.get(u.id);if(p&&p.status!==u.status&&u.status!=="sleeping"){if(u.status==="connecting"){s("Provisioning environment…","info");continue}u.status==="connected"?s("Environment connected","success"):u.status==="error"?s("Environment provision failed","error"):u.status==="disconnected"&&(p.status==="connected"?s("Environment disconnected","warning"):s("Environment stopped","info"))}}for(const u of r)d.has(u.id)||s("Environment removed","info")},[t,s])}function Wz(t,s,o){const r=y.useRef(t);y.useEffect(()=>{t&&t!==r.current&&(o(t,"error"),s()),r.current=t},[t,s,o])}const Xz={working:{message:"Task is now running",variant:"info"},paused:{message:"Task paused",variant:"warning"},complete:{message:"Task complete",variant:"success"},failed:{message:"Task failed to complete",variant:"error"}};function Qz(t){return Xz[t]}function e$(t,s){if(t===void 0)return[];const o=[],r=new Map;for(const d of t)r.set(d.id,d);const c=new Set;for(const d of s){c.add(d.id);const u=r.get(d.id);if(!u||u.status===d.status)continue;const p=Qz(d.status);p&&o.push(p)}for(const d of t)c.has(d.id)||o.push({message:"Task deleted",variant:"info"});return o}function t$(t,s){const o=y.useRef(void 0);y.useEffect(()=>{const r=o.current;o.current=t;const c=e$(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const n$="_dashboard_16pzm_1",s$="_kpiStrip_16pzm_11",a$="_kpiCard_16pzm_23",i$="_kpiValue_16pzm_68",o$="_kpiLabel_16pzm_76",r$="_bodyGrid_16pzm_84",l$="_section_16pzm_96",c$="_sectionHeader_16pzm_109",d$="_sectionIcon_16pzm_118",u$="_sectionTitle_16pzm_123",f$="_sectionCount_16pzm_131",p$="_sectionBody_16pzm_138",m$="_emptyHint_16pzm_143",h$="_sessionRow_16pzm_150",g$="_sessionPrompt_16pzm_177",v$="_sessionEnv_16pzm_186",y$="_sessionRuntime_16pzm_192",b$="_sessionStatus_16pzm_198",x$="_statusDot_16pzm_207",_$="_attentionRow_16pzm_233",k$="_attentionTitle_16pzm_259",S$="_attentionMeta_16pzm_267",T$="_reasonBadge_16pzm_274",j$="_bottomGrid_16pzm_301",w$="_envRow_16pzm_312",N$="_envName_16pzm_323",C$="_envStatusBadge_16pzm_333",E$="_workspaceRow_16pzm_369",A$="_workspaceTop_16pzm_395",D$="_workspaceName_16pzm_401",M$="_workspaceCounts_16pzm_407",R$="_progressBar_16pzm_415",I$="_progressFill_16pzm_422",ue={dashboard:n$,kpiStrip:s$,kpiCard:a$,kpiValue:i$,kpiLabel:o$,bodyGrid:r$,section:l$,sectionHeader:c$,sectionIcon:d$,sectionTitle:u$,sectionCount:f$,sectionBody:p$,emptyHint:m$,sessionRow:h$,sessionPrompt:g$,sessionEnv:v$,sessionRuntime:y$,sessionStatus:b$,statusDot:x$,attentionRow:_$,attentionTitle:k$,attentionMeta:S$,reasonBadge:T$,bottomGrid:j$,envRow:w$,envName:N$,envStatusBadge:C$,workspaceRow:E$,workspaceTop:A$,workspaceName:D$,workspaceCounts:M$,progressBar:R$,progressFill:I$};function O$(){return i.jsxs("div",{className:ue.dashboard,"aria-hidden":"true",children:[i.jsx("div",{className:ue.kpiStrip,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:ue.kpiCard,children:[i.jsx(Te,{width:"3rem",height:"2rem"}),i.jsx(Te,{width:"80%",height:"0.75rem"})]},s))}),i.jsxs("div",{className:ue.bodyGrid,children:[i.jsxs("div",{className:ue.section,children:[i.jsxs("div",{className:ue.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:ue.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:ue.sectionBody,children:Array.from({length:3},(t,s)=>i.jsxs("div",{className:ue.sessionRow,style:{cursor:"default"},children:[i.jsx(Te,{width:"60%",height:"0.875rem"}),i.jsx(Te,{width:"4rem",height:"0.75rem"}),i.jsx(Te,{width:"3rem",height:"0.75rem"}),i.jsx(Te,{width:"3rem",height:"0.75rem"})]},s))})]}),i.jsxs("div",{className:ue.section,children:[i.jsxs("div",{className:ue.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:ue.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:ue.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:ue.attentionRow,style:{cursor:"default"},children:[i.jsxs("div",{className:ue.attentionTitle,children:[i.jsx(Te,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"70%",height:"0.875rem"})]}),i.jsx("div",{className:ue.attentionMeta,children:i.jsx(Te,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),i.jsxs("div",{className:ue.bottomGrid,children:[i.jsxs("div",{className:ue.section,children:[i.jsxs("div",{className:ue.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"9rem",height:"0.75rem"}),i.jsx("span",{className:ue.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:ue.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:ue.envRow,children:[i.jsx(Te,{width:"60%",height:"0.875rem"}),i.jsx(Te,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),i.jsxs("div",{className:ue.section,children:[i.jsxs("div",{className:ue.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"6rem",height:"0.75rem"}),i.jsx("span",{className:ue.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:ue.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:ue.workspaceRow,style:{cursor:"default"},children:[i.jsxs("div",{className:ue.workspaceTop,children:[i.jsx(Te,{width:"50%",height:"0.875rem"}),i.jsx(Te,{width:"2rem",height:"0.75rem"})]}),i.jsx("div",{className:ue.progressBar,children:i.jsx("div",{className:ue.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const B$={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Jc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function L$(t,s,o,r){const c=[`${t} of ${s} tasks completed`];return o>0&&c.push(`${o} in progress`),r>0&&c.push(`${r} failed`),c.join(", ")}function Wc({value:t,label:s,accent:o,index:r,testId:c}){return i.jsxs(Rt.div,{className:ue.kpiCard,"data-accent":o,"data-testid":c,variants:B$,initial:"hidden",animate:"visible",custom:r,children:[i.jsx("span",{className:ue.kpiValue,children:t}),i.jsx("span",{className:ue.kpiLabel,children:s})]})}function z$(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:o,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:p,environmentsLoading:m}}=ot(),g=mt(),v=y.useRef(new Set);y.useEffect(()=>{for(const N of t)v.current.has(N.id)||(v.current.add(N.id),c(N.id).catch(()=>{}))},[t,c]);const x=y.useMemo(()=>az(d,o,p),[d,o,p]),b=y.useMemo(()=>oz(d,p),[d,p]),k=y.useMemo(()=>iz(o,t),[o,t]),S=y.useMemo(()=>rz(t,o),[t,o,p]);return d.length===0&&o.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?i.jsx(O$,{}):i.jsxs("div",{className:ue.dashboard,"data-testid":"dashboard",children:[i.jsxs("div",{className:ue.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[i.jsx(Wc,{value:x.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),i.jsx(Wc,{value:x.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),i.jsx(Wc,{value:x.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),i.jsx(Wc,{value:x.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),i.jsxs("div",{className:ue.bodyGrid,children:[i.jsxs(Rt.div,{className:ue.section,variants:Jc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[i.jsxs("div",{className:ue.sectionHeader,children:[i.jsx("span",{className:ue.sectionIcon,"aria-hidden":"true",children:"●"}),i.jsx("span",{className:ue.sectionTitle,children:"Active Sessions"}),i.jsx("span",{className:ue.sectionCount,children:b.length})]}),i.jsx("div",{className:ue.sectionBody,children:b.length===0?i.jsx("div",{className:ue.emptyHint,children:"No active sessions"}):b.map(({session:N,environmentName:T})=>i.jsxs("button",{type:"button",className:ue.sessionRow,onClick:()=>g(Nm(N.id)),"data-testid":"session-row",children:[i.jsx("span",{className:ue.sessionPrompt,title:N.prompt,children:N.prompt||"—"}),i.jsx("span",{className:ue.sessionEnv,children:T}),i.jsx("span",{className:ue.sessionRuntime,children:N.runtime}),i.jsxs("span",{className:ue.sessionStatus,children:[i.jsx("span",{className:ue.statusDot,"data-status":N.status}),N.status]})]},N.id))})]}),i.jsxs(Rt.div,{className:ue.section,variants:Jc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[i.jsxs("div",{className:ue.sectionHeader,children:[i.jsx("span",{className:ue.sectionIcon,"aria-hidden":"true",children:"⚑"}),i.jsx("span",{className:ue.sectionTitle,children:"Needs Attention"}),i.jsx("span",{className:ue.sectionCount,children:k.length})]}),i.jsx("div",{className:ue.sectionBody,children:k.length===0?i.jsx("div",{className:ue.emptyHint,children:"All clear"}):k.map(({task:N,reason:T,workspaceName:C})=>i.jsxs("button",{type:"button",className:ue.attentionRow,onClick:()=>g(On(N.id)),"data-testid":"attention-row",children:[i.jsxs("div",{className:ue.attentionTitle,children:[i.jsx("span",{className:ue.reasonBadge,"data-reason":T,children:T}),N.title]}),i.jsx("div",{className:ue.attentionMeta,children:i.jsx("span",{children:C})})]},N.id))})]})]}),i.jsxs("div",{className:ue.bottomGrid,children:[i.jsxs(Rt.div,{className:ue.section,variants:Jc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[i.jsxs("div",{className:ue.sectionHeader,children:[i.jsx("span",{className:ue.sectionIcon,"aria-hidden":"true",children:"◈"}),i.jsx("span",{className:ue.sectionTitle,children:"Environment Health"}),i.jsx("span",{className:ue.sectionCount,children:p.length})]}),i.jsx("div",{className:ue.sectionBody,children:p.length===0?i.jsx("div",{className:ue.emptyHint,children:"No environments configured"}):p.map(N=>i.jsxs("div",{className:ue.envRow,"data-testid":"dashboard-env-row",children:[i.jsx("span",{className:ue.envName,children:N.displayName}),i.jsx("span",{className:ue.envStatusBadge,"data-status":N.status,children:N.status})]},N.id))})]}),i.jsxs(Rt.div,{className:ue.section,variants:Jc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[i.jsxs("div",{className:ue.sectionHeader,children:[i.jsx("span",{className:ue.sectionIcon,"aria-hidden":"true",children:"▦"}),i.jsx("span",{className:ue.sectionTitle,children:"Workspaces"}),i.jsx("span",{className:ue.sectionCount,children:t.length})]}),i.jsx("div",{className:ue.sectionBody,children:S.length===0?i.jsx("div",{className:ue.emptyHint,children:"No workspaces yet"}):S.map(({workspace:N,totalTasks:T,completedTasks:C,workingTasks:D,failedTasks:B})=>{const E=T>0?Math.round(C/T*100):0;return i.jsxs("button",{type:"button",className:ue.workspaceRow,onClick:()=>g(Ei(N.id,N.linkedEnvironmentIds[0])),"data-testid":"workspace-row",children:[i.jsxs("div",{className:ue.workspaceTop,children:[i.jsx("span",{className:ue.workspaceName,children:N.name}),i.jsxs("span",{className:ue.workspaceCounts,"aria-label":L$(C,T,D,B),children:[C,"/",T,D>0&&i.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",D]}),B>0&&i.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",B]})]})]}),T>0&&i.jsx("div",{className:ue.progressBar,children:i.jsx("div",{className:ue.progressFill,style:{width:`${E}%`}})})]},N.id)})})]})]})]})}const $$="_panelContainer_1udy7_1",P$="_emptyState_1udy7_8",U$="_workspaceSummary_1udy7_17",H$="_workspaceSummaryTitle_1udy7_28",V$="_workspaceSummarySubtitle_1udy7_32",q$="_header_1udy7_36",G$="_headerInfo_1udy7_71",F$="_headerTitle_1udy7_106",Z$="_taskStatusBadge_1udy7_128",K$="_taskBranch_1udy7_137",Y$="_taskBlockedBadge_1udy7_143",J$="_tabBar_1udy7_277",W$="_tab_1udy7_277",X$="_active_1udy7_303",Q$="_eventScroll_1udy7_308",eP="_tabContent_1udy7_314",tP="_noContext_1udy7_319",nP="_overviewContent_1udy7_325",sP="_overviewDashboard_1udy7_334",aP="_overviewHero_1udy7_340",iP="_overviewSection_1udy7_347",oP="_overviewLabel_1udy7_353",rP="_envRow_1udy7_360",lP="_timeline_1udy7_366",cP="_timelineRow_1udy7_372",dP="_waitingMessage_1udy7_379",uP="_errorMessage_1udy7_383",fP="_emptyCta_1udy7_387",pP="_ctaTitle_1udy7_399",mP="_ctaDescription_1udy7_405",hP="_ctaButton_1udy7_412",gP="_workspaceHeader_1udy7_533",vP="_workspaceName_1udy7_558",yP="_workspaceMeta_1udy7_571",bP="_metaRow_1udy7_579",xP="_metaLabel_1udy7_592",_P="_metaValue_1udy7_607",kP="_archiveButton_1udy7_617",SP="_repoLink_1udy7_647",TP="_metaToggle_1udy7_657",jP="_metaToggleArrow_1udy7_678",wP="_metaToggleArrowOpen_1udy7_683",NP="_progressBarContainer_1udy7_687",CP="_progressBar_1udy7_687",EP="_progressFill_1udy7_703",AP="_progressLabel_1udy7_710",DP="_metaTimestamps_1udy7_717",MP="_metaTimestamp_1udy7_717",RP="_metaPlaceholder_1udy7_739",IP="_linkedEnvList_1udy7_744",OP="_linkedEnvChip_1udy7_750",BP="_chipDismiss_1udy7_762",LP="_linkError_1udy7_777",zP="_linkEnvSelect_1udy7_782",Y={panelContainer:$$,emptyState:P$,workspaceSummary:U$,workspaceSummaryTitle:H$,workspaceSummarySubtitle:V$,header:q$,headerInfo:G$,headerTitle:F$,taskStatusBadge:Z$,taskBranch:K$,taskBlockedBadge:Y$,tabBar:J$,tab:W$,active:X$,eventScroll:Q$,tabContent:eP,noContext:tP,overviewContent:nP,overviewDashboard:sP,overviewHero:aP,overviewSection:iP,overviewLabel:oP,envRow:rP,timeline:lP,timelineRow:cP,waitingMessage:dP,errorMessage:uP,emptyCta:fP,ctaTitle:pP,ctaDescription:mP,ctaButton:hP,workspaceHeader:gP,workspaceName:vP,workspaceMeta:yP,metaRow:bP,metaLabel:xP,metaValue:_P,archiveButton:kP,repoLink:SP,metaToggle:TP,metaToggleArrow:jP,metaToggleArrowOpen:wP,progressBarContainer:NP,progressBar:CP,progressFill:EP,progressLabel:AP,metaTimestamps:DP,metaTimestamp:MP,metaPlaceholder:RP,linkedEnvList:IP,linkedEnvChip:OP,chipDismiss:BP,linkError:LP,linkEnvSelect:zP};function $P(){return i.jsx("div",{className:Y.emptyState,children:"Select a task or click + to create one"})}function PP(){return i.jsx("div",{className:Y.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function UP(){const{workspaces:{workspaces:t},environments:{environments:s}}=ot(),o=mt(),r=s.length>0;return t.length>0?i.jsx(z$,{}):i.jsxs("div",{className:Y.emptyCta,"data-testid":"welcome-cta",children:[i.jsx("div",{className:Y.ctaTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:Y.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),i.jsx("button",{className:Y.ctaButton,onClick:()=>o(Jx),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&i.jsx("div",{className:Y.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const HP="_panelContainer_19poq_1",VP="_chatHeader_19poq_8",qP="_chatHeaderInfo_19poq_37",GP="_emptyState_19poq_43",FP="_emptyTitle_19poq_55",ZP="_emptyDescription_19poq_61",KP="_emptyHint_19poq_67",Ha={panelContainer:HP,chatHeader:VP,chatHeaderInfo:qP,emptyState:GP,emptyTitle:FP,emptyDescription:ZP,emptyHint:KP};function YP(){return i.jsx("div",{className:Ha.panelContainer,"aria-hidden":"true",children:i.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(Te,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function JP({hasLocalEnvironment:t}){return i.jsxs("div",{className:Ha.emptyState,"data-testid":"chat-empty-state",children:[i.jsx("div",{className:Ha.emptyTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:Ha.emptyDescription,children:t?"Type a message below to start chatting with the System agent. It can help you plan work, create tasks, and coordinate agents.":"Add a local environment in Settings to start chatting."}),!t&&i.jsx("div",{className:Ha.emptyHint,children:"Go to Settings → Environments to add one."})]})}function WP(){const{tasks:{tasks:t,tasksLoading:s,startTask:o},sessions:{sessions:r,sessionsLoading:c,events:d,eventsDropped:u,taskSessions:p,loadTaskSessions:m,loadSessionEvents:g,kill:v,stopGraceful:x,sendInput:b,spawn:k},environments:{environments:S,provisionEnvironment:j},personas:{personas:N}}=ot(),{showToast:T}=pn(),C=y.useRef(void 0),[D,B]=y.useState(),E=t.find(K=>K.id===Or),A=E!=null&&E.latestSessionId?r.find(K=>K.id===E.latestSessionId)??(p[Or]??[]).find(K=>K.id===E.latestSessionId):void 0;y.useEffect(()=>{m(Or).catch(()=>{})},[m]),y.useEffect(()=>{E!=null&&E.latestSessionId&&m(Or).catch(()=>{})},[E==null?void 0:E.latestSessionId,m]),y.useEffect(()=>{A&&A.id!==C.current&&(C.current=A.id,g(A.id).catch(()=>{}))},[A==null?void 0:A.id,g]);const $=y.useMemo(()=>{if(!A)return[];const K=d.filter(de=>de.sessionId===A.id);return mh(ph(K))},[d,A==null?void 0:A.id]),L=S.find(K=>K.adapterType==="local"&&K.status==="connected"),U=A!==void 0&&A.status!=="stopped"&&A.status!=="suspended",J=(A==null?void 0:A.status)==="idle";y.useEffect(()=>{D&&A&&J&&(b(A.id,D).catch(()=>{}),B(void 0))},[D,J,A==null?void 0:A.id,b]);const V=y.useCallback((K,de,ee,ie)=>{ie&&B(ie),o(K,de,ee).catch(()=>{})},[o]);return!E&&(c||s)?i.jsx(YP,{}):i.jsxs("div",{className:Ha.panelContainer,"data-testid":"chat-page",children:[U&&i.jsxs("div",{className:Ha.chatHeader,children:[i.jsxs("span",{className:Ha.chatHeaderInfo,children:["Session: ",A.id.slice(0,8)," | ",A.runtime," | ",A.status]}),i.jsx(Xx,{label:"Stop",onClick:()=>{x(A.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{x(A.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{v(A.id).catch(()=>{})}}]})]}),i.jsx(ch,{events:$,eventsDropped:u,emptyState:i.jsx(JP,{hasLocalEnvironment:!!L}),onShowToast:T}),L&&U&&i.jsx(nl,{mode:"send",sessionId:A.id,environmentId:A.environmentId,personas:N,environments:S,onSendInput:(K,de)=>{b(K,de).catch(()=>{})},onSpawn:(K,de,ee)=>{k(K,de,ee).catch(()=>{})},onStartTask:(K,de,ee)=>{o(K,de,ee).catch(()=>{})},onProvisionEnvironment:K=>{j(K).catch(()=>{})},onShowToast:T}),L&&!U&&i.jsx(nl,{mode:"start",taskId:Or,environmentId:L.id,personas:N,environments:S,onSendInput:(K,de)=>{b(K,de).catch(()=>{})},onSpawn:(K,de,ee)=>{k(K,de,ee).catch(()=>{})},onStartTask:V,onProvisionEnvironment:K=>{j(K).catch(()=>{})},onShowToast:T})]})}function XP(){const t=W7(),[s]=wm(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=ot(),{showToast:g}=pn();return i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(vs,{segments:t}),i.jsx("div",{className:Y.emptyState,children:"Enter a prompt below to start a new session"}),i.jsx(nl,{mode:"spawn",environmentId:o,showPersonaSelect:!0,personas:u,environments:p,onSendInput:(v,x)=>{r(v,x).catch(()=>{})},onSpawn:(v,x,b)=>{c(v,x,b).catch(()=>{})},onStartTask:(v,x,b)=>{d(v,x,b).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:g})]})}function QP(){return i.jsxs("div",{className:Y.panelContainer,"aria-hidden":"true",children:[i.jsxs("div",{className:Y.header,children:[i.jsx("span",{children:i.jsx(Te,{width:"10rem",height:"0.875rem"})}),i.jsx("span",{className:Y.headerInfo,children:i.jsx(Te,{width:"16rem",height:"0.875rem"})})]}),i.jsx("div",{className:Y.eventScroll,children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(Te,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function eU({sessionId:t,session:s,isActive:o,onStop:r,onKill:c}){return i.jsxs("div",{className:Y.header,children:[i.jsxs("span",{children:["Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costMillicents?` | ${Io((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${Cs(s.costMillicents??0)}`:""]}),i.jsxs("span",{className:Y.headerInfo,children:[s&&i.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),o&&i.jsx(Xx,{label:"Stop",onClick:r,variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:r},{label:"Kill",description:"Force kill",onClick:c}]})]})]})}function tU({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),o=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return i.jsx("div",{className:s?Y.errorMessage:Y.waitingMessage,children:o})}function nU(){const{sessionId:t}=as(),{sessions:{events:s,eventsDropped:o,sessions:r,sessionsLoading:c,kill:d,stopGraceful:u,loadSessionEvents:p,sendInput:m,spawn:g},tasks:{startTask:v},personas:{personas:x},environments:{environments:b,provisionEnvironment:k}}=ot(),{showToast:S}=pn(),j=y.useRef(void 0),N=X7(t),T=r.find(B=>B.id===t)??void 0,C=y.useMemo(()=>{const B=t?s.filter(E=>E.sessionId===t):[];return mh(ph(B))},[s,t]);if(y.useEffect(()=>{t&&t!==j.current&&(j.current=t,p(t).catch(()=>{}))},[t,p]),!T&&c)return i.jsx(QP,{});if(!t)return i.jsx("div",{className:Y.emptyState,children:"No session selected"});const D=(T==null?void 0:T.status)==="running"||(T==null?void 0:T.status)==="idle";return i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(vs,{segments:N}),i.jsx(eU,{sessionId:t,session:T,isActive:D,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{d(t).catch(()=>{})}}),i.jsx(ch,{events:C,eventsDropped:o,emptyState:i.jsx(tU,{session:T}),onShowToast:S}),D&&i.jsx(nl,{mode:"send",sessionId:t,environmentId:T.environmentId,personas:x,environments:b,onSendInput:(B,E)=>{m(B,E).catch(()=>{})},onSpawn:(B,E,A)=>{g(B,E,A).catch(()=>{})},onStartTask:(B,E,A)=>{v(B,E,A).catch(()=>{})},onProvisionEnvironment:B=>{k(B).catch(()=>{})},onShowToast:S})]})}function sU(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function sa(t,s){const o=y.useRef(s);o.current=s;const{key:r,ctrl:c=!1,shift:d=!1,suppressInInputs:u=!0,enabled:p=!0}=t;y.useEffect(()=>{if(!p)return;const m=g=>{if(u&&sU(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(d&&!g.shiftKey||g.key===r&&o.current())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[r,c,d,u,p])}function aU(){return i.jsxs("div",{className:Y.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:Y.workspaceHeader,children:i.jsx("span",{className:Y.workspaceName,children:i.jsx(Te,{width:"12rem",height:"1.25rem"})})}),i.jsx("div",{className:Y.metaToggle,style:{cursor:"default"},children:i.jsx(Te,{width:"4rem",height:"0.625rem"})}),i.jsxs("div",{className:Y.progressBarContainer,children:[i.jsx("div",{className:Y.progressBar,children:i.jsx("div",{className:Y.progressFill,style:{width:"0%"}})}),i.jsx(Te,{width:"2rem",height:"0.625rem"})]}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("span",{className:`${Y.tab} ${Y.active}`,children:"Graph"}),i.jsx("span",{className:Y.tab,children:"Board"}),i.jsx("span",{className:Y.tab,children:"Tasks"})]}),i.jsx("div",{className:Y.overviewContent,children:Array.from({length:3},(t,s)=>i.jsx(vd,{lines:2},s))})]})}function ux(t){if(!t)return"";const s=new Date(t);if(isNaN(s.getTime()))return"";const r=Date.now()-s.getTime();if(r<0)return"just now";const c=Math.floor(r/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const d=Math.floor(c/60);if(d<24)return`${d}h ago`;const u=Math.floor(d/24);return u<30?`${u}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const zp=100;function iU(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function oU(){const{workspaceId:t,environmentId:s}=as(),o=mt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:p,updateWorkspace:m,linkEnvironment:g,unlinkEnvironment:v,linkOperationError:x,clearLinkOperationError:b},personas:{personas:k},sessions:{sessions:S},usageCache:j,loadUsage:N}=ot(),{resolvedThemeId:T}=Y1(),[C,D]=y.useState("tasks"),[B,E]=y.useState(!1),[A,$]=y.useState(null),[L,U]=y.useState(!1),J=y.useRef(void 0),V=d.find(W=>W.id===t),K=s??(V==null?void 0:V.linkedEnvironmentIds[0])??"",de=Q7(t,K,d,c);sa({key:"1"},()=>D("graph")),sa({key:"2"},()=>D("board")),sa({key:"3"},()=>D("tasks")),y.useEffect(()=>{const W=J.current;J.current=t,!(W===void 0||W===t)&&A!==null&&$(null)},[t,A]);const ee=S.reduce((W,ye)=>W+(ye.costMillicents??0),0);y.useEffect(()=>{t&&N("workspace",t).catch(()=>{})},[t,N,ee]);const ie=t?j[`workspace:${t}`]:void 0,M=r.filter(W=>W.workspaceId===t),O=M.filter(W=>W.status==="complete").length,X=M.length,he=X>0?Math.round(O/X*100):0;return!V&&u?i.jsx(aU,{}):i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(vs,{segments:de}),i.jsxs("div",{className:Y.workspaceHeader,children:[i.jsx("span",{className:Y.workspaceName,"data-testid":"workspace-name",children:i.jsx(Ft,{value:(V==null?void 0:V.name)||"",onSave:W=>{V&&m(V.id,{name:W}).catch(()=>{})},validate:W=>{const ye=W.trim();if(!ye)return"Name is required";if(ye.length>zp)return`Max ${zp} characters`},maxLength:zp,fieldId:"name",activeFieldId:A,onActivate:$,ariaLabel:"Workspace name",renderDisplay:W=>W||t||void 0,"data-testid":"edit-name"})}),i.jsx("button",{className:Y.archiveButton,onClick:()=>E(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),i.jsxs("button",{className:Y.metaToggle,onClick:()=>U(!L),"aria-expanded":!L,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[i.jsx("span",{className:`${Y.metaToggleArrow} ${L?"":Y.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!L&&i.jsxs("div",{className:Y.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Description"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(cm,{value:(V==null?void 0:V.description)||"",onSave:W=>{V&&m(V.id,{description:W}).catch(()=>{})},fieldId:"description",activeFieldId:A,onActivate:$,renderDisplay:W=>W?i.jsx("span",{className:Y.overviewMarkdown,children:i.jsx(Sd,{remarkPlugins:[Td],children:W})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Repository"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(Ft,{value:(V==null?void 0:V.repoUrl)||"",onSave:W=>{V&&m(V.id,{repoUrl:W}).catch(()=>{})},validate:W=>{const ye=W.trim();if(ye&&!/^https?:\/\/.+/.test(ye))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:A,onActivate:$,renderDisplay:W=>{const ye=iU(W);return ye?i.jsx("a",{className:Y.repoLink,href:ye,target:"_blank",rel:"noopener noreferrer",onClick:fe=>fe.stopPropagation(),children:W}):W?i.jsx("span",{children:W}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Environments"}),i.jsx("div",{className:Y.metaValue,"data-testid":"linked-environments",children:V?i.jsxs("span",{className:Y.linkedEnvList,children:[(()=>{const W=[...new Set(V.linkedEnvironmentIds)];return W.length===0?i.jsx("span",{className:Y.metaPlaceholder,children:"None"}):W.map(ye=>{const fe=c.find(Ne=>Ne.id===ye);return i.jsxs("span",{className:Y.linkedEnvChip,"data-testid":`linked-env-${ye}`,children:[(fe==null?void 0:fe.displayName)||ye,i.jsx("button",{className:Y.chipDismiss,onClick:()=>{v(V.id,ye).catch(()=>{})},title:`Unlink ${(fe==null?void 0:fe.displayName)||ye}`,"aria-label":`Unlink ${(fe==null?void 0:fe.displayName)||ye}`,"data-testid":`unlink-env-${ye}`,disabled:W.length<=1,children:"x"})]},ye)})})(),(()=>{const W=new Set(V.linkedEnvironmentIds),ye=c.filter(fe=>!W.has(fe.id));return ye.length===0?null:i.jsxs("select",{className:Y.linkEnvSelect,value:"",onChange:fe=>{fe.target.value&&g(V.id,fe.target.value).catch(()=>{})},"aria-label":"Link environment","data-testid":"link-env-select",children:[i.jsx("option",{value:"",children:"+ Link"}),ye.map(fe=>i.jsx("option",{value:fe.id,children:fe.displayName||fe.id},fe.id))]})})(),x&&i.jsxs("span",{className:Y.linkError,"data-testid":"link-operation-error",role:"alert",children:[x,i.jsx("button",{className:Y.chipDismiss,onClick:b,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"x"})]})]}):i.jsx("span",{className:Y.metaPlaceholder,children:"None"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Persona"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(yd,{value:(V==null?void 0:V.defaultPersonaId)||"",onSave:W=>{V&&m(V.id,{defaultPersonaId:W}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...k.map(W=>({value:W.id,label:W.name}))],fieldId:"defaultPersonaId",activeFieldId:A,onActivate:$,renderDisplay:W=>{const ye=k.find(fe=>fe.id===W);if(ye)return i.jsx("span",{children:ye.name})},placeholder:(V==null?void 0:V.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Worktrees"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(F6,{checked:(V==null?void 0:V.useWorktrees)??!0,onChange:W=>{V&&m(V.id,{useWorktrees:W}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Working Dir"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(Ft,{value:(V==null?void 0:V.workingDirectory)||"",onSave:W=>{V&&m(V.id,{workingDirectory:W}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:A,onActivate:$,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),V&&i.jsxs("div",{className:Y.metaTimestamps,children:[i.jsxs("span",{className:Y.metaTimestamp,children:["Created ",ux(V.createdAt)]}),V.updatedAt&&V.updatedAt!==V.createdAt&&i.jsxs("span",{className:Y.metaTimestamp,children:["· Updated ",ux(V.updatedAt)]})]})]}),X>0&&i.jsxs("div",{className:Y.progressBarContainer,"data-testid":"progress-bar",children:[i.jsx("div",{className:Y.progressBar,children:i.jsx("div",{className:Y.progressFill,style:{width:`${he}%`}})}),i.jsxs("span",{className:Y.progressLabel,children:[O,"/",X]})]}),ie&&ie.costMillicents>0&&i.jsx("div",{className:Y.progressBarContainer,children:i.jsxs("span",{className:Y.progressLabel,children:["Usage: ",Cs(ie.costMillicents)," (",ie.sessionCount," session",ie.sessionCount!==1?"s":"",")"]})}),V&&(V.tokenBudget>0||V.costBudgetMillicents>0)&&i.jsx("div",{className:Y.progressBarContainer,children:i.jsxs("span",{className:Y.progressLabel,children:["Budget:"," ",V.tokenBudget>0&&i.jsxs(i.Fragment,{children:["Tokens: ",Io(((ie==null?void 0:ie.inputTokens)??0)+((ie==null?void 0:ie.outputTokens)??0))," / ",Io(V.tokenBudget)]}),V.tokenBudget>0&&V.costBudgetMillicents>0&&" | ",V.costBudgetMillicents>0&&i.jsxs(i.Fragment,{children:["Cost: ",Cs((ie==null?void 0:ie.costMillicents)??0)," / ",Cs(V.costBudgetMillicents)]})]})}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("button",{role:"tab","aria-selected":C==="graph",className:`${Y.tab} ${C==="graph"?Y.active:""}`,onClick:()=>D("graph"),children:"Graph"}),i.jsx("button",{role:"tab","aria-selected":C==="board",className:`${Y.tab} ${C==="board"?Y.active:""}`,onClick:()=>D("board"),"data-testid":"board-tab",children:"Board"}),i.jsx("button",{role:"tab","aria-selected":C==="tasks",className:`${Y.tab} ${C==="tasks"?Y.active:""}`,onClick:()=>D("tasks"),children:"Tasks"})]}),C==="tasks"&&X>0&&i.jsxs("div",{className:Y.workspaceSummary,children:[i.jsx("span",{className:Y.workspaceSummaryTitle,children:`${O}/${X} tasks complete`}),i.jsx("span",{className:Y.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),C==="tasks"&&X===0&&i.jsxs("div",{className:Y.emptyCta,children:[i.jsx("button",{className:Y.ctaButton,onClick:()=>o(Ii(t,void 0,K)),children:"Create Task"}),i.jsx("div",{className:Y.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),C==="board"&&i.jsx(k7,{workspaceId:t,environmentId:K,tasks:r,sessions:S,personas:k,environments:c}),C==="graph"&&i.jsx(DN,{workspaceId:t,environmentId:K,tasks:r,resolvedThemeId:T}),i.jsx(oa,{isOpen:B,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{V&&(p(V.id).catch(()=>{}),o("/",{replace:!0})),E(!1)},onCancel:()=>E(!1)})]})}const rU="_container_3pgew_1",lU="_header_3pgew_8",cU="_headerTitle_3pgew_35",dU="_headerActions_3pgew_44",uU="_body_3pgew_51",fU="_btnPrimary_3pgew_63",pU="_btnGhost_3pgew_94",mU="_error_3pgew_116",$a={container:rU,header:lU,headerTitle:cU,headerActions:dU,body:uU,btnPrimary:fU,btnGhost:pU,error:mU};function hU(t){const s={};return t.name.trim()||(s.name="Name is required"),t.repoUrl.trim()&&!/^https?:\/\/.+/i.test(t.repoUrl.trim())&&(s.repoUrl="Must be a valid http(s) URL"),t.environmentId||(s.environmentId="Environment is required"),Object.keys(s).length>0?s:void 0}const gU=[{label:"Home",url:Di},{label:"New Workspace",url:void 0}];function vU(){const[t]=wm(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=ot(),{showToast:u}=pn(),p=mt(),[m,g]=y.useState(()=>{var N;return R7(void 0,s||((N=o[0])==null?void 0:N.id))}),[v,x]=y.useState(),[b,k]=y.useState();y.useEffect(()=>{s||m.environmentId||o.length===0||g(N=>{var T;return N.environmentId?N:{...N,environmentId:((T=o[0])==null?void 0:T.id)??""}})},[o,s,m.environmentId]);const S=()=>{const N=hU(m);if(N){x(N),k(void 0);return}x(void 0),k(void 0),c(m.name.trim(),m.description,m.repoUrl.trim(),m.environmentId,m.defaultPersonaId,m.useWorktrees,m.workingDirectory,()=>{u("Workspace created","success"),p(Di,{replace:!0})},T=>{k(T)}).catch(()=>{})},j=()=>{p(s?Ai(s):Di,{replace:!0})};return i.jsxs("div",{className:$a.container,children:[i.jsxs("div",{className:$a.header,children:[i.jsx("div",{className:$a.headerTitle,children:i.jsx(vs,{segments:gU})}),i.jsxs("div",{className:$a.headerActions,children:[i.jsx("button",{className:$a.btnGhost,onClick:j,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),i.jsx("button",{className:$a.btnPrimary,onClick:S,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?i.jsx(C1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),i.jsxs("div",{className:$a.body,children:[i.jsx(O7,{values:m,onChange:N=>{g(N),x(void 0),k(void 0)},environments:o,personas:r,errors:v,disabled:d,autoFocusName:!0}),b&&i.jsx("div",{className:$a.error,"data-testid":"workspace-create-submit-error",children:b})]})]})}function fx(){const{workspaceId:t,environmentId:s}=as(),[o]=wm(),r=t??o.get("workspace")??"",c=o.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:p},workspaces:{workspaces:m},personas:{personas:g}}=ot(),{showToast:v}=pn();return i.jsx(H1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(x,b,k,S,j,N,T,C,D)=>{u(x,b,k,S,j,N,T,C,D).catch(()=>{})},onUpdateTask:(x,b,k,S,j)=>{p(x,b,k,S,j).catch(()=>{})},onShowToast:v})}function yU(){return i.jsxs("div",{className:Y.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:Y.header,children:i.jsxs("span",{className:Y.headerTitle,children:[i.jsx(Te,{width:"12rem",height:"1rem"}),i.jsx(Te,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("span",{className:`${Y.tab} ${Y.active}`,children:"Overview"}),i.jsx("span",{className:Y.tab,children:"Stream"}),i.jsx("span",{className:Y.tab,children:"Findings"})]}),i.jsx("div",{className:Y.overviewContent,children:i.jsxs("div",{className:Y.overviewDashboard,children:[i.jsx("div",{className:Y.overviewHero,children:i.jsx(Te,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Description"}),i.jsx(lm,{lines:2})]}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Environment"}),i.jsxs("div",{className:Y.envRow,children:[i.jsx(Te,{width:"0.5rem",height:"0.5rem",variant:"circular"}),i.jsx(Te,{width:"8rem",height:"0.875rem"})]})]}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Dependencies"}),i.jsx(lm,{lines:2})]}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Timeline"}),i.jsx("div",{className:Y.timeline,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:Y.timelineRow,children:[i.jsx(Te,{width:"4rem",height:"0.75rem"}),i.jsx(Te,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function Pa(){const{taskId:t,workspaceId:s,environmentId:o}=as(),r=Yt(),c=mt(),{showToast:d}=pn(),{sessions:{events:u,eventsDropped:p,sessions:m,loadSessionEvents:g,taskSessions:v,loadTaskSessions:x,sendInput:b,spawn:k,kill:S},tasks:{tasks:j,tasksLoading:N,startTask:T,stopTask:C,resumeTask:D,deleteTask:B,createTask:E,updateTask:A},environments:{environments:$,provisionEnvironment:L},findings:{findings:U,loadFindings:J},workspaces:{workspaces:V},personas:{personas:K},usageCache:de,loadUsage:ee}=ot(),ie=y.useRef(void 0),M=y.useRef(void 0),O=y.useRef(void 0),X=y.useRef(void 0),he=y.useRef(void 0),W=r.pathname.endsWith("/stream")?"stream":r.pathname.endsWith("/findings")?"findings":"overview",ye=r.pathname.endsWith("/edit"),[fe,Ne]=y.useState(W),[Ue,ge]=y.useState(!1),[ke,xe]=y.useState(void 0),[Be,It]=y.useState(""),[zn,oe]=y.useState(ye),Je=y.useRef(W),Ut=y.useRef(ye),ne=j.find(Ae=>Ae.id===t),wt=(ne==null?void 0:ne.workspaceId)||void 0,Ot=V.find(Ae=>Ae.id===wt);y.useEffect(()=>{W!==Je.current&&(Je.current=W,W!==fe&&Ne(W))},[W,fe]),y.useEffect(()=>{ye!==Ut.current&&(Ut.current=ye,ye!==zn&&oe(ye))},[ye,zn]),y.useEffect(()=>{if(Be===""){if(Ot!=null&&Ot.linkedEnvironmentIds[0])It(Ot.linkedEnvironmentIds[0]);else if($.length>0){const Ae=$.find(We=>We.status==="connected");It((Ae==null?void 0:Ae.id)??$[0].id)}}},[Be,Ot==null?void 0:Ot.linkedEnvironmentIds[0],$]);const Bt=ne?v[ne.id]??[]:[];let ze;ke&&Bt.some(Ae=>Ae.id===ke)?ze=ke:ze=(ne==null?void 0:ne.latestSessionId)||void 0;const sn=()=>{ge(!0)},ca=()=>{if(!ne)return;B(ne.id).catch(()=>{}),ge(!1);const Ae=o??(Ot==null?void 0:Ot.linkedEnvironmentIds[0]);c(ne.workspaceId&&Ae?Ei(ne.workspaceId,Ae):"/",{replace:!0})};y.useEffect(()=>{(ne==null?void 0:ne.id)!==M.current&&(M.current=ne==null?void 0:ne.id,xe(void 0),It(""),oe(ye))},[ne==null?void 0:ne.id,ye]),y.useEffect(()=>{if(!(ne!=null&&ne.id))return;const Ae=ne.id!==X.current,We=ne.latestSessionId!==he.current;(Ae||We)&&(X.current=ne.id,he.current=ne.latestSessionId,x(ne.id).catch(()=>{}))},[ne==null?void 0:ne.id,ne==null?void 0:ne.latestSessionId,x]),y.useEffect(()=>{if((ne==null?void 0:ne.status)!==O.current){const Ae=O.current===void 0;O.current=ne==null?void 0:ne.status;const We=(ne==null?void 0:ne.status)==="not_started"?"overview":(ne==null?void 0:ne.status)==="working"||(ne==null?void 0:ne.status)==="paused"?"stream":(ne==null?void 0:ne.status)==="complete"?"findings":void 0;We&&We!==fe&&!(Ae&&W!=="overview")&&Ne(We)}},[ne==null?void 0:ne.status,fe,W]);const is=y.useMemo(()=>new Map(j.map(Ae=>[Ae.id,Ae])),[j]),Ja=y.useMemo(()=>{const Ae=ze?u.filter(We=>We.sessionId===ze):[];return mh(ph(Ae))},[u,ze]),da=ne?ne.dependsOn.some(Ae=>{const We=is.get(Ae);return We!==void 0&&We.status!=="complete"}):!1,Jt=y.useMemo(()=>ez(t,o,V,$,is),[t,o,V,$,is]);y.useEffect(()=>{ze&&ze!==ie.current&&(ie.current=ze,g(ze).catch(()=>{}))},[ze,g]),y.useEffect(()=>{fe==="findings"&&wt&&J(wt).catch(()=>{})},[fe,wt,J]);const Bi=Bt.reduce((Ae,We)=>Ae+(We.costMillicents??0),0);y.useEffect(()=>{ne&&(ee("task",ne.id).catch(()=>{}),ne.childTaskIds.length>0&&ee("task_tree",ne.id).catch(()=>{}))},[ne==null?void 0:ne.id,ne==null?void 0:ne.childTaskIds.length,ee,Bi]);const ua=ne?`task:${ne.id}`:"",Wa=ua in de?de[ua]:void 0,ys=ne?`task_tree:${ne.id}`:"",Li=ne&&ne.childTaskIds.length>0&&ys in de?de[ys]:void 0,$n=Ae=>{Ne(Ae),c(On(t,Ae==="overview"?void 0:Ae,s,o))};return sa({key:"1"},()=>$n("overview")),sa({key:"2"},()=>$n("stream")),sa({key:"3"},()=>$n("findings")),!ne&&N?i.jsx(yU,{}):i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(vs,{segments:Jt}),i.jsxs("div",{className:Y.header,children:[i.jsxs("span",{className:Y.headerTitle,children:[i.jsx("span",{"data-testid":"task-title",children:(ne==null?void 0:ne.title)||t}),ne&&i.jsx("span",{className:Y.taskStatusBadge,"data-testid":"task-status",children:ne.status}),(ne==null?void 0:ne.branch)&&i.jsx("span",{className:Y.taskBranch,children:ne.branch}),da&&i.jsx("span",{className:Y.taskBlockedBadge,children:"blocked"})]}),ne&&i.jsx(zB,{task:ne,sessionId:ze,isBlocked:da,onStart:()=>{T(ne.id,void 0,Be).catch(()=>{})},onResume:()=>{D(ne.id).catch(()=>{})},onStop:()=>{C(ne.id).catch(()=>{})},onPause:()=>{ze&&S(ze).catch(()=>{})},onDelete:sn,onEdit:()=>oe(!0)})]}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("button",{role:"tab","aria-selected":fe==="overview",className:`${Y.tab} ${fe==="overview"?Y.active:""}`,onClick:()=>$n("overview"),children:"Overview"}),i.jsx("button",{role:"tab","aria-selected":fe==="stream",className:`${Y.tab} ${fe==="stream"?Y.active:""}`,onClick:()=>$n("stream"),children:"Stream"}),i.jsx("button",{role:"tab","aria-selected":fe==="findings",className:`${Y.tab} ${fe==="findings"?Y.active:""}`,onClick:()=>$n("findings"),children:"Findings"})]}),i.jsxs(gs,{mode:"wait",children:[fe==="overview"&&i.jsx(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:Y.overviewContent,"data-testid":"task-overview",children:zn&&ne?i.jsx(H1,{mode:"edit",taskId:ne.id,workspaceId:wt,environmentId:o,tasks:j,workspaces:V,personas:K,onCreateTask:(Ae,We,Wt,St,mn,Xt,zi,$i,Pi)=>{E(Ae,We,Wt,St,mn,Xt,zi,$i,Pi).catch(()=>{})},onUpdateTask:(Ae,We,Wt,St,mn)=>{A(Ae,We,Wt,St,mn).catch(()=>{})},onEditDone:()=>{ye?c(On(ne.id,void 0,s,o),{replace:!0}):oe(!1)},onShowToast:d}):ne?i.jsx(jL,{task:ne,tasksById:is,environments:$,workspaces:V,taskSessions:Bt,selectedEnvId:Be,taskUsage:Wa,treeUsage:Li}):i.jsx("div",{className:Y.waitingMessage,children:"No additional details"})},"overview"),fe==="stream"&&i.jsxs(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[i.jsx(W3,{taskSessions:Bt,selectedSessionId:ze,onSelect:Ae=>xe(Ae)}),i.jsx(ch,{events:Ja,eventsDropped:p,emptyState:!ze&&ne?da?i.jsx("div",{className:Y.emptyCta,"data-testid":"stream-blocked-message",children:i.jsx("div",{className:Y.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):i.jsxs("div",{className:Y.emptyCta,children:[i.jsx("button",{"data-testid":"stream-start-cta",className:Y.ctaButton,onClick:()=>{T(ne.id,void 0,Be).catch(()=>{})},children:"Start Task"}),i.jsx("div",{className:Y.ctaDescription,children:"Click to begin agent execution"})]}):ze&&Ja.length===0?i.jsx("div",{className:Y.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:d})]},"stream"),fe==="findings"&&i.jsx(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:Y.tabContent,children:wt?i.jsx(P1,{findings:U.filter(Ae=>Ae.workspaceId===wt)}):i.jsx("div",{className:Y.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!ne||ne.status!=="working"&&ne.status!=="paused")return;const Ae=ze?m.find(We=>We.id===ze):void 0;if(!(!Ae||Ae.status==="stopped"))return i.jsx(nl,{mode:"send",sessionId:Ae.id,environmentId:Ae.environmentId,personas:K,environments:$,onSendInput:(We,Wt)=>{b(We,Wt).catch(()=>{})},onSpawn:(We,Wt,St)=>{k(We,Wt,St).catch(()=>{})},onStartTask:(We,Wt,St)=>{T(We,Wt,St).catch(()=>{})},onProvisionEnvironment:We=>{L(We).catch(()=>{})},onShowToast:d})})(),ne&&i.jsx(oa,{isOpen:Ue,title:"Delete Task?",description:`"${ne.title}" will be permanently removed.`,onConfirm:ca,onCancel:()=>ge(!1)})]})}function bU(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:o},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:p,createCodespace:m}}=ot(),{showToast:g}=pn();return i.jsx(V1,{mode:"new",environments:t,onAddEnvironment:(v,x,b)=>{s(v,x,b).catch(()=>{})},onUpdateEnvironment:(v,x)=>{o(v,x).catch(()=>{})},onListCodespaces:()=>{p().catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(v,x)=>{m(v,x).catch(()=>{})},onShowToast:g})}function xU(){const{environmentId:t}=as(),{environments:{environments:s,addEnvironment:o,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,listCodespaces:m,createCodespace:g}}=ot(),{showToast:v}=pn();return i.jsx(V1,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(x,b,k)=>{o(x,b,k).catch(()=>{})},onUpdateEnvironment:(x,b)=>{r(x,b).catch(()=>{})},onListCodespaces:()=>{m().catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(x,b)=>{g(x,b).catch(()=>{})},onShowToast:v})}const _U="_layout_11u79_1",kU="_content_11u79_8",SU="_tabPanel_11u79_14",tl={layout:_U,content:kU,tabPanel:SU};function TU(){const t=J7();return i.jsxs("div",{className:tl.layout,children:[i.jsx(vs,{segments:t}),i.jsx("div",{className:tl.content,children:i.jsx(Ka,{})})]})}const jU="_container_144a4_1",wU="_envHeader_144a4_6",NU="_envTitleRow_144a4_10",CU="_statusDot_144a4_16",EU="_envName_144a4_21",AU="_statusBadge_144a4_27",DU="_envMeta_144a4_33",MU="_metaTag_144a4_39",RU="_actions_144a4_51",IU="_provisionMessage_144a4_59",OU="_errorMessage_144a4_64",BU="_section_144a4_69",LU="_sectionHeader_144a4_73",zU="_cardList_144a4_121",$U="_card_144a4_121",PU="_cardHeader_144a4_138",UU="_cardName_144a4_144",HU="_cardActions_144a4_149",VU="_cardDescription_144a4_154",qU="_cardMeta_144a4_160",GU="_repoLink_144a4_166",FU="_empty_144a4_174",ZU="_errorHint_144a4_180",KU="_btnPrimary_144a4_186",YU="_btnOutline_144a4_220",JU="_btnSmall_144a4_247",WU="_btnDanger_144a4_273",De={container:jU,envHeader:wU,envTitleRow:NU,statusDot:CU,envName:EU,statusBadge:AU,envMeta:DU,metaTag:MU,actions:RU,provisionMessage:IU,errorMessage:OU,section:BU,sectionHeader:LU,cardList:zU,card:$U,cardHeader:PU,cardName:UU,cardActions:HU,cardDescription:VU,cardMeta:qU,repoLink:GU,empty:FU,errorHint:ZU,btnPrimary:KU,btnOutline:YU,btnSmall:JU,btnDanger:WU};function XU(){return i.jsxs("div",{className:De.container,"aria-hidden":"true",children:[i.jsxs("div",{className:De.envHeader,children:[i.jsxs("div",{className:De.envTitleRow,children:[i.jsx(Te,{width:"0.875rem",height:"0.875rem",variant:"circular"}),i.jsx(Te,{width:"12rem",height:"1.5rem"}),i.jsx(Te,{width:"4rem",height:"0.875rem"})]}),i.jsxs("div",{className:De.envMeta,children:[i.jsx(Te,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),i.jsxs("div",{className:De.actions,children:[i.jsx(Te,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),i.jsxs("div",{className:De.section,children:[i.jsx("div",{className:De.sectionHeader,children:i.jsx("h3",{style:{margin:0},children:"Workspaces"})}),i.jsxs("div",{className:De.cardList,children:[i.jsx(vd,{lines:2}),i.jsx(vd,{lines:2})]})]})]})}const QU={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function e9(){const{environmentId:t}=as(),s=mt(),{environments:{environments:o,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:p},workspaces:{workspaces:m,archiveWorkspace:g,linkEnvironment:v,unlinkEnvironment:x,linkOperationError:b,clearLinkOperationError:k},sessions:{sessions:S}}=ot(),[j,N]=y.useState(!1),[T,C]=y.useState(!1),[D,B]=y.useState(void 0),E=o.find(O=>O.id===t);if(!E&&r)return i.jsx(XU,{});if(!t||!E)return i.jsx(ts,{to:Ro,replace:!0});const A=m.filter(O=>O.linkedEnvironmentIds.includes(E.id)),$=S.filter(O=>O.environmentId===E.id),L=$.reduce((O,X)=>O+(X.costMillicents??0),0),U=QU[E.status]||"var(--text-tertiary)",J=E.status==="connected",V=E.status==="connecting",K=E.status==="disconnected"||E.status==="error"||E.status==="sleeping",de=E.id in c?c[E.id]:void 0,ee=()=>{p(E.id).catch(()=>{}),N(!1),s(Ro,{replace:!0})},ie=()=>{C(!1),d(E.id,!0).catch(()=>{})},M=O=>{g(O).catch(()=>{}),B(void 0)};return i.jsxs("div",{className:De.container,children:[i.jsx(oa,{isOpen:j,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:ee,onCancel:()=>N(!1)}),i.jsx(oa,{isOpen:T,title:"Reprovision Environment?",description:"This will kill any active session and force a fresh provision cycle. The environment will be temporarily disconnected.",confirmLabel:"Reprovision",onConfirm:ie,onCancel:()=>C(!1)}),i.jsxs("div",{className:De.envHeader,children:[i.jsxs("div",{className:De.envTitleRow,children:[i.jsx("span",{className:De.statusDot,style:{color:U},children:"●"}),i.jsx("h2",{className:De.envName,children:E.displayName||E.id}),i.jsx("span",{className:De.statusBadge,style:{color:U},children:E.status})]}),i.jsxs("div",{className:De.envMeta,children:[i.jsxs("span",{className:De.metaTag,children:["Adapter: ",E.adapterType]}),$.length>0&&i.jsxs("span",{className:De.metaTag,children:[$.length," session",$.length!==1?"s":""]}),L>0&&i.jsxs("span",{className:De.metaTag,children:["Cost: ",Cs(L)]})]})]}),i.jsxs("div",{className:De.actions,children:[J&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:De.btnPrimary,onClick:()=>s(Zx(E.id)),children:"New Chat"}),i.jsx("button",{className:De.btnOutline,onClick:()=>{u(E.id).catch(()=>{})},children:"Stop"}),i.jsx("button",{className:De.btnOutline,onClick:()=>C(!0),disabled:de!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),K&&i.jsx("button",{className:De.btnPrimary,onClick:()=>{d(E.id).catch(()=>{})},children:E.status==="error"?"Retry":E.status==="sleeping"?"Wake":"Connect"}),V&&de!==void 0&&i.jsx("span",{className:De.provisionMessage,children:de.message}),E.status==="error"&&(de==null?void 0:de.stage)==="error"&&i.jsx("span",{className:De.errorMessage,children:de.message}),i.jsx("button",{className:De.btnOutline,onClick:()=>s(xN(E.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),i.jsx("button",{className:De.btnDanger,onClick:()=>N(!0),children:"Delete"})]}),i.jsxs("div",{className:De.section,children:[i.jsxs("div",{className:De.sectionHeader,children:[i.jsx("h3",{children:"Workspaces"}),i.jsx("button",{className:De.btnPrimary,onClick:()=>s(`${Jx}?environment=${encodeURIComponent(E.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"}),(()=>{const O=m.filter(X=>!X.linkedEnvironmentIds.includes(E.id)&&X.status==="active");return O.length===0?null:i.jsxs("select",{className:De.btnPrimary,value:"",onChange:X=>{X.target.value&&v(X.target.value,E.id).catch(()=>{})},"aria-label":"Link a workspace","data-testid":"link-workspace-select",children:[i.jsx("option",{value:"",children:"+ Link Workspace"}),O.map(X=>i.jsx("option",{value:X.id,children:X.name},X.id))]})})()]}),b&&i.jsxs("p",{className:De.errorHint,"data-testid":"link-operation-error",role:"alert",children:[b,i.jsx("button",{className:De.btnSmall,onClick:k,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"Dismiss"})]}),A.length===0&&i.jsx("p",{className:De.empty,"data-testid":"linked-workspaces-empty",children:"No workspaces yet. Create one to get started."}),i.jsx("div",{className:De.cardList,"data-testid":"linked-workspaces-list",children:A.map(O=>i.jsx(t9,{workspace:O,confirmArchiveId:D,onOpen:()=>s(Ei(O.id,E.id)),onArchive:()=>B(O.id),onConfirmArchive:()=>M(O.id),onCancelArchive:()=>B(void 0),onUnlink:()=>{x(O.id,E.id).catch(()=>{})}},O.id))})]})]})}function t9({workspace:t,confirmArchiveId:s,onOpen:o,onArchive:r,onConfirmArchive:c,onCancelArchive:d,onUnlink:u}){const p=s===t.id,m=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return i.jsxs("div",{className:De.card,"data-testid":"workspace-card","data-workspace-id":t.id,children:[i.jsxs("div",{className:De.cardHeader,children:[i.jsx("strong",{className:De.cardName,children:t.name}),i.jsxs("div",{className:De.cardActions,children:[i.jsx("button",{className:De.btnSmall,onClick:o,children:"Open"}),i.jsx("button",{className:De.btnSmall,onClick:u,disabled:t.linkedEnvironmentIds.length<=1,"data-testid":`unlink-workspace-${t.id}`,children:"Unlink"}),p?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:De.btnDanger,onClick:c,children:"Confirm"}),i.jsx("button",{className:De.btnSmall,onClick:d,children:"Cancel"})]}):i.jsx("button",{className:De.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&i.jsx("p",{className:De.cardDescription,children:t.description}),t.repoUrl&&i.jsx("div",{className:De.cardMeta,children:m?i.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:De.repoLink,children:t.repoUrl}):i.jsx("span",{children:t.repoUrl})})]})}const n9={credentials:"Credentials",personas:"Personas",schedules:"Schedules",appearance:"Appearance",about:"About",shortcuts:"Shortcuts",plugins:"Plugins"};function s9(){const s=Yt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=n9[s],r=Y7(o);return i.jsxs("div",{className:tl.layout,children:[i.jsx(vs,{segments:r}),i.jsx("div",{className:tl.content,children:i.jsx("div",{className:tl.tabPanel,children:i.jsx(Ka,{})},s)})]})}function a9(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=ot(),{showToast:d}=pn();return i.jsxs(i.Fragment,{children:[i.jsx(s8,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),i.jsx(lB,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function i9(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=ot(),{showToast:c}=pn(),d=mt();return i.jsx(g8,{personas:t,appDefaultPersonaId:o,onDeletePersona:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete persona",{personaId:u,error:p}),c("Failed to delete persona","error"),p}},onSetAppDefaultPersonaId:async u=>{try{await r(u)}catch(p){console.error("Failed to set app default persona ID",{personaId:u,error:p}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>d(kN),onNavigateToPersona:u=>d(Kx(u))})}const o9="_container_1ooin_1",r9="_form_1ooin_7",l9="_formActions_1ooin_75",c9="_editableSection_1ooin_82",d9="_defaultBadge_1ooin_93",u9="_typeToggle_1ooin_107",f9="_scriptEditor_1ooin_121",p9="_optional_1ooin_128",ms={container:o9,form:r9,formActions:l9,editableSection:c9,defaultBadge:d9,typeToggle:u9,scriptEditor:f9,optional:p9},px=[{value:"claude-code",label:"claude-code"},{value:"codex",label:"codex"},{value:"copilot",label:"copilot"},{value:"goose",label:"goose"},{value:"stub",label:"stub"},{value:"claude-code-acp",label:"claude-code-acp (experimental)"},{value:"codex-acp",label:"codex-acp (experimental)"},{value:"copilot-acp",label:"copilot-acp (experimental)"}],mx=[{value:"genaiscript",label:"genaiscript"}],m9="0";function hx(){const{personaId:t}=as(),s=mt(),{showToast:o}=pn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:p,setAppDefaultPersonaId:m}=ot(),g=t===void 0,v=g?void 0:r.find(b=>b.id===t);if(!g&&r.length>0&&!v)return i.jsx(ts,{to:Qf,replace:!0});const x=[{label:"Settings",url:wi},{label:"Personas",url:Qf},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return i.jsxs("div",{className:ms.container,children:[i.jsx(vs,{segments:x}),i.jsx(h9,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(Qf)},showToast:o})]})}function h9({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=mt(),[v,x]=y.useState((t==null?void 0:t.name)??""),[b,k]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.systemPrompt)??""),[N,T]=y.useState((t==null?void 0:t.runtime)??"claude-code"),[C,D]=y.useState((t==null?void 0:t.model)??"sonnet"),[B,E]=y.useState((t==null?void 0:t.maxTurns)??0),[A,$]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[L,U]=y.useState((t==null?void 0:t.script)??""),[J,V]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[K,de]=y.useState(!1),[ee,ie]=y.useState(null),[M,O]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!M){O(!0),x(t.name),k(t.description),j(t.systemPrompt);const oe=t.type==="script"?"script":"agent";T(oe==="script"?t.runtime||"genaiscript":t.runtime),D(t.model),E(t.maxTurns),$(oe),U(t.script||""),V(t.allowedMcpTools)}},[s,t,M]);const X=oe=>{$(oe),oe==="script"?T("genaiscript"):N==="genaiscript"&&T("claude-code")},he=!s&&t===void 0,W=v.trim().length>0&&!he&&S.trim().length>0&&(A==="script"?L.trim().length>0:!!N&&!!C),ye=s&&W,fe=!s&&o===(t==null?void 0:t.id),Ne=!s&&t&&!fe&&A==="agent"&&!!N&&!!C,Ue=(oe,Je)=>{if(!oe.trim())return`${Je} is required`},ge=oe=>{if(oe.preventDefault(),!(he||!W)){if(t){c(t.id,v,b,S,N,C,B,A,L).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,b,S,N,C,B,A,L,J).then(Je=>{m("Persona created","success"),g(Kx(Je.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},ke=()=>{t&&d(t.id).then(()=>{m("Persona deleted","success"),p()},()=>{m("Failed to delete persona","error")})},xe=async(oe,Je,Ut,ne)=>oe().then(()=>{Je(),m(Ut,"success")},()=>{m(ne,"error")}),Be=(oe,Je)=>{if(!t)return;const Ut=oe==="type"?String(Je):A,ne=oe==="runtime"?String(Je):oe==="type"?String(Je)==="script"?"genaiscript":N==="genaiscript"?"claude-code":N:N,wt=oe==="model"?String(Je):C,Ot=oe==="maxTurns"?Number(Je):B,Bt=oe==="systemPrompt"?String(Je):S,ze=oe==="script"?String(Je):L;xe(()=>c(t.id,oe==="name"?String(Je):v,oe==="description"?String(Je):b,Bt,ne,wt,Ot,Ut,ze),()=>{if(oe==="type"){const sn=String(Je)==="script"?"script":"agent";$(sn),T(ne)}oe==="runtime"&&T(String(Je)),oe==="name"&&x(String(Je)),oe==="description"&&k(String(Je)),oe==="systemPrompt"&&j(String(Je)),oe==="model"&&D(String(Je)),oe==="maxTurns"&&E(Number(Je)),oe==="script"&&U(String(Je))},"Persona updated","Failed to update persona").catch(()=>{})},It=oe=>{ge(oe)},zn=()=>{t&&u(t.id).then(()=>{m("Set as app default","success")},()=>{m("Failed to set app default","error")})};return i.jsxs(i.Fragment,{children:[he?i.jsxs("div",{className:ms.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsx("p",{children:"Loading persona..."})]}):s?i.jsxs("form",{onSubmit:It,className:ms.form,children:[i.jsx("h3",{children:"Create Persona"}),i.jsxs("div",{className:ms.typeToggle,"data-testid":"persona-type-toggle",children:[i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:A==="agent",onChange:()=>X("agent")}),"Agent"]}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"script",checked:A==="script",onChange:()=>X("script")}),"Script"]})]}),i.jsxs("label",{children:["Name",i.jsx("input",{type:"text",value:v,onChange:oe=>x(oe.target.value),placeholder:A==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx("input",{type:"text",value:b,onChange:oe=>k(oe.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Runtime",i.jsx("select",{value:N,onChange:oe=>T(oe.target.value),"data-testid":"persona-runtime-select",children:(A==="script"?mx:px).map(oe=>i.jsx("option",{value:oe.value,children:oe.label},oe.value))})]}),A==="agent"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model",i.jsx("input",{type:"text",value:C,onChange:oe=>D(oe.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx("input",{type:"number",value:B,onChange:oe=>E(parseInt(oe.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:S,onChange:oe=>j(oe.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),A==="script"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model ",i.jsx("span",{className:ms.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:C,onChange:oe=>D(oe.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:S,onChange:oe=>j(oe.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),i.jsxs("label",{children:["Script",i.jsx("textarea",{value:L,onChange:oe=>U(oe.target.value),placeholder:`script({ model: "openai:gpt-4o" });
712
-
713
- const grackle = await host.mcpServer({
714
- id: "grackle",
715
- url: env.vars.GRACKLE_MCP_URL,
716
- });
717
-
718
- $\`Summarize the current tasks.\`;`,rows:20,className:ms.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),A==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(nx,{selectedTools:J,onChange:V})]}),i.jsxs("div",{className:ms.formActions,children:[i.jsx(tn,{type:"submit",variant:"primary",size:"md",disabled:!ye,"data-testid":"persona-detail-save",children:"Create"}),i.jsx(tn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:ms.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsxs("div",{className:ms.formActions,children:[i.jsx(tn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),Ne&&i.jsx(tn,{type:"button",variant:"ghost",size:"md",onClick:zn,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),fe&&i.jsx("span",{className:ms.defaultBadge,children:"App Default"}),i.jsx(tn,{type:"button",variant:"danger",size:"md",onClick:()=>de(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:ms.editableSection,children:[i.jsxs("label",{children:["Name",i.jsx(Ft,{value:v,onSave:oe=>{Be("name",oe)},validate:oe=>Ue(oe,"Name"),fieldId:"persona-name",activeFieldId:ee,onActivate:ie,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx(Ft,{value:b,onSave:oe=>{Be("description",oe)},fieldId:"persona-description",activeFieldId:ee,onActivate:ie,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Type",i.jsx(yd,{value:A,onSave:oe=>{Be("type",oe)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:ee,onActivate:ie,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),i.jsxs("label",{children:["Runtime",i.jsx(yd,{value:N,onSave:oe=>{Be("runtime",oe)},options:A==="script"?mx:px,fieldId:"persona-runtime",activeFieldId:ee,onActivate:ie,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),i.jsxs("label",{children:["Model",A==="script"?" (optional)":"",i.jsx(Ft,{value:C,onSave:oe=>{Be("model",oe)},validate:A==="agent"?oe=>Ue(oe,"Model"):void 0,fieldId:"persona-model",activeFieldId:ee,onActivate:ie,placeholder:A==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx(Ft,{value:String(B),onSave:oe=>{Be("maxTurns",parseInt(oe,10)||0)},validate:oe=>/^\d+$/.test(oe.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:ee,onActivate:ie,placeholder:m9,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx(cm,{value:S,onSave:oe=>{Be("systemPrompt",oe)},validate:oe=>Ue(oe,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:ee,onActivate:ie,placeholder:A==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),A==="script"&&i.jsxs("label",{children:["Script",i.jsx(cm,{value:L,onSave:oe=>{Be("script",oe)},validate:oe=>Ue(oe,"Script"),fieldId:"persona-script",activeFieldId:ee,onActivate:ie,placeholder:`script({ model: "openai:gpt-4o" });
719
-
720
- const grackle = await host.mcpServer({
721
- id: "grackle",
722
- url: env.vars.GRACKLE_MCP_URL,
723
- });
724
-
725
- $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),A==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(nx,{selectedTools:J,onChange:oe=>{V(oe),xe(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,oe),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Ne&&!fe&&i.jsx("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-tertiary)",marginTop:"var(--space-xs)"},children:"Only agent personas with a runtime and model can be set as app default."})]}):null,i.jsx(oa,{isOpen:K,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:ke,onCancel:()=>de(!1)})]})}function g9(){const{schedules:{schedules:t,deleteSchedule:s,updateSchedule:o},personas:{personas:r}}=ot(),{showToast:c}=pn(),d=mt();return i.jsx(G8,{schedules:t,personas:r,onDeleteSchedule:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete schedule",{scheduleId:u,error:p}),c("Failed to delete schedule","error"),p}},onToggleEnabled:async(u,p)=>{try{return await o(u,p)}catch(m){throw console.error("Failed to update schedule",{scheduleId:u,error:m}),c("Failed to update schedule","error"),m}},onNavigateToNew:()=>d(SN),onNavigateToSchedule:u=>d(Yx(u))})}const v9="_container_1g4qh_1",y9="_form_1g4qh_7",b9="_formActions_1g4qh_66",x9="_editableSection_1g4qh_73",_9="_helperText_1g4qh_84",k9="_metaSection_1g4qh_90",S9="_optional_1g4qh_108",T9="_readonlyValue_1g4qh_113",Mn={container:v9,form:y9,formActions:b9,editableSection:x9,helperText:_9,metaSection:k9,optional:S9,readonlyValue:T9};function gx(){const{scheduleId:t}=as(),s=mt(),{showToast:o}=pn(),{schedules:{schedules:r,schedulesLoading:c,createSchedule:d,updateSchedule:u,deleteSchedule:p},personas:{personas:m},workspaces:{workspaces:g}}=ot(),v=t===void 0,x=v?void 0:r.find(k=>k.id===t);if(!v&&!c&&r.length>0&&!x)return i.jsx(ts,{to:ep,replace:!0});const b=[{label:"Settings",url:wi},{label:"Schedules",url:ep},{label:v?"New Schedule":(x==null?void 0:x.title)??"Schedule",url:void 0}];return i.jsxs("div",{className:Mn.container,children:[i.jsx(vs,{segments:b}),i.jsx(j9,{existing:x,isNew:v,personas:m,workspaces:g,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:p,onDone:()=>{s(ep)},showToast:o})]})}function j9({existing:t,isNew:s,personas:o,workspaces:r,onCreateSchedule:c,onUpdateSchedule:d,onDeleteSchedule:u,onDone:p,showToast:m}){var M;const g=mt(),[v,x]=y.useState((t==null?void 0:t.title)??""),[b,k]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.scheduleExpression)??""),[N,T]=y.useState((t==null?void 0:t.personaId)??""),[C,D]=y.useState((t==null?void 0:t.workspaceId)??""),[B,E]=y.useState(!1),[A,$]=y.useState(null);y.useEffect(()=>{s||t&&A===null&&(x(t.title),k(t.description),j(t.scheduleExpression),T(t.personaId),D(t.workspaceId))},[s,t,A]);const L=!s&&t===void 0,U=s&&v.trim().length>0&&S.trim().length>0&&N.length>0,J=o.map(O=>({value:O.id,label:O.name})),V=[{value:"",label:"System-level (no workspace)"},...r.map(O=>({value:O.id,label:O.name}))],K=O=>{O.preventDefault(),U&&c(v,b,S,N,C||void 0).then(X=>{m("Schedule created","success"),g(Yx(X.id),{replace:!0})},()=>{m("Failed to create schedule","error")})},de=(O,X)=>{t&&d(t.id,{[O]:X}).then(()=>{m("Schedule updated","success"),O==="title"&&x(String(X)),O==="description"&&k(String(X)),O==="scheduleExpression"&&j(String(X)),O==="personaId"&&T(String(X))},()=>{m("Failed to update schedule","error")})},ee=()=>{if(!t)return;const O=!t.enabled;d(t.id,{enabled:O}).then(()=>{m(O?"Schedule enabled":"Schedule disabled","success")},()=>{m("Failed to update schedule","error")})},ie=()=>{t&&u(t.id).then(()=>{m("Schedule deleted","success"),p()},()=>{m("Failed to delete schedule","error")})};return i.jsxs(i.Fragment,{children:[L?i.jsxs("div",{className:Mn.form,children:[i.jsx("h3",{children:"Edit Schedule"}),i.jsx("p",{children:"Loading schedule..."})]}):s?i.jsxs("form",{onSubmit:K,className:Mn.form,children:[i.jsx("h3",{children:"Create Schedule"}),i.jsxs("label",{children:["Title",i.jsx("input",{type:"text",value:v,onChange:O=>x(O.target.value),placeholder:"e.g. Nightly Review",required:!0,"data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description ",i.jsx("span",{className:Mn.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:b,onChange:O=>k(O.target.value),placeholder:"Brief description...","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx("input",{type:"text",value:S,onChange:O=>j(O.target.value),placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",required:!0,"data-testid":"schedule-detail-expression"}),i.jsxs("p",{className:Mn.helperText,children:["Interval: ",i.jsx("code",{children:"30s"}),", ",i.jsx("code",{children:"5m"}),", ",i.jsx("code",{children:"1h"}),", ",i.jsx("code",{children:"1d"})," (min 10s)  |  Cron: ",i.jsx("code",{children:"0 9 * * MON"})," (standard 5-field cron syntax)"]})]}),i.jsxs("label",{children:["Persona",i.jsxs("select",{value:N,onChange:O=>T(O.target.value),required:!0,"data-testid":"schedule-detail-persona",children:[i.jsx("option",{value:"",children:"Select a persona..."}),J.map(O=>i.jsx("option",{value:O.value,children:O.label},O.value))]})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:Mn.optional,children:"(optional)"}),i.jsx("select",{value:C,onChange:O=>D(O.target.value),"data-testid":"schedule-detail-workspace",children:V.map(O=>i.jsx("option",{value:O.value,children:O.label},O.value))})]}),i.jsxs("div",{className:Mn.formActions,children:[i.jsx(tn,{type:"submit",variant:"primary",size:"md",disabled:!U,"data-testid":"schedule-detail-save",children:"Create"}),i.jsx(tn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:Mn.form,children:[i.jsx("h3",{children:"Edit Schedule"}),i.jsxs("div",{className:Mn.formActions,children:[i.jsx(tn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Back to Schedules"}),i.jsx(tn,{type:"button",variant:t.enabled?"ghost":"primary",size:"md",onClick:ee,"data-testid":"schedule-detail-toggle",children:t.enabled?"Disable":"Enable"}),i.jsx(tn,{type:"button",variant:"danger",size:"md",onClick:()=>E(!0),"data-testid":"schedule-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:Mn.editableSection,children:[i.jsxs("label",{children:["Title",i.jsx(Ft,{value:v,onSave:O=>{de("title",O)},validate:O=>O.trim()?void 0:"Title is required",fieldId:"schedule-title",activeFieldId:A,onActivate:$,ariaLabel:"Schedule title","data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description",i.jsx(Ft,{value:b,onSave:O=>{de("description",O)},fieldId:"schedule-description",activeFieldId:A,onActivate:$,placeholder:"Brief description...",ariaLabel:"Schedule description","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx(Ft,{value:S,onSave:O=>{de("scheduleExpression",O)},validate:O=>O.trim()?void 0:"Schedule expression is required",fieldId:"schedule-expression",activeFieldId:A,onActivate:$,placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",ariaLabel:"Schedule expression","data-testid":"schedule-detail-expression"})]}),i.jsxs("label",{children:["Persona",i.jsx(yd,{value:N,onSave:O=>{de("personaId",O)},options:J,fieldId:"schedule-persona",activeFieldId:A,onActivate:$,ariaLabel:"Schedule persona","data-testid":"schedule-detail-persona"})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:Mn.optional,children:"(optional — set at creation)"}),i.jsx("span",{className:Mn.readonlyValue,"data-testid":"schedule-detail-workspace",children:((M=r.find(O=>O.id===t.workspaceId))==null?void 0:M.name)??"System-level (no workspace)"})]})]}),i.jsxs("div",{className:Mn.metaSection,children:[t.lastRunAt?i.jsxs("span",{children:["Last run: ",$o(t.lastRunAt)]}):i.jsx("span",{children:"Last run: Never"}),t.enabled&&t.nextRunAt?i.jsxs("span",{children:["Next run: ",O1(t.nextRunAt)]}):null,t.runCount>0&&i.jsxs("span",{children:["Total runs: ",t.runCount]}),i.jsxs("span",{children:["Created: ",$o(t.createdAt)]})]})]}):null,i.jsx(oa,{isOpen:B,title:"Delete Schedule?",description:`"${t==null?void 0:t.title}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:ie,onCancel:()=>E(!1)})]})}function w9(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=Y1();return i.jsx(cB,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function N9(){const[t,s]=y.useState(void 0);return y.useEffect(()=>{let o=!1;return(async()=>{try{const c=await Ye.getVersionStatus({});o||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{o=!0}},[]),t}function C9(){const{connectionStatus:t,environments:{environments:s},sessions:{sessions:o}}=ot(),r=N9();return i.jsxs(i.Fragment,{children:[r&&i.jsx(cO,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),i.jsx(fB,{connectionStatus:t,environments:s,sessions:o})]})}function E9(){return i.jsx(t8,{})}function A9(){const{plugins:{plugins:t,pluginsLoading:s,setPluginEnabled:o}}=ot();return i.jsx(wL,{plugins:t,loading:s,onSetPluginEnabled:(r,c)=>{o(r,c).catch(()=>{})}})}const vx=Ii();function D9(){const t=mt();return sa({key:"?"},()=>{t(TN)}),sa({key:"n"},()=>{t(vx)}),sa({key:"N"},()=>{t(vx)}),i.jsx(i.Fragment,{})}function yl(t){const s=q7();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function M9(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=ot(),o=y.useMemo(()=>i.jsx($I,{workspaces:t,tasks:s}),[t,s]);return yl(o),i.jsx(Ka,{})}function R9(){const{environments:{environments:t}}=ot(),s=y.useMemo(()=>i.jsx(Y5,{environments:t}),[t]);return yl(s),i.jsx(Ka,{})}function I9(){const t=y.useMemo(()=>i.jsx(J8,{}),[]);return yl(t),i.jsx(Ka,{})}function O9(){const{findings:{findings:t,loadFindings:s,loadAllFindings:o}}=ot(),{workspaceId:r,environmentId:c}=as();y.useEffect(()=>{r?s(r).catch(()=>{}):o().catch(()=>{})},[r,s,o]);const d=y.useMemo(()=>i.jsx(oI,{findings:t,workspaceId:r,environmentId:c}),[t,r,c]);return yl(d),i.jsx(Ka,{})}function B9(){const{knowledge:t,workspaces:{workspaces:s}}=ot(),o=y.useCallback(p=>{t.search(p).catch(()=>{})},[t]),r=y.useCallback(()=>{t.clearSearch()},[t]),c=y.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),d=y.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),u=y.useMemo(()=>i.jsx(i5,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:o,onClearSearch:r,onSelectNode:c,onWorkspaceChange:d}),[t,s,o,r,c,d]);return yl(u),i.jsx(Ka,{})}const L9="_container_ce571_1",z9="_title_ce571_6",_d={container:L9,title:z9};function $9(){return i.jsxs("div",{className:_d.container,"aria-hidden":"true",children:[i.jsx("h1",{className:_d.title,children:"Findings"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:Array.from({length:4},(t,s)=>i.jsx(vd,{lines:3},s))})]})}function yx(){const{environmentId:t,workspaceId:s}=as(),{findings:{findings:o,findingsLoading:r,loadFindings:c},workspaces:{workspaces:d},environments:{environments:u}}=ot(),p=mt();y.useEffect(()=>{s&&c(s).catch(()=>{})},[s,c]);const m=y.useCallback(v=>{p(qp(v,s,t))},[p,s,t]);if(r)return i.jsx($9,{});const g=s&&t?nk("Findings",s,t,d,u).slice(0,-1):nz();return i.jsxs("div",{className:_d.container,"data-testid":"findings-list-page",children:[i.jsx(vs,{segments:g}),i.jsx("h1",{className:_d.title,children:"Findings"}),i.jsx(P1,{findings:o,onFindingClick:m})]})}const P9="_container_1wwpb_1",U9="_notFound_1wwpb_6",H9="_header_1wwpb_12",V9="_categoryBadge_1wwpb_19",q9="_title_1wwpb_28",G9="_content_1wwpb_35",F9="_tags_1wwpb_77",Z9="_tag_1wwpb_77",K9="_meta_1wwpb_92",Y9="_metaTimestamp_1wwpb_100",J9="_metaLink_1wwpb_105",vn={container:P9,notFound:U9,header:H9,categoryBadge:V9,title:q9,content:G9,tags:F9,tag:Z9,meta:K9,metaTimestamp:Y9,metaLink:J9};function bx(){const{findingId:t,environmentId:s,workspaceId:o}=as(),{findings:{selectedFinding:r,findingLoading:c,loadFinding:d},workspaces:{workspaces:u},environments:{environments:p}}=ot(),m=mt();if(y.useEffect(()=>{t&&d(t).catch(()=>{})},[t,d]),c)return i.jsx("div",{className:vn.container,"data-testid":"finding-detail-page",children:i.jsx("div",{className:vn.notFound,children:"Loading..."})});if(!r)return i.jsx("div",{className:vn.container,"data-testid":"finding-detail-page",children:i.jsx("div",{className:vn.notFound,children:"Finding not found."})});const g=nk(r.title,o,s,u,p),v=bd(r.category);return i.jsxs("div",{className:vn.container,"data-testid":"finding-detail-page",children:[i.jsx(vs,{segments:g}),i.jsxs("div",{className:vn.header,children:[i.jsx("span",{className:vn.categoryBadge,style:{background:v.bg,color:v.text},children:r.category}),i.jsx("h1",{className:vn.title,children:r.title})]}),r.content&&i.jsx("div",{className:vn.content,children:i.jsx(Sd,{remarkPlugins:[Td],children:r.content})}),r.tags.length>0&&i.jsx("div",{className:vn.tags,children:r.tags.map(x=>i.jsx("span",{className:vn.tag,children:x},x))}),i.jsxs("div",{className:vn.meta,children:[i.jsx("span",{className:vn.metaTimestamp,title:r.createdAt,children:$o(r.createdAt)}),r.taskId&&i.jsx("button",{type:"button",className:vn.metaLink,onClick:()=>{m(On(r.taskId))},children:"View Task"}),r.sessionId&&i.jsx("button",{type:"button",className:vn.metaLink,onClick:()=>{m(Nm(r.sessionId))},children:"View Session"})]})]})}const W9="_wizard_1260s_1",X9="_container_1260s_10",Q9="_stepContent_1260s_19",eH="_logoArea_1260s_28",tH="_logoImage_1260s_32",nH="_heading_1260s_41",sH="_tagline_1260s_49",aH="_subtitle_1260s_56",iH="_featureList_1260s_64",oH="_runtimeGrid_1260s_89",rH="_runtimeCard_1260s_101",lH="_runtimeName_1260s_133",cH="_runtimeDescription_1260s_139",dH="_buttonRow_1260s_144",uH="_primaryButton_1260s_151",fH="_ghostButton_1260s_185",pH="_dots_1260s_213",mH="_dot_1260s_213",Ke={wizard:W9,container:X9,stepContent:Q9,logoArea:eH,logoImage:tH,heading:nH,tagline:sH,subtitle:aH,featureList:iH,runtimeGrid:oH,runtimeCard:rH,runtimeName:lH,runtimeDescription:cH,buttonRow:dH,primaryButton:uH,ghostButton:fH,dots:pH,dot:mH};function hH({onNext:t}){return i.jsxs("div",{className:Ke.stepContent,"data-testid":"setup-welcome",children:[i.jsx("div",{className:Ke.logoArea,children:i.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Ke.logoImage})}),i.jsx("h1",{className:Ke.heading,children:"Welcome to Grackle"}),i.jsx("p",{className:Ke.tagline,children:"Multi-agent orchestration for software teams"}),i.jsx("button",{type:"button",className:Ke.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function gH({onNext:t,onBack:s}){return i.jsxs("div",{className:Ke.stepContent,"data-testid":"setup-about",children:[i.jsx("h2",{className:Ke.heading,children:"What is Grackle?"}),i.jsxs("ul",{className:Ke.featureList,children:[i.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),i.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),i.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),i.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),i.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),i.jsxs("div",{className:Ke.buttonRow,children:[i.jsx("button",{type:"button",className:Ke.ghostButton,onClick:s,children:"Back"}),i.jsx("button",{type:"button",className:Ke.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const vH=[{id:"claude-code",name:"Claude Code",description:"Anthropic's agentic coding tool"},{id:"copilot",name:"Copilot Coding Agent",description:"GitHub's AI pair programmer"},{id:"codex",name:"Codex CLI",description:"OpenAI's coding agent"},{id:"goose",name:"Goose",description:"Block's open-source AI coding agent"}];function yH({currentRuntime:t,onFinish:s,onBack:o,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),i.jsxs("div",{className:Ke.stepContent,"data-testid":"setup-runtime",children:[i.jsx("h2",{className:Ke.heading,children:"Choose Your Runtime"}),i.jsx("p",{className:Ke.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),i.jsx("div",{className:Ke.runtimeGrid,children:vH.map(u=>i.jsxs("button",{type:"button",className:Ke.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[i.jsx("span",{className:Ke.runtimeName,children:u.name}),i.jsx("span",{className:Ke.runtimeDescription,children:u.description})]},u.id))}),i.jsxs("div",{className:Ke.buttonRow,children:[i.jsx("button",{type:"button",className:Ke.ghostButton,onClick:o,children:"Back"}),i.jsx("button",{type:"button",className:Ke.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function bH(){return typeof Notification<"u"}function xH({onFinish:t,onBack:s,finishDisabled:o}){const r=bH(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return i.jsxs("div",{className:Ke.stepContent,"data-testid":"setup-notifications",children:[i.jsx("h2",{className:Ke.heading,children:"Stay in the Loop"}),i.jsx("p",{className:Ke.subtitle,children:"Grackle can send you a browser notification when an agent needs your input, so you never miss an important moment."}),c?i.jsx("p",{className:Ke.subtitle,children:Notification.permission==="granted"?"Notifications are already enabled.":"Notifications have been blocked. You can change this in your browser settings."}):null,i.jsxs("div",{className:Ke.buttonRow,children:[i.jsx("button",{type:"button",className:Ke.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:Ke.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),i.jsx("button",{type:"button",className:Ke.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):i.jsx("button",{type:"button",className:Ke.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const _H=4,xx={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function kH(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=ot(),{showToast:c}=pn(),d=mt(),[u,p]=y.useState(0),[m,g]=y.useState("claude-code"),[v,x]=y.useState(!1),b=t.find(j=>j.id==="claude-code"),k=y.useCallback(j=>{g(j),p(3)},[]),S=y.useCallback(()=>{const j=m;x(!0);const N=[];if(b&&j!==b.runtime){const C=xx[j]??"sonnet";N.push(s(b.id,void 0,void 0,void 0,j,C))}const T=t.find(C=>C.id===cy);if(T&&j!==T.runtime){const C=xx[j]??"sonnet";N.push(s(cy,void 0,void 0,void 0,j,C))}Promise.all(N).then(()=>o()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),x(!1)})},[m,b,t,s,o,d,c]);return r===!0?i.jsx(ts,{to:"/",replace:!0}):i.jsx("div",{className:Ke.wizard,"data-testid":"setup-wizard",children:i.jsxs("div",{className:Ke.container,children:[i.jsx(gs,{mode:"wait",children:i.jsxs(Rt.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&i.jsx(hH,{onNext:()=>p(1)}),u===1&&i.jsx(gH,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&i.jsx(yH,{currentRuntime:m,onFinish:k,onBack:()=>p(1),finishDisabled:!b}),u===3&&i.jsx(xH,{onFinish:S,onBack:()=>p(2),finishDisabled:v})]},u)}),i.jsx("div",{className:Ke.dots,children:Array.from({length:_H},(j,N)=>i.jsx("span",{className:Ke.dot,"data-active":N===u},N))})]})})}const SH="_root_zndgp_1",TH="_body_zndgp_7",jH="_main_zndgp_19",wH="_sidebarWrapper_zndgp_26",NH="_overlay_zndgp_51",Yr={root:SH,body:TH,main:jH,sidebarWrapper:wH,overlay:NH},CH=y.lazy(()=>YT(()=>import("./KnowledgePage-DVM_7qDh.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),rk=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function EH({tabs:t}){const{connectionStatus:s,environments:{environments:o},sessions:{sessions:r},tasks:{tasks:c}}=ot(),{toasts:d,dismissToast:u}=pn(),p=Yt(),m=V7(),g=m!==void 0,[v,x]=y.useState(!1),b=y.useCallback(()=>x(k=>!k),[]);return y.useEffect(()=>{x(!1)},[p.pathname]),y.useEffect(()=>{if(!v)return;const k=S=>{S.key==="Escape"&&x(!1)};return document.addEventListener("keydown",k),()=>{document.removeEventListener("keydown",k)}},[v]),i.jsxs(i.Fragment,{children:[i.jsx(y5,{connectionStatus:s,environments:o,sessions:r,onToggleSidebar:g?b:void 0,sidebarOpen:v}),i.jsx(j5,{tabs:t}),i.jsxs("div",{className:Yr.body,children:[g&&i.jsx("div",{className:Yr.sidebarWrapper,"data-sidebar-open":v,children:i.jsx(D5,{content:m})}),g&&v&&i.jsx("div",{className:Yr.overlay,"data-testid":"drawer-overlay",onClick:()=>x(!1)}),i.jsxs("div",{className:Yr.main,children:[i.jsx(Ka,{}),i.jsx($5,{sessions:r,tasks:c,environments:o})]})]}),i.jsx(XI,{toasts:d,onDismiss:u}),i.jsx(D9,{})]})}function AH(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connectionStatus:d,onboardingCompleted:u}=ot(),{pluginNames:p}=hh(),{showToast:m}=pn();Jz(s,m),t$(c,m),Wz(o,r,m);const g=mt(),v=Yt();if(y.useEffect(()=>{t&&!v.pathname.includes("/tasks/")&&g(Nm(t),{replace:!0})},[t,g,v.pathname]),d==="connected"&&u===!1)return i.jsx(ts,{to:"/setup",replace:!0});const x=Tz(p);return i.jsx(H7,{children:i.jsxs("div",{className:Yr.root,children:[rk&&i.jsx(eC,{}),i.jsx(EH,{tabs:x})]})})}function $p(){const{workspaceId:t}=as(),{workspaces:{workspaces:s}}=ot(),o=Yt(),r=s.find(g=>g.id===t),c=r!=null&&r.linkedEnvironmentIds?[...r.linkedEnvironmentIds].sort()[0]:void 0;if(!c)return s.length===0?void 0:i.jsx(ts,{to:"/environments",replace:!0});const d=encodeURIComponent(t),u=`/workspaces/${d}`,p=o.pathname.startsWith(u)?o.pathname.slice(u.length):"",m=`/environments/${encodeURIComponent(c)}/workspaces/${d}${p}${o.search}${o.hash}`;return i.jsx(ts,{to:m,replace:!0})}function DH(){const{pluginNames:t}=hh(),s=t.includes("orchestration"),o=t.includes("knowledge");return i.jsxs(zw,{children:[i.jsx(we,{path:"setup",element:i.jsx(kH,{})}),i.jsxs(we,{element:i.jsx(AH,{}),children:[i.jsx(we,{index:!0,element:i.jsx(UP,{})}),i.jsx(we,{path:"chat",element:i.jsx(WP,{})}),i.jsx(we,{path:"sessions/new",element:i.jsx(XP,{})}),i.jsx(we,{path:"sessions/:sessionId",element:i.jsx(nU,{})}),o&&i.jsx(we,{element:i.jsx(B9,{}),children:i.jsx(we,{path:"knowledge",element:i.jsx(y.Suspense,{fallback:i.jsx(E1,{}),children:i.jsx(CH,{})})})}),s&&i.jsxs(we,{element:i.jsx(M9,{}),children:[i.jsx(we,{path:"tasks",element:i.jsx($P,{})}),i.jsx(we,{path:"tasks/new",element:i.jsx(fx,{})}),i.jsx(we,{path:"tasks/:taskId",element:i.jsx(Pa,{})}),i.jsx(we,{path:"tasks/:taskId/edit",element:i.jsx(Pa,{})}),i.jsx(we,{path:"tasks/:taskId/stream",element:i.jsx(Pa,{})}),i.jsx(we,{path:"tasks/:taskId/findings",element:i.jsx(Pa,{})})]}),s&&i.jsxs(we,{element:i.jsx(O9,{}),children:[i.jsx(we,{path:"findings",element:i.jsx(yx,{})}),i.jsx(we,{path:"findings/:findingId",element:i.jsx(bx,{})}),i.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:i.jsx(yx,{})}),i.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:i.jsx(bx,{})})]}),i.jsxs(we,{element:i.jsx(R9,{}),children:[i.jsx(we,{path:"workspaces",element:i.jsx(ts,{to:"/environments",replace:!0})}),i.jsx(we,{path:"workspaces/new",element:i.jsx(vU,{})}),i.jsx(we,{path:"workspaces/:workspaceId",element:i.jsx($p,{})}),i.jsx(we,{path:"workspaces/:workspaceId/tasks/:taskId",element:i.jsx($p,{})}),i.jsx(we,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:i.jsx($p,{})}),i.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId",element:i.jsx(oU,{})}),i.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:i.jsx(fx,{})}),i.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:i.jsx(Pa,{})}),i.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:i.jsx(Pa,{})}),i.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:i.jsx(Pa,{})}),i.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:i.jsx(Pa,{})}),i.jsxs(we,{path:"environments",element:i.jsx(TU,{}),children:[i.jsx(we,{index:!0,element:i.jsx(PP,{})}),i.jsx(we,{path:"new",element:i.jsx(bU,{})}),i.jsx(we,{path:":environmentId",element:i.jsx(e9,{})}),i.jsx(we,{path:":environmentId/edit",element:i.jsx(xU,{})})]})]}),i.jsx(we,{element:i.jsx(I9,{}),children:i.jsxs(we,{path:"settings",element:i.jsx(s9,{}),children:[i.jsx(we,{index:!0,element:i.jsx(ts,{to:"credentials",replace:!0})}),i.jsx(we,{path:"environments",element:i.jsx(ts,{to:"/environments",replace:!0})}),i.jsx(we,{path:"credentials",element:i.jsx(a9,{})}),i.jsx(we,{path:"tokens",element:i.jsx(ts,{to:"../credentials",replace:!0})}),i.jsx(we,{path:"personas",element:i.jsx(i9,{})}),i.jsx(we,{path:"personas/new",element:i.jsx(hx,{})}),i.jsx(we,{path:"personas/:personaId",element:i.jsx(hx,{})}),i.jsx(we,{path:"schedules",element:i.jsx(g9,{})}),i.jsx(we,{path:"schedules/new",element:i.jsx(gx,{})}),i.jsx(we,{path:"schedules/:scheduleId",element:i.jsx(gx,{})}),i.jsx(we,{path:"appearance",element:i.jsx(w9,{})}),i.jsx(we,{path:"shortcuts",element:i.jsx(E9,{})}),i.jsx(we,{path:"plugins",element:i.jsx(A9,{})}),i.jsx(we,{path:"about",element:i.jsx(C9,{})})]})}),i.jsx(we,{path:"*",element:i.jsx(ts,{to:"/",replace:!0})})]})]})}const MH=1e4;function RH(){const{onboardingCompleted:t}=ot(),[s,o]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),MH);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return i.jsx(gs,{mode:"wait",children:r?i.jsx(Rt.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:i.jsx(E1,{})},"splash"):i.jsx(Rt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:i.jsx(cN,{basename:"/".replace(/\/$/,""),children:i.jsx(DH,{})})},"app")})}function IH(){const t=rk?vz:Yz;return i.jsx(xz,{children:i.jsx(U7,{children:i.jsx(L7,{children:i.jsx(t,{children:i.jsx(RH,{})})})})})}FT.createRoot(document.getElementById("root")).render(i.jsx(y.StrictMode,{children:i.jsx(IH,{})}));export{vs as B,Wx as K,ot as a,qp as f,Nm as s,On as t,mt as u};