@grackle-ai/web 0.91.3 → 0.91.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{KnowledgePage-Ctrxq4X6.js → KnowledgePage-gigL5i5c.js} +1 -1
- package/dist/assets/index-DT3lRLFK.css +1 -0
- package/dist/assets/index-_Xcro3Wz.js +715 -0
- package/dist/index.html +2 -2
- package/package.json +2 -2
- package/dist/assets/index-0caCtBWi.js +0 -715
- package/dist/assets/index-FTSUHQT6.css +0 -1
|
@@ -1,715 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-Ctrxq4X6.js","assets/dagview-tHPW3Rz3.js","assets/grpc-CbbuZL-C.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as JS,a as WS,b as y,j as o,d as q0,H as G0,P as F0,i as XS,B as QS,c as eT,C as tT,M as nT,e as sT}from"./dagview-tHPW3Rz3.js";import{c as aT,a as iT,G as oT,f as rT,M as lT,A as s_,D as a_,W as cT,O as dT,b as uT,C as el,d as fT,e as i_,w as pT,t as mT,p as Tc,g as hT,R as wr,S as Z0}from"./grpc-CbbuZL-C.js";import{v as gT,r as vT,t as wc,i as yT,f as bT,M as dd,a as ud}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 i(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=i(c);fetch(c.href,d)}})();var If={exports:{}},jr={},Of={exports:{}},Lf={};/**
|
|
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 K0;function _T(){return K0||(K0=1,(function(t){function s(D,Z){var se=D.length;D.push(Z);e:for(;0<se;){var ue=se-1>>>1,de=D[ue];if(0<c(de,Z))D[ue]=Z,D[se]=de,se=ue;else break e}}function i(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var Z=D[0],se=D.pop();if(se!==Z){D[0]=se;e:for(var ue=0,de=D.length,Ge=de>>>1;ue<Ge;){var De=2*(ue+1)-1,Ne=D[De],Oe=De+1,fe=D[Oe];if(0>c(Ne,se))Oe<de&&0>c(fe,Ne)?(D[ue]=fe,D[Oe]=se,ue=Oe):(D[ue]=Ne,D[De]=se,ue=De);else if(Oe<de&&0>c(fe,se))D[ue]=fe,D[Oe]=se,ue=Oe;else break e}}return Z}function c(D,Z){var se=D.sortIndex-Z.sortIndex;return se!==0?se:D.id-Z.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,b=null,_=3,S=!1,k=!1,w=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function B(D){for(var Z=i(g);Z!==null;){if(Z.callback===null)r(g);else if(Z.startTime<=D)r(g),Z.sortIndex=Z.expirationTime,s(m,Z);else break;Z=i(g)}}function A(D){if(w=!1,B(D),!k)if(i(m)!==null)k=!0,I||(I=!0,H());else{var Z=i(g);Z!==null&&re(A,Z.startTime-D)}}var I=!1,O=-1,U=5,P=-1;function W(){return N?!0:!(t.unstable_now()-P<U)}function te(){if(N=!1,I){var D=t.unstable_now();P=D;var Z=!0;try{e:{k=!1,w&&(w=!1,C(O),O=-1),S=!0;var se=_;try{t:{for(B(D),b=i(m);b!==null&&!(b.expirationTime>D&&W());){var ue=b.callback;if(typeof ue=="function"){b.callback=null,_=b.priorityLevel;var de=ue(b.expirationTime<=D);if(D=t.unstable_now(),typeof de=="function"){b.callback=de,B(D),Z=!0;break t}b===i(m)&&r(m),B(D)}else r(m);b=i(m)}if(b!==null)Z=!0;else{var Ge=i(g);Ge!==null&&re(A,Ge.startTime-D),Z=!1}}break e}finally{b=null,_=se,S=!1}Z=void 0}}finally{Z?H():I=!1}}}var H;if(typeof E=="function")H=function(){E(te)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,Y=ie.port2;ie.port1.onmessage=te,H=function(){Y.postMessage(null)}}else H=function(){T(te,0)};function re(D,Z){O=T(function(){D(t.unstable_now())},Z)}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(D){D.callback=null},t.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<D?Math.floor(1e3/D):5},t.unstable_getCurrentPriorityLevel=function(){return _},t.unstable_next=function(D){switch(_){case 1:case 2:case 3:var Z=3;break;default:Z=_}var se=_;_=Z;try{return D()}finally{_=se}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(D,Z){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var se=_;_=D;try{return Z()}finally{_=se}},t.unstable_scheduleCallback=function(D,Z,se){var ue=t.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?ue+se:ue):se=ue,D){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=se+de,D={id:v++,callback:Z,priorityLevel:D,startTime:se,expirationTime:de,sortIndex:-1},se>ue?(D.sortIndex=se,s(g,D),i(m)===null&&D===i(g)&&(w?(C(O),O=-1):w=!0,re(A,se-ue))):(D.sortIndex=de,s(m,D),k||S||(k=!0,I||(I=!0,H()))),D},t.unstable_shouldYield=W,t.unstable_wrapCallback=function(D){var Z=_;return function(){var se=_;_=Z;try{return D.apply(this,arguments)}finally{_=se}}}})(Lf)),Lf}var Y0;function xT(){return Y0||(Y0=1,Of.exports=_T()),Of.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 J0;function kT(){if(J0)return jr;J0=1;var t=xT(),s=JS(),i=WS();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 x=!1,j=f.child;j;){if(j===a){x=!0,a=f,l=h;break}if(j===l){x=!0,l=f,a=h;break}j=j.sibling}if(!x){for(j=h.child;j;){if(j===a){x=!0,a=h,l=f;break}if(j===l){x=!0,l=h,a=f;break}j=j.sibling}if(!x)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 b=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),E=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function H(e){return e===null||typeof e!="object"?null:(e=te&&e[te]||e["@@iterator"],typeof e=="function"?e:null)}var ie=Symbol.for("react.client.reference");function Y(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case T:return"Profiler";case N:return"StrictMode";case A:return"Suspense";case I:return"SuspenseList";case P:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case E: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 O:return n=e.displayName||null,n!==null?n:Y(e.type)||"Memo";case U:n=e._payload,e=e._init;try{return Y(e(n))}catch{}}return null}var re=Array.isArray,D=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},ue=[],de=-1;function Ge(e){return{current:e}}function De(e){0>de||(e.current=ue[de],ue[de]=null,de--)}function Ne(e,n){de++,ue[de]=e.current,e.current=n}var Oe=Ge(null),fe=Ge(null),ye=Ge(null),me=Ge(null);function Ue(e,n){switch(Ne(ye,n),Ne(fe,e),Ne(Oe,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?p0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=p0(n),e=m0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}De(Oe),Ne(Oe,e)}function pt(){De(Oe),De(fe),De(ye)}function bn(e){e.memoizedState!==null&&Ne(me,e);var n=Oe.current,a=m0(n,e.type);n!==a&&(Ne(fe,e),Ne(Oe,a))}function ae(e){fe.current===e&&(De(Oe),De(fe)),me.current===e&&(De(me),xr._currentValue=se)}var Q,ct;function Le(e){if(Q===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Q=n&&n[1]||"",ct=-1<a.stack.indexOf(`
|
|
19
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+Q+e+ct}var $t=!1;function dt(e,n){if(!e||$t)return"";$t=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(K){var F=K}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(K){F=K}e.call(ee.prototype)}}else{try{throw Error()}catch(K){F=K}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(K){if(K&&F&&typeof K.stack=="string")return[K.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(),x=h[0],j=h[1];if(x&&j){var R=x.split(`
|
|
21
|
-
`),G=j.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 J=`
|
|
23
|
-
`+R[l].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=l&&0<=f);break}}}finally{$t=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Le(a):""}function na(e,n){switch(e.tag){case 26:case 27:case 5:return Le(e.type);case 16:return Le("Lazy");case 13:return e.child!==n&&n!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return dt(e.type,!1);case 11:return dt(e.type.render,!1);case 1:return dt(e.type,!0);case 31:return Le("Activity");default:return""}}function Ss(e){try{var n="",a=null;do n+=na(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
|
|
24
|
-
Error generating stack: `+l.message+`
|
|
25
|
-
`+l.stack}}var _n=Object.prototype.hasOwnProperty,Ts=t.unstable_scheduleCallback,us=t.unstable_cancelCallback,ji=t.unstable_shouldYield,Wn=t.unstable_requestPaint,_e=t.unstable_now,Qe=t.unstable_getCurrentPriorityLevel,on=t.unstable_ImmediatePriority,xn=t.unstable_UserBlockingPriority,In=t.unstable_NormalPriority,Ni=t.unstable_LowPriority,Ha=t.unstable_IdlePriority,Ci=t.log,Ei=t.unstable_setDisableYieldValue,sa=null,tn=null;function Xn(e){if(typeof Ci=="function"&&Ei(e),tn&&typeof tn.setStrictMode=="function")try{tn.setStrictMode(sa,e)}catch{}}var nn=Math.clz32?Math.clz32:ul,cl=Math.log,dl=Math.LN2;function ul(e){return e>>>=0,e===0?32:31-(cl(e)/dl|0)|0}var Va=256,qa=262144,Ga=4194304;function ws(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 V(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var j=l&134217727;return j!==0?(l=j&~h,l!==0?f=ws(l):(x&=j,x!==0?f=ws(x):a||(a=j&~e,a!==0&&(f=ws(a))))):(j=l&~h,j!==0?f=ws(j):x!==0?f=ws(x):a||(a=l&~e,a!==0&&(f=ws(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 ne(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function le(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 pe(){var e=Ga;return Ga<<=1,(Ga&62914560)===0&&(Ga=4194304),e}function he(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function $e(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ke(e,n,a,l,f,h){var x=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 j=e.entanglements,R=e.expirationTimes,G=e.hiddenUpdates;for(a=x&~a;0<a;){var J=31-nn(a),ee=1<<J;j[J]=0,R[J]=-1;var F=G[J];if(F!==null)for(G[J]=null,J=0;J<F.length;J++){var K=F[J];K!==null&&(K.lane&=-536870913)}a&=~ee}l!==0&&Re(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function Re(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-nn(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Ze(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-nn(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function ut(e,n){var a=n&-n;return a=(a&42)!==0?1:Ke(a),(a&(e.suspendedLanes|n))!==0?0:a}function Ke(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 Pt(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Kt(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:B0(e.type))}function At(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var rn=Math.random().toString(36).slice(2),ht="__reactFiber$"+rn,qt="__reactProps$"+rn,Ai="__reactContainer$"+rn,Td="__reactEvents$"+rn,U1="__reactListeners$"+rn,$1="__reactHandles$"+rn,eh="__reactResources$"+rn,Lo="__reactMarker$"+rn;function wd(e){delete e[ht],delete e[qt],delete e[Td],delete e[U1],delete e[$1]}function Di(e){var n=e[ht];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Ai]||a[ht]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=x0(e);e!==null;){if(a=e[ht])return a;e=x0(e)}return n}e=a,a=e.parentNode}return null}function Ri(e){if(e=e[ht]||e[Ai]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Bo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function Mi(e){var n=e[eh];return n||(n=e[eh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Gt(e){e[Lo]=!0}var th=new Set,nh={};function Fa(e,n){Ii(e,n),Ii(e+"Capture",n)}function Ii(e,n){for(nh[e]=n,e=0;e<n.length;e++)th.add(n[e])}var P1=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]*$"),sh={},ah={};function H1(e){return _n.call(ah,e)?!0:_n.call(sh,e)?!1:P1.test(e)?ah[e]=!0:(sh[e]=!0,!1)}function fl(e,n,a){if(H1(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 pl(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 js(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 On(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ih(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function V1(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(x){a=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function jd(e){if(!e._valueTracker){var n=ih(e)?"checked":"value";e._valueTracker=V1(e,n,""+e[n])}}function oh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=ih(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function ml(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 q1=/[\n"\\]/g;function Ln(e){return e.replace(q1,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Nd(e,n,a,l,f,h,x,j){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+On(n)):e.value!==""+On(n)&&(e.value=""+On(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Cd(e,x,On(n)):a!=null?Cd(e,x,On(a)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.name=""+On(j):e.removeAttribute("name")}function rh(e,n,a,l,f,h,x,j){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)){jd(e);return}a=a!=null?""+On(a):"",n=n!=null?""+On(n):a,j||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=j?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),jd(e)}function Cd(e,n,a){n==="number"&&ml(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Oi(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=""+On(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 lh(e,n,a){if(n!=null&&(n=""+On(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+On(a):""}function ch(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(r(92));if(re(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=On(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),jd(e)}function Li(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var G1=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 dh(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||G1.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function uh(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&&dh(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&dh(e,h,n[h])}function Ed(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 F1=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"]]),Z1=/^[\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 hl(e){return Z1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ns(){}var Ad=null;function Dd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bi=null,zi=null;function fh(e){var n=Ri(e);if(n&&(e=n.stateNode)){var a=e[qt]||null;e:switch(e=n.stateNode,n.type){case"input":if(Nd(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="'+Ln(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[qt]||null;if(!f)throw Error(r(90));Nd(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&&oh(l)}break e;case"textarea":lh(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Oi(e,!!a.multiple,n,!1)}}}var Rd=!1;function ph(e,n,a){if(Rd)return e(n,a);Rd=!0;try{var l=e(n);return l}finally{if(Rd=!1,(Bi!==null||zi!==null)&&(nc(),Bi&&(n=Bi,e=zi,zi=Bi=null,fh(n),e)))for(n=0;n<e.length;n++)fh(e[n])}}function zo(e,n){var a=e.stateNode;if(a===null)return null;var l=a[qt]||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 Cs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Md=!1;if(Cs)try{var Uo={};Object.defineProperty(Uo,"passive",{get:function(){Md=!0}}),window.addEventListener("test",Uo,Uo),window.removeEventListener("test",Uo,Uo)}catch{Md=!1}var aa=null,Id=null,gl=null;function mh(){if(gl)return gl;var e,n=Id,a=n.length,l,f="value"in aa?aa.value:aa.textContent,h=f.length;for(e=0;e<a&&n[e]===f[e];e++);var x=a-e;for(l=1;l<=x&&n[a-l]===f[h-l];l++);return gl=f.slice(e,1<l?1-l:void 0)}function vl(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 yl(){return!0}function hh(){return!1}function fn(e){function n(a,l,f,h,x){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(a=e[j],this[j]=a?a(h):h[j]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?yl:hh,this.isPropagationStopped=hh,this}return b(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=yl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=yl)},persist:function(){},isPersistent:yl}),n}var Za={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bl=fn(Za),$o=b({},Za,{view:0,detail:0}),K1=fn($o),Od,Ld,Po,_l=b({},$o,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zd,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!==Po&&(Po&&e.type==="mousemove"?(Od=e.screenX-Po.screenX,Ld=e.screenY-Po.screenY):Ld=Od=0,Po=e),Od)},movementY:function(e){return"movementY"in e?e.movementY:Ld}}),gh=fn(_l),Y1=b({},_l,{dataTransfer:0}),J1=fn(Y1),W1=b({},$o,{relatedTarget:0}),Bd=fn(W1),X1=b({},Za,{animationName:0,elapsedTime:0,pseudoElement:0}),Q1=fn(X1),ek=b({},Za,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),tk=fn(ek),nk=b({},Za,{data:0}),vh=fn(nk),sk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ak={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"},ik={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ok(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=ik[e])?!!n[e]:!1}function zd(){return ok}var rk=b({},$o,{key:function(e){if(e.key){var n=sk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=vl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ak[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zd,charCode:function(e){return e.type==="keypress"?vl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?vl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),lk=fn(rk),ck=b({},_l,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yh=fn(ck),dk=b({},$o,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zd}),uk=fn(dk),fk=b({},Za,{propertyName:0,elapsedTime:0,pseudoElement:0}),pk=fn(fk),mk=b({},_l,{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}),hk=fn(mk),gk=b({},Za,{newState:0,oldState:0}),vk=fn(gk),yk=[9,13,27,32],Ud=Cs&&"CompositionEvent"in window,Ho=null;Cs&&"documentMode"in document&&(Ho=document.documentMode);var bk=Cs&&"TextEvent"in window&&!Ho,bh=Cs&&(!Ud||Ho&&8<Ho&&11>=Ho),_h=" ",xh=!1;function kh(e,n){switch(e){case"keyup":return yk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ui=!1;function _k(e,n){switch(e){case"compositionend":return Sh(n);case"keypress":return n.which!==32?null:(xh=!0,_h);case"textInput":return e=n.data,e===_h&&xh?null:e;default:return null}}function xk(e,n){if(Ui)return e==="compositionend"||!Ud&&kh(e,n)?(e=mh(),gl=Id=aa=null,Ui=!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 bh&&n.locale!=="ko"?null:n.data;default:return null}}var kk={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 Th(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!kk[e.type]:n==="textarea"}function wh(e,n,a,l){Bi?zi?zi.push(l):zi=[l]:Bi=l,n=cc(n,"onChange"),0<n.length&&(a=new bl("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Vo=null,qo=null;function Sk(e){r0(e,0)}function xl(e){var n=Bo(e);if(oh(n))return e}function jh(e,n){if(e==="change")return n}var Nh=!1;if(Cs){var $d;if(Cs){var Pd="oninput"in document;if(!Pd){var Ch=document.createElement("div");Ch.setAttribute("oninput","return;"),Pd=typeof Ch.oninput=="function"}$d=Pd}else $d=!1;Nh=$d&&(!document.documentMode||9<document.documentMode)}function Eh(){Vo&&(Vo.detachEvent("onpropertychange",Ah),qo=Vo=null)}function Ah(e){if(e.propertyName==="value"&&xl(qo)){var n=[];wh(n,qo,e,Dd(e)),ph(Sk,n)}}function Tk(e,n,a){e==="focusin"?(Eh(),Vo=n,qo=a,Vo.attachEvent("onpropertychange",Ah)):e==="focusout"&&Eh()}function wk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return xl(qo)}function jk(e,n){if(e==="click")return xl(n)}function Nk(e,n){if(e==="input"||e==="change")return xl(n)}function Ck(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var kn=typeof Object.is=="function"?Object.is:Ck;function Go(e,n){if(kn(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(!_n.call(n,f)||!kn(e[f],n[f]))return!1}return!0}function Dh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Rh(e,n){var a=Dh(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=Dh(a)}}function Mh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Mh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Ih(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=ml(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=ml(e.document)}return n}function Hd(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 Ek=Cs&&"documentMode"in document&&11>=document.documentMode,$i=null,Vd=null,Fo=null,qd=!1;function Oh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;qd||$i==null||$i!==ml(l)||(l=$i,"selectionStart"in l&&Hd(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}),Fo&&Go(Fo,l)||(Fo=l,l=cc(Vd,"onSelect"),0<l.length&&(n=new bl("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=$i)))}function Ka(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Pi={animationend:Ka("Animation","AnimationEnd"),animationiteration:Ka("Animation","AnimationIteration"),animationstart:Ka("Animation","AnimationStart"),transitionrun:Ka("Transition","TransitionRun"),transitionstart:Ka("Transition","TransitionStart"),transitioncancel:Ka("Transition","TransitionCancel"),transitionend:Ka("Transition","TransitionEnd")},Gd={},Lh={};Cs&&(Lh=document.createElement("div").style,"AnimationEvent"in window||(delete Pi.animationend.animation,delete Pi.animationiteration.animation,delete Pi.animationstart.animation),"TransitionEvent"in window||delete Pi.transitionend.transition);function Ya(e){if(Gd[e])return Gd[e];if(!Pi[e])return e;var n=Pi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Lh)return Gd[e]=n[a];return e}var Bh=Ya("animationend"),zh=Ya("animationiteration"),Uh=Ya("animationstart"),Ak=Ya("transitionrun"),Dk=Ya("transitionstart"),Rk=Ya("transitioncancel"),$h=Ya("transitionend"),Ph=new Map,Fd="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(" ");Fd.push("scrollEnd");function Qn(e,n){Ph.set(e,n),Fa(n,[e])}var kl=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)},Bn=[],Hi=0,Zd=0;function Sl(){for(var e=Hi,n=Zd=Hi=0;n<e;){var a=Bn[n];Bn[n++]=null;var l=Bn[n];Bn[n++]=null;var f=Bn[n];Bn[n++]=null;var h=Bn[n];if(Bn[n++]=null,l!==null&&f!==null){var x=l.pending;x===null?f.next=f:(f.next=x.next,x.next=f),l.pending=f}h!==0&&Hh(a,f,h)}}function Tl(e,n,a,l){Bn[Hi++]=e,Bn[Hi++]=n,Bn[Hi++]=a,Bn[Hi++]=l,Zd|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Kd(e,n,a,l){return Tl(e,n,a,l),wl(e)}function Ja(e,n){return Tl(e,null,null,n),wl(e)}function Hh(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-nn(a),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),h):null}function wl(e){if(50<mr)throw mr=0,sf=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Vi={};function Mk(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 Sn(e,n,a,l){return new Mk(e,n,a,l)}function Yd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Es(e,n){var a=e.alternate;return a===null?(a=Sn(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 Vh(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 jl(e,n,a,l,f,h){var x=0;if(l=e,typeof e=="function")Yd(e)&&(x=1);else if(typeof e=="string")x=zS(e,a,Oe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case P:return e=Sn(31,a,n,f),e.elementType=P,e.lanes=h,e;case w:return Wa(a.children,f,h,n);case N:x=8,f|=24;break;case T:return e=Sn(12,a,n,f|2),e.elementType=T,e.lanes=h,e;case A:return e=Sn(13,a,n,f),e.elementType=A,e.lanes=h,e;case I:return e=Sn(19,a,n,f),e.elementType=I,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case E:x=10;break e;case C:x=9;break e;case B:x=11;break e;case O:x=14;break e;case U:x=16,l=null;break e}x=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=Sn(x,a,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function Wa(e,n,a,l){return e=Sn(7,e,l,n),e.lanes=a,e}function Jd(e,n,a){return e=Sn(6,e,null,n),e.lanes=a,e}function qh(e){var n=Sn(18,null,null,0);return n.stateNode=e,n}function Wd(e,n,a){return n=Sn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Gh=new WeakMap;function zn(e,n){if(typeof e=="object"&&e!==null){var a=Gh.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Ss(n)},Gh.set(e,n),n)}return{value:e,source:n,stack:Ss(n)}}var qi=[],Gi=0,Nl=null,Zo=0,Un=[],$n=0,ia=null,fs=1,ps="";function As(e,n){qi[Gi++]=Zo,qi[Gi++]=Nl,Nl=e,Zo=n}function Fh(e,n,a){Un[$n++]=fs,Un[$n++]=ps,Un[$n++]=ia,ia=e;var l=fs;e=ps;var f=32-nn(l)-1;l&=~(1<<f),a+=1;var h=32-nn(n)+f;if(30<h){var x=f-f%5;h=(l&(1<<x)-1).toString(32),l>>=x,f-=x,fs=1<<32-nn(n)+f|a<<f|l,ps=h+e}else fs=1<<h|a<<f|l,ps=e}function Xd(e){e.return!==null&&(As(e,1),Fh(e,1,0))}function Qd(e){for(;e===Nl;)Nl=qi[--Gi],qi[Gi]=null,Zo=qi[--Gi],qi[Gi]=null;for(;e===ia;)ia=Un[--$n],Un[$n]=null,ps=Un[--$n],Un[$n]=null,fs=Un[--$n],Un[$n]=null}function Zh(e,n){Un[$n++]=fs,Un[$n++]=ps,Un[$n++]=ia,fs=n.id,ps=n.overflow,ia=e}var Yt=null,gt=null,Ve=!1,oa=null,Pn=!1,eu=Error(r(519));function ra(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ko(zn(n,e)),eu}function Kh(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[ht]=e,n[qt]=l,a){case"dialog":ze("cancel",n),ze("close",n);break;case"iframe":case"object":case"embed":ze("load",n);break;case"video":case"audio":for(a=0;a<gr.length;a++)ze(gr[a],n);break;case"source":ze("error",n);break;case"img":case"image":case"link":ze("error",n),ze("load",n);break;case"details":ze("toggle",n);break;case"input":ze("invalid",n),rh(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":ze("invalid",n);break;case"textarea":ze("invalid",n),ch(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||u0(n.textContent,a)?(l.popover!=null&&(ze("beforetoggle",n),ze("toggle",n)),l.onScroll!=null&&ze("scroll",n),l.onScrollEnd!=null&&ze("scrollend",n),l.onClick!=null&&(n.onclick=Ns),n=!0):n=!1,n||ra(e,!0)}function Yh(e){for(Yt=e.return;Yt;)switch(Yt.tag){case 5:case 31:case 13:Pn=!1;return;case 27:case 3:Pn=!0;return;default:Yt=Yt.return}}function Fi(e){if(e!==Yt)return!1;if(!Ve)return Yh(e),Ve=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||bf(e.type,e.memoizedProps)),a=!a),a&>&&ra(e),Yh(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));gt=_0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));gt=_0(e)}else n===27?(n=gt,xa(e.type)?(e=Tf,Tf=null,gt=e):gt=n):gt=Yt?Vn(e.stateNode.nextSibling):null;return!0}function Xa(){gt=Yt=null,Ve=!1}function tu(){var e=oa;return e!==null&&(gn===null?gn=e:gn.push.apply(gn,e),oa=null),e}function Ko(e){oa===null?oa=[e]:oa.push(e)}var nu=Ge(null),Qa=null,Ds=null;function la(e,n,a){Ne(nu,n._currentValue),n._currentValue=a}function Rs(e){e._currentValue=nu.current,De(nu)}function su(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 au(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var x=f.child;h=h.firstContext;e:for(;h!==null;){var j=h;h=f;for(var R=0;R<n.length;R++)if(j.context===n[R]){h.lanes|=a,j=h.alternate,j!==null&&(j.lanes|=a),su(h.return,a,e),l||(x=null);break e}h=j.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(r(341));x.lanes|=a,h=x.alternate,h!==null&&(h.lanes|=a),su(x,a,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function Zi(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 x=f.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var j=f.type;kn(f.pendingProps.value,x.value)||(e!==null?e.push(j):e=[j])}}else if(f===me.current){if(x=f.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(xr):e=[xr])}f=f.return}e!==null&&au(n,e,a,l),n.flags|=262144}function Cl(e){for(e=e.firstContext;e!==null;){if(!kn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ei(e){Qa=e,Ds=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Jt(e){return Jh(Qa,e)}function El(e,n){return Qa===null&&ei(e),Jh(e,n)}function Jh(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Ds===null){if(e===null)throw Error(r(308));Ds=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Ds=Ds.next=n;return a}var Ik=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()})}},Ok=t.unstable_scheduleCallback,Lk=t.unstable_NormalPriority,Lt={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function iu(){return{controller:new Ik,data:new Map,refCount:0}}function Yo(e){e.refCount--,e.refCount===0&&Ok(Lk,function(){e.controller.abort()})}var Jo=null,ou=0,Ki=0,Yi=null;function Bk(e,n){if(Jo===null){var a=Jo=[];ou=0,Ki=df(),Yi={status:"pending",value:void 0,then:function(l){a.push(l)}}}return ou++,n.then(Wh,Wh),n}function Wh(){if(--ou===0&&Jo!==null){Yi!==null&&(Yi.status="fulfilled");var e=Jo;Jo=null,Ki=0,Yi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function zk(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 Xh=D.S;D.S=function(e,n){Ov=_e(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Bk(e,n),Xh!==null&&Xh(e,n)};var ti=Ge(null);function ru(){var e=ti.current;return e!==null?e:ft.pooledCache}function Al(e,n){n===null?Ne(ti,ti.current):Ne(ti,n.pool)}function Qh(){var e=ru();return e===null?null:{parent:Lt._currentValue,pool:e}}var Ji=Error(r(460)),lu=Error(r(474)),Dl=Error(r(542)),Rl={then:function(){}};function eg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function tg(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(Ns,Ns),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,sg(e),e;default:if(typeof n.status=="string")n.then(Ns,Ns);else{if(e=ft,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,sg(e),e}throw si=n,Ji}}function ni(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(si=a,Ji):a}}var si=null;function ng(){if(si===null)throw Error(r(459));var e=si;return si=null,e}function sg(e){if(e===Ji||e===Dl)throw Error(r(483))}var Wi=null,Wo=0;function Ml(e){var n=Wo;return Wo+=1,Wi===null&&(Wi=[]),tg(Wi,e,n)}function Xo(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Il(e,n){throw n.$$typeof===_?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function ag(e){function n($,z){if(e){var q=$.deletions;q===null?($.deletions=[z],$.flags|=16):q.push(z)}}function a($,z){if(!e)return null;for(;z!==null;)n($,z),z=z.sibling;return null}function l($){for(var z=new Map;$!==null;)$.key!==null?z.set($.key,$):z.set($.index,$),$=$.sibling;return z}function f($,z){return $=Es($,z),$.index=0,$.sibling=null,$}function h($,z,q){return $.index=q,e?(q=$.alternate,q!==null?(q=q.index,q<z?($.flags|=67108866,z):q):($.flags|=67108866,z)):($.flags|=1048576,z)}function x($){return e&&$.alternate===null&&($.flags|=67108866),$}function j($,z,q,X){return z===null||z.tag!==6?(z=Jd(q,$.mode,X),z.return=$,z):(z=f(z,q),z.return=$,z)}function R($,z,q,X){var Se=q.type;return Se===w?J($,z,q.props.children,X,q.key):z!==null&&(z.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===U&&ni(Se)===z.type)?(z=f(z,q.props),Xo(z,q),z.return=$,z):(z=jl(q.type,q.key,q.props,null,$.mode,X),Xo(z,q),z.return=$,z)}function G($,z,q,X){return z===null||z.tag!==4||z.stateNode.containerInfo!==q.containerInfo||z.stateNode.implementation!==q.implementation?(z=Wd(q,$.mode,X),z.return=$,z):(z=f(z,q.children||[]),z.return=$,z)}function J($,z,q,X,Se){return z===null||z.tag!==7?(z=Wa(q,$.mode,X,Se),z.return=$,z):(z=f(z,q),z.return=$,z)}function ee($,z,q){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=Jd(""+z,$.mode,q),z.return=$,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case S:return q=jl(z.type,z.key,z.props,null,$.mode,q),Xo(q,z),q.return=$,q;case k:return z=Wd(z,$.mode,q),z.return=$,z;case U:return z=ni(z),ee($,z,q)}if(re(z)||H(z))return z=Wa(z,$.mode,q,null),z.return=$,z;if(typeof z.then=="function")return ee($,Ml(z),q);if(z.$$typeof===E)return ee($,El($,z),q);Il($,z)}return null}function F($,z,q,X){var Se=z!==null?z.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return Se!==null?null:j($,z,""+q,X);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case S:return q.key===Se?R($,z,q,X):null;case k:return q.key===Se?G($,z,q,X):null;case U:return q=ni(q),F($,z,q,X)}if(re(q)||H(q))return Se!==null?null:J($,z,q,X,null);if(typeof q.then=="function")return F($,z,Ml(q),X);if(q.$$typeof===E)return F($,z,El($,q),X);Il($,q)}return null}function K($,z,q,X,Se){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return $=$.get(q)||null,j(z,$,""+X,Se);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case S:return $=$.get(X.key===null?q:X.key)||null,R(z,$,X,Se);case k:return $=$.get(X.key===null?q:X.key)||null,G(z,$,X,Se);case U:return X=ni(X),K($,z,q,X,Se)}if(re(X)||H(X))return $=$.get(q)||null,J(z,$,X,Se,null);if(typeof X.then=="function")return K($,z,q,Ml(X),Se);if(X.$$typeof===E)return K($,z,q,El(z,X),Se);Il(z,X)}return null}function ve($,z,q,X){for(var Se=null,Ye=null,be=z,Ie=z=0,He=null;be!==null&&Ie<q.length;Ie++){be.index>Ie?(He=be,be=null):He=be.sibling;var Je=F($,be,q[Ie],X);if(Je===null){be===null&&(be=He);break}e&&be&&Je.alternate===null&&n($,be),z=h(Je,z,Ie),Ye===null?Se=Je:Ye.sibling=Je,Ye=Je,be=He}if(Ie===q.length)return a($,be),Ve&&As($,Ie),Se;if(be===null){for(;Ie<q.length;Ie++)be=ee($,q[Ie],X),be!==null&&(z=h(be,z,Ie),Ye===null?Se=be:Ye.sibling=be,Ye=be);return Ve&&As($,Ie),Se}for(be=l(be);Ie<q.length;Ie++)He=K(be,$,Ie,q[Ie],X),He!==null&&(e&&He.alternate!==null&&be.delete(He.key===null?Ie:He.key),z=h(He,z,Ie),Ye===null?Se=He:Ye.sibling=He,Ye=He);return e&&be.forEach(function(ja){return n($,ja)}),Ve&&As($,Ie),Se}function we($,z,q,X){if(q==null)throw Error(r(151));for(var Se=null,Ye=null,be=z,Ie=z=0,He=null,Je=q.next();be!==null&&!Je.done;Ie++,Je=q.next()){be.index>Ie?(He=be,be=null):He=be.sibling;var ja=F($,be,Je.value,X);if(ja===null){be===null&&(be=He);break}e&&be&&ja.alternate===null&&n($,be),z=h(ja,z,Ie),Ye===null?Se=ja:Ye.sibling=ja,Ye=ja,be=He}if(Je.done)return a($,be),Ve&&As($,Ie),Se;if(be===null){for(;!Je.done;Ie++,Je=q.next())Je=ee($,Je.value,X),Je!==null&&(z=h(Je,z,Ie),Ye===null?Se=Je:Ye.sibling=Je,Ye=Je);return Ve&&As($,Ie),Se}for(be=l(be);!Je.done;Ie++,Je=q.next())Je=K(be,$,Ie,Je.value,X),Je!==null&&(e&&Je.alternate!==null&&be.delete(Je.key===null?Ie:Je.key),z=h(Je,z,Ie),Ye===null?Se=Je:Ye.sibling=Je,Ye=Je);return e&&be.forEach(function(YS){return n($,YS)}),Ve&&As($,Ie),Se}function rt($,z,q,X){if(typeof q=="object"&&q!==null&&q.type===w&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case S:e:{for(var Se=q.key;z!==null;){if(z.key===Se){if(Se=q.type,Se===w){if(z.tag===7){a($,z.sibling),X=f(z,q.props.children),X.return=$,$=X;break e}}else if(z.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===U&&ni(Se)===z.type){a($,z.sibling),X=f(z,q.props),Xo(X,q),X.return=$,$=X;break e}a($,z);break}else n($,z);z=z.sibling}q.type===w?(X=Wa(q.props.children,$.mode,X,q.key),X.return=$,$=X):(X=jl(q.type,q.key,q.props,null,$.mode,X),Xo(X,q),X.return=$,$=X)}return x($);case k:e:{for(Se=q.key;z!==null;){if(z.key===Se)if(z.tag===4&&z.stateNode.containerInfo===q.containerInfo&&z.stateNode.implementation===q.implementation){a($,z.sibling),X=f(z,q.children||[]),X.return=$,$=X;break e}else{a($,z);break}else n($,z);z=z.sibling}X=Wd(q,$.mode,X),X.return=$,$=X}return x($);case U:return q=ni(q),rt($,z,q,X)}if(re(q))return ve($,z,q,X);if(H(q)){if(Se=H(q),typeof Se!="function")throw Error(r(150));return q=Se.call(q),we($,z,q,X)}if(typeof q.then=="function")return rt($,z,Ml(q),X);if(q.$$typeof===E)return rt($,z,El($,q),X);Il($,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,z!==null&&z.tag===6?(a($,z.sibling),X=f(z,q),X.return=$,$=X):(a($,z),X=Jd(q,$.mode,X),X.return=$,$=X),x($)):a($,z)}return function($,z,q,X){try{Wo=0;var Se=rt($,z,q,X);return Wi=null,Se}catch(be){if(be===Ji||be===Dl)throw be;var Ye=Sn(29,be,null,$.mode);return Ye.lanes=X,Ye.return=$,Ye}finally{}}}var ai=ag(!0),ig=ag(!1),ca=!1;function cu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function du(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 da(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ua(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(et&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=wl(e),Hh(e,null,a),n}return Tl(e,l,n,a),wl(e)}function Qo(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,Ze(e,a)}}function uu(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 x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?f=h=x:h=h.next=x,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 fu=!1;function er(){if(fu){var e=Yi;if(e!==null)throw e}}function tr(e,n,a,l){fu=!1;var f=e.updateQueue;ca=!1;var h=f.firstBaseUpdate,x=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var R=j,G=R.next;R.next=null,x===null?h=G:x.next=G,x=R;var J=e.alternate;J!==null&&(J=J.updateQueue,j=J.lastBaseUpdate,j!==x&&(j===null?J.firstBaseUpdate=G:j.next=G,J.lastBaseUpdate=R))}if(h!==null){var ee=f.baseState;x=0,J=G=R=null,j=h;do{var F=j.lane&-536870913,K=F!==j.lane;if(K?(Pe&F)===F:(l&F)===F){F!==0&&F===Ki&&(fu=!0),J!==null&&(J=J.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var ve=e,we=j;F=n;var rt=a;switch(we.tag){case 1:if(ve=we.payload,typeof ve=="function"){ee=ve.call(rt,ee,F);break e}ee=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=we.payload,F=typeof ve=="function"?ve.call(rt,ee,F):ve,F==null)break e;ee=b({},ee,F);break e;case 2:ca=!0}}F=j.callback,F!==null&&(e.flags|=64,K&&(e.flags|=8192),K=f.callbacks,K===null?f.callbacks=[F]:K.push(F))}else K={lane:F,tag:j.tag,payload:j.payload,callback:j.callback,next:null},J===null?(G=J=K,R=ee):J=J.next=K,x|=F;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;K=j,j=K.next,K.next=null,f.lastBaseUpdate=K,f.shared.pending=null}}while(!0);J===null&&(R=ee),f.baseState=R,f.firstBaseUpdate=G,f.lastBaseUpdate=J,h===null&&(f.shared.lanes=0),ga|=x,e.lanes=x,e.memoizedState=ee}}function og(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function rg(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)og(a[e],n)}var Xi=Ge(null),Ol=Ge(0);function lg(e,n){e=Ps,Ne(Ol,e),Ne(Xi,n),Ps=e|n.baseLanes}function pu(){Ne(Ol,Ps),Ne(Xi,Xi.current)}function mu(){Ps=Ol.current,De(Xi),De(Ol)}var Tn=Ge(null),Hn=null;function fa(e){var n=e.alternate;Ne(Dt,Dt.current&1),Ne(Tn,e),Hn===null&&(n===null||Xi.current!==null||n.memoizedState!==null)&&(Hn=e)}function hu(e){Ne(Dt,Dt.current),Ne(Tn,e),Hn===null&&(Hn=e)}function cg(e){e.tag===22?(Ne(Dt,Dt.current),Ne(Tn,e),Hn===null&&(Hn=e)):pa()}function pa(){Ne(Dt,Dt.current),Ne(Tn,Tn.current)}function wn(e){De(Tn),Hn===e&&(Hn=null),De(Dt)}var Dt=Ge(0);function Ll(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||kf(a)||Sf(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 Ms=0,Me=null,it=null,Bt=null,Bl=!1,Qi=!1,ii=!1,zl=0,nr=0,eo=null,Uk=0;function wt(){throw Error(r(321))}function gu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!kn(e[a],n[a]))return!1;return!0}function vu(e,n,a,l,f,h){return Ms=h,Me=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,D.H=e===null||e.memoizedState===null?Fg:Ru,ii=!1,h=a(l,f),ii=!1,Qi&&(h=ug(n,a,l,f)),dg(e),h}function dg(e){D.H=ir;var n=it!==null&&it.next!==null;if(Ms=0,Bt=it=Me=null,Bl=!1,nr=0,eo=null,n)throw Error(r(300));e===null||zt||(e=e.dependencies,e!==null&&Cl(e)&&(zt=!0))}function ug(e,n,a,l){Me=e;var f=0;do{if(Qi&&(eo=null),nr=0,Qi=!1,25<=f)throw Error(r(301));if(f+=1,Bt=it=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}D.H=Zg,h=n(a,l)}while(Qi);return h}function $k(){var e=D.H,n=e.useState()[0];return n=typeof n.then=="function"?sr(n):n,e=e.useState()[0],(it!==null?it.memoizedState:null)!==e&&(Me.flags|=1024),n}function yu(){var e=zl!==0;return zl=0,e}function bu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function _u(e){if(Bl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Bl=!1}Ms=0,Bt=it=Me=null,Qi=!1,nr=zl=0,eo=null}function ln(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?Me.memoizedState=Bt=e:Bt=Bt.next=e,Bt}function Rt(){if(it===null){var e=Me.alternate;e=e!==null?e.memoizedState:null}else e=it.next;var n=Bt===null?Me.memoizedState:Bt.next;if(n!==null)Bt=n,it=e;else{if(e===null)throw Me.alternate===null?Error(r(467)):Error(r(310));it=e,e={memoizedState:it.memoizedState,baseState:it.baseState,baseQueue:it.baseQueue,queue:it.queue,next:null},Bt===null?Me.memoizedState=Bt=e:Bt=Bt.next=e}return Bt}function Ul(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function sr(e){var n=nr;return nr+=1,eo===null&&(eo=[]),e=tg(eo,e,n),n=Me,(Bt===null?n.memoizedState:Bt.next)===null&&(n=n.alternate,D.H=n===null||n.memoizedState===null?Fg:Ru),e}function $l(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return sr(e);if(e.$$typeof===E)return Jt(e)}throw Error(r(438,String(e)))}function xu(e){var n=null,a=Me.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=Me.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=Ul(),Me.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]=W;return n.index++,a}function Is(e,n){return typeof n=="function"?n(e):n}function Pl(e){var n=Rt();return ku(n,it,e)}function ku(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 x=f.next;f.next=h.next,h.next=x}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var j=x=null,R=null,G=n,J=!1;do{var ee=G.lane&-536870913;if(ee!==G.lane?(Pe&ee)===ee:(Ms&ee)===ee){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}),ee===Ki&&(J=!0);else if((Ms&F)===F){G=G.next,F===Ki&&(J=!0);continue}else ee={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},R===null?(j=R=ee,x=h):R=R.next=ee,Me.lanes|=F,ga|=F;ee=G.action,ii&&a(h,ee),h=G.hasEagerState?G.eagerState:a(h,ee)}else F={lane:ee,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},R===null?(j=R=F,x=h):R=R.next=F,Me.lanes|=ee,ga|=ee;G=G.next}while(G!==null&&G!==n);if(R===null?x=h:R.next=j,!kn(h,e.memoizedState)&&(zt=!0,J&&(a=Yi,a!==null)))throw a;e.memoizedState=h,e.baseState=x,e.baseQueue=R,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Su(e){var n=Rt(),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 x=f=f.next;do h=e(h,x.action),x=x.next;while(x!==f);kn(h,n.memoizedState)||(zt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,l]}function fg(e,n,a){var l=Me,f=Rt(),h=Ve;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=n();var x=!kn((it||f).memoizedState,a);if(x&&(f.memoizedState=a,zt=!0),f=f.queue,ju(hg.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||Bt!==null&&Bt.memoizedState.tag&1){if(l.flags|=2048,to(9,{destroy:void 0},mg.bind(null,l,f,a,n),null),ft===null)throw Error(r(349));h||(Ms&127)!==0||pg(l,n,a)}return a}function pg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Me.updateQueue,n===null?(n=Ul(),Me.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function mg(e,n,a,l){n.value=a,n.getSnapshot=l,gg(n)&&vg(e)}function hg(e,n,a){return a(function(){gg(n)&&vg(e)})}function gg(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!kn(e,a)}catch{return!0}}function vg(e){var n=Ja(e,2);n!==null&&vn(n,e,2)}function Tu(e){var n=ln();if(typeof e=="function"){var a=e;if(e=a(),ii){Xn(!0);try{a()}finally{Xn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Is,lastRenderedState:e},n}function yg(e,n,a,l){return e.baseState=a,ku(e,it,typeof l=="function"?l:Is)}function Pk(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(x){h.listeners.push(x)}};D.T!==null?a(!0):h.isTransition=!1,l(h),a=n.pending,a===null?(h.next=n.pending=h,bg(n,h)):(h.next=a.next,n.pending=a.next=h)}}function bg(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=D.T,x={};D.T=x;try{var j=a(f,l),R=D.S;R!==null&&R(x,j),_g(e,n,j)}catch(G){wu(e,n,G)}finally{h!==null&&x.types!==null&&(h.types=x.types),D.T=h}}else try{h=a(f,l),_g(e,n,h)}catch(G){wu(e,n,G)}}function _g(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){xg(e,n,l)},function(l){return wu(e,n,l)}):xg(e,n,a)}function xg(e,n,a){n.status="fulfilled",n.value=a,kg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,bg(e,a)))}function wu(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,kg(n),n=n.next;while(n!==l)}e.action=null}function kg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Sg(e,n){return n}function Tg(e,n){if(Ve){var a=ft.formState;if(a!==null){e:{var l=Me;if(Ve){if(gt){t:{for(var f=gt,h=Pn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Vn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){gt=Vn(f.nextSibling),l=f.data==="F!";break e}}ra(l)}l=!1}l&&(n=a[0])}}return a=ln(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sg,lastRenderedState:n},a.queue=l,a=Vg.bind(null,Me,l),l.dispatch=a,l=Tu(!1),h=Du.bind(null,Me,!1,l.queue),l=ln(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=Pk.bind(null,Me,f,h,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function wg(e){var n=Rt();return jg(n,it,e)}function jg(e,n,a){if(n=ku(e,n,Sg)[0],e=Pl(Is)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=sr(n)}catch(x){throw x===Ji?Dl:x}else l=n;n=Rt();var f=n.queue,h=f.dispatch;return a!==n.memoizedState&&(Me.flags|=2048,to(9,{destroy:void 0},Hk.bind(null,f,a),null)),[l,h,e]}function Hk(e,n){e.action=n}function Ng(e){var n=Rt(),a=it;if(a!==null)return jg(n,a,e);Rt(),n=n.memoizedState,a=Rt();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function to(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=Me.updateQueue,n===null&&(n=Ul(),Me.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 Cg(){return Rt().memoizedState}function Hl(e,n,a,l){var f=ln();Me.flags|=e,f.memoizedState=to(1|n,{destroy:void 0},a,l===void 0?null:l)}function Vl(e,n,a,l){var f=Rt();l=l===void 0?null:l;var h=f.memoizedState.inst;it!==null&&l!==null&&gu(l,it.memoizedState.deps)?f.memoizedState=to(n,h,a,l):(Me.flags|=e,f.memoizedState=to(1|n,h,a,l))}function Eg(e,n){Hl(8390656,8,e,n)}function ju(e,n){Vl(2048,8,e,n)}function Vk(e){Me.flags|=4;var n=Me.updateQueue;if(n===null)n=Ul(),Me.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Ag(e){var n=Rt().memoizedState;return Vk({ref:n,nextImpl:e}),function(){if((et&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Dg(e,n){return Vl(4,2,e,n)}function Rg(e,n){return Vl(4,4,e,n)}function Mg(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 Ig(e,n,a){a=a!=null?a.concat([e]):null,Vl(4,4,Mg.bind(null,n,e),a)}function Nu(){}function Og(e,n){var a=Rt();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&gu(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Lg(e,n){var a=Rt();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&gu(n,l[1]))return l[0];if(l=e(),ii){Xn(!0);try{e()}finally{Xn(!1)}}return a.memoizedState=[l,n],l}function Cu(e,n,a){return a===void 0||(Ms&1073741824)!==0&&(Pe&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Bv(),Me.lanes|=e,ga|=e,a)}function Bg(e,n,a,l){return kn(a,n)?a:Xi.current!==null?(e=Cu(e,a,l),kn(e,n)||(zt=!0),e):(Ms&42)===0||(Ms&1073741824)!==0&&(Pe&261930)===0?(zt=!0,e.memoizedState=a):(e=Bv(),Me.lanes|=e,ga|=e,n)}function zg(e,n,a,l,f){var h=Z.p;Z.p=h!==0&&8>h?h:8;var x=D.T,j={};D.T=j,Du(e,!1,n,a);try{var R=f(),G=D.S;if(G!==null&&G(j,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var J=zk(R,l);ar(e,n,J,Cn(e))}else ar(e,n,l,Cn(e))}catch(ee){ar(e,n,{then:function(){},status:"rejected",reason:ee},Cn())}finally{Z.p=h,x!==null&&j.types!==null&&(x.types=j.types),D.T=x}}function qk(){}function Eu(e,n,a,l){if(e.tag!==5)throw Error(r(476));var f=Ug(e).queue;zg(e,f,n,se,a===null?qk:function(){return $g(e),a(l)})}function Ug(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Is,lastRenderedState:se},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Is,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function $g(e){var n=Ug(e);n.next===null&&(n=e.alternate.memoizedState),ar(e,n.next.queue,{},Cn())}function Au(){return Jt(xr)}function Pg(){return Rt().memoizedState}function Hg(){return Rt().memoizedState}function Gk(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Cn();e=da(a);var l=ua(n,e,a);l!==null&&(vn(l,n,a),Qo(l,n,a)),n={cache:iu()},e.payload=n;return}n=n.return}}function Fk(e,n,a){var l=Cn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ql(e)?qg(n,a):(a=Kd(e,n,a,l),a!==null&&(vn(a,e,l),Gg(a,n,l)))}function Vg(e,n,a){var l=Cn();ar(e,n,a,l)}function ar(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(ql(e))qg(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,j=h(x,a);if(f.hasEagerState=!0,f.eagerState=j,kn(j,x))return Tl(e,n,f,0),ft===null&&Sl(),!1}catch{}finally{}if(a=Kd(e,n,f,l),a!==null)return vn(a,e,l),Gg(a,n,l),!0}return!1}function Du(e,n,a,l){if(l={lane:2,revertLane:df(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ql(e)){if(n)throw Error(r(479))}else n=Kd(e,a,l,2),n!==null&&vn(n,e,2)}function ql(e){var n=e.alternate;return e===Me||n!==null&&n===Me}function qg(e,n){Qi=Bl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Gg(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Ze(e,a)}}var ir={readContext:Jt,use:$l,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};ir.useEffectEvent=wt;var Fg={readContext:Jt,use:$l,useCallback:function(e,n){return ln().memoizedState=[e,n===void 0?null:n],e},useContext:Jt,useEffect:Eg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Hl(4194308,4,Mg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Hl(4194308,4,e,n)},useInsertionEffect:function(e,n){Hl(4,2,e,n)},useMemo:function(e,n){var a=ln();n=n===void 0?null:n;var l=e();if(ii){Xn(!0);try{e()}finally{Xn(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=ln();if(a!==void 0){var f=a(n);if(ii){Xn(!0);try{a(n)}finally{Xn(!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=Fk.bind(null,Me,e),[l.memoizedState,e]},useRef:function(e){var n=ln();return e={current:e},n.memoizedState=e},useState:function(e){e=Tu(e);var n=e.queue,a=Vg.bind(null,Me,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Nu,useDeferredValue:function(e,n){var a=ln();return Cu(a,e,n)},useTransition:function(){var e=Tu(!1);return e=zg.bind(null,Me,e.queue,!0,!1),ln().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=Me,f=ln();if(Ve){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),ft===null)throw Error(r(349));(Pe&127)!==0||pg(l,n,a)}f.memoizedState=a;var h={value:a,getSnapshot:n};return f.queue=h,Eg(hg.bind(null,l,h,e),[e]),l.flags|=2048,to(9,{destroy:void 0},mg.bind(null,l,h,a,n),null),a},useId:function(){var e=ln(),n=ft.identifierPrefix;if(Ve){var a=ps,l=fs;a=(l&~(1<<32-nn(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=zl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Uk++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Au,useFormState:Tg,useActionState:Tg,useOptimistic:function(e){var n=ln();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Du.bind(null,Me,!0,a),a.dispatch=n,[e,n]},useMemoCache:xu,useCacheRefresh:function(){return ln().memoizedState=Gk.bind(null,Me)},useEffectEvent:function(e){var n=ln(),a={impl:e};return n.memoizedState=a,function(){if((et&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Ru={readContext:Jt,use:$l,useCallback:Og,useContext:Jt,useEffect:ju,useImperativeHandle:Ig,useInsertionEffect:Dg,useLayoutEffect:Rg,useMemo:Lg,useReducer:Pl,useRef:Cg,useState:function(){return Pl(Is)},useDebugValue:Nu,useDeferredValue:function(e,n){var a=Rt();return Bg(a,it.memoizedState,e,n)},useTransition:function(){var e=Pl(Is)[0],n=Rt().memoizedState;return[typeof e=="boolean"?e:sr(e),n]},useSyncExternalStore:fg,useId:Pg,useHostTransitionStatus:Au,useFormState:wg,useActionState:wg,useOptimistic:function(e,n){var a=Rt();return yg(a,it,e,n)},useMemoCache:xu,useCacheRefresh:Hg};Ru.useEffectEvent=Ag;var Zg={readContext:Jt,use:$l,useCallback:Og,useContext:Jt,useEffect:ju,useImperativeHandle:Ig,useInsertionEffect:Dg,useLayoutEffect:Rg,useMemo:Lg,useReducer:Su,useRef:Cg,useState:function(){return Su(Is)},useDebugValue:Nu,useDeferredValue:function(e,n){var a=Rt();return it===null?Cu(a,e,n):Bg(a,it.memoizedState,e,n)},useTransition:function(){var e=Su(Is)[0],n=Rt().memoizedState;return[typeof e=="boolean"?e:sr(e),n]},useSyncExternalStore:fg,useId:Pg,useHostTransitionStatus:Au,useFormState:Ng,useActionState:Ng,useOptimistic:function(e,n){var a=Rt();return it!==null?yg(a,it,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:xu,useCacheRefresh:Hg};Zg.useEffectEvent=Ag;function Mu(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Iu={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=Cn(),f=da(l);f.payload=n,a!=null&&(f.callback=a),n=ua(e,f,l),n!==null&&(vn(n,e,l),Qo(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=Cn(),f=da(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=ua(e,f,l),n!==null&&(vn(n,e,l),Qo(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Cn(),l=da(a);l.tag=2,n!=null&&(l.callback=n),n=ua(e,l,a),n!==null&&(vn(n,e,a),Qo(n,e,a))}};function Kg(e,n,a,l,f,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,x):n.prototype&&n.prototype.isPureReactComponent?!Go(a,l)||!Go(f,h):!0}function Yg(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&&Iu.enqueueReplaceState(n,n.state,null)}function oi(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=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function Jg(e){kl(e)}function Wg(e){console.error(e)}function Xg(e){kl(e)}function Gl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function Qg(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 Ou(e,n,a){return a=da(a),a.tag=3,a.payload={element:null},a.callback=function(){Gl(e,n)},a}function ev(e){return e=da(e),e.tag=3,e}function tv(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(){Qg(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Qg(n,a,l),typeof f!="function"&&(va===null?va=new Set([this]):va.add(this));var j=l.stack;this.componentDidCatch(l.value,{componentStack:j!==null?j:""})})}function Zk(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&Zi(n,a,f,!0),a=Tn.current,a!==null){switch(a.tag){case 31:case 13:return Hn===null?sc():a.alternate===null&&jt===0&&(jt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Rl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),rf(e,l,f)),!1;case 22:return a.flags|=65536,l===Rl?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)),rf(e,l,f)),!1}throw Error(r(435,a.tag))}return rf(e,l,f),sc(),!1}if(Ve)return n=Tn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==eu&&(e=Error(r(422),{cause:l}),Ko(zn(e,a)))):(l!==eu&&(n=Error(r(423),{cause:l}),Ko(zn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=zn(l,a),f=Ou(e.stateNode,l,f),uu(e,f),jt!==4&&(jt=2)),!1;var h=Error(r(520),{cause:l});if(h=zn(h,a),pr===null?pr=[h]:pr.push(h),jt!==4&&(jt=2),n===null)return!0;l=zn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Ou(a.stateNode,l,e),uu(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"&&(va===null||!va.has(h))))return a.flags|=65536,f&=-f,a.lanes|=f,f=ev(f),tv(f,e,a,l),uu(a,f),!1}a=a.return}while(a!==null);return!1}var Lu=Error(r(461)),zt=!1;function Wt(e,n,a,l){n.child=e===null?ig(n,null,a,l):ai(n,e.child,a,l)}function nv(e,n,a,l,f){a=a.render;var h=n.ref;if("ref"in l){var x={};for(var j in l)j!=="ref"&&(x[j]=l[j])}else x=l;return ei(n),l=vu(e,n,a,x,h,f),j=yu(),e!==null&&!zt?(bu(e,n,f),Os(e,n,f)):(Ve&&j&&Xd(n),n.flags|=1,Wt(e,n,l,f),n.child)}function sv(e,n,a,l,f){if(e===null){var h=a.type;return typeof h=="function"&&!Yd(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,av(e,n,h,l,f)):(e=jl(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!qu(e,f)){var x=h.memoizedProps;if(a=a.compare,a=a!==null?a:Go,a(x,l)&&e.ref===n.ref)return Os(e,n,f)}return n.flags|=1,e=Es(h,l),e.ref=n.ref,e.return=n,n.child=e}function av(e,n,a,l,f){if(e!==null){var h=e.memoizedProps;if(Go(h,l)&&e.ref===n.ref)if(zt=!1,n.pendingProps=l=h,qu(e,f))(e.flags&131072)!==0&&(zt=!0);else return n.lanes=e.lanes,Os(e,n,f)}return Bu(e,n,a,l,f)}function iv(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 ov(e,n,h,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Al(n,h!==null?h.cachePool:null),h!==null?lg(n,h):pu(),cg(n);else return l=n.lanes=536870912,ov(e,n,h!==null?h.baseLanes|a:a,a,l)}else h!==null?(Al(n,h.cachePool),lg(n,h),pa(),n.memoizedState=null):(e!==null&&Al(n,null),pu(),pa());return Wt(e,n,f,a),n.child}function or(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function ov(e,n,a,l,f){var h=ru();return h=h===null?null:{parent:Lt._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Al(n,null),pu(),cg(n),e!==null&&Zi(e,n,l,!0),n.childLanes=f,null}function Fl(e,n){return n=Kl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function rv(e,n,a){return ai(n,e.child,null,a),e=Fl(n,n.pendingProps),e.flags|=2,wn(n),n.memoizedState=null,e}function Kk(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ve){if(l.mode==="hidden")return e=Fl(n,l),n.lanes=536870912,or(null,e);if(hu(n),(e=gt)?(e=b0(e,Pn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ia!==null?{id:fs,overflow:ps}:null,retryLane:536870912,hydrationErrors:null},a=qh(e),a.return=n,n.child=a,Yt=n,gt=null)):e=null,e===null)throw ra(n);return n.lanes=536870912,null}return Fl(n,l)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(hu(n),f)if(n.flags&256)n.flags&=-257,n=rv(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(zt||Zi(e,n,a,!1),f=(a&e.childLanes)!==0,zt||f){if(l=ft,l!==null&&(x=ut(l,a),x!==0&&x!==h.retryLane))throw h.retryLane=x,Ja(e,x),vn(l,e,x),Lu;sc(),n=rv(e,n,a)}else e=h.treeContext,gt=Vn(x.nextSibling),Yt=n,Ve=!0,oa=null,Pn=!1,e!==null&&Zh(n,e),n=Fl(n,l),n.flags|=4096;return n}return e=Es(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Zl(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 Bu(e,n,a,l,f){return ei(n),a=vu(e,n,a,l,void 0,f),l=yu(),e!==null&&!zt?(bu(e,n,f),Os(e,n,f)):(Ve&&l&&Xd(n),n.flags|=1,Wt(e,n,a,f),n.child)}function lv(e,n,a,l,f,h){return ei(n),n.updateQueue=null,a=ug(n,l,a,f),dg(e),l=yu(),e!==null&&!zt?(bu(e,n,h),Os(e,n,h)):(Ve&&l&&Xd(n),n.flags|=1,Wt(e,n,a,h),n.child)}function cv(e,n,a,l,f){if(ei(n),n.stateNode===null){var h=Vi,x=a.contextType;typeof x=="object"&&x!==null&&(h=Jt(x)),h=new a(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Iu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},cu(n),x=a.contextType,h.context=typeof x=="object"&&x!==null?Jt(x):Vi,h.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Mu(n,a,x,l),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Iu.enqueueReplaceState(h,h.state,null),tr(n,l,h,f),er(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var j=n.memoizedProps,R=oi(a,j);h.props=R;var G=h.context,J=a.contextType;x=Vi,typeof J=="object"&&J!==null&&(x=Jt(J));var ee=a.getDerivedStateFromProps;J=typeof ee=="function"||typeof h.getSnapshotBeforeUpdate=="function",j=n.pendingProps!==j,J||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(j||G!==x)&&Yg(n,h,l,x),ca=!1;var F=n.memoizedState;h.state=F,tr(n,l,h,f),er(),G=n.memoizedState,j||F!==G||ca?(typeof ee=="function"&&(Mu(n,a,ee,l),G=n.memoizedState),(R=ca||Kg(n,a,R,l,F,G,x))?(J||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=x,l=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,du(e,n),x=n.memoizedProps,J=oi(a,x),h.props=J,ee=n.pendingProps,F=h.context,G=a.contextType,R=Vi,typeof G=="object"&&G!==null&&(R=Jt(G)),j=a.getDerivedStateFromProps,(G=typeof j=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ee||F!==R)&&Yg(n,h,l,R),ca=!1,F=n.memoizedState,h.state=F,tr(n,l,h,f),er();var K=n.memoizedState;x!==ee||F!==K||ca||e!==null&&e.dependencies!==null&&Cl(e.dependencies)?(typeof j=="function"&&(Mu(n,a,j,l),K=n.memoizedState),(J=ca||Kg(n,a,J,l,F,K,R)||e!==null&&e.dependencies!==null&&Cl(e.dependencies))?(G||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,K,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,K,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=K),h.props=l,h.state=K,h.context=R,l=J):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,Zl(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=ai(n,e.child,null,f),n.child=ai(n,null,a,f)):Wt(e,n,a,f),n.memoizedState=h.state,e=n.child):e=Os(e,n,f),e}function dv(e,n,a,l){return Xa(),n.flags|=256,Wt(e,n,a,l),n.child}var zu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Uu(e){return{baseLanes:e,cachePool:Qh()}}function $u(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Nn),e}function uv(e,n,a){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(Dt.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ve){if(f?fa(n):pa(),(e=gt)?(e=b0(e,Pn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ia!==null?{id:fs,overflow:ps}:null,retryLane:536870912,hydrationErrors:null},a=qh(e),a.return=n,n.child=a,Yt=n,gt=null)):e=null,e===null)throw ra(n);return Sf(e)?n.lanes=32:n.lanes=536870912,null}var j=l.children;return l=l.fallback,f?(pa(),f=n.mode,j=Kl({mode:"hidden",children:j},f),l=Wa(l,f,a,null),j.return=n,l.return=n,j.sibling=l,n.child=j,l=n.child,l.memoizedState=Uu(a),l.childLanes=$u(e,x,a),n.memoizedState=zu,or(null,l)):(fa(n),Pu(n,j))}var R=e.memoizedState;if(R!==null&&(j=R.dehydrated,j!==null)){if(h)n.flags&256?(fa(n),n.flags&=-257,n=Hu(e,n,a)):n.memoizedState!==null?(pa(),n.child=e.child,n.flags|=128,n=null):(pa(),j=l.fallback,f=n.mode,l=Kl({mode:"visible",children:l.children},f),j=Wa(j,f,a,null),j.flags|=2,l.return=n,j.return=n,l.sibling=j,n.child=l,ai(n,e.child,null,a),l=n.child,l.memoizedState=Uu(a),l.childLanes=$u(e,x,a),n.memoizedState=zu,n=or(null,l));else if(fa(n),Sf(j)){if(x=j.nextSibling&&j.nextSibling.dataset,x)var G=x.dgst;x=G,l=Error(r(419)),l.stack="",l.digest=x,Ko({value:l,source:null,stack:null}),n=Hu(e,n,a)}else if(zt||Zi(e,n,a,!1),x=(a&e.childLanes)!==0,zt||x){if(x=ft,x!==null&&(l=ut(x,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,Ja(e,l),vn(x,e,l),Lu;kf(j)||sc(),n=Hu(e,n,a)}else kf(j)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,gt=Vn(j.nextSibling),Yt=n,Ve=!0,oa=null,Pn=!1,e!==null&&Zh(n,e),n=Pu(n,l.children),n.flags|=4096);return n}return f?(pa(),j=l.fallback,f=n.mode,R=e.child,G=R.sibling,l=Es(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,G!==null?j=Es(G,j):(j=Wa(j,f,a,null),j.flags|=2),j.return=n,l.return=n,l.sibling=j,n.child=l,or(null,l),l=n.child,j=e.child.memoizedState,j===null?j=Uu(a):(f=j.cachePool,f!==null?(R=Lt._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=Qh(),j={baseLanes:j.baseLanes|a,cachePool:f}),l.memoizedState=j,l.childLanes=$u(e,x,a),n.memoizedState=zu,or(e.child,l)):(fa(n),a=e.child,e=a.sibling,a=Es(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function Pu(e,n){return n=Kl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Kl(e,n){return e=Sn(22,e,null,n),e.lanes=0,e}function Hu(e,n,a){return ai(n,e.child,null,a),e=Pu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function fv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),su(e.return,n,a)}function Vu(e,n,a,l,f,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=a,x.tailMode=f,x.treeForkCount=h)}function pv(e,n,a){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var x=Dt.current,j=(x&2)!==0;if(j?(x=x&1|2,n.flags|=128):x&=1,Ne(Dt,x),Wt(e,n,l,a),l=Ve?Zo:0,!j&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&fv(e,a,n);else if(e.tag===19)fv(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&&Ll(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Vu(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&&Ll(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Vu(n,!0,a,null,h,l);break;case"together":Vu(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Os(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),ga|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Zi(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=Es(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Es(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function qu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Cl(e)))}function Yk(e,n,a){switch(n.tag){case 3:Ue(n,n.stateNode.containerInfo),la(n,Lt,e.memoizedState.cache),Xa();break;case 27:case 5:bn(n);break;case 4:Ue(n,n.stateNode.containerInfo);break;case 10:la(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,hu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(fa(n),n.flags|=128,null):(a&n.child.childLanes)!==0?uv(e,n,a):(fa(n),e=Os(e,n,a),e!==null?e.sibling:null);fa(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(Zi(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return pv(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ne(Dt,Dt.current),l)break;return null;case 22:return n.lanes=0,iv(e,n,a,n.pendingProps);case 24:la(n,Lt,e.memoizedState.cache)}return Os(e,n,a)}function mv(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)zt=!0;else{if(!qu(e,a)&&(n.flags&128)===0)return zt=!1,Yk(e,n,a);zt=(e.flags&131072)!==0}else zt=!1,Ve&&(n.flags&1048576)!==0&&Fh(n,Zo,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=ni(n.elementType),n.type=e,typeof e=="function")Yd(e)?(l=oi(e,l),n.tag=1,n=cv(null,n,e,l,a)):(n.tag=0,n=Bu(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===B){n.tag=11,n=nv(null,n,e,l,a);break e}else if(f===O){n.tag=14,n=sv(null,n,e,l,a);break e}}throw n=Y(e)||e,Error(r(306,n,""))}}return n;case 0:return Bu(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=oi(l,n.pendingProps),cv(e,n,l,f,a);case 3:e:{if(Ue(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var h=n.memoizedState;f=h.element,du(e,n),tr(n,l,null,a);var x=n.memoizedState;if(l=x.cache,la(n,Lt,l),l!==h.cache&&au(n,[Lt],a,!0),er(),l=x.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=dv(e,n,l,a);break e}else if(l!==f){f=zn(Error(r(424)),n),Ko(f),n=dv(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(gt=Vn(e.firstChild),Yt=n,Ve=!0,oa=null,Pn=!0,a=ig(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Xa(),l===f){n=Os(e,n,a);break e}Wt(e,n,l,a)}n=n.child}return n;case 26:return Zl(e,n),e===null?(a=w0(n.type,null,n.pendingProps,null))?n.memoizedState=a:Ve||(a=n.type,e=n.pendingProps,l=dc(ye.current).createElement(a),l[ht]=n,l[qt]=e,Xt(l,a,e),Gt(l),n.stateNode=l):n.memoizedState=w0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return bn(n),e===null&&Ve&&(l=n.stateNode=k0(n.type,n.pendingProps,ye.current),Yt=n,Pn=!0,f=gt,xa(n.type)?(Tf=f,gt=Vn(l.firstChild)):gt=f),Wt(e,n,n.pendingProps.children,a),Zl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ve&&((f=l=gt)&&(l=wS(l,n.type,n.pendingProps,Pn),l!==null?(n.stateNode=l,Yt=n,gt=Vn(l.firstChild),Pn=!1,f=!0):f=!1),f||ra(n)),bn(n),f=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,l=h.children,bf(f,h)?l=null:x!==null&&bf(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=vu(e,n,$k,null,null,a),xr._currentValue=f),Zl(e,n),Wt(e,n,l,a),n.child;case 6:return e===null&&Ve&&((e=a=gt)&&(a=jS(a,n.pendingProps,Pn),a!==null?(n.stateNode=a,Yt=n,gt=null,e=!0):e=!1),e||ra(n)),null;case 13:return uv(e,n,a);case 4:return Ue(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=ai(n,null,l,a):Wt(e,n,l,a),n.child;case 11:return nv(e,n,n.type,n.pendingProps,a);case 7:return Wt(e,n,n.pendingProps,a),n.child;case 8:return Wt(e,n,n.pendingProps.children,a),n.child;case 12:return Wt(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,la(n,n.type,l.value),Wt(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,ei(n),f=Jt(f),l=l(f),n.flags|=1,Wt(e,n,l,a),n.child;case 14:return sv(e,n,n.type,n.pendingProps,a);case 15:return av(e,n,n.type,n.pendingProps,a);case 19:return pv(e,n,a);case 31:return Kk(e,n,a);case 22:return iv(e,n,a,n.pendingProps);case 24:return ei(n),l=Jt(Lt),e===null?(f=ru(),f===null&&(f=ft,h=iu(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=a),f=h),n.memoizedState={parent:l,cache:f},cu(n),la(n,Lt,f)):((e.lanes&a)!==0&&(du(e,n),tr(n,null,null,a),er()),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),la(n,Lt,l)):(l=h.cache,la(n,Lt,l),l!==f.cache&&au(n,[Lt],a,!0))),Wt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Ls(e){e.flags|=4}function Gu(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(Pv())e.flags|=8192;else throw si=Rl,lu}else e.flags&=-16777217}function hv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!A0(n))if(Pv())e.flags|=8192;else throw si=Rl,lu}function Yl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?pe():536870912,e.lanes|=n,io|=n)}function rr(e,n){if(!Ve)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 vt(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 Jk(e,n,a){var l=n.pendingProps;switch(Qd(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(n),null;case 1:return vt(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Rs(Lt),pt(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Fi(n)?Ls(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,tu())),vt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(Ls(n),h!==null?(vt(n),hv(n,h)):(vt(n),Gu(n,f,null,l,a))):h?h!==e.memoizedState?(Ls(n),vt(n),hv(n,h)):(vt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Ls(n),vt(n),Gu(n,f,e,l,a)),null;case 27:if(ae(n),a=ye.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Ls(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return vt(n),null}e=Oe.current,Fi(n)?Kh(n):(e=k0(f,l,a),n.stateNode=e,Ls(n))}return vt(n),null;case 5:if(ae(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Ls(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return vt(n),null}if(h=Oe.current,Fi(n))Kh(n);else{var x=dc(ye.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?x.createElement(f,{is:l.is}):x.createElement(f)}}h[ht]=n,h[qt]=l;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(Xt(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&&Ls(n)}}return vt(n),Gu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Ls(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=ye.current,Fi(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=Yt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[ht]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||u0(e.nodeValue,a)),e||ra(n,!0)}else e=dc(e).createTextNode(l),e[ht]=n,n.stateNode=e}return vt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=Fi(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[ht]=n}else Xa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;vt(n),e=!1}else a=tu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(wn(n),n):(wn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return vt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=Fi(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[ht]=n}else Xa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;vt(n),f=!1}else f=tu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(wn(n),n):(wn(n),null)}return wn(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),Yl(n,n.updateQueue),vt(n),null);case 4:return pt(),e===null&&mf(n.stateNode.containerInfo),vt(n),null;case 10:return Rs(n.type),vt(n),null;case 19:if(De(Dt),l=n.memoizedState,l===null)return vt(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)rr(l,!1);else{if(jt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Ll(e),h!==null){for(n.flags|=128,rr(l,!1),e=h.updateQueue,n.updateQueue=e,Yl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Vh(a,e),a=a.sibling;return Ne(Dt,Dt.current&1|2),Ve&&As(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&_e()>ec&&(n.flags|=128,f=!0,rr(l,!1),n.lanes=4194304)}else{if(!f)if(e=Ll(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Yl(n,e),rr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Ve)return vt(n),null}else 2*_e()-l.renderingStartTime>ec&&a!==536870912&&(n.flags|=128,f=!0,rr(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=_e(),e.sibling=null,a=Dt.current,Ne(Dt,f?a&1|2:a&1),Ve&&As(n,l.treeForkCount),e):(vt(n),null);case 22:case 23:return wn(n),mu(),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&&(vt(n),n.subtreeFlags&6&&(n.flags|=8192)):vt(n),a=n.updateQueue,a!==null&&Yl(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&&De(ti),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Rs(Lt),vt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function Wk(e,n){switch(Qd(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Rs(Lt),pt(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ae(n),null;case 31:if(n.memoizedState!==null){if(wn(n),n.alternate===null)throw Error(r(340));Xa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(wn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Xa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return De(Dt),null;case 4:return pt(),null;case 10:return Rs(n.type),null;case 22:case 23:return wn(n),mu(),e!==null&&De(ti),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Rs(Lt),null;case 25:return null;default:return null}}function gv(e,n){switch(Qd(n),n.tag){case 3:Rs(Lt),pt();break;case 26:case 27:case 5:ae(n);break;case 4:pt();break;case 31:n.memoizedState!==null&&wn(n);break;case 13:wn(n);break;case 19:De(Dt);break;case 10:Rs(n.type);break;case 22:case 23:wn(n),mu(),e!==null&&De(ti);break;case 24:Rs(Lt)}}function lr(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,x=a.inst;l=h(),x.destroy=l}a=a.next}while(a!==f)}}catch(j){st(n,n.return,j)}}function ma(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 x=l.inst,j=x.destroy;if(j!==void 0){x.destroy=void 0,f=n;var R=a,G=j;try{G()}catch(J){st(f,R,J)}}}l=l.next}while(l!==h)}}catch(J){st(n,n.return,J)}}function vv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{rg(n,a)}catch(l){st(e,e.return,l)}}}function yv(e,n,a){a.props=oi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){st(e,n,l)}}function cr(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){st(e,n,f)}}function ms(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){st(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){st(e,n,f)}else a.current=null}function bv(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){st(e,e.return,f)}}function Fu(e,n,a){try{var l=e.stateNode;bS(l,e.type,a,n),l[qt]=n}catch(f){st(e,e.return,f)}}function _v(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&xa(e.type)||e.tag===4}function Zu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_v(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&&xa(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 Ku(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=Ns));else if(l!==4&&(l===27&&xa(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Ku(e,n,a),e=e.sibling;e!==null;)Ku(e,n,a),e=e.sibling}function Jl(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&&xa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Jl(e,n,a),e=e.sibling;e!==null;)Jl(e,n,a),e=e.sibling}function xv(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Xt(n,l,a),n[ht]=e,n[qt]=a}catch(h){st(e,e.return,h)}}var Bs=!1,Ut=!1,Yu=!1,kv=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function Xk(e,n){if(e=e.containerInfo,vf=vc,e=Ih(e),Hd(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 x=0,j=-1,R=-1,G=0,J=0,ee=e,F=null;t:for(;;){for(var K;ee!==a||f!==0&&ee.nodeType!==3||(j=x+f),ee!==h||l!==0&&ee.nodeType!==3||(R=x+l),ee.nodeType===3&&(x+=ee.nodeValue.length),(K=ee.firstChild)!==null;)F=ee,ee=K;for(;;){if(ee===e)break t;if(F===a&&++G===f&&(j=x),F===h&&++J===l&&(R=x),(K=ee.nextSibling)!==null)break;ee=F,F=ee.parentNode}ee=K}a=j===-1||R===-1?null:{start:j,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(yf={focusedElem:e,selectionRange:a},vc=!1,Ft=n;Ft!==null;)if(n=Ft,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Ft=e;else for(;Ft!==null;){switch(n=Ft,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 ve=oi(a.type,f);e=l.getSnapshotBeforeUpdate(ve,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(we){st(a,a.return,we)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)xf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":xf(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,Ft=e;break}Ft=n.return}}function Sv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Us(e,a),l&4&&lr(5,a);break;case 1:if(Us(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){st(a,a.return,x)}else{var f=oi(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){st(a,a.return,x)}}l&64&&vv(a),l&512&&cr(a,a.return);break;case 3:if(Us(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{rg(e,n)}catch(x){st(a,a.return,x)}}break;case 27:n===null&&l&4&&xv(a);case 26:case 5:Us(e,a),n===null&&l&4&&bv(a),l&512&&cr(a,a.return);break;case 12:Us(e,a);break;case 31:Us(e,a),l&4&&jv(e,a);break;case 13:Us(e,a),l&4&&Nv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=rS.bind(null,a),NS(e,a))));break;case 22:if(l=a.memoizedState!==null||Bs,!l){n=n!==null&&n.memoizedState!==null||Ut,f=Bs;var h=Ut;Bs=l,(Ut=n)&&!h?$s(e,a,(a.subtreeFlags&8772)!==0):Us(e,a),Bs=f,Ut=h}break;case 30:break;default:Us(e,a)}}function Tv(e){var n=e.alternate;n!==null&&(e.alternate=null,Tv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&wd(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 kt=null,pn=!1;function zs(e,n,a){for(a=a.child;a!==null;)wv(e,n,a),a=a.sibling}function wv(e,n,a){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(sa,a)}catch{}switch(a.tag){case 26:Ut||ms(a,n),zs(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ut||ms(a,n);var l=kt,f=pn;xa(a.type)&&(kt=a.stateNode,pn=!1),zs(e,n,a),yr(a.stateNode),kt=l,pn=f;break;case 5:Ut||ms(a,n);case 6:if(l=kt,f=pn,kt=null,zs(e,n,a),kt=l,pn=f,kt!==null)if(pn)try{(kt.nodeType===9?kt.body:kt.nodeName==="HTML"?kt.ownerDocument.body:kt).removeChild(a.stateNode)}catch(h){st(a,n,h)}else try{kt.removeChild(a.stateNode)}catch(h){st(a,n,h)}break;case 18:kt!==null&&(pn?(e=kt,v0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),mo(e)):v0(kt,a.stateNode));break;case 4:l=kt,f=pn,kt=a.stateNode.containerInfo,pn=!0,zs(e,n,a),kt=l,pn=f;break;case 0:case 11:case 14:case 15:ma(2,a,n),Ut||ma(4,a,n),zs(e,n,a);break;case 1:Ut||(ms(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&yv(a,n,l)),zs(e,n,a);break;case 21:zs(e,n,a);break;case 22:Ut=(l=Ut)||a.memoizedState!==null,zs(e,n,a),Ut=l;break;default:zs(e,n,a)}}function jv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{mo(e)}catch(a){st(n,n.return,a)}}}function Nv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{mo(e)}catch(a){st(n,n.return,a)}}function Qk(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new kv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new kv),n;default:throw Error(r(435,e.tag))}}function Wl(e,n){var a=Qk(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=lS.bind(null,e,l);l.then(f,f)}})}function mn(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],h=e,x=n,j=x;e:for(;j!==null;){switch(j.tag){case 27:if(xa(j.type)){kt=j.stateNode,pn=!1;break e}break;case 5:kt=j.stateNode,pn=!1;break e;case 3:case 4:kt=j.stateNode.containerInfo,pn=!0;break e}j=j.return}if(kt===null)throw Error(r(160));wv(h,x,f),kt=null,pn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Cv(n,e),n=n.sibling}var es=null;function Cv(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:mn(n,e),hn(e),l&4&&(ma(3,e,e.return),lr(3,e),ma(5,e,e.return));break;case 1:mn(n,e),hn(e),l&512&&(Ut||a===null||ms(a,a.return)),l&64&&Bs&&(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=es;if(mn(n,e),hn(e),l&512&&(Ut||a===null||ms(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[Lo]||h[ht]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),Xt(h,l,a),h[ht]=e,Gt(h),l=h;break e;case"link":var x=C0("link","href",f).get(l+(a.href||""));if(x){for(var j=0;j<x.length;j++)if(h=x[j],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)){x.splice(j,1);break t}}h=f.createElement(l),Xt(h,l,a),f.head.appendChild(h);break;case"meta":if(x=C0("meta","content",f).get(l+(a.content||""))){for(j=0;j<x.length;j++)if(h=x[j],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)){x.splice(j,1);break t}}h=f.createElement(l),Xt(h,l,a),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[ht]=e,Gt(h),l=h}e.stateNode=l}else E0(f,e.type,e.stateNode);else e.stateNode=N0(f,l,e.memoizedProps);else h!==l?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,l===null?E0(f,e.type,e.stateNode):N0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Fu(e,e.memoizedProps,a.memoizedProps)}break;case 27:mn(n,e),hn(e),l&512&&(Ut||a===null||ms(a,a.return)),a!==null&&l&4&&Fu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(mn(n,e),hn(e),l&512&&(Ut||a===null||ms(a,a.return)),e.flags&32){f=e.stateNode;try{Li(f,"")}catch(ve){st(e,e.return,ve)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,Fu(e,f,a!==null?a.memoizedProps:f)),l&1024&&(Yu=!0);break;case 6:if(mn(n,e),hn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ve){st(e,e.return,ve)}}break;case 3:if(pc=null,f=es,es=uc(n.containerInfo),mn(n,e),es=f,hn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{mo(n.containerInfo)}catch(ve){st(e,e.return,ve)}Yu&&(Yu=!1,Ev(e));break;case 4:l=es,es=uc(e.stateNode.containerInfo),mn(n,e),hn(e),es=l;break;case 12:mn(n,e),hn(e);break;case 31:mn(n,e),hn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Wl(e,l)));break;case 13:mn(n,e),hn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Ql=_e()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Wl(e,l)));break;case 22:f=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,G=Bs,J=Ut;if(Bs=G||f,Ut=J||R,mn(n,e),Ut=J,Bs=G,hn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||R||Bs||Ut||ri(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,f)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{j=R.stateNode;var ee=R.memoizedProps.style,F=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;j.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(ve){st(R,R.return,ve)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(ve){st(R,R.return,ve)}}}else if(n.tag===18){if(a===null){R=n;try{var K=R.stateNode;f?y0(K,!0):y0(R.stateNode,!1)}catch(ve){st(R,R.return,ve)}}}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,Wl(e,a))));break;case 19:mn(n,e),hn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Wl(e,l)));break;case 30:break;case 21:break;default:mn(n,e),hn(e)}}function hn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(_v(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,h=Zu(e);Jl(e,h,f);break;case 5:var x=a.stateNode;a.flags&32&&(Li(x,""),a.flags&=-33);var j=Zu(e);Jl(e,j,x);break;case 3:case 4:var R=a.stateNode.containerInfo,G=Zu(e);Ku(e,G,R);break;default:throw Error(r(161))}}catch(J){st(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Ev(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Ev(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Us(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Sv(e,n.alternate,n),n=n.sibling}function ri(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:ma(4,n,n.return),ri(n);break;case 1:ms(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&yv(n,n.return,a),ri(n);break;case 27:yr(n.stateNode);case 26:case 5:ms(n,n.return),ri(n);break;case 22:n.memoizedState===null&&ri(n);break;case 30:ri(n);break;default:ri(n)}e=e.sibling}}function $s(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:$s(f,h,a),lr(4,h);break;case 1:if($s(f,h,a),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(G){st(l,l.return,G)}if(l=h,f=l.updateQueue,f!==null){var j=l.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)og(R[f],j)}catch(G){st(l,l.return,G)}}a&&x&64&&vv(h),cr(h,h.return);break;case 27:xv(h);case 26:case 5:$s(f,h,a),a&&l===null&&x&4&&bv(h),cr(h,h.return);break;case 12:$s(f,h,a);break;case 31:$s(f,h,a),a&&x&4&&jv(f,h);break;case 13:$s(f,h,a),a&&x&4&&Nv(f,h);break;case 22:h.memoizedState===null&&$s(f,h,a),cr(h,h.return);break;case 30:break;default:$s(f,h,a)}n=n.sibling}}function Ju(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&&Yo(a))}function Wu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Yo(e))}function ts(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Av(e,n,a,l),n=n.sibling}function Av(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:ts(e,n,a,l),f&2048&&lr(9,n);break;case 1:ts(e,n,a,l);break;case 3:ts(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&&Yo(e)));break;case 12:if(f&2048){ts(e,n,a,l),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,j=h.onPostCommit;typeof j=="function"&&j(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){st(n,n.return,R)}}else ts(e,n,a,l);break;case 31:ts(e,n,a,l);break;case 13:ts(e,n,a,l);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?ts(e,n,a,l):dr(e,n):h._visibility&2?ts(e,n,a,l):(h._visibility|=2,no(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Ju(x,n);break;case 24:ts(e,n,a,l),f&2048&&Wu(n.alternate,n);break;default:ts(e,n,a,l)}}function no(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,j=a,R=l,G=x.flags;switch(x.tag){case 0:case 11:case 15:no(h,x,j,R,f),lr(8,x);break;case 23:break;case 22:var J=x.stateNode;x.memoizedState!==null?J._visibility&2?no(h,x,j,R,f):dr(h,x):(J._visibility|=2,no(h,x,j,R,f)),f&&G&2048&&Ju(x.alternate,x);break;case 24:no(h,x,j,R,f),f&&G&2048&&Wu(x.alternate,x);break;default:no(h,x,j,R,f)}n=n.sibling}}function dr(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:dr(a,l),f&2048&&Ju(l.alternate,l);break;case 24:dr(a,l),f&2048&&Wu(l.alternate,l);break;default:dr(a,l)}n=n.sibling}}var ur=8192;function so(e,n,a){if(e.subtreeFlags&ur)for(e=e.child;e!==null;)Dv(e,n,a),e=e.sibling}function Dv(e,n,a){switch(e.tag){case 26:so(e,n,a),e.flags&ur&&e.memoizedState!==null&&US(a,es,e.memoizedState,e.memoizedProps);break;case 5:so(e,n,a);break;case 3:case 4:var l=es;es=uc(e.stateNode.containerInfo),so(e,n,a),es=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ur,ur=16777216,so(e,n,a),ur=l):so(e,n,a));break;default:so(e,n,a)}}function Rv(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 fr(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];Ft=l,Iv(l,e)}Rv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Mv(e),e=e.sibling}function Mv(e){switch(e.tag){case 0:case 11:case 15:fr(e),e.flags&2048&&ma(9,e,e.return);break;case 3:fr(e);break;case 12:fr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Xl(e)):fr(e);break;default:fr(e)}}function Xl(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];Ft=l,Iv(l,e)}Rv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:ma(8,n,n.return),Xl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Xl(n));break;default:Xl(n)}e=e.sibling}}function Iv(e,n){for(;Ft!==null;){var a=Ft;switch(a.tag){case 0:case 11:case 15:ma(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:Yo(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Ft=l;else e:for(a=e;Ft!==null;){l=Ft;var f=l.sibling,h=l.return;if(Tv(l),l===a){Ft=null;break e}if(f!==null){f.return=h,Ft=f;break e}Ft=h}}}var eS={getCacheForType:function(e){var n=Jt(Lt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Jt(Lt).controller.signal}},tS=typeof WeakMap=="function"?WeakMap:Map,et=0,ft=null,Be=null,Pe=0,nt=0,jn=null,ha=!1,ao=!1,Xu=!1,Ps=0,jt=0,ga=0,li=0,Qu=0,Nn=0,io=0,pr=null,gn=null,ef=!1,Ql=0,Ov=0,ec=1/0,tc=null,va=null,Ht=0,ya=null,oo=null,Hs=0,tf=0,nf=null,Lv=null,mr=0,sf=null;function Cn(){return(et&2)!==0&&Pe!==0?Pe&-Pe:D.T!==null?df():Kt()}function Bv(){if(Nn===0)if((Pe&536870912)===0||Ve){var e=qa;qa<<=1,(qa&3932160)===0&&(qa=262144),Nn=e}else Nn=536870912;return e=Tn.current,e!==null&&(e.flags|=32),Nn}function vn(e,n,a){(e===ft&&(nt===2||nt===9)||e.cancelPendingCommit!==null)&&(ro(e,0),ba(e,Pe,Nn,!1)),$e(e,a),((et&2)===0||e!==ft)&&(e===ft&&((et&2)===0&&(li|=a),jt===4&&ba(e,Pe,Nn,!1)),hs(e))}function zv(e,n,a){if((et&6)!==0)throw Error(r(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ne(e,n),f=l?aS(e,n):of(e,n,!0),h=l;do{if(f===0){ao&&!l&&ba(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!nS(a)){f=of(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var j=e;f=pr;var R=j.current.memoizedState.isDehydrated;if(R&&(ro(j,x).flags|=256),x=of(j,x,!1),x!==2){if(Xu&&!R){j.errorRecoveryDisabledLanes|=h,li|=h,f=4;break e}h=gn,gn=f,h!==null&&(gn===null?gn=h:gn.push.apply(gn,h))}f=x}if(h=!1,f!==2)continue}}if(f===1){ro(e,0),ba(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:ba(l,n,Nn,!ha);break e;case 2:gn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=Ql+300-_e(),10<f)){if(ba(l,n,Nn,!ha),V(l,0,!0)!==0)break e;Hs=n,l.timeoutHandle=h0(Uv.bind(null,l,a,gn,tc,ef,n,Nn,li,io,ha,h,"Throttled",-0,0),f);break e}Uv(l,a,gn,tc,ef,n,Nn,li,io,ha,h,null,-0,0)}}break}while(!0);hs(e)}function Uv(e,n,a,l,f,h,x,j,R,G,J,ee,F,K){if(e.timeoutHandle=-1,ee=n.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ns},Dv(n,h,ee);var ve=(h&62914560)===h?Ql-_e():(h&4194048)===h?Ov-_e():0;if(ve=$S(ee,ve),ve!==null){Hs=h,e.cancelPendingCommit=ve(Zv.bind(null,e,n,h,a,l,f,x,j,R,J,ee,null,F,K)),ba(e,h,x,!G);return}}Zv(e,n,h,a,l,f,x,j,R)}function nS(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(!kn(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 ba(e,n,a,l){n&=~Qu,n&=~li,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-nn(f),x=1<<h;l[h]=-1,f&=~x}a!==0&&Re(e,a,n)}function nc(){return(et&6)===0?(hr(0),!1):!0}function af(){if(Be!==null){if(nt===0)var e=Be.return;else e=Be,Ds=Qa=null,_u(e),Wi=null,Wo=0,e=Be;for(;e!==null;)gv(e.alternate,e),e=e.return;Be=null}}function ro(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,kS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Hs=0,af(),ft=e,Be=a=Es(e.current,null),Pe=n,nt=0,jn=null,ha=!1,ao=ne(e,n),Xu=!1,io=Nn=Qu=li=ga=jt=0,gn=pr=null,ef=!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-nn(l),h=1<<f;n|=e[f],l&=~h}return Ps=n,Sl(),a}function $v(e,n){Me=null,D.H=ir,n===Ji||n===Dl?(n=ng(),nt=3):n===lu?(n=ng(),nt=4):nt=n===Lu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,jn=n,Be===null&&(jt=1,Gl(e,zn(n,e.current)))}function Pv(){var e=Tn.current;return e===null?!0:(Pe&4194048)===Pe?Hn===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?e===Hn:!1}function Hv(){var e=D.H;return D.H=ir,e===null?ir:e}function Vv(){var e=D.A;return D.A=eS,e}function sc(){jt=4,ha||(Pe&4194048)!==Pe&&Tn.current!==null||(ao=!0),(ga&134217727)===0&&(li&134217727)===0||ft===null||ba(ft,Pe,Nn,!1)}function of(e,n,a){var l=et;et|=2;var f=Hv(),h=Vv();(ft!==e||Pe!==n)&&(tc=null,ro(e,n)),n=!1;var x=jt;e:do try{if(nt!==0&&Be!==null){var j=Be,R=jn;switch(nt){case 8:af(),x=6;break e;case 3:case 2:case 9:case 6:Tn.current===null&&(n=!0);var G=nt;if(nt=0,jn=null,lo(e,j,R,G),a&&ao){x=0;break e}break;default:G=nt,nt=0,jn=null,lo(e,j,R,G)}}sS(),x=jt;break}catch(J){$v(e,J)}while(!0);return n&&e.shellSuspendCounter++,Ds=Qa=null,et=l,D.H=f,D.A=h,Be===null&&(ft=null,Pe=0,Sl()),x}function sS(){for(;Be!==null;)qv(Be)}function aS(e,n){var a=et;et|=2;var l=Hv(),f=Vv();ft!==e||Pe!==n?(tc=null,ec=_e()+500,ro(e,n)):ao=ne(e,n);e:do try{if(nt!==0&&Be!==null){n=Be;var h=jn;t:switch(nt){case 1:nt=0,jn=null,lo(e,n,h,1);break;case 2:case 9:if(eg(h)){nt=0,jn=null,Gv(n);break}n=function(){nt!==2&&nt!==9||ft!==e||(nt=7),hs(e)},h.then(n,n);break e;case 3:nt=7;break e;case 4:nt=5;break e;case 7:eg(h)?(nt=0,jn=null,Gv(n)):(nt=0,jn=null,lo(e,n,h,7));break;case 5:var x=null;switch(Be.tag){case 26:x=Be.memoizedState;case 5:case 27:var j=Be;if(x?A0(x):j.stateNode.complete){nt=0,jn=null;var R=j.sibling;if(R!==null)Be=R;else{var G=j.return;G!==null?(Be=G,ac(G)):Be=null}break t}}nt=0,jn=null,lo(e,n,h,5);break;case 6:nt=0,jn=null,lo(e,n,h,6);break;case 8:af(),jt=6;break e;default:throw Error(r(462))}}iS();break}catch(J){$v(e,J)}while(!0);return Ds=Qa=null,D.H=l,D.A=f,et=a,Be!==null?0:(ft=null,Pe=0,Sl(),jt)}function iS(){for(;Be!==null&&!ji();)qv(Be)}function qv(e){var n=mv(e.alternate,e,Ps);e.memoizedProps=e.pendingProps,n===null?ac(e):Be=n}function Gv(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=lv(a,n,n.pendingProps,n.type,void 0,Pe);break;case 11:n=lv(a,n,n.pendingProps,n.type.render,n.ref,Pe);break;case 5:_u(n);default:gv(a,n),n=Be=Vh(n,Ps),n=mv(a,n,Ps)}e.memoizedProps=e.pendingProps,n===null?ac(e):Be=n}function lo(e,n,a,l){Ds=Qa=null,_u(n),Wi=null,Wo=0;var f=n.return;try{if(Zk(e,f,n,a,Pe)){jt=1,Gl(e,zn(a,e.current)),Be=null;return}}catch(h){if(f!==null)throw Be=f,h;jt=1,Gl(e,zn(a,e.current)),Be=null;return}n.flags&32768?(Ve||l===1?e=!0:ao||(Pe&536870912)!==0?e=!1:(ha=e=!0,(l===2||l===9||l===3||l===6)&&(l=Tn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Fv(n,e)):ac(n)}function ac(e){var n=e;do{if((n.flags&32768)!==0){Fv(n,ha);return}e=n.return;var a=Jk(n.alternate,n,Ps);if(a!==null){Be=a;return}if(n=n.sibling,n!==null){Be=n;return}Be=n=e}while(n!==null);jt===0&&(jt=5)}function Fv(e,n){do{var a=Wk(e.alternate,e);if(a!==null){a.flags&=32767,Be=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Be=e;return}Be=e=a}while(e!==null);jt=6,Be=null}function Zv(e,n,a,l,f,h,x,j,R){e.cancelPendingCommit=null;do ic();while(Ht!==0);if((et&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=Zd,ke(e,a,h,x,j,R),e===ft&&(Be=ft=null,Pe=0),oo=n,ya=e,Hs=a,tf=h,nf=f,Lv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,cS(In,function(){return Xv(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=D.T,D.T=null,f=Z.p,Z.p=2,x=et,et|=4;try{Xk(e,n,a)}finally{et=x,Z.p=f,D.T=l}}Ht=1,Kv(),Yv(),Jv()}}function Kv(){if(Ht===1){Ht=0;var e=ya,n=oo,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=D.T,D.T=null;var l=Z.p;Z.p=2;var f=et;et|=4;try{Cv(n,e);var h=yf,x=Ih(e.containerInfo),j=h.focusedElem,R=h.selectionRange;if(x!==j&&j&&j.ownerDocument&&Mh(j.ownerDocument.documentElement,j)){if(R!==null&&Hd(j)){var G=R.start,J=R.end;if(J===void 0&&(J=G),"selectionStart"in j)j.selectionStart=G,j.selectionEnd=Math.min(J,j.value.length);else{var ee=j.ownerDocument||document,F=ee&&ee.defaultView||window;if(F.getSelection){var K=F.getSelection(),ve=j.textContent.length,we=Math.min(R.start,ve),rt=R.end===void 0?we:Math.min(R.end,ve);!K.extend&&we>rt&&(x=rt,rt=we,we=x);var $=Rh(j,we),z=Rh(j,rt);if($&&z&&(K.rangeCount!==1||K.anchorNode!==$.node||K.anchorOffset!==$.offset||K.focusNode!==z.node||K.focusOffset!==z.offset)){var q=ee.createRange();q.setStart($.node,$.offset),K.removeAllRanges(),we>rt?(K.addRange(q),K.extend(z.node,z.offset)):(q.setEnd(z.node,z.offset),K.addRange(q))}}}}for(ee=[],K=j;K=K.parentNode;)K.nodeType===1&&ee.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<ee.length;j++){var X=ee[j];X.element.scrollLeft=X.left,X.element.scrollTop=X.top}}vc=!!vf,yf=vf=null}finally{et=f,Z.p=l,D.T=a}}e.current=n,Ht=2}}function Yv(){if(Ht===2){Ht=0;var e=ya,n=oo,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=D.T,D.T=null;var l=Z.p;Z.p=2;var f=et;et|=4;try{Sv(e,n.alternate,n)}finally{et=f,Z.p=l,D.T=a}}Ht=3}}function Jv(){if(Ht===4||Ht===3){Ht=0,Wn();var e=ya,n=oo,a=Hs,l=Lv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ht=5:(Ht=0,oo=ya=null,Wv(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(va=null),Pt(a),n=n.stateNode,tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(sa,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=D.T,f=Z.p,Z.p=2,D.T=null;try{for(var h=e.onRecoverableError,x=0;x<l.length;x++){var j=l[x];h(j.value,{componentStack:j.stack})}}finally{D.T=n,Z.p=f}}(Hs&3)!==0&&ic(),hs(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===sf?mr++:(mr=0,sf=e):mr=0,hr(0)}}function Wv(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Yo(n)))}function ic(){return Kv(),Yv(),Jv(),Xv()}function Xv(){if(Ht!==5)return!1;var e=ya,n=tf;tf=0;var a=Pt(Hs),l=D.T,f=Z.p;try{Z.p=32>a?32:a,D.T=null,a=nf,nf=null;var h=ya,x=Hs;if(Ht=0,oo=ya=null,Hs=0,(et&6)!==0)throw Error(r(331));var j=et;if(et|=4,Mv(h.current),Av(h,h.current,x,a),et=j,hr(0,!1),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(sa,h)}catch{}return!0}finally{Z.p=f,D.T=l,Wv(e,n)}}function Qv(e,n,a){n=zn(a,n),n=Ou(e.stateNode,n,2),e=ua(e,n,2),e!==null&&($e(e,2),hs(e))}function st(e,n,a){if(e.tag===3)Qv(e,e,a);else for(;n!==null;){if(n.tag===3){Qv(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(va===null||!va.has(l))){e=zn(a,e),a=ev(2),l=ua(n,a,2),l!==null&&(tv(a,l,n,e),$e(l,2),hs(l));break}}n=n.return}}function rf(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new tS;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)||(Xu=!0,f.add(a),e=oS.bind(null,e,n,a),n.then(e,e))}function oS(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ft===e&&(Pe&a)===a&&(jt===4||jt===3&&(Pe&62914560)===Pe&&300>_e()-Ql?(et&2)===0&&ro(e,0):Qu|=a,io===Pe&&(io=0)),hs(e)}function e0(e,n){n===0&&(n=pe()),e=Ja(e,n),e!==null&&($e(e,n),hs(e))}function rS(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),e0(e,a)}function lS(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),e0(e,a)}function cS(e,n){return Ts(e,n)}var oc=null,co=null,lf=!1,rc=!1,cf=!1,_a=0;function hs(e){e!==co&&e.next===null&&(co===null?oc=co=e:co=co.next=e),rc=!0,lf||(lf=!0,uS())}function hr(e,n){if(!cf&&rc){cf=!0;do for(var a=!1,l=oc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var x=l.suspendedLanes,j=l.pingedLanes;h=(1<<31-nn(42|e)+1)-1,h&=f&~(x&~j),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,a0(l,h))}else h=Pe,h=V(l,l===ft?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||ne(l,h)||(a=!0,a0(l,h));l=l.next}while(a);cf=!1}}function dS(){t0()}function t0(){rc=lf=!1;var e=0;_a!==0&&xS()&&(e=_a);for(var n=_e(),a=null,l=oc;l!==null;){var f=l.next,h=n0(l,n);h===0?(l.next=null,a===null?oc=f:a.next=f,f===null&&(co=a)):(a=l,(e!==0||(h&3)!==0)&&(rc=!0)),l=f}Ht!==0&&Ht!==5||hr(e),_a!==0&&(_a=0)}function n0(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-nn(h),j=1<<x,R=f[x];R===-1?((j&a)===0||(j&l)!==0)&&(f[x]=le(j,n)):R<=n&&(e.expiredLanes|=j),h&=~j}if(n=ft,a=Pe,a=V(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(nt===2||nt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&us(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ne(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&us(l),Pt(a)){case 2:case 8:a=xn;break;case 32:a=In;break;case 268435456:a=Ha;break;default:a=In}return l=s0.bind(null,e),a=Ts(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&us(l),e.callbackPriority=2,e.callbackNode=null,2}function s0(e,n){if(Ht!==0&&Ht!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(ic()&&e.callbackNode!==a)return null;var l=Pe;return l=V(e,e===ft?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(zv(e,l,n),n0(e,_e()),e.callbackNode!=null&&e.callbackNode===a?s0.bind(null,e):null)}function a0(e,n){if(ic())return null;zv(e,n,!0)}function uS(){SS(function(){(et&6)!==0?Ts(on,dS):t0()})}function df(){if(_a===0){var e=Ki;e===0&&(e=Va,Va<<=1,(Va&261888)===0&&(Va=256)),_a=e}return _a}function i0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:hl(""+e)}function o0(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 fS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var h=i0((f[qt]||null).action),x=l.submitter;x&&(n=(n=x[qt]||null)?i0(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var j=new bl("action","action",null,l,f);e.push({event:j,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(_a!==0){var R=x?o0(f,x):new FormData(f);Eu(a,{pending:!0,data:R,method:f.method,action:h},null,R)}}else typeof h=="function"&&(j.preventDefault(),R=x?o0(f,x):new FormData(f),Eu(a,{pending:!0,data:R,method:f.method,action:h},h,R))},currentTarget:f}]})}}for(var uf=0;uf<Fd.length;uf++){var ff=Fd[uf],pS=ff.toLowerCase(),mS=ff[0].toUpperCase()+ff.slice(1);Qn(pS,"on"+mS)}Qn(Bh,"onAnimationEnd"),Qn(zh,"onAnimationIteration"),Qn(Uh,"onAnimationStart"),Qn("dblclick","onDoubleClick"),Qn("focusin","onFocus"),Qn("focusout","onBlur"),Qn(Ak,"onTransitionRun"),Qn(Dk,"onTransitionStart"),Qn(Rk,"onTransitionCancel"),Qn($h,"onTransitionEnd"),Ii("onMouseEnter",["mouseout","mouseover"]),Ii("onMouseLeave",["mouseout","mouseover"]),Ii("onPointerEnter",["pointerout","pointerover"]),Ii("onPointerLeave",["pointerout","pointerover"]),Fa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Fa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Fa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Fa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Fa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Fa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gr="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(" "),hS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(gr));function r0(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 x=l.length-1;0<=x;x--){var j=l[x],R=j.instance,G=j.currentTarget;if(j=j.listener,R!==h&&f.isPropagationStopped())break e;h=j,f.currentTarget=G;try{h(f)}catch(J){kl(J)}f.currentTarget=null,h=R}else for(x=0;x<l.length;x++){if(j=l[x],R=j.instance,G=j.currentTarget,j=j.listener,R!==h&&f.isPropagationStopped())break e;h=j,f.currentTarget=G;try{h(f)}catch(J){kl(J)}f.currentTarget=null,h=R}}}}function ze(e,n){var a=n[Td];a===void 0&&(a=n[Td]=new Set);var l=e+"__bubble";a.has(l)||(l0(n,e,2,!1),a.add(l))}function pf(e,n,a){var l=0;n&&(l|=4),l0(a,e,l,n)}var lc="_reactListening"+Math.random().toString(36).slice(2);function mf(e){if(!e[lc]){e[lc]=!0,th.forEach(function(a){a!=="selectionchange"&&(hS.has(a)||pf(a,!1,e),pf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[lc]||(n[lc]=!0,pf("selectionchange",!1,n))}}function l0(e,n,a,l){switch(B0(n)){case 2:var f=VS;break;case 8:f=qS;break;default:f=Ef}a=f.bind(null,n,a,e),f=void 0,!Md||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 hf(e,n,a,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var j=l.stateNode.containerInfo;if(j===f)break;if(x===4)for(x=l.return;x!==null;){var R=x.tag;if((R===3||R===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;j!==null;){if(x=Di(j),x===null)return;if(R=x.tag,R===5||R===6||R===26||R===27){l=h=x;continue e}j=j.parentNode}}l=l.return}ph(function(){var G=h,J=Dd(a),ee=[];e:{var F=Ph.get(e);if(F!==void 0){var K=bl,ve=e;switch(e){case"keypress":if(vl(a)===0)break e;case"keydown":case"keyup":K=lk;break;case"focusin":ve="focus",K=Bd;break;case"focusout":ve="blur",K=Bd;break;case"beforeblur":case"afterblur":K=Bd;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":K=gh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=J1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=uk;break;case Bh:case zh:case Uh:K=Q1;break;case $h:K=pk;break;case"scroll":case"scrollend":K=K1;break;case"wheel":K=hk;break;case"copy":case"cut":case"paste":K=tk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=yh;break;case"toggle":case"beforetoggle":K=vk}var we=(n&4)!==0,rt=!we&&(e==="scroll"||e==="scrollend"),$=we?F!==null?F+"Capture":null:F;we=[];for(var z=G,q;z!==null;){var X=z;if(q=X.stateNode,X=X.tag,X!==5&&X!==26&&X!==27||q===null||$===null||(X=zo(z,$),X!=null&&we.push(vr(z,X,q))),rt)break;z=z.return}0<we.length&&(F=new K(F,ve,null,a,J),ee.push({event:F,listeners:we}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",F&&a!==Ad&&(ve=a.relatedTarget||a.fromElement)&&(Di(ve)||ve[Ai]))break e;if((K||F)&&(F=J.window===J?J:(F=J.ownerDocument)?F.defaultView||F.parentWindow:window,K?(ve=a.relatedTarget||a.toElement,K=G,ve=ve?Di(ve):null,ve!==null&&(rt=d(ve),we=ve.tag,ve!==rt||we!==5&&we!==27&&we!==6)&&(ve=null)):(K=null,ve=G),K!==ve)){if(we=gh,X="onMouseLeave",$="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(we=yh,X="onPointerLeave",$="onPointerEnter",z="pointer"),rt=K==null?F:Bo(K),q=ve==null?F:Bo(ve),F=new we(X,z+"leave",K,a,J),F.target=rt,F.relatedTarget=q,X=null,Di(J)===G&&(we=new we($,z+"enter",ve,a,J),we.target=q,we.relatedTarget=rt,X=we),rt=X,K&&ve)t:{for(we=gS,$=K,z=ve,q=0,X=$;X;X=we(X))q++;X=0;for(var Se=z;Se;Se=we(Se))X++;for(;0<q-X;)$=we($),q--;for(;0<X-q;)z=we(z),X--;for(;q--;){if($===z||z!==null&&$===z.alternate){we=$;break t}$=we($),z=we(z)}we=null}else we=null;K!==null&&c0(ee,F,K,we,!1),ve!==null&&rt!==null&&c0(ee,rt,ve,we,!0)}}e:{if(F=G?Bo(G):window,K=F.nodeName&&F.nodeName.toLowerCase(),K==="select"||K==="input"&&F.type==="file")var Ye=jh;else if(Th(F))if(Nh)Ye=Nk;else{Ye=wk;var be=Tk}else K=F.nodeName,!K||K.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?G&&Ed(G.elementType)&&(Ye=jh):Ye=jk;if(Ye&&(Ye=Ye(e,G))){wh(ee,Ye,a,J);break e}be&&be(e,F,G),e==="focusout"&&G&&F.type==="number"&&G.memoizedProps.value!=null&&Cd(F,"number",F.value)}switch(be=G?Bo(G):window,e){case"focusin":(Th(be)||be.contentEditable==="true")&&($i=be,Vd=G,Fo=null);break;case"focusout":Fo=Vd=$i=null;break;case"mousedown":qd=!0;break;case"contextmenu":case"mouseup":case"dragend":qd=!1,Oh(ee,a,J);break;case"selectionchange":if(Ek)break;case"keydown":case"keyup":Oh(ee,a,J)}var Ie;if(Ud)e:{switch(e){case"compositionstart":var He="onCompositionStart";break e;case"compositionend":He="onCompositionEnd";break e;case"compositionupdate":He="onCompositionUpdate";break e}He=void 0}else Ui?kh(e,a)&&(He="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(He="onCompositionStart");He&&(bh&&a.locale!=="ko"&&(Ui||He!=="onCompositionStart"?He==="onCompositionEnd"&&Ui&&(Ie=mh()):(aa=J,Id="value"in aa?aa.value:aa.textContent,Ui=!0)),be=cc(G,He),0<be.length&&(He=new vh(He,e,null,a,J),ee.push({event:He,listeners:be}),Ie?He.data=Ie:(Ie=Sh(a),Ie!==null&&(He.data=Ie)))),(Ie=bk?_k(e,a):xk(e,a))&&(He=cc(G,"onBeforeInput"),0<He.length&&(be=new vh("onBeforeInput","beforeinput",null,a,J),ee.push({event:be,listeners:He}),be.data=Ie)),fS(ee,e,G,a,J)}r0(ee,n)})}function vr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function cc(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=zo(e,a),f!=null&&l.unshift(vr(e,f,h)),f=zo(e,n),f!=null&&l.push(vr(e,f,h))),e.tag===3)return l;e=e.return}return[]}function gS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function c0(e,n,a,l,f){for(var h=n._reactName,x=[];a!==null&&a!==l;){var j=a,R=j.alternate,G=j.stateNode;if(j=j.tag,R!==null&&R===l)break;j!==5&&j!==26&&j!==27||G===null||(R=G,f?(G=zo(a,h),G!=null&&x.unshift(vr(a,G,R))):f||(G=zo(a,h),G!=null&&x.push(vr(a,G,R)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var vS=/\r\n?/g,yS=/\u0000|\uFFFD/g;function d0(e){return(typeof e=="string"?e:""+e).replace(vS,`
|
|
26
|
-
`).replace(yS,"")}function u0(e,n){return n=d0(n),d0(e)===n}function ot(e,n,a,l,f,h){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Li(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Li(e,""+l);break;case"className":pl(e,"class",l);break;case"tabIndex":pl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":pl(e,a,l);break;case"style":uh(e,l,h);break;case"data":if(n!=="object"){pl(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=hl(""+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"&&ot(e,n,"name",f.name,f,null),ot(e,n,"formEncType",f.formEncType,f,null),ot(e,n,"formMethod",f.formMethod,f,null),ot(e,n,"formTarget",f.formTarget,f,null)):(ot(e,n,"encType",f.encType,f,null),ot(e,n,"method",f.method,f,null),ot(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=hl(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Ns);break;case"onScroll":l!=null&&ze("scroll",e);break;case"onScrollEnd":l!=null&&ze("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=hl(""+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":ze("beforetoggle",e),ze("toggle",e),fl(e,"popover",l);break;case"xlinkActuate":js(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":js(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":js(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":js(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":js(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":js(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":js(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":js(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":js(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":fl(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=F1.get(a)||a,fl(e,a,l))}}function gf(e,n,a,l,f,h){switch(a){case"style":uh(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"?Li(e,l):(typeof l=="number"||typeof l=="bigint")&&Li(e,""+l);break;case"onScroll":l!=null&&ze("scroll",e);break;case"onScrollEnd":l!=null&&ze("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Ns);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!nh.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[qt]||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,""):fl(e,a,l)}}}function Xt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ze("error",e),ze("load",e);var l=!1,f=!1,h;for(h in a)if(a.hasOwnProperty(h)){var x=a[h];if(x!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ot(e,n,h,x,a,null)}}f&&ot(e,n,"srcSet",a.srcSet,a,null),l&&ot(e,n,"src",a.src,a,null);return;case"input":ze("invalid",e);var j=h=x=f=null,R=null,G=null;for(l in a)if(a.hasOwnProperty(l)){var J=a[l];if(J!=null)switch(l){case"name":f=J;break;case"type":x=J;break;case"checked":R=J;break;case"defaultChecked":G=J;break;case"value":h=J;break;case"defaultValue":j=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:ot(e,n,l,J,a,null)}}rh(e,h,j,R,G,x,f,!1);return;case"select":ze("invalid",e),l=x=h=null;for(f in a)if(a.hasOwnProperty(f)&&(j=a[f],j!=null))switch(f){case"value":h=j;break;case"defaultValue":x=j;break;case"multiple":l=j;default:ot(e,n,f,j,a,null)}n=h,a=x,e.multiple=!!l,n!=null?Oi(e,!!l,n,!1):a!=null&&Oi(e,!!l,a,!0);return;case"textarea":ze("invalid",e),h=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(j=a[x],j!=null))switch(x){case"value":l=j;break;case"defaultValue":f=j;break;case"children":h=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(r(91));break;default:ot(e,n,x,j,a,null)}ch(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:ot(e,n,R,l,a,null)}return;case"dialog":ze("beforetoggle",e),ze("toggle",e),ze("cancel",e),ze("close",e);break;case"iframe":case"object":ze("load",e);break;case"video":case"audio":for(l=0;l<gr.length;l++)ze(gr[l],e);break;case"image":ze("error",e),ze("load",e);break;case"details":ze("toggle",e);break;case"embed":case"source":case"link":ze("error",e),ze("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:ot(e,n,G,l,a,null)}return;default:if(Ed(n)){for(J in a)a.hasOwnProperty(J)&&(l=a[J],l!==void 0&&gf(e,n,J,l,a,void 0));return}}for(j in a)a.hasOwnProperty(j)&&(l=a[j],l!=null&&ot(e,n,j,l,a,null))}function bS(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,x=null,j=null,R=null,G=null,J=null;for(K in a){var ee=a[K];if(a.hasOwnProperty(K)&&ee!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=ee;default:l.hasOwnProperty(K)||ot(e,n,K,null,l,ee)}}for(var F in l){var K=l[F];if(ee=a[F],l.hasOwnProperty(F)&&(K!=null||ee!=null))switch(F){case"type":h=K;break;case"name":f=K;break;case"checked":G=K;break;case"defaultChecked":J=K;break;case"value":x=K;break;case"defaultValue":j=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,n));break;default:K!==ee&&ot(e,n,F,K,l,ee)}}Nd(e,x,j,R,G,J,h,f);return;case"select":K=x=j=F=null;for(h in a)if(R=a[h],a.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":K=R;default:l.hasOwnProperty(h)||ot(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":j=h;break;case"multiple":x=h;default:h!==R&&ot(e,n,f,h,l,R)}n=j,a=x,l=K,F!=null?Oi(e,!!a,F,!1):!!l!=!!a&&(n!=null?Oi(e,!!a,n,!0):Oi(e,!!a,a?[]:"",!1));return;case"textarea":K=F=null;for(j in a)if(f=a[j],a.hasOwnProperty(j)&&f!=null&&!l.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:ot(e,n,j,null,l,f)}for(x in l)if(f=l[x],h=a[x],l.hasOwnProperty(x)&&(f!=null||h!=null))switch(x){case"value":F=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&ot(e,n,x,f,l,h)}lh(e,F,K);return;case"option":for(var ve in a)if(F=a[ve],a.hasOwnProperty(ve)&&F!=null&&!l.hasOwnProperty(ve))switch(ve){case"selected":e.selected=!1;break;default:ot(e,n,ve,null,l,F)}for(R in l)if(F=l[R],K=a[R],l.hasOwnProperty(R)&&F!==K&&(F!=null||K!=null))switch(R){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:ot(e,n,R,F,l,K)}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 we in a)F=a[we],a.hasOwnProperty(we)&&F!=null&&!l.hasOwnProperty(we)&&ot(e,n,we,null,l,F);for(G in l)if(F=l[G],K=a[G],l.hasOwnProperty(G)&&F!==K&&(F!=null||K!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(r(137,n));break;default:ot(e,n,G,F,l,K)}return;default:if(Ed(n)){for(var rt in a)F=a[rt],a.hasOwnProperty(rt)&&F!==void 0&&!l.hasOwnProperty(rt)&&gf(e,n,rt,void 0,l,F);for(J in l)F=l[J],K=a[J],!l.hasOwnProperty(J)||F===K||F===void 0&&K===void 0||gf(e,n,J,F,l,K);return}}for(var $ in a)F=a[$],a.hasOwnProperty($)&&F!=null&&!l.hasOwnProperty($)&&ot(e,n,$,null,l,F);for(ee in l)F=l[ee],K=a[ee],!l.hasOwnProperty(ee)||F===K||F==null&&K==null||ot(e,n,ee,F,l,K)}function f0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _S(){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,x=f.initiatorType,j=f.duration;if(h&&j&&f0(x)){for(x=0,j=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],G=R.startTime;if(G>j)break;var J=R.transferSize,ee=R.initiatorType;J&&f0(ee)&&(R=R.responseEnd,x+=J*(R<j?1:(j-G)/(R-G)))}if(--l,n+=8*(h+x)/(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 vf=null,yf=null;function dc(e){return e.nodeType===9?e:e.ownerDocument}function p0(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 m0(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 bf(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 _f=null;function xS(){var e=window.event;return e&&e.type==="popstate"?e===_f?!1:(_f=e,!0):(_f=null,!1)}var h0=typeof setTimeout=="function"?setTimeout:void 0,kS=typeof clearTimeout=="function"?clearTimeout:void 0,g0=typeof Promise=="function"?Promise:void 0,SS=typeof queueMicrotask=="function"?queueMicrotask:typeof g0<"u"?function(e){return g0.resolve(null).then(e).catch(TS)}:h0;function TS(e){setTimeout(function(){throw e})}function xa(e){return e==="head"}function v0(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),mo(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")yr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,yr(a);for(var h=a.firstChild;h;){var x=h.nextSibling,j=h.nodeName;h[Lo]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=x}}else a==="body"&&yr(e.ownerDocument.body);a=f}while(a);mo(n)}function y0(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 xf(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":xf(a),wd(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function wS(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[Lo])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=Vn(e.nextSibling),e===null)break}return null}function jS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Vn(e.nextSibling),e===null))return null;return e}function b0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Vn(e.nextSibling),e===null))return null;return e}function kf(e){return e.data==="$?"||e.data==="$~"}function Sf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function NS(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 Vn(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 Tf=null;function _0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Vn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function x0(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 k0(e,n,a){switch(n=dc(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 yr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);wd(e)}var qn=new Map,S0=new Set;function uc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Vs=Z.d;Z.d={f:CS,r:ES,D:AS,C:DS,L:RS,m:MS,X:OS,S:IS,M:LS};function CS(){var e=Vs.f(),n=nc();return e||n}function ES(e){var n=Ri(e);n!==null&&n.tag===5&&n.type==="form"?$g(n):Vs.r(e)}var uo=typeof document>"u"?null:document;function T0(e,n,a){var l=uo;if(l&&typeof n=="string"&&n){var f=Ln(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),S0.has(f)||(S0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),Xt(n,"link",e),Gt(n),l.head.appendChild(n)))}}function AS(e){Vs.D(e),T0("dns-prefetch",e,null)}function DS(e,n){Vs.C(e,n),T0("preconnect",e,n)}function RS(e,n,a){Vs.L(e,n,a);var l=uo;if(l&&e&&n){var f='link[rel="preload"][as="'+Ln(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Ln(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Ln(a.imageSizes)+'"]')):f+='[href="'+Ln(e)+'"]';var h=f;switch(n){case"style":h=fo(e);break;case"script":h=po(e)}qn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),qn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(br(h))||n==="script"&&l.querySelector(_r(h))||(n=l.createElement("link"),Xt(n,"link",e),Gt(n),l.head.appendChild(n)))}}function MS(e,n){Vs.m(e,n);var a=uo;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Ln(l)+'"][href="'+Ln(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=po(e)}if(!qn.has(h)&&(e=b({rel:"modulepreload",href:e},n),qn.set(h,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(_r(h)))return}l=a.createElement("link"),Xt(l,"link",e),Gt(l),a.head.appendChild(l)}}}function IS(e,n,a){Vs.S(e,n,a);var l=uo;if(l&&e){var f=Mi(l).hoistableStyles,h=fo(e);n=n||"default";var x=f.get(h);if(!x){var j={loading:0,preload:null};if(x=l.querySelector(br(h)))j.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=qn.get(h))&&wf(e,a);var R=x=l.createElement("link");Gt(R),Xt(R,"link",e),R._p=new Promise(function(G,J){R.onload=G,R.onerror=J}),R.addEventListener("load",function(){j.loading|=1}),R.addEventListener("error",function(){j.loading|=2}),j.loading|=4,fc(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:j},f.set(h,x)}}}function OS(e,n){Vs.X(e,n);var a=uo;if(a&&e){var l=Mi(a).hoistableScripts,f=po(e),h=l.get(f);h||(h=a.querySelector(_r(f)),h||(e=b({src:e,async:!0},n),(n=qn.get(f))&&jf(e,n),h=a.createElement("script"),Gt(h),Xt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function LS(e,n){Vs.M(e,n);var a=uo;if(a&&e){var l=Mi(a).hoistableScripts,f=po(e),h=l.get(f);h||(h=a.querySelector(_r(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=qn.get(f))&&jf(e,n),h=a.createElement("script"),Gt(h),Xt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function w0(e,n,a,l){var f=(f=ye.current)?uc(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=fo(a.href),a=Mi(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=fo(a.href);var h=Mi(f).hoistableStyles,x=h.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=f.querySelector(br(e)))&&!h._p&&(x.instance=h,x.state.loading=5),qn.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},qn.set(e,a),h||BS(f,e,a,x.state))),n&&l===null)throw Error(r(528,""));return x}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=po(a),a=Mi(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 fo(e){return'href="'+Ln(e)+'"'}function br(e){return'link[rel="stylesheet"]['+e+"]"}function j0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function BS(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}),Xt(n,"link",a),Gt(n),e.head.appendChild(n))}function po(e){return'[src="'+Ln(e)+'"]'}function _r(e){return"script[async]"+e}function N0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Ln(a.href)+'"]');if(l)return n.instance=l,Gt(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Gt(l),Xt(l,"style",f),fc(l,a.precedence,e),n.instance=l;case"stylesheet":f=fo(a.href);var h=e.querySelector(br(f));if(h)return n.state.loading|=4,n.instance=h,Gt(h),h;l=j0(a),(f=qn.get(f))&&wf(l,f),h=(e.ownerDocument||e).createElement("link"),Gt(h);var x=h;return x._p=new Promise(function(j,R){x.onload=j,x.onerror=R}),Xt(h,"link",l),n.state.loading|=4,fc(h,a.precedence,e),n.instance=h;case"script":return h=po(a.src),(f=e.querySelector(_r(h)))?(n.instance=f,Gt(f),f):(l=a,(f=qn.get(h))&&(l=b({},a),jf(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),Gt(f),Xt(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,fc(l,a.precedence,e));return n.instance}function fc(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,x=0;x<l.length;x++){var j=l[x];if(j.dataset.precedence===n)h=j;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 wf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function jf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var pc=null;function C0(e,n,a){if(pc===null){var l=new Map,f=pc=new Map;f.set(a,l)}else f=pc,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[Lo]||h[ht]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var j=l.get(x);j?j.push(h):l.set(x,[h])}}return l}function E0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function zS(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 A0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function US(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=fo(l.href),h=n.querySelector(br(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=mc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,Gt(h);return}h=n.ownerDocument||n,l=j0(l),(f=qn.get(f))&&wf(l,f),h=h.createElement("link"),Gt(h);var x=h;x._p=new Promise(function(j,R){x.onload=j,x.onerror=R}),Xt(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=mc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Nf=0;function $S(e,n){return e.stylesheets&&e.count===0&&gc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&gc(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Nf===0&&(Nf=62500*_S());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&gc(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Nf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function mc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var hc=null;function gc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hc=new Map,n.forEach(PS,e),hc=null,mc.call(e))}function PS(e,n){if(!(n.state.loading&4)){var a=hc.get(e);if(a)var l=a.get(null);else{a=new Map,hc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var x=f[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),l=x)}l&&a.set(null,l)}f=n.instance,x=f.getAttribute("data-precedence"),h=a.get(x)||l,h===l&&a.set(null,f),a.set(x,f),this.count++,l=mc.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 xr={$$typeof:E,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function HS(e,n,a,l,f,h,x,j,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=he(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=he(0),this.hiddenUpdates=he(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function D0(e,n,a,l,f,h,x,j,R,G,J,ee){return e=new HS(e,n,a,x,R,G,J,ee,j),n=1,h===!0&&(n|=24),h=Sn(3,null,null,n),e.current=h,h.stateNode=e,n=iu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:a,cache:n},cu(h),e}function R0(e){return e?(e=Vi,e):Vi}function M0(e,n,a,l,f,h){f=R0(f),l.context===null?l.context=f:l.pendingContext=f,l=da(n),l.payload={element:a},h=h===void 0?null:h,h!==null&&(l.callback=h),a=ua(e,l,n),a!==null&&(vn(a,e,n),Qo(a,e,n))}function I0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Cf(e,n){I0(e,n),(e=e.alternate)&&I0(e,n)}function O0(e){if(e.tag===13||e.tag===31){var n=Ja(e,67108864);n!==null&&vn(n,e,67108864),Cf(e,67108864)}}function L0(e){if(e.tag===13||e.tag===31){var n=Cn();n=Ke(n);var a=Ja(e,n);a!==null&&vn(a,e,n),Cf(e,n)}}var vc=!0;function VS(e,n,a,l){var f=D.T;D.T=null;var h=Z.p;try{Z.p=2,Ef(e,n,a,l)}finally{Z.p=h,D.T=f}}function qS(e,n,a,l){var f=D.T;D.T=null;var h=Z.p;try{Z.p=8,Ef(e,n,a,l)}finally{Z.p=h,D.T=f}}function Ef(e,n,a,l){if(vc){var f=Af(l);if(f===null)hf(e,n,l,yc,a),z0(e,l);else if(FS(f,e,n,a,l))l.stopPropagation();else if(z0(e,l),n&4&&-1<GS.indexOf(e)){for(;f!==null;){var h=Ri(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=ws(h.pendingLanes);if(x!==0){var j=h;for(j.pendingLanes|=2,j.entangledLanes|=2;x;){var R=1<<31-nn(x);j.entanglements[1]|=R,x&=~R}hs(h),(et&6)===0&&(ec=_e()+500,hr(0))}}break;case 31:case 13:j=Ja(h,2),j!==null&&vn(j,h,2),nc(),Cf(h,2)}if(h=Af(l),h===null&&hf(e,n,l,yc,a),h===f)break;f=h}f!==null&&l.stopPropagation()}else hf(e,n,l,null,a)}}function Af(e){return e=Dd(e),Df(e)}var yc=null;function Df(e){if(yc=null,e=Di(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 yc=e,null}function B0(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(Qe()){case on:return 2;case xn:return 8;case In:case Ni:return 32;case Ha:return 268435456;default:return 32}default:return 32}}var Rf=!1,ka=null,Sa=null,Ta=null,kr=new Map,Sr=new Map,wa=[],GS="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 z0(e,n){switch(e){case"focusin":case"focusout":ka=null;break;case"dragenter":case"dragleave":Sa=null;break;case"mouseover":case"mouseout":Ta=null;break;case"pointerover":case"pointerout":kr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sr.delete(n.pointerId)}}function Tr(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=Ri(n),n!==null&&O0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function FS(e,n,a,l,f){switch(n){case"focusin":return ka=Tr(ka,e,n,a,l,f),!0;case"dragenter":return Sa=Tr(Sa,e,n,a,l,f),!0;case"mouseover":return Ta=Tr(Ta,e,n,a,l,f),!0;case"pointerover":var h=f.pointerId;return kr.set(h,Tr(kr.get(h)||null,e,n,a,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Sr.set(h,Tr(Sr.get(h)||null,e,n,a,l,f)),!0}return!1}function U0(e){var n=Di(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,At(e.priority,function(){L0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,At(e.priority,function(){L0(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 bc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Af(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Ad=l,a.target.dispatchEvent(l),Ad=null}else return n=Ri(a),n!==null&&O0(n),e.blockedOn=a,!1;n.shift()}return!0}function $0(e,n,a){bc(e)&&a.delete(n)}function ZS(){Rf=!1,ka!==null&&bc(ka)&&(ka=null),Sa!==null&&bc(Sa)&&(Sa=null),Ta!==null&&bc(Ta)&&(Ta=null),kr.forEach($0),Sr.forEach($0)}function _c(e,n){e.blockedOn===n&&(e.blockedOn=null,Rf||(Rf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ZS)))}var xc=null;function P0(e){xc!==e&&(xc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){xc===e&&(xc=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(Df(l||a)===null)continue;break}var h=Ri(a);h!==null&&(e.splice(n,3),n-=3,Eu(h,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function mo(e){function n(R){return _c(R,e)}ka!==null&&_c(ka,e),Sa!==null&&_c(Sa,e),Ta!==null&&_c(Ta,e),kr.forEach(n),Sr.forEach(n);for(var a=0;a<wa.length;a++){var l=wa[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<wa.length&&(a=wa[0],a.blockedOn===null);)U0(a),a.blockedOn===null&&wa.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],x=f[qt]||null;if(typeof h=="function")x||P0(a);else if(x){var j=null;if(h&&h.hasAttribute("formAction")){if(f=h,x=h[qt]||null)j=x.formAction;else if(Df(f)!==null)continue}else j=x.action;typeof j=="function"?a[l+1]=j:(a.splice(l,3),l-=3),P0(a)}}}function H0(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return f=x})},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 Mf(e){this._internalRoot=e}kc.prototype.render=Mf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,l=Cn();M0(a,l,e,n,null,null)},kc.prototype.unmount=Mf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;M0(e.current,2,null,e,null,null),nc(),n[Ai]=null}};function kc(e){this._internalRoot=e}kc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Kt();e={blockedOn:null,target:e,priority:n};for(var a=0;a<wa.length&&n!==0&&n<wa[a].priority;a++);wa.splice(a,0,e),a===0&&U0(e)}};var V0=s.version;if(V0!=="19.2.4")throw Error(r(527,V0,"19.2.4"));Z.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 KS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Sc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sc.isDisabled&&Sc.supportsFiber)try{sa=Sc.inject(KS),tn=Sc}catch{}}return jr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var a=!1,l="",f=Jg,h=Wg,x=Xg;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&&(x=n.onRecoverableError)),n=D0(e,1,!1,null,null,a,l,null,f,h,x,H0),e[Ai]=n.current,mf(e),new Mf(n)},jr.hydrateRoot=function(e,n,a){if(!c(e))throw Error(r(299));var l=!1,f="",h=Jg,x=Wg,j=Xg,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&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=D0(e,1,!0,n,a??null,l,f,R,h,x,j,H0),n.context=R0(null),a=n.current,l=Cn(),l=Ke(l),f=da(l),f.callback=null,ua(a,f,l),a=l,n.current.lanes=a,$e(n,a),hs(n),e[Ai]=n.current,mf(e),new kc(n)},jr.version="19.2.4",jr}var W0;function ST(){if(W0)return If.exports;W0=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(),If.exports=kT(),If.exports}var TT=ST();const wT="modulepreload",jT=function(t){return"/"+t},X0={},NT=function(s,i,r){let c=Promise.resolve();if(i&&i.length>0){let u=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};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(i.map(g=>{if(g=jT(g),g in X0)return;X0[g]=!0;const v=g.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":wT,v||(_.as="script"),_.crossOrigin="",_.href=g,m&&_.setAttribute("nonce",m),document.head.appendChild(_),v)return new Promise((S,k)=>{_.addEventListener("load",S),_.addEventListener("error",()=>k(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)})},CT=new Proxy(globalThis.fetch,{apply(t,s,i){return Reflect.apply(globalThis.fetch,s,i)}}),ET=aT({baseUrl:"/",fetch:CT}),Te=iT(oT,ET),AT="_bar_1xhb4_1",DT="_input_1xhb4_32",RT="_select_1xhb4_67",MT="_btnPrimary_1xhb4_103",IT="_btnGhost_1xhb4_173",OT="_badge_1xhb4_195",LT="_disconnectHint_1xhb4_205",En={bar:AT,input:DT,select:RT,btnPrimary:MT,btnGhost:IT,badge:OT,disconnectHint:LT};function BT(t,s){if(!t)return!1;const i=s.find(r=>r.id===t);return i!==void 0&&(i.status==="disconnected"||i.status==="error")}function zT({environmentId:t,onReconnect:s}){return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:En.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),o.jsx("button",{type:"button",onClick:()=>s(t),className:En.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function Gr({mode:t,sessionId:s,environmentId:i,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:p,onSpawn:m,onStartTask:g,onProvisionEnvironment:v,onShowToast:b}){const[_,S]=y.useState(""),[k,w]=y.useState(""),N=BT(i,u),T=C=>{if(C.preventDefault(),!!_.trim())if(t==="send"){if(!s||N)return;p(s,_),S("")}else if(t==="spawn"){if(!i)return;m(i,_,k),b==null||b("Session started","success"),S(""),w("")}else{if(!r)return;g(r,void 0,i,_),S("")}};return t==="spawn"?o.jsxs("form",{onSubmit:T,className:En.bar,children:[o.jsx("span",{className:En.badge,children:"new chat"}),o.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:En.input,"aria-label":"Enter prompt"}),c&&o.jsxs("select",{value:k,onChange:C=>w(C.target.value),className:En.select,"aria-label":"Select persona",children:[o.jsx("option",{value:"",children:"(Default)"}),d.map(C=>o.jsx("option",{value:C.id,children:C.name},C.id))]}),o.jsx("button",{type:"submit",disabled:!_.trim()||!i,className:En.btnPrimary,children:"Go"})]}):t==="start"?o.jsxs("form",{onSubmit:T,className:En.bar,children:[o.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:En.input,"aria-label":"Type a message"}),o.jsx("button",{type:"submit",disabled:!_.trim(),className:En.btnPrimary,children:"Send"})]}):o.jsxs("form",{onSubmit:T,className:En.bar,children:[N&&i&&o.jsx(zT,{environmentId:i,onReconnect:v}),o.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!N,disabled:N,className:En.input,"aria-label":"Type a message"}),o.jsx("span",{title:N?"Environment is unavailable — reconnect first":void 0,children:o.jsx("button",{type:"submit",disabled:!_.trim()||N,className:En.btnPrimary,children:"Send"})})]})}const Q0=220,ey=70,UT=40,$T=60,PT="hierarchy",HT="dependency";function VT(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new q0.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:UT,ranksep:$T});const i=new Map(t.map(u=>[u.id,u])),r=new Map;for(const u of t)if(u.parentTaskId&&i.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:Q0,height:ey});const c=[];for(const u of t){if(u.parentTaskId&&i.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:PT},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of u.dependsOn)if(i.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:HT},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return q0.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-Q0/2,y:p.y-ey/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 qT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o_=(...t)=>t.filter((s,i,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===i).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 GT={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 FT=y.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...p},m)=>y.createElement("svg",{ref:m,...GT,width:s,height:s,stroke:t,strokeWidth:r?Number(i)*24/Number(s):i,className:o_("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 Fe=(t,s)=>{const i=y.forwardRef(({className:r,...c},d)=>y.createElement(FT,{ref:d,iconNode:s,className:o_(`lucide-${qT(t)}`,r),...c}));return i.displayName=`${t}`,i};/**
|
|
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 ZT=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ty=Fe("ArrowDown",ZT);/**
|
|
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 KT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ny=Fe("ArrowUp",KT);/**
|
|
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 YT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],JT=Fe("Ban",YT);/**
|
|
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 WT=[["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"}]],XT=Fe("Brain",WT);/**
|
|
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 QT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ki=Fe("Check",QT);/**
|
|
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 e2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],r_=Fe("ChevronDown",e2);/**
|
|
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 t2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ta=Fe("ChevronRight",t2);/**
|
|
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 n2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ia=Fe("Circle",n2);/**
|
|
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 s2=[["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"}]],a2=Fe("ClipboardList",s2);/**
|
|
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 i2=[["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"}]],l_=Fe("Clipboard",i2);/**
|
|
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 o2=[["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"}]],r2=Fe("Cog",o2);/**
|
|
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 l2=[["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"}]],c2=Fe("Copy",l2);/**
|
|
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=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],u2=Fe("CornerDownRight",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 f2=[["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"}]],p2=Fe("FilePen",f2);/**
|
|
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 m2=[["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"}]],h2=Fe("FileText",m2);/**
|
|
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 g2=[["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"}]],v2=Fe("House",g2);/**
|
|
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 y2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],em=Fe("Info",y2);/**
|
|
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 b2=[["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"}]],_2=Fe("Key",b2);/**
|
|
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 x2=[["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"}]],k2=Fe("Keyboard",x2);/**
|
|
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 S2=[["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"}]],T2=Fe("ListChecks",S2);/**
|
|
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 w2=[["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"}]],j2=Fe("List",w2);/**
|
|
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 N2=[["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"}]],C2=Fe("Loader",N2);/**
|
|
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 E2=[["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"}]],A2=Fe("Menu",E2);/**
|
|
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 D2=[["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"}]],R2=Fe("MessageSquare",D2);/**
|
|
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 M2=[["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"}]],I2=Fe("Monitor",M2);/**
|
|
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 O2=[["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"}]],L2=Fe("Palette",O2);/**
|
|
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 B2=[["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"}]],z2=Fe("Pause",B2);/**
|
|
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 U2=[["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"}]],$2=Fe("Pencil",U2);/**
|
|
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 P2=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],c_=Fe("Search",P2);/**
|
|
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 H2=[["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"}]],V2=Fe("Settings",H2);/**
|
|
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 q2=[["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"}]],G2=Fe("SquareCheckBig",q2);/**
|
|
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 F2=[["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"}]],tm=Fe("TriangleAlert",F2);/**
|
|
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 Z2=[["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"}]],K2=Fe("User",Z2);/**
|
|
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 Y2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],za=Fe("X",Y2),nm=8,at=12,Zt=14,It=16,wp={not_started:{color:"var(--text-tertiary)",icon:o.jsx(Ia,{size:at}),label:"Not Started"},working:{color:"var(--accent-green)",icon:o.jsx(Ia,{size:at,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:o.jsx(z2,{size:at}),label:"Paused"},complete:{color:"var(--accent-green)",icon:o.jsx(ki,{size:at}),label:"Complete"},failed:{color:"var(--accent-red)",icon:o.jsx(za,{size:at}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:o.jsx(JT,{size:at}),label:"Blocked"}};function Oa(t){return t==="blocked"?wp.blocked:wp[tl(t)]}const J2={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function W2(t){return J2[tl(t)]??"statusPending"}const X2=["working","paused","failed","not_started","blocked","complete"],sy=["not_started","working","paused","complete","failed"],Q2={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function tl(t){return t in wp&&t!=="blocked"?t:Q2[t]??"not_started"}const ew={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"},tw="_dagContainer_js4w6_1",nw="_taskNode_js4w6_26",sw="_taskNodeBorder_js4w6_54",aw="_taskNodeContent_js4w6_60",iw="_taskNodeHeader_js4w6_70",ow="_taskNodeIcon_js4w6_77",rw="_taskNodeTitle_js4w6_82",lw="_taskNodeBadges_js4w6_90",cw="_childBadge_js4w6_95",dw="_depBadge_js4w6_107",uw="_handle_js4w6_119",fw="_emptyCta_js4w6_126",pw="_ctaDescription_js4w6_137",mw="_ctaButton_js4w6_144",un={dagContainer:tw,taskNode:nw,taskNodeBorder:sw,taskNodeContent:aw,taskNodeHeader:iw,taskNodeIcon:ow,taskNodeTitle:rw,taskNodeBadges:lw,childBadge:cw,depBadge:dw,handle:uw,emptyCta:fw,ctaDescription:pw,ctaButton:mw};function hw({data:t}){const{task:s,childCount:i,doneChildCount:r,hasDependencies:c}=t,d=Oa(s.status);return o.jsxs("div",{className:un.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[o.jsx(G0,{type:"target",position:F0.Top,className:un.handle}),o.jsx("div",{className:un.taskNodeBorder,style:{backgroundColor:d.color}}),o.jsxs("div",{className:un.taskNodeContent,children:[o.jsxs("div",{className:un.taskNodeHeader,children:[o.jsx("span",{className:un.taskNodeIcon,style:{color:d.color},children:d.icon}),o.jsx("span",{className:un.taskNodeTitle,children:s.title})]}),o.jsxs("div",{className:un.taskNodeBadges,children:[i>0&&o.jsxs("span",{className:un.childBadge,children:[r,"/",i]}),c&&o.jsx("span",{className:un.depBadge,children:"dep"})]})]}),o.jsx(G0,{type:"source",position:F0.Bottom,className:un.handle})]})}/**
|
|
217
|
-
* react-router v7.13.2
|
|
218
|
-
*
|
|
219
|
-
* Copyright (c) Remix Software Inc.
|
|
220
|
-
*
|
|
221
|
-
* This source code is licensed under the MIT license found in the
|
|
222
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
223
|
-
*
|
|
224
|
-
* @license MIT
|
|
225
|
-
*/var ay="popstate";function iy(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function gw(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 jp("",{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 i(r,c){return typeof c=="string"?c:Fr(c)}return yw(s,i,null,t)}function bt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Yn(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function vw(){return Math.random().toString(36).substring(2,10)}function oy(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 jp(t,s,i=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?Do(s):s,state:i,key:s&&s.key||r||vw(),unstable_mask:c}}function Fr({pathname:t="/",search:s="",hash:i=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),i&&i!=="#"&&(t+=i.charAt(0)==="#"?i:"#"+i),t}function Do(t){let s={};if(t){let i=t.indexOf("#");i>=0&&(s.hash=t.substring(i),t=t.substring(0,i));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function yw(t,s,i,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 b(){p="POP";let N=v(),T=N==null?null:N-g;g=N,m&&m({action:p,location:w.location,delta:T})}function _(N,T){p="PUSH";let C=iy(N)?N:jp(w.location,N,T);g=v()+1;let E=oy(C,g),B=w.createHref(C.unstable_mask||C);try{u.pushState(E,"",B)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;c.location.assign(B)}d&&m&&m({action:p,location:w.location,delta:1})}function S(N,T){p="REPLACE";let C=iy(N)?N:jp(w.location,N,T);g=v();let E=oy(C,g),B=w.createHref(C.unstable_mask||C);u.replaceState(E,"",B),d&&m&&m({action:p,location:w.location,delta:0})}function k(N){return bw(N)}let w={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(ay,b),m=N,()=>{c.removeEventListener(ay,b),m=null}},createHref(N){return s(c,N)},createURL:k,encodeLocation(N){let T=k(N);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:_,replace:S,go(N){return u.go(N)}};return w}function bw(t,s=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),bt(i,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Fr(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function d_(t,s,i="/"){return _w(t,s,i,!1)}function _w(t,s,i,r){let c=typeof s=="string"?Do(s):s,d=Xs(c.pathname||"/",i);if(d==null)return null;let u=u_(t);xw(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=p_(d);p=Aw(u[m],g,r)}return p}function u_(t,s=[],i=[],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;bt(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 b=bs([r,v.relativePath]),_=i.concat(v);u.children&&u.children.length>0&&(bt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),u_(u.children,s,_,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:Cw(b,u.index),routesMeta:_})};return t.forEach((u,p)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))d(u,p);else for(let g of f_(u.path))d(u,p,!0,g)}),s}function f_(t){let s=t.split("/");if(s.length===0)return[];let[i,...r]=s,c=i.endsWith("?"),d=i.replace(/\?$/,"");if(r.length===0)return c?[d,""]:[d];let u=f_(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 xw(t){t.sort((s,i)=>s.score!==i.score?i.score-s.score:Ew(s.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var kw=/^:[\w-]+$/,Sw=3,Tw=2,ww=1,jw=10,Nw=-2,ry=t=>t==="*";function Cw(t,s){let i=t.split("/"),r=i.length;return i.some(ry)&&(r+=Nw),s&&(r+=Tw),i.filter(c=>!ry(c)).reduce((c,d)=>c+(kw.test(d)?Sw:d===""?ww:jw),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 Aw(t,s,i=!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)||"/",b=Zr({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),_=m.route;if(!b&&g&&i&&!r[r.length-1].route.index&&(b=Zr({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:bs([d,b.pathname]),pathnameBase:Ow(bs([d,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(d=bs([d,b.pathnameBase]))}return u}function Zr(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,r]=Dw(t.path,t.caseSensitive,t.end),c=s.match(i);if(!c)return null;let d=c[0],u=d.replace(/(.)\/+$/,"$1"),p=c.slice(1);return{params:r.reduce((g,{paramName:v,isOptional:b},_)=>{if(v==="*"){let k=p[_]||"";u=d.slice(0,d.length-k.length).replace(/(.)\/+$/,"$1")}const S=p[_];return b&&!S?g[v]=void 0:g[v]=(S||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function Dw(t,s=!1,i=!0){Yn(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 b=v.charAt(g+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),r]}function p_(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Yn(!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 Xs(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let i=s.endsWith("/")?s.length-1:s.length,r=t.charAt(i);return r&&r!=="/"?null:t.slice(i)||"/"}var Rw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Mw(t,s="/"){let{pathname:i,search:r="",hash:c=""}=typeof t=="string"?Do(t):t,d;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?d=ly(i.substring(1),"/"):d=ly(i,s)):d=s,{pathname:d,search:Lw(r),hash:Bw(c)}}function ly(t,s){let i=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function Bf(t,s,i,r){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${i}\` 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,i)=>i===0||s.route.path&&s.route.path.length>0)}function sm(t){let s=Iw(t);return s.map((i,r)=>r===s.length-1?i.pathname:i.pathnameBase)}function fd(t,s,i,r=!1){let c;typeof t=="string"?c=Do(t):(c={...t},bt(!c.pathname||!c.pathname.includes("?"),Bf("?","pathname","search",c)),bt(!c.pathname||!c.pathname.includes("#"),Bf("#","pathname","hash",c)),bt(!c.search||!c.search.includes("#"),Bf("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=i;else{let b=s.length-1;if(!r&&u.startsWith("..")){let _=u.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}p=b>=0?s[b]:"/"}let m=Mw(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&i.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var bs=t=>t.join("/").replace(/\/\/+/g,"/"),Ow=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Lw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Bw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,zw=class{constructor(t,s,i,r=!1){this.status=t,this.statusText=s||"",this.internal=r,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function Uw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function $w(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var m_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function h_(t,s){let i=t;if(typeof i!="string"||!Rw.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let r=i,c=!1;if(m_)try{let d=new URL(window.location.href),u=i.startsWith("//")?new URL(d.protocol+i):new URL(i),p=Xs(u.pathname,s);u.origin===d.origin&&p!=null?i=p+u.search+u.hash:c=!0}catch{Yn(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:c,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var g_=["POST","PUT","PATCH","DELETE"];new Set(g_);var Pw=["GET",...g_];new Set(Pw);var Ro=y.createContext(null);Ro.displayName="DataRouter";var pd=y.createContext(null);pd.displayName="DataRouterState";var Hw=y.createContext(!1),v_=y.createContext({isTransitioning:!1});v_.displayName="ViewTransition";var Vw=y.createContext(new Map);Vw.displayName="Fetchers";var qw=y.createContext(null);qw.displayName="Await";var Mn=y.createContext(null);Mn.displayName="Navigation";var nl=y.createContext(null);nl.displayName="Location";var Jn=y.createContext({outlet:null,matches:[],isDataRoute:!1});Jn.displayName="Route";var am=y.createContext(null);am.displayName="RouteError";var y_="REACT_ROUTER_ERROR",Gw="REDIRECT",Fw="ROUTE_ERROR_RESPONSE";function Zw(t){if(t.startsWith(`${y_}:${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 Kw(t){if(t.startsWith(`${y_}:${Fw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new zw(s.status,s.statusText,s.data)}catch{}}function Yw(t,{relative:s}={}){bt(Si(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=y.useContext(Mn),{hash:c,pathname:d,search:u}=sl(t,{relative:s}),p=d;return i!=="/"&&(p=d==="/"?i:bs([i,d])),r.createHref({pathname:p,search:u,hash:c})}function Si(){return y.useContext(nl)!=null}function Vt(){return bt(Si(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(nl).location}function Nt(t){bt(Si(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Vt();return y.useMemo(()=>Zr(t,p_(s)),[s,t])}var b_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function __(t){y.useContext(Mn).static||y.useLayoutEffect(t)}function md(){let{isDataRoute:t}=y.useContext(Jn);return t?dj():Jw()}function Jw(){bt(Si(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Ro),{basename:s,navigator:i}=y.useContext(Mn),{matches:r}=y.useContext(Jn),{pathname:c}=Vt(),d=JSON.stringify(sm(r)),u=y.useRef(!1);return __(()=>{u.current=!0}),y.useCallback((m,g={})=>{if(Yn(u.current,b_),!u.current)return;if(typeof m=="number"){i.go(m);return}let v=fd(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:bs([s,v.pathname])),(g.replace?i.replace:i.push)(v,g.state,g)},[s,i,d,c,t])}var Ww=y.createContext(null);function Xw(t){let s=y.useContext(Jn).outlet;return y.useMemo(()=>s&&y.createElement(Ww.Provider,{value:t},s),[s,t])}function ds(){let{matches:t}=y.useContext(Jn),s=t[t.length-1];return s?s.params:{}}function sl(t,{relative:s}={}){let{matches:i}=y.useContext(Jn),{pathname:r}=Vt(),c=JSON.stringify(sm(i));return y.useMemo(()=>fd(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function Qw(t,s){return x_(t,s)}function x_(t,s,i){var N;bt(Si(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Mn),{matches:c}=y.useContext(Jn),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||"";S_(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.
|
|
226
|
-
|
|
227
|
-
Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let v=Vt(),b;if(s){let T=typeof s=="string"?Do(s):s;bt(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.`),b=T}else b=v;let _=b.pathname||"/",S=_;if(m!=="/"){let T=m.replace(/^\//,"").split("/");S="/"+_.replace(/^\//,"").split("/").slice(T.length).join("/")}let k=d_(t,{pathname:S});Yn(g||k!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Yn(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.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 w=aj(k&&k.map(T=>Object.assign({},T,{params:Object.assign({},u,T.params),pathname:bs([m,r.encodeLocation?r.encodeLocation(T.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?m:bs([m,r.encodeLocation?r.encodeLocation(T.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),c,i);return s&&w?y.createElement(nl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},w):w}function ej(){let t=cj(),s=Uw(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),i=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),i?y.createElement("pre",{style:c},i):null,u)}var tj=y.createElement(ej,null),k_=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 i=Kw(t.digest);i&&(t=i)}let s=t!==void 0?y.createElement(Jn.Provider,{value:this.props.routeContext},y.createElement(am.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(nj,{error:t},s):s}};k_.contextType=Hw;var zf=new WeakMap;function nj({children:t,error:s}){let{basename:i}=y.useContext(Mn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=Zw(s.digest);if(r){let c=zf.get(s);if(c)throw c;let d=h_(r.location,i);if(m_&&!zf.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 zf.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function sj({routeContext:t,match:s,children:i}){let r=y.useContext(Ro);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(Jn.Provider,{value:t},i)}function aj(t,s=[],i){let r=i==null?void 0:i.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(b=>b.route.id&&(d==null?void 0:d[b.route.id])!==void 0);bt(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(i&&r){u=r.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=v),b.route.id){let{loaderData:_,errors:S}=r,k=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!S||S[b.route.id]===void 0);if(b.route.lazy||k){i.isStatic&&(u=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let m=i==null?void 0:i.onError,g=r&&m?(v,b)=>{var _,S;m(v,{location:r.location,params:((S=(_=r.matches)==null?void 0:_[0])==null?void 0:S.params)??{},unstable_pattern:$w(r.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let S,k=!1,w=null,N=null;r&&(S=d&&b.route.id?d[b.route.id]:void 0,w=b.route.errorElement||tj,u&&(p<0&&_===0?(S_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,N=null):p===_&&(k=!0,N=b.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,_+1)),C=()=>{let E;return S?E=w:k?E=N:b.route.Component?E=y.createElement(b.route.Component,null):b.route.element?E=b.route.element:E=v,y.createElement(sj,{match:b,routeContext:{outlet:v,matches:T,isDataRoute:r!=null},children:E})};return r&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement(k_,{location:r.location,revalidation:r.revalidation,component:w,error:S,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:g}):C()},null)}function im(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ij(t){let s=y.useContext(Ro);return bt(s,im(t)),s}function oj(t){let s=y.useContext(pd);return bt(s,im(t)),s}function rj(t){let s=y.useContext(Jn);return bt(s,im(t)),s}function om(t){let s=rj(t),i=s.matches[s.matches.length-1];return bt(i.route.id,`${t} can only be used on routes that contain a unique "id"`),i.route.id}function lj(){return om("useRouteId")}function cj(){var r;let t=y.useContext(am),s=oj("useRouteError"),i=om("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[i]}function dj(){let{router:t}=ij("useNavigate"),s=om("useNavigate"),i=y.useRef(!1);return __(()=>{i.current=!0}),y.useCallback(async(c,d={})=>{Yn(i.current,b_),i.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var cy={};function S_(t,s,i){!s&&!cy[t]&&(cy[t]=!0,Yn(!1,i))}y.memo(uj);function uj({routes:t,future:s,state:i,isStatic:r,onError:c}){return x_(t,void 0,{state:i,isStatic:r,onError:c})}function ls({to:t,replace:s,state:i,relative:r}){bt(Si(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Mn);Yn(!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(Jn),{pathname:u}=Vt(),p=md(),m=fd(t,sm(d),u,r==="path"),g=JSON.stringify(m);return y.useEffect(()=>{p(JSON.parse(g),{replace:s,state:i,relative:r})},[p,g,r,s,i]),null}function Ua(t){return Xw(t.context)}function je(t){bt(!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 fj({basename:t="/",children:s=null,location:i,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){bt(!Si(),"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 i=="string"&&(i=Do(i));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:S="default",unstable_mask:k}=i,w=y.useMemo(()=>{let N=Xs(g,p);return N==null?null:{location:{pathname:N,search:v,hash:b,state:_,key:S,unstable_mask:k},navigationType:r}},[p,g,v,b,_,S,r,k]);return Yn(w!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${b}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:y.createElement(Mn.Provider,{value:m},y.createElement(nl.Provider,{children:s,value:w}))}function pj({children:t,location:s}){return Qw(Np(t),s)}function Np(t,s=[]){let i=[];return y.Children.forEach(t,(r,c)=>{if(!y.isValidElement(r))return;let d=[...s,c];if(r.type===y.Fragment){i.push.apply(i,Np(r.props.children,d));return}bt(r.type===je,`[${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>`),bt(!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=Np(r.props.children,d)),i.push(u)}),i}var Pc="get",Hc="application/x-www-form-urlencoded";function hd(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function mj(t){return hd(t)&&t.tagName.toLowerCase()==="button"}function hj(t){return hd(t)&&t.tagName.toLowerCase()==="form"}function gj(t){return hd(t)&&t.tagName.toLowerCase()==="input"}function vj(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yj(t,s){return t.button===0&&(!s||s==="_self")&&!vj(t)}function Cp(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((s,i)=>{let r=t[i];return s.concat(Array.isArray(r)?r.map(c=>[i,c]):[[i,r]])},[]))}function bj(t,s){let i=Cp(t);return s&&s.forEach((r,c)=>{i.has(c)||s.getAll(c).forEach(d=>{i.append(c,d)})}),i}var jc=null;function _j(){if(jc===null)try{new FormData(document.createElement("form"),0),jc=!1}catch{jc=!0}return jc}var xj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Uf(t){return t!=null&&!xj.has(t)?(Yn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Hc}"`),null):t}function kj(t,s){let i,r,c,d,u;if(hj(t)){let p=t.getAttribute("action");r=p?Xs(p,s):null,i=t.getAttribute("method")||Pc,c=Uf(t.getAttribute("enctype"))||Hc,d=new FormData(t)}else if(mj(t)||gj(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?Xs(m,s):null,i=t.getAttribute("formmethod")||p.getAttribute("method")||Pc,c=Uf(t.getAttribute("formenctype"))||Uf(p.getAttribute("enctype"))||Hc,d=new FormData(p,t),!_j()){let{name:g,type:v,value:b}=t;if(v==="image"){let _=g?`${g}.`:"";d.append(`${_}x`,"0"),d.append(`${_}y`,"0")}else g&&d.append(g,b)}}else{if(hd(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Pc,r=null,c=Hc,u=t}return d&&c==="text/plain"&&(u=d,d=void 0),{action:r,method:i.toLowerCase(),encType:c,formData:d,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function rm(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Sj(t,s,i,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return i?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&Xs(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function Tj(t,s){if(t.id in s)return s[t.id];try{let i=await import(t.module);return s[t.id]=i,i}catch(i){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function wj(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 jj(t,s,i){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await Tj(d,i);return u.links?u.links():[]}return[]}));return Aj(r.flat(1).filter(wj).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function dy(t,s,i,r,c,d){let u=(m,g)=>i[g]?m.route.id!==i[g].route.id:!0,p=(m,g)=>{var v;return i[g].pathname!==m.pathname||((v=i[g].route.path)==null?void 0:v.endsWith("*"))&&i[g].params["*"]!==m.params["*"]};return d==="assets"?s.filter((m,g)=>u(m,g)||p(m,g)):d==="data"?s.filter((m,g)=>{var b;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 _=m.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((b=i[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function Nj(t,s,{includeHydrateFallback:i}={}){return Cj(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)),i&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function Cj(t){return[...new Set(t)]}function Ej(t){let s={},i=Object.keys(t).sort();for(let r of i)s[r]=t[r];return s}function Aj(t,s){let i=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(Ej(c));return i.has(d)||(i.add(d),r.push({key:d,link:c})),r},[])}function T_(){let t=y.useContext(Ro);return rm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Dj(){let t=y.useContext(pd);return rm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var lm=y.createContext(void 0);lm.displayName="FrameworkContext";function w_(){let t=y.useContext(lm);return rm(t,"You must render this element inside a <HydratedRouter> element"),t}function Rj(t,s){let i=y.useContext(lm),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,_=y.useRef(null);y.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let w=T=>{T.forEach(C=>{u(C.isIntersecting)})},N=new IntersectionObserver(w,{threshold:.5});return _.current&&N.observe(_.current),()=>{N.disconnect()}}},[t]),y.useEffect(()=>{if(r){let w=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(w)}}},[r]);let S=()=>{c(!0)},k=()=>{c(!1),u(!1)};return i?t!=="intent"?[d,_,{}]:[d,_,{onFocus:Nr(p,S),onBlur:Nr(m,k),onMouseEnter:Nr(g,S),onMouseLeave:Nr(v,k),onTouchStart:Nr(b,S)}]:[!1,_,{}]}function Nr(t,s){return i=>{t&&t(i),i.defaultPrevented||s(i)}}function Mj({page:t,...s}){let{router:i}=T_(),r=y.useMemo(()=>d_(i.routes,t,i.basename),[i.routes,t,i.basename]);return r?y.createElement(Oj,{page:t,matches:r,...s}):null}function Ij(t){let{manifest:s,routeModules:i}=w_(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return jj(t,s,i).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,i]),r}function Oj({page:t,matches:s,...i}){let r=Vt(),{future:c,manifest:d,routeModules:u}=w_(),{basename:p}=T_(),{loaderData:m,matches:g}=Dj(),v=y.useMemo(()=>dy(t,s,g,d,r,"data"),[t,s,g,d,r]),b=y.useMemo(()=>dy(t,s,g,d,r,"assets"),[t,s,g,d,r]),_=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let w=new Set,N=!1;if(s.forEach(C=>{var B;let E=d.routes[C.route.id];!E||!E.hasLoader||(!v.some(A=>A.route.id===C.route.id)&&C.route.id in m&&((B=u[C.route.id])!=null&&B.shouldRevalidate)||E.hasClientLoader?N=!0:w.add(C.route.id))}),w.size===0)return[];let T=Sj(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return N&&w.size>0&&T.searchParams.set("_routes",s.filter(C=>w.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]),S=y.useMemo(()=>Nj(b,d),[b,d]),k=Ij(b);return y.createElement(y.Fragment,null,_.map(w=>y.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),S.map(w=>y.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),k.map(({key:w,link:N})=>y.createElement("link",{key:w,nonce:i.nonce,...N,crossOrigin:N.crossOrigin??i.crossOrigin})))}function Lj(...t){return s=>{t.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var Bj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Bj&&(window.__reactRouterVersion="7.13.2")}catch{}function zj({basename:t,children:s,unstable_useTransitions:i,window:r}){let c=y.useRef();c.current==null&&(c.current=gw({window:r,v5Compat:!0}));let d=c.current,[u,p]=y.useState({action:d.action,location:d.location}),m=y.useCallback(g=>{i===!1?p(g):y.startTransition(()=>p(g))},[i]);return y.useLayoutEffect(()=>d.listen(m),[d,m]),y.createElement(fj,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:i})}var j_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cm=y.forwardRef(function({onClick:s,discover:i="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:p,state:m,target:g,to:v,preventScrollReset:b,viewTransition:_,unstable_defaultShouldRevalidate:S,...k},w){let{basename:N,navigator:T,unstable_useTransitions:C}=y.useContext(Mn),E=typeof v=="string"&&j_.test(v),B=h_(v,N);v=B.to;let A=Yw(v,{relative:c}),I=Vt(),O=null;if(p){let re=fd(p,[],I.unstable_mask?I.unstable_mask.pathname:"/",!0);N!=="/"&&(re.pathname=re.pathname==="/"?N:bs([N,re.pathname])),O=T.createHref(re)}let[U,P,W]=Rj(r,k),te=Hj(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:S,unstable_useTransitions:C});function H(re){s&&s(re),re.defaultPrevented||te(re)}let ie=!(B.isExternal||d),Y=y.createElement("a",{...k,...W,href:(ie?O:void 0)||B.absoluteURL||A,onClick:ie?H:s,ref:Lj(w,P),target:g,"data-discover":!E&&i==="render"?"true":void 0});return U&&!E?y.createElement(y.Fragment,null,Y,y.createElement(Mj,{page:A})):Y});cm.displayName="Link";var Uj=y.forwardRef(function({"aria-current":s="page",caseSensitive:i=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:p,children:m,...g},v){let b=sl(u,{relative:g.relative}),_=Vt(),S=y.useContext(pd),{navigator:k,basename:w}=y.useContext(Mn),N=S!=null&&Zj(b)&&p===!0,T=k.encodeLocation?k.encodeLocation(b).pathname:b.pathname,C=_.pathname,E=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;i||(C=C.toLowerCase(),E=E?E.toLowerCase():null,T=T.toLowerCase()),E&&w&&(E=Xs(E,w)||E);const B=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let A=C===T||!c&&C.startsWith(T)&&C.charAt(B)==="/",I=E!=null&&(E===T||!c&&E.startsWith(T)&&E.charAt(T.length)==="/"),O={isActive:A,isPending:I,isTransitioning:N},U=A?s:void 0,P;typeof r=="function"?P=r(O):P=[r,A?"active":null,I?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let W=typeof d=="function"?d(O):d;return y.createElement(cm,{...g,"aria-current":U,className:P,ref:v,style:W,to:u,viewTransition:p},typeof m=="function"?m(O):m)});Uj.displayName="NavLink";var $j=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:i,reloadDocument:r,replace:c,state:d,method:u=Pc,action:p,onSubmit:m,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...S},k)=>{let{unstable_useTransitions:w}=y.useContext(Mn),N=Gj(),T=Fj(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&j_.test(p),B=A=>{if(m&&m(A),A.defaultPrevented)return;A.preventDefault();let I=A.nativeEvent.submitter,O=(I==null?void 0:I.getAttribute("formmethod"))||u,U=()=>N(I||A.currentTarget,{fetcherKey:s,method:O,navigate:i,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_});w&&i!==!1?y.startTransition(()=>U()):U()};return y.createElement("form",{ref:k,method:C,action:T,onSubmit:r?m:B,...S,"data-discover":!E&&t==="render"?"true":void 0})});$j.displayName="Form";function Pj(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function N_(t){let s=y.useContext(Ro);return bt(s,Pj(t)),s}function Hj(t,{target:s,replace:i,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=md(),b=Vt(),_=sl(t,{relative:u});return y.useCallback(S=>{if(yj(S,s)){S.preventDefault();let k=i!==void 0?i:Fr(b)===Fr(_),w=()=>v(t,{replace:k,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m});g?y.startTransition(()=>w()):w()}},[b,v,_,i,r,c,s,t,d,u,p,m,g])}function dm(t){Yn(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(Cp(t)),i=y.useRef(!1),r=Vt(),c=y.useMemo(()=>bj(r.search,i.current?null:s.current),[r.search]),d=md(),u=y.useCallback((p,m)=>{const g=Cp(typeof p=="function"?p(new URLSearchParams(c)):p);i.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var Vj=0,qj=()=>`__${String(++Vj)}__`;function Gj(){let{router:t}=N_("useSubmit"),{basename:s}=y.useContext(Mn),i=lj(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:b}=kj(d,s);if(u.navigate===!1){let _=u.fetcherKey||qj();await r(_,i,u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,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:b,formMethod:u.method||m,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:i,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,i])}function Fj(t,{relative:s}={}){let{basename:i}=y.useContext(Mn),r=y.useContext(Jn);bt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...sl(t||".",{relative:s})},u=Vt();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(b=>b).forEach(b=>p.append("index",b));let v=p.toString();d.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:bs([i,d.pathname])),Fr(d)}function Zj(t,{relative:s}={}){let i=y.useContext(v_);bt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=N_("useViewTransitionState"),c=sl(t,{relative:s});if(!i.isTransitioning)return!1;let d=Xs(i.currentLocation.pathname,r)||i.currentLocation.pathname,u=Xs(i.nextLocation.pathname,r)||i.nextLocation.pathname;return Zr(c.pathname,u)!=null||Zr(c.pathname,d)!=null}function xt(){const t=md();return y.useCallback((s,i)=>{typeof s=="number"?t(s):t(s,i)},[t])}function um(t){return`/sessions/${encodeURIComponent(t)}`}function yi(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function Dn(t,s,i,r){const c=encodeURIComponent(t);let d;return i&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(i)}/tasks/${c}`:i?d=`/workspaces/${encodeURIComponent(i)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Ti(t,s,i){const r=new URLSearchParams;t&&r.set("workspace",t),s&&r.set("parent",s);const c=r.toString();if(t&&i){const d=`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${d}?parent=${encodeURIComponent(s)}`:d}return c?`/tasks/new?${c}`:"/tasks/new"}function C_(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const wo="/environments",Kj="/environments/new";function bi(t){return`/environments/${encodeURIComponent(t)}`}function Yj(t){return`/environments/${encodeURIComponent(t)}/edit`}const To="/settings",Jj="/settings/credentials",$f="/settings/personas",Wj="/settings/personas/new";function E_(t){return`/settings/personas/${encodeURIComponent(t)}`}const Xj="/settings/shortcuts",Qj="/pair",eN="/chat",_i="/",tN="/tasks",A_="/workspaces/new",D_="/knowledge",gd="/findings";function nN(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:gd}function Ep(t,s,i){const r=encodeURIComponent(t);return s&&i?`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(s)}/findings/${r}`:`/findings/${r}`}const sN=ew,aN={task:hw};function iN({workspaceId:t,environmentId:s,tasks:i,resolvedThemeId:r}){const c=xt(),d=y.useMemo(()=>i.filter(b=>b.workspaceId===t),[i,t]),{nodes:u,edges:p}=VT(d),m=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[S,k]of Object.entries(sN))_[S]=b.getPropertyValue(k).trim()||"#6b7a8d";return _},[r]),g=y.useCallback((b,_)=>{c(Dn(_.id,void 0,t,s))},[c,t,s]),v=y.useCallback(b=>{const _=b.data;return m[_.task.status]||m.pending},[m]);return d.length===0?o.jsxs("div",{className:un.emptyCta,children:[o.jsx("button",{className:un.ctaButton,onClick:()=>c(Ti(t,void 0,s)),children:"Create Task"}),o.jsx("div",{className:un.ctaDescription,children:"Create tasks to see the dependency graph"})]}):o.jsx("div",{className:un.dagContainer,children:o.jsxs(XS,{nodes:u,edges:p,nodeTypes:aN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[o.jsx(QS,{variant:eT.Dots,gap:24,size:1,color:"var(--text-disabled)"}),o.jsx(tT,{showInteractive:!1}),o.jsx(nT,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const oN="_breadcrumbs_17or2_1",rN="_list_17or2_11",lN="_item_17or2_21",cN="_separator_17or2_28",dN="_link_17or2_34",uN="_current_17or2_57",ho={breadcrumbs:oN,list:rN,item:lN,separator:cN,link:dN,current:uN};function ks({segments:t}){return o.jsx("nav",{className:ho.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:o.jsx("ol",{className:ho.list,children:t.map((s,i)=>{const r=i===t.length-1;return o.jsxs("li",{className:ho.item,children:[i>0&&o.jsx("span",{className:ho.separator,"aria-hidden":"true",children:o.jsx(ta,{size:at})}),s.url&&!r?o.jsx(cm,{className:ho.link,to:s.url,title:s.label,children:s.label}):o.jsx("span",{className:ho.current,"aria-current":"page",title:s.label,children:s.label})]},i)})})})}const fN="_btn_dwk2o_1",pN="_sm_dwk2o_22",mN="_md_dwk2o_28",hN="_lg_dwk2o_34",gN="_primary_dwk2o_40",vN="_danger_dwk2o_55",yN="_outline_dwk2o_70",bN="_ghost_dwk2o_80",Pf={btn:fN,sm:pN,md:mN,lg:hN,primary:gN,danger:vN,outline:yN,ghost:bN},Ks=y.forwardRef(function({variant:s="primary",size:i="md",className:r,children:c,...d},u){const p=[Pf.btn,Pf[s],Pf[i],r].filter(Boolean).join(" ");return o.jsx("button",{ref:u,className:p,...d,children:c})}),_N="_copyButton_1bqk0_1",xN={copyButton:_N},kN=2e3;function SN({text:t,className:s,"data-testid":i}){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 o.jsx("button",{type:"button",className:`${xN.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":i??"copy-button",children:r?o.jsx(ki,{size:Zt,"aria-hidden":"true"}):o.jsx(l_,{size:Zt,"aria-hidden":"true"})})}const TN="_banner_bxqlh_1",wN="_label_bxqlh_15",jN="_text_bxqlh_25",NN="_link_bxqlh_29",Nc={banner:TN,label:wN,text:jN,link:NN};function CN(){return o.jsxs("div",{className:Nc.banner,"data-testid":"demo-banner",children:[o.jsx("span",{className:Nc.label,children:"DEMO"}),o.jsxs("span",{className:Nc.text,children:["This is an interactive demo with mock data."," ",o.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:Nc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const EN="_container_og0yp_1",AN="_chevronButton_og0yp_6",DN="_mainButton_og0yp_6",RN="_sm_og0yp_34",MN="_md_og0yp_34",IN="_lg_og0yp_34",ON="_primary_og0yp_57",LN="_danger_og0yp_70",BN="_outline_og0yp_83",zN="_ghost_og0yp_92",UN="_dropdown_og0yp_100",$N="_option_og0yp_113",PN="_optionLabel_og0yp_130",HN="_optionDesc_og0yp_135",qs={container:EN,chevronButton:AN,mainButton:DN,sm:RN,md:MN,lg:IN,primary:ON,danger:LN,outline:BN,ghost:zN,dropdown:UN,option:$N,optionLabel:PN,optionDesc:HN};function R_({label:t,onClick:s,options:i,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 _(S){m.current&&S.target instanceof Node&&!m.current.contains(S.target)&&p(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[u]),y.useEffect(()=>{if(!u)return;function _(S){S.key==="Escape"&&p(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const g=qs[r]||"",v=qs[c]||"",b=()=>{u&&p(!1),s()};return o.jsxs("div",{ref:m,className:qs.container,"data-testid":d,children:[o.jsx("button",{type:"button",className:`${qs.mainButton} ${g} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),o.jsx("button",{type:"button",className:`${qs.chevronButton} ${g} ${v}`,onClick:()=>p(_=>!_),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:o.jsx(r_,{size:Zt,"aria-hidden":"true"})}),u&&o.jsx("div",{className:qs.dropdown,"data-testid":d?`${d}-menu`:void 0,children:i.map((_,S)=>o.jsxs("button",{type:"button",className:qs.option,onClick:()=>{_.onClick(),p(!1)},children:[o.jsx("span",{className:qs.optionLabel,children:_.label}),_.description&&o.jsx("span",{className:qs.optionDesc,children:_.description})]},S))})]})}function Ap(){Ap=function(c,d){return new i(c,void 0,d)};var t=RegExp.prototype,s=new WeakMap;function i(c,d,u){var p=new RegExp(c,d);return s.set(p,u||s.get(c)),Yc(p,i.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&&Yc(c,d)})(i,RegExp),i.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},i.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)},Ap.apply(this,arguments)}function Yc(t,s){return Yc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,r){return i.__proto__=r,i},Yc(t,s)}function uy(t,s){(s==null||s>t.length)&&(s=t.length);for(var i=0,r=new Array(s);i<s;i++)r[i]=t[i];return r}function Hf(t,s){var i=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=(function(c,d){if(c){if(typeof c=="string")return uy(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)?uy(c,d):void 0}})(t))||s){i&&(t=i);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.
|
|
228
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var VN=(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){gT(r,"element",i)};function i(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,b=(function(A){for(var I,O=Hf(A.properties.className);!(I=O()).done;){var U=I.value;if(U.slice(0,9)==="language-")return U.slice(9).toLowerCase()}return null})(r);if(!b&&s.defaultLanguage&&r.properties.className.push("language-"+(b=s.defaultLanguage)),r.properties.className.push("code-highlight"),b)try{var _,S;S=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,g=t.highlight(wc(r),S),d.properties.className=(d.properties.className||[]).concat("language-"+S)}catch(A){if(!s.ignoreMissing||!/Unknown language/.test(A.message))throw A;g=r}else g=r;g.children=(v=1,function A(I){return I.reduce(function(O,U){if(U.type==="text"){var P=U.value,W=(P.match(/\n/g)||"").length;if(W===0)U.position={start:{line:v,column:1},end:{line:v,column:1}},O.push(U);else for(var te,H=P.split(`
|
|
229
|
-
`),ie=Hf(H.entries());!(te=ie()).done;){var Y=te.value,re=Y[0],D=Y[1];O.push({type:"text",value:re===H.length-1?D:D+`
|
|
230
|
-
`,position:{start:{line:v+re,column:1},end:{line:v+re,column:1}}})}return v+=W,O}if(Object.prototype.hasOwnProperty.call(U,"children")){var Z=v;return U.children=A(U.children),O.push(U),U.position={start:{line:Z,column:1},end:{line:v,column:1}},O}return O.push(U),O},[])})(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 k,w=(function(A){var I=/{([\d,-]+)}/,O=A.split(",").map(function(W){return W.trim()}).join();if(I.test(O)){var U=I.exec(O)[1],P=yT(U);return function(W){return P.includes(W+1)}}return function(){return!1}})(m),N=(function(A){var I=Ap(/showLineNumbers=(\d+)/i,{lines:1});if(I.test(A)){var O=I.exec(A);return Number(O.groups.lines)}return 1})(m),T=(function(A){for(var I=new Array(A),O=0;O<A;O++)I[O]={type:"element",tagName:"span",properties:{className:[]},children:[]};return I})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],E=function(){var A,I,O=k.value,U=O[0],P=O[1];P.properties.className=["code-line"];var W=bT(g,function(te){return te.position.start.line<=U+1&&te.position.end.line>=U+1});P.children=W.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function(te){return m.toLowerCase().includes(te)})&&(P.properties.line=[(U+N).toString()],P.properties.className.push("line-number")),w(U)&&P.properties.className.push("highlight-line"),(b==="diff"||(A=b)!=null&&A.includes("diff-"))&&wc(P).substring(0,1)==="-"?P.properties.className.push("deleted"):(b==="diff"||(I=b)!=null&&I.includes("diff-"))&&wc(P).substring(0,1)==="+"&&P.properties.className.push("inserted")},B=Hf(T.entries());!(k=B()).done;)E();T.length>0&&wc(T[T.length-1]).trim()===""&&T.pop(),r.children=T}}}})(vT);function M_(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 jo(t){return t===0?"-":t<.01?`$${t.toFixed(4)}`:`$${t.toFixed(2)}`}const fy=new Set(["grackle"]);function Mo(t){if(t.startsWith("mcp__")){const i=t.indexOf("__",5);if(i>5){const r=t.slice(5,i);if(fy.has(r))return t.slice(i+2)}}const s=t.indexOf("-");if(s>0){const i=t.slice(0,s);if(fy.has(i))return t.slice(s+1)}return t}const qN={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",toolsearch:"tool-search",agent:"agent",task:"agent",read_agent:"agent"};function GN(t){const s=Mo(t);return qN[s.toLowerCase()]??"generic"}const FN="_card_qkm9i_2",ZN="_cardBlue_qkm9i_20",KN="_cardOrange_qkm9i_24",YN="_cardGreen_qkm9i_28",JN="_cardPurple_qkm9i_32",WN="_cardNeutral_qkm9i_36",XN="_cardRed_qkm9i_40",QN="_cardTeal_qkm9i_44",eC="_header_qkm9i_48",tC="_icon_qkm9i_55",nC="_toolName_qkm9i_64",sC="_fileName_qkm9i_71",aC="_badge_qkm9i_80",iC="_spacer_qkm9i_87",oC="_bodyToggle_qkm9i_91",rC="_chevron_qkm9i_109",lC="_chevronExpanded_qkm9i_115",cC="_pre_qkm9i_119",dC="_diffAdd_qkm9i_143",uC="_diffRemove_qkm9i_155",fC="_diffContext_qkm9i_167",pC="_diffHeader_qkm9i_176",mC="_diffLine_qkm9i_182",hC="_exitOk_qkm9i_188",gC="_exitError_qkm9i_194",vC="_exitPending_qkm9i_200",yC="_inProgress_qkm9i_228",bC="_metadata_qkm9i_232",_C="_metadataPrefix_qkm9i_239",M={card:FN,cardBlue:ZN,cardOrange:KN,cardGreen:YN,cardPurple:JN,cardNeutral:WN,cardRed:XN,cardTeal:QN,header:eC,icon:tC,toolName:nC,fileName:sC,badge:aC,spacer:iC,bodyToggle:oC,chevron:rC,chevronExpanded:lC,pre:cC,diffAdd:dC,diffRemove:uC,diffContext:fC,diffHeader:pC,diffLine:mC,exitOk:hC,exitError:gC,exitPending:vC,inProgress:yC,metadata:bC,metadataPrefix:_C};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 kC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const Vf=5;function py({tool:t,args:s,result:i,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=xC(s),m=kC(p),g=i===void 0,v=r?M.cardRed:c?M.cardGreen:M.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?o.jsx(p2,{size:Zt}):o.jsx(h2,{size:Zt}),S=c?"tool-card-file-write":"tool-card-file-read",k=(i==null?void 0:i.split(`
|
|
231
|
-
`))??[],w=k.length>Vf,N=d?k:k.slice(0,Vf);return o.jsxs("div",{className:`${M.card} ${v} ${g?M.inProgress:""}`,"data-testid":S,children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,children:_}),o.jsx("span",{className:M.toolName,style:{color:b},children:t}),m&&o.jsx("span",{className:M.fileName,title:p,children:m}),!g&&k.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,children:[k.length," lines"]})]})]}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&!g&&k.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-content",children:N.map((T,C)=>o.jsxs("span",{className:M.diffLine,children:[o.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))}),w&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(T=>!T)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${d?M.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(ta,{size:at})}),d?"collapse":`${k.length-Vf} more lines`]})]})]})}function SC(t){const s=t.split(`
|
|
232
|
-
`),i=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?i.push({type:"header",content:r}):r.startsWith("+")?i.push({type:"add",content:r.slice(1)}):r.startsWith("-")?i.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?i.push({type:"context",content:r.slice(1)}):r===""&&i.push({type:"context",content:""}));return i}function TC(t,s){const i=t.split(`
|
|
233
|
-
`),r=s.split(`
|
|
234
|
-
`),c=[];for(const d of i)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,i=0;for(const r of t)r.type==="add"&&s++,r.type==="remove"&&i++;return{added:s,removed:i}}function jC(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 NC(t){if(t===void 0||typeof t!="object"||t===null)return;const s=t,i=(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(i!==void 0&&r!==void 0)return{oldStr:i,newStr:r}}function CC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function EC(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=SC(r);if(c.length>0)return c}}const i=NC(t);if(i)return TC(i.oldStr,i.newStr)}const qf=5;function AC({tool:t,args:s,result:i,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=jC(s),m=CC(p),g=i===void 0,v=EC(s,c),b=v?wC(v):null,_=((v==null?void 0:v.length)??0)>qf,S=d?v:v==null?void 0:v.slice(0,qf);return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardOrange} ${g?M.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,children:o.jsx($2,{size:Zt})}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&o.jsx("span",{className:M.fileName,title:p,children:m}),b&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-diff-stats",children:[o.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",o.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]})]}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&S&&S.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-diff",children:S.map((k,w)=>{let N=M.diffContext;return k.type==="add"&&(N=M.diffAdd),k.type==="remove"&&(N=M.diffRemove),k.type==="header"&&(N=M.diffHeader),o.jsx("span",{className:`${M.diffLine} ${N}`,children:k.content},w)})}),_&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(k=>!k)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${d?M.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(ta,{size:at})}),d?"collapse":`${((v==null?void 0:v.length)??0)-qf} more lines`]})]}),!r&&!v&&!g&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-content",children:i})]})}const DC=/^\[exit (\d+)\]\s*/;function RC(t){const s=DC.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function MC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function IC(t){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'([^']*)'\s*$/i.exec(t);if(s)return s[1];const i=/pwsh(?:\.exe)?["']?\s+-Command\s+"([^"]*)"\s*$/i.exec(t);return i?i[1]:t}const Gf=3;function OC({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=MC(s),p=IC(u),m=i===void 0,g=i?RC(i):null,v=(g==null?void 0:g.output.split(`
|
|
235
|
-
`))??[],b=v.length>Gf,_=c?v:v.slice(0,Gf),S=g==null?void 0:g.exitCode,k=r||S!==void 0&&S!==0;return o.jsxs("div",{className:`${M.card} ${k?M.cardRed:M.cardNeutral}`,"data-testid":"tool-card-shell",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),o.jsx("span",{className:M.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==p?u:void 0,"data-testid":"tool-card-command",children:p}),S!==void 0&&o.jsxs("span",{className:S===0?M.exitOk:M.exitError,"data-testid":"tool-card-exit-code",children:[S===0?o.jsx(ki,{size:at,"aria-hidden":"true"}):o.jsx(za,{size:at,"aria-hidden":"true"})," ","exit ",S]}),m&&o.jsx("span",{className:M.exitPending,"data-testid":"tool-card-pending",children:o.jsx(C2,{size:at,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-output",children:_.join(`
|
|
236
|
-
`)}),b&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(w=>!w)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(ta,{size:at})}),c?"collapse":`${v.length-Gf} more lines`]})]})]})}function LC(t){if(t==null||typeof t!="object")return{pattern:"",path:""};const s=t,i=typeof s.pattern=="string"?s.pattern:"",r=typeof s.path=="string"?s.path:"";return{pattern:i,path:r}}const Ff=5;function BC({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=LC(s),m=i===void 0,g=(i==null?void 0:i.split(`
|
|
237
|
-
`).filter(_=>_.length>0))??[],v=g.length>Ff,b=c?g:g.slice(0,Ff);return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-search",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,children:o.jsx(c_,{size:Zt})}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&o.jsxs("span",{className:M.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&o.jsxs("span",{className:M.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!m&&!r&&g.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&!m&&b.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-results",children:b.join(`
|
|
238
|
-
`)}),v&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(ta,{size:at})}),c?"collapse":`${g.length-Ff} more matches`]})]})]})}const zC="_progressBar_14f5c_1",UC="_progressFill_14f5c_9",$C="_activeTask_14f5c_16",PC="_activeIcon_14f5c_27",HC="_todoPulse_14f5c_1",VC="_activeText_14f5c_34",qC="_checklist_14f5c_48",GC="_item_14f5c_55",FC="_itemIcon_14f5c_65",ZC="_itemText_14f5c_73",KC="_pending_14f5c_78",YC="_in_progress_14f5c_85",JC="_completed_14f5c_97",WC="_emptyMessage_14f5c_108",ns={progressBar:zC,progressFill:UC,activeTask:$C,activeIcon:PC,todoPulse:HC,activeText:VC,checklist:qC,item:GC,itemIcon:FC,itemText:ZC,pending:KC,in_progress:YC,completed:JC,emptyMessage:WC},XC=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function QC(t){if(t===void 0||typeof t!="object"||t===null)return[];const s=t;return Array.isArray(s.todos)?s.todos.filter(i=>typeof i=="object"&&i!==null&&typeof i.content=="string"&&typeof i.status=="string").map(i=>({content:i.content,activeForm:typeof i.activeForm=="string"?i.activeForm:void 0,status:my(i.status)})):Array.isArray(s.plan)?s.plan.filter(i=>typeof i=="object"&&i!==null&&typeof i.step=="string"&&typeof i.status=="string").map(i=>({content:i.step,status:my(i.status)})):typeof s.content=="string"?eE(s.content):[]}function my(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 eE(t){const s=t.split(`
|
|
239
|
-
`),i=[];for(const r of s){const c=XC.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"),i.push({content:u,status:p})}}return i}function tE(t){switch(t){case"completed":return o.jsx(ki,{size:at});case"in_progress":return o.jsx(Ia,{size:at,fill:"currentColor"});default:return o.jsx(Ia,{size:at})}}function nE({args:t}){const s=QC(t),i=s.filter(d=>d.status==="completed").length,r=s.find(d=>d.status==="in_progress"),c=s.length===0;return o.jsxs("div",{className:`${M.card} ${M.cardBlue}`,"data-testid":"tool-card-todo",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,children:o.jsx(T2,{size:Zt})}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-todo-progress",children:[i,"/",s.length]})]})]}),!c&&o.jsx("div",{className:ns.progressBar,"data-testid":"tool-card-todo-bar",children:o.jsx("div",{className:ns.progressFill,style:{width:`${i/s.length*100}%`}})}),r&&o.jsxs("div",{className:ns.activeTask,"data-testid":"tool-card-todo-active",children:[o.jsx("span",{className:ns.activeIcon,children:o.jsx(Ia,{size:at,fill:"currentColor"})}),o.jsx("span",{className:ns.activeText,children:r.activeForm||r.content})]}),!c&&o.jsx("div",{className:ns.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>o.jsxs("div",{className:`${ns.item} ${ns[d.status]}`,"data-testid":"tool-card-todo-item",children:[o.jsx("span",{className:ns.itemIcon,children:tE(d.status)}),o.jsx("span",{className:ns.itemText,children:d.content})]},u))}),c&&o.jsx("div",{className:ns.emptyMessage,children:"All items completed and cleared."})]})}function sE(t,s){if(s==null||typeof s!="object")return"";const i=s;if(typeof i.intent=="string")return i.intent;for(const r of Object.values(i))if(typeof r=="string")return r;return t}function aE({tool:t,args:s}){const i=sE(t,s);return o.jsxs("div",{className:M.metadata,"data-testid":"tool-card-metadata",children:[o.jsx("span",{className:M.metadataPrefix,children:o.jsx(u2,{size:at})}),i]})}function iE(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 oE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(i=>i!==null&&typeof i=="object")};if(typeof s=="object"&&s!==null)return{single:s}}catch{}return{}}const Zf=5,Kf=5;function rE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Mo(t),p=iE(s),m=i===void 0,{single:g,list:v}=oE(i),b=(g==null?void 0:g.title)??p.title,_=v?void 0:(g==null?void 0:g.category)??p.category,S=v?void 0:(g==null?void 0:g.tags)??p.tags;return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-finding",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"💡"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),b&&o.jsxs("span",{className:M.fileName,"data-testid":"tool-card-finding-title",children:['"',b,'"']}),_&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsx("span",{className:M.badge,"data-testid":"tool-card-finding-category",children:_})]}),v&&!_&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]})]}),S&&S.length>0&&o.jsx("div",{className:M.pre,style:{padding:"4px 8px",whiteSpace:"normal"},"data-testid":"tool-card-finding-tags",children:S.map((k,w)=>o.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",k]},w))}),m&&!b&&s!==null&&s!==void 0&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&(g==null?void 0:g.content)&&o.jsx(o.Fragment,{children:(()=>{const k=g.content.split(`
|
|
240
|
-
`),w=k.length>Kf,N=c?g.content:k.slice(0,Kf).join(`
|
|
241
|
-
`);return o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-finding-content",children:N}),w&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${k.length-Kf} more lines`]})]})})()}),!r&&v&&v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-finding-list",children:(c?v:v.slice(0,Zf)).map((k,w)=>`${k.category?`[${k.category}] `:""}${k.title??k.id??`Finding ${w+1}`}`).join(`
|
|
242
|
-
`)}),v.length>Zf&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Zf} more findings`]})]})]})}function lE(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 cE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(i=>i!==null&&typeof i=="object")};if(typeof s=="object"&&s!==null){const i=s;return typeof i.sessionId=="string"?{sessionId:i.sessionId,single:i}:{single:i}}}catch{}return{}}function hy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function dE(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 Yf=5;function uE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Mo(t),p=lE(s),m=i===void 0,{single:g,list:v,sessionId:b}=cE(i),_=(g==null?void 0:g.title)??p.title,S=(g==null?void 0:g.status)??p.status;return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardBlue} ${m?M.inProgress:""}`,"data-testid":"tool-card-task",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"📋"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:u}),_&&o.jsxs("span",{className:M.fileName,"data-testid":"tool-card-task-title",children:['"',_,'"']}),!_&&p.taskId&&o.jsx("span",{className:M.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),S&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,style:{color:dE(S)},"data-testid":"tool-card-task-status",children:[hy(S)," ",S]})]}),v&&!S&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),m&&!_&&!p.taskId&&s!==null&&s!==void 0&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&b&&o.jsxs("div",{className:M.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",b]}),!r&&g&&!v&&!b&&o.jsx("pre",{className:M.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(`
|
|
243
|
-
`)}),!r&&v&&v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,Yf)).map(k=>{const w=hy(k.status),N=k.title??k.id??"untitled";return`${w} ${N}`}).join(`
|
|
244
|
-
`)}),v.length>Yf&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Yf} more tasks`]})]})]})}function fE(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 pE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s,r=typeof i.workpad=="object"&&i.workpad!==null?i.workpad:i;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 mE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Mo(t),p=fE(s),m=i===void 0,g=pE(i),v=g.status??p.status,b=g.summary??p.summary;return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardGreen} ${m?M.inProgress:""}`,"data-testid":"tool-card-workpad",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"📓"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsx("span",{className:M.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&o.jsx("pre",{className:M.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&!m&&i&&!b&&!v&&!g.extra&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:i}),!r&&g.extra&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function hE(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 gE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s;if(Array.isArray(i.results))return{results:i.results.filter(r=>r!==null&&typeof r=="object")};if(typeof i.node=="object"&&i.node!==null){const r=Array.isArray(i.edges)?i.edges.length:0;return{node:i.node,edgeCount:r}}if(typeof i.id=="string")return{node:i}}catch{}return{}}const Jf=5;function vE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Mo(t),p=hE(s),m=i===void 0,g=gE(i);return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🧠"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&o.jsxs("span",{className:M.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&o.jsx("span",{className:M.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-knowledge-count",children:[g.results.length," ",g.results.length===1?"result":"results"]})]}),g.node&&g.edgeCount!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.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&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&g.results&&g.results.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,Jf)).map(v=>{var S,k,w;const b=((S=v.node)==null?void 0:S.title)??((k=v.node)==null?void 0:k.label)??((w=v.node)==null?void 0:w.id)??"node",_=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${b}${_}`}).join(`
|
|
245
|
-
`)}),g.results.length>Jf&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-Jf} more results`]})]}),!r&&g.node&&!g.results&&o.jsx("pre",{className:M.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(`
|
|
246
|
-
`)})]})}function yE(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 bE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s;return{sessionId:typeof i.sessionId=="string"?i.sessionId:void 0,fd:typeof i.fd=="number"?i.fd:void 0,fds:Array.isArray(i.fds)?i.fds.filter(r=>r!==null&&typeof r=="object"):void 0,success:typeof i.success=="boolean"?i.success:void 0,output:typeof i.output=="string"?i.output:void 0}}catch{}return{}}function _E({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Mo(t),p=yE(s),m=i===void 0,g=bE(i);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const b=p.prompt?p.prompt.length>60?`${p.prompt.slice(0,60)}...`:p.prompt:void 0;return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardOrange} ${m?M.inProgress:""}`,"data-testid":"tool-card-ipc",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🔀"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&o.jsx("span",{className:M.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&o.jsx("span",{className:M.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),g.fds&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-ipc-fd-count",children:[g.fds.length," ",g.fds.length===1?"fd":"fds"]})]}),g.success!==void 0&&!g.fds&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsx("span",{className:M.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&&!b&&!v&&s!==null&&s!==void 0&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&g.sessionId&&o.jsxs("div",{className:M.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&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(_=>{const S=[`fd:${_.fd??"?"}`,_.permission??"",_.deliveryMode??""];return _.streamName&&S.push(_.streamName),_.owned&&S.push("(owned)"),S.filter(Boolean).join(" ")}).join(`
|
|
247
|
-
`)}),g.fds.length>5&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function xE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const Wf=8;function kE({args:t,result:s,isError:i}){const[r,c]=y.useState(!1),d=xE(t),u=s===void 0,p=(s==null?void 0:s.split(`
|
|
248
|
-
`))??[],m=p.length>Wf,g=r?s:p.slice(0,Wf).join(`
|
|
249
|
-
`);return o.jsxs("div",{className:`${M.card} ${i?M.cardRed:M.cardNeutral} ${u?M.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🔧"}),o.jsx("span",{className:M.toolName,children:"ToolSearch"}),d&&o.jsxs("span",{className:M.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!i&&s&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),i&&s&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:s}),!i&&!u&&s&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${r?M.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-Wf} more lines`]})]})]})}function SE(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function TE(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 i=JSON.stringify(t);return i.length>120?`${i.slice(0,120)}…`:i}catch{return""}}const Xf=5;function wE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),{display:u}=SE(t),p=TE(s),m=i===void 0,g=(i==null?void 0:i.split(`
|
|
250
|
-
`))??[],v=g.length>Xf,b=c?i:g.slice(0,Xf).join(`
|
|
251
|
-
`);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardBlue} ${m?M.inProgress:""}`,"data-testid":"tool-card-generic",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,children:o.jsx(r2,{size:Zt,"aria-hidden":"true"})}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&o.jsx("span",{className:M.fileName,children:p})]}),m&&_&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:_}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&!m&&i&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:b}),v&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(ta,{size:at})}),c?"collapse":`${g.length-Xf} more lines`]})]})]})}const jE="_badgePill_o7eqc_1",NE="_modelBadge_o7eqc_14",CE="_backgroundBadge_o7eqc_26",EE="_backgroundDot_o7eqc_36",AE="_backgroundDotPulsing_o7eqc_41",DE="_description_o7eqc_55",RE="_statusLine_o7eqc_62",ME="_statusCompleted_o7eqc_72",IE="_statusRunning_o7eqc_77",OE="_statusError_o7eqc_83",LE="_promptToggle_o7eqc_88",ss={badgePill:jE,modelBadge:NE,backgroundBadge:CE,backgroundDot:EE,backgroundDotPulsing:AE,description:DE,statusLine:RE,statusCompleted:ME,statusRunning:IE,statusError:OE,promptToggle:LE};function BE(t,s){if(s==null||typeof s!="object")return{};const i=s;return t.toLowerCase()==="read_agent"?{agentId:typeof i.agent_id=="string"?i.agent_id:void 0,isPoll:!0}:typeof i.agent_type=="string"||typeof i.name=="string"?{agentType:typeof i.agent_type=="string"?i.agent_type:void 0,description:typeof i.description=="string"?i.description:void 0,prompt:typeof i.prompt=="string"?i.prompt:void 0,isBackground:i.mode==="background",agentName:typeof i.name=="string"?i.name:void 0}:{agentType:typeof i.subagent_type=="string"?i.subagent_type:void 0,description:typeof i.description=="string"?i.description:void 0,prompt:typeof i.prompt=="string"?i.prompt:void 0,isBackground:i.run_in_background===!0,model:typeof i.model=="string"?i.model:void 0,isResume:typeof i.resume=="string"&&i.resume.length>0}}const zE=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function UE(t){const s=zE.exec(t);if(!s)return;const i=s[4];return{status:s[1].toLowerCase(),agentId:s[2].replace(/,$/,""),metadata:s[3].trim(),content:i?i.trim():void 0}}const Qf=5;function $E({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),m=BE(t,s),g=i===void 0,v=m.isPoll&&i?UE(i):void 0,b=(v==null?void 0:v.content)??i,_=(b==null?void 0:b.split(`
|
|
252
|
-
`))??[],S=_.length>Qf,k=c?b:_.slice(0,Qf).join(`
|
|
253
|
-
`),w=m.isPoll?"Subagent":"Agent";return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardTeal} ${g?M.inProgress:""}`,"data-testid":"tool-card-agent",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:w}),m.agentType&&o.jsx("span",{className:ss.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&o.jsx("span",{className:ss.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&o.jsxs("span",{className:ss.backgroundBadge,"data-testid":"tool-card-agent-background",children:[o.jsx("span",{className:g?ss.backgroundDotPulsing:ss.backgroundDot,children:"●"}),"BG"]}),m.agentName&&o.jsx("span",{className:M.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&o.jsx("span",{className:M.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),o.jsx("span",{className:M.spacer}),g&&!m.isBackground&&o.jsx("span",{className:M.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&o.jsx("div",{className:ss.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&o.jsxs("div",{className:ss.statusLine,"data-testid":"tool-card-agent-status",children:[o.jsx("span",{className:v.status==="completed"?ss.statusCompleted:v.status==="running"?ss.statusRunning:ss.statusError,children:v.status}),v.metadata&&o.jsx("span",{children:v.metadata})]}),m.prompt&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:ss.promptToggle,onClick:()=>{p(N=>!N)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[o.jsx("span",{className:`${M.chevron} ${u?M.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&!g&&b&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:k}),S&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${_.length-Qf} more lines`]})]})]})}function ep(t){switch(GN(t.tool)){case"file-read":return o.jsx(py,{...t});case"file-edit":return o.jsx(AC,{...t});case"file-write":return o.jsx(py,{...t,writeVariant:!0});case"shell":return o.jsx(OC,{...t});case"search":return o.jsx(BC,{...t});case"todo":return o.jsx(nE,{...t});case"metadata":return o.jsx(aE,{...t});case"finding":return o.jsx(rE,{...t});case"task":return o.jsx(uE,{...t});case"workpad":return o.jsx(mE,{...t});case"knowledge":return o.jsx(vE,{...t});case"ipc":return o.jsx(_E,{...t});case"tool-search":return o.jsx(kE,{...t});case"agent":return o.jsx($E,{...t});default:return o.jsx(wE,{...t})}}const PE="_systemContextEvent_hmqlm_1",HE="_systemContextHeader_hmqlm_7",VE="_systemContextBadge_hmqlm_28",qE="_systemContextToggle_hmqlm_37",GE="_systemContextPre_hmqlm_43",FE="_systemContextEllipsis_hmqlm_54",ZE="_systemEvent_hmqlm_58",KE="_systemTimestamp_hmqlm_65",YE="_textEvent_hmqlm_69",JE="_codeBlockWrapper_hmqlm_156",WE="_codeBlockCopyButton_hmqlm_159",XE="_errorEvent_hmqlm_163",QE="_statusEvent_hmqlm_171",eA="_userInputEvent_hmqlm_180",tA="_userInputContent_hmqlm_186",nA="_signalEvent_hmqlm_203",sA="_signalBadge_hmqlm_214",aA="_signalContent_hmqlm_223",iA="_usageEvent_hmqlm_228",oA="_usageBadge_hmqlm_235",rA="_defaultEvent_hmqlm_244",Ot={systemContextEvent:PE,systemContextHeader:HE,systemContextBadge:VE,systemContextToggle:qE,systemContextPre:GE,systemContextEllipsis:FE,systemEvent:ZE,systemTimestamp:KE,textEvent:YE,codeBlockWrapper:JE,codeBlockCopyButton:WE,errorEvent:XE,statusEvent:QE,userInputEvent:eA,userInputContent:tA,signalEvent:nA,signalBadge:sA,signalContent:aA,usageEvent:iA,usageBadge:oA,defaultEvent:rA},gy=3;function lA({content:t}){const[s,i]=y.useState(!1),r=t.split(`
|
|
254
|
-
`),c=r.length>gy,d=s?t:r.slice(0,gy).join(`
|
|
255
|
-
`);return o.jsxs("div",{className:Ot.systemContextEvent,"data-testid":"system-context-event",children:[o.jsxs("button",{type:"button",className:Ot.systemContextHeader,onClick:()=>{i(u=>!u)},"aria-expanded":s,children:[o.jsx("span",{className:Ot.systemContextBadge,children:"SYSTEM PROMPT"}),c&&o.jsx("span",{className:Ot.systemContextToggle,"aria-hidden":"true",children:s?o.jsx(r_,{size:at}):o.jsx(ta,{size:at})})]}),o.jsxs("pre",{className:Ot.systemContextPre,children:[d,!s&&c&&o.jsx("span",{className:Ot.systemContextEllipsis,children:"…"})]})]})}function cA({time:t,content:s}){return o.jsxs("div",{className:Ot.systemEvent,children:[o.jsxs("span",{className:Ot.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Dp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Dp).join(""):t!=null&&typeof t=="object"&&"props"in t?Dp(t.props.children):""}function dA({children:t,node:s,...i}){const r=Dp(t);return o.jsxs("div",{className:Ot.codeBlockWrapper,children:[o.jsx("pre",{...i,children:t}),o.jsx(SN,{text:r,"data-testid":"copy-code-block",className:Ot.codeBlockCopyButton})]})}const uA={pre:dA};function fA({content:t}){return o.jsx("div",{className:Ot.textEvent,children:o.jsx(dd,{remarkPlugins:[ud],rehypePlugins:[VN],components:uA,children:t})})}function pA({content:t}){return o.jsxs("div",{className:Ot.errorEvent,children:["Error: ",t]})}function mA({content:t}){return o.jsxs("div",{className:Ot.statusEvent,children:["--- ",t," ---"]})}function hA({content:t}){return o.jsx("div",{className:Ot.userInputEvent,children:o.jsx("span",{className:Ot.userInputContent,children:t})})}function gA({content:t}){return o.jsxs("div",{className:Ot.signalEvent,"data-testid":"signal-event",children:[o.jsx("span",{className:Ot.signalBadge,children:"SIGNAL"}),o.jsx("span",{className:Ot.signalContent,children:t})]})}function vA({content:t}){let s=t;try{const i=JSON.parse(t),r=Number(i.input_tokens)||0,c=Number(i.output_tokens)||0,d=M_(r+c),u=jo(Number(i.cost_usd)||0);s=`${d} tokens · ${u}`}catch{}return o.jsx("div",{className:Ot.usageEvent,"data-testid":"usage-event",children:o.jsx("span",{className:Ot.usageBadge,children:s})})}function yA({content:t}){return o.jsx("div",{className:Ot.defaultEvent,children:t})}function bA({event:t,toolUseCtx:s,settled:i}){const r=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return o.jsx(lA,{content:t.content})}catch{}return o.jsx(cA,{time:r,content:t.content})}case"text":case"output":return o.jsx(fA,{content:t.content});case"tool_use":{let c="",d={};try{const u=JSON.parse(t.content);c=u.tool||"",d=u.args}catch{}return o.jsx(ep,{tool:c,args:d,result:i?"":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?o.jsx(ep,{tool:s.tool,args:s.args,result:d,isError:c,detailedResult:s.detailedResult}):o.jsx(ep,{tool:"Tool output",args:void 0,result:d,isError:c})}case"error":return o.jsx(pA,{content:t.content});case"status":return o.jsx(mA,{content:t.content});case"user_input":return o.jsx(hA,{content:t.content});case"signal":return o.jsx(gA,{content:t.content});case"usage":return o.jsx(vA,{content:t.content});default:return o.jsx(yA,{content:t.content})}}const fm=y.createContext({});function pm(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const vd=y.createContext(null),mm=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class _A extends y.Component{getSnapshotBeforeUpdate(s){const i=this.props.childRef.current;if(i&&s.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=i.offsetHeight||0,r.width=i.offsetWidth||0,r.top=i.offsetTop,r.left=i.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function xA({children:t,isPresent:s}){const i=y.useId(),r=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0}),{nonce:d}=y.useContext(mm);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=i;const v=document.createElement("style");return d&&(v.nonce=d),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
|
|
256
|
-
[data-motion-pop-id="${i}"] {
|
|
257
|
-
position: absolute !important;
|
|
258
|
-
width: ${u}px !important;
|
|
259
|
-
height: ${p}px !important;
|
|
260
|
-
top: ${m}px !important;
|
|
261
|
-
left: ${g}px !important;
|
|
262
|
-
}
|
|
263
|
-
`),()=>{document.head.removeChild(v)}},[s]),o.jsx(_A,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const kA=({children:t,initial:s,isPresent:i,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=pm(SA),m=y.useId(),g=y.useCallback(b=>{p.set(b,!0);for(const _ of p.values())if(!_)return;r&&r()},[p,r]),v=y.useMemo(()=>({id:m,initial:s,isPresent:i,custom:c,onExitComplete:g,register:b=>(p.set(b,!1),()=>p.delete(b))}),d?[Math.random(),g]:[i,g]);return y.useMemo(()=>{p.forEach((b,_)=>p.set(_,!1))},[i]),y.useEffect(()=>{!i&&!p.size&&r&&r()},[i]),u==="popLayout"&&(t=o.jsx(xA,{isPresent:i,children:t})),o.jsx(vd.Provider,{value:v,children:t})};function SA(){return new Map}function I_(t=!0){const s=y.useContext(vd);if(s===null)return[!0,null];const{isPresent:i,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!i&&r?[!1,u]:[!0]}const Cc=t=>t.key||"";function vy(t){const s=[];return y.Children.forEach(t,i=>{y.isValidElement(i)&&s.push(i)}),s}const hm=typeof window<"u",O_=hm?y.useLayoutEffect:y.useEffect,cs=({children:t,custom:s,initial:i=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=I_(u),g=y.useMemo(()=>vy(t),[t]),v=u&&!p?[]:g.map(Cc),b=y.useRef(!0),_=y.useRef(g),S=pm(()=>new Map),[k,w]=y.useState(g),[N,T]=y.useState(g);O_(()=>{b.current=!1,_.current=g;for(let B=0;B<N.length;B++){const A=Cc(N[B]);v.includes(A)?S.delete(A):S.get(A)!==!0&&S.set(A,!1)}},[N,v.length,v.join("-")]);const C=[];if(g!==k){let B=[...g];for(let A=0;A<N.length;A++){const I=N[A],O=Cc(I);v.includes(O)||(B.splice(A,0,I),C.push(I))}d==="wait"&&C.length&&(B=C),T(vy(B)),w(g);return}const{forceRender:E}=y.useContext(fm);return o.jsx(o.Fragment,{children:N.map(B=>{const A=Cc(B),I=u&&!p?!1:g===N||v.includes(A),O=()=>{if(S.has(A))S.set(A,!0);else return;let U=!0;S.forEach(P=>{P||(U=!1)}),U&&(E==null||E(),T(_.current),u&&(m==null||m()),r&&r())};return o.jsx(kA,{isPresent:I,initial:!b.current||i?void 0:!1,custom:I?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:I?void 0:O,children:B},A)})})},An=t=>t;let L_=An;const TA={useManualTiming:!1};function wA(t){let s=new Set,i=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,b=!1)=>{const S=b&&r?s:i;return v&&d.add(g),S.has(g)||S.add(g),g},cancel:g=>{i.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,i]=[i,s],s.forEach(p),s.clear(),r=!1,c&&(c=!1,m.process(g))}};return m}const Ec=["read","resolveKeyframes","update","preRender","render","postRender"],jA=40;function B_(t,s){let i=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>i=!0,u=Ec.reduce((T,C)=>(T[C]=wA(d),T),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:b,postRender:_}=u,S=()=>{const T=performance.now();i=!1,c.delta=r?1e3/60:Math.max(Math.min(T-c.timestamp,jA),1),c.timestamp=T,c.isProcessing=!0,p.process(c),m.process(c),g.process(c),v.process(c),b.process(c),_.process(c),c.isProcessing=!1,i&&s&&(r=!1,t(S))},k=()=>{i=!0,r=!0,c.isProcessing||t(S)};return{schedule:Ec.reduce((T,C)=>{const E=u[C];return T[C]=(B,A=!1,I=!1)=>(i||k(),E.schedule(B,A,I)),T},{}),cancel:T=>{for(let C=0;C<Ec.length;C++)u[Ec[C]].cancel(T)},state:c,steps:u}}const{schedule:_t,cancel:La,state:Qt,steps:tp}=B_(typeof requestAnimationFrame<"u"?requestAnimationFrame:An,!0),z_=y.createContext({strict:!1}),yy={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"]},No={};for(const t in yy)No[t]={isEnabled:s=>yy[t].some(i=>!!s[i])};function NA(t){for(const s in t)No[s]={...No[s],...t[s]}}const CA=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 Jc(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||CA.has(t)}let U_=t=>!Jc(t);function EA(t){t&&(U_=s=>s.startsWith("on")?!Jc(s):t(s))}try{EA(require("@emotion/is-prop-valid").default)}catch{}function AA(t,s,i){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(U_(c)||i===!0&&Jc(c)||!s&&!Jc(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function DA(t){if(typeof Proxy>"u")return t;const s=new Map,i=(...r)=>t(...r);return new Proxy(i,{get:(r,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const yd=y.createContext({});function Kr(t){return typeof t=="string"||Array.isArray(t)}function bd(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const gm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],vm=["initial",...gm];function _d(t){return bd(t.animate)||vm.some(s=>Kr(t[s]))}function $_(t){return!!(_d(t)||t.variants)}function RA(t,s){if(_d(t)){const{initial:i,animate:r}=t;return{initial:i===!1||Kr(i)?i:void 0,animate:Kr(r)?r:void 0}}return t.inherit!==!1?s:{}}function MA(t){const{initial:s,animate:i}=RA(t,y.useContext(yd));return y.useMemo(()=>({initial:s,animate:i}),[by(s),by(i)])}function by(t){return Array.isArray(t)?t.join(" "):t}const IA=Symbol.for("motionComponentSymbol");function yo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function OA(t,s,i){return y.useCallback(r=>{r&&t.onMount&&t.onMount(r),s&&(r?s.mount(r):s.unmount()),i&&(typeof i=="function"?i(r):yo(i)&&(i.current=r))},[s])}const ym=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),LA="framerAppearId",P_="data-"+ym(LA),{schedule:bm}=B_(queueMicrotask,!1),H_=y.createContext({});function BA(t,s,i,r,c){var d,u;const{visualElement:p}=y.useContext(yd),m=y.useContext(z_),g=y.useContext(vd),v=y.useContext(mm).reducedMotion,b=y.useRef(null);r=r||m.renderer,!b.current&&r&&(b.current=r(t,{visualState:s,parent:p,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const _=b.current,S=y.useContext(H_);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&zA(b.current,i,c,S);const k=y.useRef(!1);y.useInsertionEffect(()=>{_&&k.current&&_.update(i,g)});const w=i[P_],N=y.useRef(!!w&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,w))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,w)));return O_(()=>{_&&(k.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),bm.render(_.render),N.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!N.current&&_.animationState&&_.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,w)}),N.current=!1))}),_}function zA(t,s,i,r){const{layoutId:c,layout:d,drag:u,dragConstraints:p,layoutScroll:m,layoutRoot:g}=s;t.projection=new i(t.latestValues,s["data-framer-portal-id"]?void 0:V_(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&yo(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function V_(t){if(t)return t.options.allowProjection!==!1?t.projection:V_(t.parent)}function UA({preloadedFeatures:t,createVisualElement:s,useRender:i,useVisualState:r,Component:c}){var d,u;t&&NA(t);function p(g,v){let b;const _={...y.useContext(mm),...g,layoutId:$A(g)},{isStatic:S}=_,k=MA(g),w=r(g,S);if(!S&&hm){PA();const N=HA(_);b=N.MeasureLayout,k.visualElement=BA(c,w,_,s,N.ProjectionNode)}return o.jsxs(yd.Provider,{value:k,children:[b&&k.visualElement?o.jsx(b,{visualElement:k.visualElement,..._}):null,i(c,g,OA(w,k.visualElement,v),w,S,k.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[IA]=c,m}function $A({layoutId:t}){const s=y.useContext(fm).id;return s&&t!==void 0?s+"-"+t:t}function PA(t,s){y.useContext(z_).strict}function HA(t){const{drag:s,layout:i}=No;if(!s&&!i)return{};const r={...s,...i};return{MeasureLayout:s!=null&&s.isEnabled(t)||i!=null&&i.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const VA=["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 _m(t){return typeof t!="string"||t.includes("-")?!1:!!(VA.indexOf(t)>-1||/[A-Z]/u.test(t))}function _y(t){const s=[{},{}];return t==null||t.values.forEach((i,r)=>{s[0][r]=i.get(),s[1][r]=i.getVelocity()}),s}function xm(t,s,i,r){if(typeof s=="function"){const[c,d]=_y(r);s=s(i!==void 0?i:t.custom,c,d)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,d]=_y(r);s=s(i!==void 0?i:t.custom,c,d)}return s}const Rp=t=>Array.isArray(t),qA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),GA=t=>Rp(t)?t[t.length-1]||0:t,an=t=>!!(t&&t.getVelocity);function Vc(t){const s=an(t)?t.get():t;return qA(s)?s.toValue():s}function FA({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:i},r,c,d){const u={latestValues:ZA(r,c,d,t),renderState:s()};return i&&(u.onMount=p=>i({props:r,current:p,...u}),u.onUpdate=p=>i(p)),u}const q_=t=>(s,i)=>{const r=y.useContext(yd),c=y.useContext(vd),d=()=>FA(t,s,r,c);return i?d():pm(d)};function ZA(t,s,i,r){const c={},d=r(t,{});for(const _ in d)c[_]=Vc(d[_]);let{initial:u,animate:p}=t;const m=_d(t),g=$_(t);s&&g&&!m&&t.inherit!==!1&&(u===void 0&&(u=s.initial),p===void 0&&(p=s.animate));let v=i?i.initial===!1:!1;v=v||u===!1;const b=v?p:u;if(b&&typeof b!="boolean"&&!bd(b)){const _=Array.isArray(b)?b:[b];for(let S=0;S<_.length;S++){const k=xm(t,_[S]);if(k){const{transitionEnd:w,transition:N,...T}=k;for(const C in T){let E=T[C];if(Array.isArray(E)){const B=v?E.length-1:0;E=E[B]}E!==null&&(c[C]=E)}for(const C in w)c[C]=w[C]}}}return c}const Io=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],wi=new Set(Io),G_=t=>s=>typeof s=="string"&&s.startsWith(t),F_=G_("--"),KA=G_("var(--"),km=t=>KA(t)?YA.test(t.split("/*")[0].trim()):!1,YA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Z_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,Qs=(t,s,i)=>i>s?s:i<t?t:i,Oo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Yr={...Oo,transform:t=>Qs(0,1,t)},Ac={...Oo,default:1},al=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Ra=al("deg"),_s=al("%"),Ce=al("px"),JA=al("vh"),WA=al("vw"),xy={..._s,parse:t=>_s.parse(t)/100,transform:t=>_s.transform(t*100)},XA={borderWidth:Ce,borderTopWidth:Ce,borderRightWidth:Ce,borderBottomWidth:Ce,borderLeftWidth:Ce,borderRadius:Ce,radius:Ce,borderTopLeftRadius:Ce,borderTopRightRadius:Ce,borderBottomRightRadius:Ce,borderBottomLeftRadius:Ce,width:Ce,maxWidth:Ce,height:Ce,maxHeight:Ce,top:Ce,right:Ce,bottom:Ce,left:Ce,padding:Ce,paddingTop:Ce,paddingRight:Ce,paddingBottom:Ce,paddingLeft:Ce,margin:Ce,marginTop:Ce,marginRight:Ce,marginBottom:Ce,marginLeft:Ce,backgroundPositionX:Ce,backgroundPositionY:Ce},QA={rotate:Ra,rotateX:Ra,rotateY:Ra,rotateZ:Ra,scale:Ac,scaleX:Ac,scaleY:Ac,scaleZ:Ac,skew:Ra,skewX:Ra,skewY:Ra,distance:Ce,translateX:Ce,translateY:Ce,translateZ:Ce,x:Ce,y:Ce,z:Ce,perspective:Ce,transformPerspective:Ce,opacity:Yr,originX:xy,originY:xy,originZ:Ce},ky={...Oo,transform:Math.round},Sm={...XA,...QA,zIndex:ky,size:Ce,fillOpacity:Yr,strokeOpacity:Yr,numOctaves:ky},eD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tD=Io.length;function nD(t,s,i){let r="",c=!0;for(let d=0;d<tD;d++){const u=Io[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||i){const g=Z_(p,Sm[u]);if(!m){c=!1;const v=eD[u]||u;r+=`${v}(${g}) `}i&&(s[u]=g)}}return r=r.trim(),i?r=i(s,c?"":r):c&&(r="none"),r}function Tm(t,s,i){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,p=!1;for(const m in s){const g=s[m];if(wi.has(m)){u=!0;continue}else if(F_(m)){c[m]=g;continue}else{const v=Z_(g,Sm[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||i?r.transform=nD(s,t.transform,i):r.transform&&(r.transform="none")),p){const{originX:m="50%",originY:g="50%",originZ:v=0}=d;r.transformOrigin=`${m} ${g} ${v}`}}const sD={offset:"stroke-dashoffset",array:"stroke-dasharray"},aD={offset:"strokeDashoffset",array:"strokeDasharray"};function iD(t,s,i=1,r=0,c=!0){t.pathLength=1;const d=c?sD:aD;t[d.offset]=Ce.transform(-r);const u=Ce.transform(s),p=Ce.transform(i);t[d.array]=`${u} ${p}`}function Sy(t,s,i){return typeof t=="string"?t:Ce.transform(s+i*t)}function oD(t,s,i){const r=Sy(s,t.x,t.width),c=Sy(i,t.y,t.height);return`${r} ${c}`}function wm(t,{attrX:s,attrY:i,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,b){if(Tm(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:_,style:S,dimensions:k}=t;_.transform&&(k&&(S.transform=_.transform),delete _.transform),k&&(c!==void 0||d!==void 0||S.transform)&&(S.transformOrigin=oD(k,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(_.x=s),i!==void 0&&(_.y=i),r!==void 0&&(_.scale=r),u!==void 0&&iD(_,u,p,m,!1)}const jm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),K_=()=>({...jm(),attrs:{}}),Nm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Y_(t,{style:s,vars:i},r,c){Object.assign(t.style,s,c&&c.getProjectionStyles(r));for(const d in i)t.style.setProperty(d,i[d])}const J_=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 W_(t,s,i,r){Y_(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(J_.has(c)?c:ym(c),s.attrs[c])}const Wc={};function rD(t){Object.assign(Wc,t)}function X_(t,{layout:s,layoutId:i}){return wi.has(t)||t.startsWith("origin")||(s||i!==void 0)&&(!!Wc[t]||t==="opacity")}function Cm(t,s,i){var r;const{style:c}=t,d={};for(const u in c)(an(c[u])||s.style&&an(s.style[u])||X_(u,t)||((r=i==null?void 0:i.getValue(u))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(d[u]=c[u]);return d}function Q_(t,s,i){const r=Cm(t,s,i);for(const c in t)if(an(t[c])||an(s[c])){const d=Io.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function lD(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 Ty=["x","y","width","height","cx","cy","r"],cD={useVisualState:q_({scrapeMotionValuesFromProps:Q_,createRenderState:K_,onUpdate:({props:t,prevProps:s,current:i,renderState:r,latestValues:c})=>{if(!i)return;let d=!!t.drag;if(!d){for(const p in c)if(wi.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<Ty.length;p++){const m=Ty[p];t[m]!==s[m]&&(u=!0)}u&&_t.read(()=>{lD(i,r),_t.render(()=>{wm(r,c,Nm(i.tagName),t.transformTemplate),W_(i,r)})})}})},dD={useVisualState:q_({scrapeMotionValuesFromProps:Cm,createRenderState:jm})};function ex(t,s,i){for(const r in s)!an(s[r])&&!X_(r,i)&&(t[r]=s[r])}function uD({transformTemplate:t},s){return y.useMemo(()=>{const i=jm();return Tm(i,s,t),Object.assign({},i.vars,i.style)},[s])}function fD(t,s){const i=t.style||{},r={};return ex(r,i,t),Object.assign(r,uD(t,s)),r}function pD(t,s){const i={},r=fD(t,s);return t.drag&&t.dragListener!==!1&&(i.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)&&(i.tabIndex=0),i.style=r,i}function mD(t,s,i,r){const c=y.useMemo(()=>{const d=K_();return wm(d,s,Nm(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};ex(d,t.style,t),c.style={...d,...c.style}}return c}function hD(t=!1){return(i,r,c,{latestValues:d},u)=>{const m=(_m(i)?mD:pD)(r,d,u,i),g=AA(r,typeof i=="string",t),v=i!==y.Fragment?{...g,...m,ref:c}:{},{children:b}=r,_=y.useMemo(()=>an(b)?b.get():b,[b]);return y.createElement(i,{...v,children:_})}}function gD(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={..._m(r)?cD:dD,preloadedFeatures:t,useRender:hD(c),createVisualElement:s,Component:r};return UA(u)}}function tx(t,s){if(!Array.isArray(s))return!1;const i=s.length;if(i!==t.length)return!1;for(let r=0;r<i;r++)if(s[r]!==t[r])return!1;return!0}function xd(t,s,i){const r=t.getProps();return xm(r,s,i!==void 0?i:r.custom,t)}function Em(t,s){return t?t[s]||t.default||t:void 0}const nx=new Set(["width","height","top","left","right","bottom",...Io]);let qc;function vD(){qc=void 0}const xs={now:()=>(qc===void 0&&xs.set(Qt.isProcessing||TA.useManualTiming?Qt.timestamp:performance.now()),qc),set:t=>{qc=t,queueMicrotask(vD)}};function Am(t,s){t.indexOf(s)===-1&&t.push(s)}function Dm(t,s){const i=t.indexOf(s);i>-1&&t.splice(i,1)}class Rm{constructor(){this.subscriptions=[]}add(s){return Am(this.subscriptions,s),()=>Dm(this.subscriptions,s)}notify(s,i,r){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,i,r);else for(let d=0;d<c;d++){const u=this.subscriptions[d];u&&u(s,i,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function sx(t,s){return s?t*(1e3/s):0}const wy=30,yD=t=>!isNaN(parseFloat(t));class bD{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=xs.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=i.owner}setCurrent(s){this.current=s,this.updatedAt=xs.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=yD(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,i){this.events[s]||(this.events[s]=new Rm);const r=this.events[s].add(i);return s==="change"?()=>{r(),_t.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,i){this.passiveEffect=s,this.stopPassiveEffect=i}set(s,i=!0){!i||!this.passiveEffect?this.updateAndNotify(s,i):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,i,r){this.set(i),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,i=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,i&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=xs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>wy)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,wy);return sx(parseFloat(this.current)-parseFloat(this.prevFrameValue),i)}start(s){return this.stop(),new Promise(i=>{this.hasAnimated=!0,this.animation=s(i),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 Jr(t,s){return new bD(t,s)}function _D(t,s,i){t.hasValue(s)?t.getValue(s).set(i):t.addValue(s,Jr(i))}function xD(t,s){const i=xd(t,s);let{transitionEnd:r={},transition:c={},...d}=i||{};d={...d,...r};for(const u in d){const p=GA(d[u]);_D(t,u,p)}}function kD(t){return!!(an(t)&&t.add)}function Mp(t,s){const i=t.getValue("willChange");if(kD(i))return i.add(s)}function ax(t){return t.props[P_]}function Mm(t){let s;return()=>(s===void 0&&(s=t()),s)}const SD=Mm(()=>window.ScrollTimeline!==void 0);class TD{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,i){for(let r=0;r<this.animations.length;r++)this.animations[r][s]=i}attachTimeline(s,i){const r=this.animations.map(c=>{if(SD()&&c.attachTimeline)return c.attachTimeline(s);if(typeof i=="function")return i(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 i=0;i<this.animations.length;i++)s=Math.max(s,this.animations[i].duration);return s}runAll(s){this.animations.forEach(i=>i[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class wD extends TD{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Ys=t=>t*1e3,Js=t=>t/1e3;function Im(t){return typeof t=="function"}function jy(t,s){t.timeline=s,t.onfinish=null}const Om=t=>Array.isArray(t)&&typeof t[0]=="number",jD={linearEasing:void 0};function ND(t,s){const i=Mm(t);return()=>{var r;return(r=jD[s])!==null&&r!==void 0?r:i()}}const Xc=ND(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Co=(t,s,i)=>{const r=s-t;return r===0?1:(i-t)/r},ix=(t,s,i=10)=>{let r="";const c=Math.max(Math.round(s/i),2);for(let d=0;d<c;d++)r+=t(Co(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function ox(t){return!!(typeof t=="function"&&Xc()||!t||typeof t=="string"&&(t in Ip||Xc())||Om(t)||Array.isArray(t)&&t.every(ox))}const Ir=([t,s,i,r])=>`cubic-bezier(${t}, ${s}, ${i}, ${r})`,Ip={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ir([0,.65,.55,1]),circOut:Ir([.55,0,1,.45]),backIn:Ir([.31,.01,.66,-.59]),backOut:Ir([.33,1.53,.69,.99])};function rx(t,s){if(t)return typeof t=="function"&&Xc()?ix(t,s):Om(t)?Ir(t):Array.isArray(t)?t.map(i=>rx(i,s)||Ip.easeOut):Ip[t]}const lx=(t,s,i)=>(((1-3*i+3*s)*t+(3*i-6*s))*t+3*s)*t,CD=1e-7,ED=12;function AD(t,s,i,r,c){let d,u,p=0;do u=s+(i-s)/2,d=lx(u,r,c)-t,d>0?i=u:s=u;while(Math.abs(d)>CD&&++p<ED);return u}function il(t,s,i,r){if(t===s&&i===r)return An;const c=d=>AD(d,0,1,t,i);return d=>d===0||d===1?d:lx(c(d),s,r)}const cx=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,dx=t=>s=>1-t(1-s),ux=il(.33,1.53,.69,.99),Lm=dx(ux),fx=cx(Lm),px=t=>(t*=2)<1?.5*Lm(t):.5*(2-Math.pow(2,-10*(t-1))),Bm=t=>1-Math.sin(Math.acos(t)),mx=dx(Bm),hx=cx(Bm),gx=t=>/^0[^.\s]+$/u.test(t);function DD(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||gx(t):!0}const Ur=t=>Math.round(t*1e5)/1e5,zm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function RD(t){return t==null}const MD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Um=(t,s)=>i=>!!(typeof i=="string"&&MD.test(i)&&i.startsWith(t)||s&&!RD(i)&&Object.prototype.hasOwnProperty.call(i,s)),vx=(t,s,i)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(zm);return{[t]:parseFloat(c),[s]:parseFloat(d),[i]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},ID=t=>Qs(0,255,t),np={...Oo,transform:t=>Math.round(ID(t))},gi={test:Um("rgb","red"),parse:vx("red","green","blue"),transform:({red:t,green:s,blue:i,alpha:r=1})=>"rgba("+np.transform(t)+", "+np.transform(s)+", "+np.transform(i)+", "+Ur(Yr.transform(r))+")"};function OD(t){let s="",i="",r="",c="";return t.length>5?(s=t.substring(1,3),i=t.substring(3,5),r=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),i=t.substring(2,3),r=t.substring(3,4),c=t.substring(4,5),s+=s,i+=i,r+=r,c+=c),{red:parseInt(s,16),green:parseInt(i,16),blue:parseInt(r,16),alpha:c?parseInt(c,16)/255:1}}const Op={test:Um("#"),parse:OD,transform:gi.transform},bo={test:Um("hsl","hue"),parse:vx("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:i,alpha:r=1})=>"hsla("+Math.round(t)+", "+_s.transform(Ur(s))+", "+_s.transform(Ur(i))+", "+Ur(Yr.transform(r))+")"},sn={test:t=>gi.test(t)||Op.test(t)||bo.test(t),parse:t=>gi.test(t)?gi.parse(t):bo.test(t)?bo.parse(t):Op.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?gi.transform(t):bo.transform(t)},LD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function BD(t){var s,i;return isNaN(t)&&typeof t=="string"&&(((s=t.match(zm))===null||s===void 0?void 0:s.length)||0)+(((i=t.match(LD))===null||i===void 0?void 0:i.length)||0)>0}const yx="number",bx="color",zD="var",UD="var(",Ny="${}",$D=/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 Wr(t){const s=t.toString(),i=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace($D,m=>(sn.test(m)?(r.color.push(d),c.push(bx),i.push(sn.parse(m))):m.startsWith(UD)?(r.var.push(d),c.push(zD),i.push(m)):(r.number.push(d),c.push(yx),i.push(parseFloat(m))),++d,Ny)).split(Ny);return{values:i,split:p,indexes:r,types:c}}function _x(t){return Wr(t).values}function xx(t){const{split:s,types:i}=Wr(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=i[u];p===yx?d+=Ur(c[u]):p===bx?d+=sn.transform(c[u]):d+=c[u]}return d}}const PD=t=>typeof t=="number"?0:t;function HD(t){const s=_x(t);return xx(t)(s.map(PD))}const Ba={test:BD,parse:_x,createTransformer:xx,getAnimatableNone:HD},VD=new Set(["brightness","contrast","saturate","opacity"]);function qD(t){const[s,i]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=i.match(zm)||[];if(!r)return t;const c=i.replace(r,"");let d=VD.has(s)?1:0;return r!==i&&(d*=100),s+"("+d+c+")"}const GD=/\b([a-z-]*)\(.*?\)/gu,Lp={...Ba,getAnimatableNone:t=>{const s=t.match(GD);return s?s.map(qD).join(" "):t}},FD={...Sm,color:sn,backgroundColor:sn,outlineColor:sn,fill:sn,stroke:sn,borderColor:sn,borderTopColor:sn,borderRightColor:sn,borderBottomColor:sn,borderLeftColor:sn,filter:Lp,WebkitFilter:Lp},$m=t=>FD[t];function kx(t,s){let i=$m(t);return i!==Lp&&(i=Ba),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const ZD=new Set(["auto","none","0"]);function KD(t,s,i){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!ZD.has(d)&&Wr(d).values.length&&(c=t[r]),r++}if(c&&i)for(const d of s)t[d]=kx(i,c)}const Cy=t=>t===Oo||t===Ce,Ey=(t,s)=>parseFloat(t.split(", ")[s]),Ay=(t,s)=>(i,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return Ey(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?Ey(d[1],t):0}},YD=new Set(["x","y","z"]),JD=Io.filter(t=>!YD.has(t));function WD(t){const s=[];return JD.forEach(i=>{const r=t.getValue(i);r!==void 0&&(s.push([i,r.get()]),r.set(i.startsWith("scale")?1:0))}),s}const Eo={width:({x:t},{paddingLeft:s="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),height:({y:t},{paddingTop:s="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),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:Ay(4,13),y:Ay(5,14)};Eo.translateX=Eo.x;Eo.translateY=Eo.y;const vi=new Set;let Bp=!1,zp=!1;function Sx(){if(zp){const t=Array.from(vi).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),i=new Map;s.forEach(r=>{const c=WD(r);c.length&&(i.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=i.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)})}zp=!1,Bp=!1,vi.forEach(t=>t.complete()),vi.clear()}function Tx(){vi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(zp=!0)})}function XD(){Tx(),Sx()}class Pm{constructor(s,i,r,c,d,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=i,this.name=r,this.motionValue=c,this.element=d,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(vi.add(this),Bp||(Bp=!0,_t.read(Tx),_t.resolveKeyframes(Sx))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:i,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&&i){const m=r.readValue(i,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),vi.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,vi.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const wx=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),QD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function eR(t){const s=QD.exec(t);if(!s)return[,];const[,i,r,c]=s;return[`--${i??r}`,c]}function jx(t,s,i=1){const[r,c]=eR(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return wx(u)?parseFloat(u):u}return km(c)?jx(c,s,i+1):c}const Nx=t=>s=>s.test(t),tR={test:t=>t==="auto",parse:t=>t},Cx=[Oo,Ce,_s,Ra,WA,JA,tR],Dy=t=>Cx.find(Nx(t));class Ex extends Pm{constructor(s,i,r,c,d){super(s,i,r,c,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:i,name:r}=this;if(!i||!i.current)return;super.readKeyframes();for(let m=0;m<s.length;m++){let g=s[m];if(typeof g=="string"&&(g=g.trim(),km(g))){const v=jx(g,i.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!nx.has(r)||s.length!==2)return;const[c,d]=s,u=Dy(c),p=Dy(d);if(u!==p)if(Cy(u)&&Cy(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:i}=this,r=[];for(let c=0;c<s.length;c++)DD(s[c])&&r.push(c);r.length&&KD(s,r,i)}measureInitialState(){const{element:s,unresolvedKeyframes:i,name:r}=this;if(!s||!s.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Eo[r](s.measureViewportBox(),window.getComputedStyle(s.current)),i[0]=this.measuredOrigin;const c=i[i.length-1];c!==void 0&&s.getValue(r,c).jump(c,!1)}measureEndState(){var s;const{element:i,name:r,unresolvedKeyframes:c}=this;if(!i||!i.current)return;const d=i.getValue(r);d&&d.jump(this.measuredOrigin,!1);const u=c.length-1,p=c[u];c[u]=Eo[r](i.measureViewportBox(),window.getComputedStyle(i.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([m,g])=>{i.getValue(m).set(g)}),this.resolveNoneKeyframes()}}const Ry=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ba.test(t)||t==="0")&&!t.startsWith("url("));function nR(t){const s=t[0];if(t.length===1)return!0;for(let i=0;i<t.length;i++)if(t[i]!==s)return!0}function sR(t,s,i,r){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const d=t[t.length-1],u=Ry(c,s),p=Ry(d,s);return!u||!p?!1:nR(t)||(i==="spring"||Im(i))&&r}const aR=t=>t!==null;function kd(t,{repeat:s,repeatType:i="loop"},r){const c=t.filter(aR),d=s&&i!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const iR=40;class Ax{constructor({autoplay:s=!0,delay:i=0,type:r="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:u="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=xs.now(),this.options={autoplay:s,delay:i,type:r,repeat:c,repeatDelay:d,repeatType:u,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>iR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&XD(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=xs.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!sR(s,r,c,d))if(u)this.options.duration=0;else{m&&m(kd(s,this.options,i)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,i);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:i,...v},this.onPostResolved())}onPostResolved(){}then(s,i){return this.currentFinishedPromise.then(s,i)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const Up=2e4;function Dx(t){let s=0;const i=50;let r=t.next(s);for(;!r.done&&s<Up;)s+=i,r=t.next(s);return s>=Up?1/0:s}const Tt=(t,s,i)=>t+(s-t)*i;function sp(t,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+(s-t)*6*i:i<1/2?s:i<2/3?t+(s-t)*(2/3-i)*6:t}function oR({hue:t,saturation:s,lightness:i,alpha:r}){t/=360,s/=100,i/=100;let c=0,d=0,u=0;if(!s)c=d=u=i;else{const p=i<.5?i*(1+s):i+s-i*s,m=2*i-p;c=sp(m,p,t+1/3),d=sp(m,p,t),u=sp(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function Qc(t,s){return i=>i>0?s:t}const ap=(t,s,i)=>{const r=t*t,c=i*(s*s-r)+r;return c<0?0:Math.sqrt(c)},rR=[Op,gi,bo],lR=t=>rR.find(s=>s.test(t));function My(t){const s=lR(t);if(!s)return!1;let i=s.parse(t);return s===bo&&(i=oR(i)),i}const Iy=(t,s)=>{const i=My(t),r=My(s);if(!i||!r)return Qc(t,s);const c={...i};return d=>(c.red=ap(i.red,r.red,d),c.green=ap(i.green,r.green,d),c.blue=ap(i.blue,r.blue,d),c.alpha=Tt(i.alpha,r.alpha,d),gi.transform(c))},cR=(t,s)=>i=>s(t(i)),ol=(...t)=>t.reduce(cR),$p=new Set(["none","hidden"]);function dR(t,s){return $p.has(t)?i=>i<=0?t:s:i=>i>=1?s:t}function uR(t,s){return i=>Tt(t,s,i)}function Hm(t){return typeof t=="number"?uR:typeof t=="string"?km(t)?Qc:sn.test(t)?Iy:mR:Array.isArray(t)?Rx:typeof t=="object"?sn.test(t)?Iy:fR:Qc}function Rx(t,s){const i=[...t],r=i.length,c=t.map((d,u)=>Hm(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)i[u]=c[u](d);return i}}function fR(t,s){const i={...t,...s},r={};for(const c in i)t[c]!==void 0&&s[c]!==void 0&&(r[c]=Hm(t[c])(t[c],s[c]));return c=>{for(const d in r)i[d]=r[d](c);return i}}function pR(t,s){var i;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=(i=t.values[p])!==null&&i!==void 0?i:0;r[d]=m,c[u]++}return r}const mR=(t,s)=>{const i=Ba.createTransformer(s),r=Wr(t),c=Wr(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?$p.has(t)&&!c.values.length||$p.has(s)&&!r.values.length?dR(t,s):ol(Rx(pR(r,c),c.values),i):Qc(t,s)};function Mx(t,s,i){return typeof t=="number"&&typeof s=="number"&&typeof i=="number"?Tt(t,s,i):Hm(t)(t,s)}const hR=5;function Ix(t,s,i){const r=Math.max(s-hR,0);return sx(i-t(r),s-r)}const Ct={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},ip=.001;function gR({duration:t=Ct.duration,bounce:s=Ct.bounce,velocity:i=Ct.velocity,mass:r=Ct.mass}){let c,d,u=1-s;u=Qs(Ct.minDamping,Ct.maxDamping,u),t=Qs(Ct.minDuration,Ct.maxDuration,Js(t)),u<1?(c=g=>{const v=g*u,b=v*t,_=v-i,S=Pp(g,u),k=Math.exp(-b);return ip-_/S*k},d=g=>{const b=g*u*t,_=b*i+i,S=Math.pow(u,2)*Math.pow(g,2)*t,k=Math.exp(-b),w=Pp(Math.pow(g,2),u);return(-c(g)+ip>0?-1:1)*((_-S)*k)/w}):(c=g=>{const v=Math.exp(-g*t),b=(g-i)*t+1;return-ip+v*b},d=g=>{const v=Math.exp(-g*t),b=(i-g)*(t*t);return v*b});const p=5/t,m=yR(c,d,p);if(t=Ys(t),isNaN(m))return{stiffness:Ct.stiffness,damping:Ct.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const vR=12;function yR(t,s,i){let r=i;for(let c=1;c<vR;c++)r=r-t(r)/s(r);return r}function Pp(t,s){return t*Math.sqrt(1-s*s)}const bR=["duration","bounce"],_R=["stiffness","damping","mass"];function Oy(t,s){return s.some(i=>t[i]!==void 0)}function xR(t){let s={velocity:Ct.velocity,stiffness:Ct.stiffness,damping:Ct.damping,mass:Ct.mass,isResolvedFromDuration:!1,...t};if(!Oy(t,_R)&&Oy(t,bR))if(t.visualDuration){const i=t.visualDuration,r=2*Math.PI/(i*1.2),c=r*r,d=2*Qs(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Ct.mass,stiffness:c,damping:d}}else{const i=gR(t);s={...s,...i,mass:Ct.mass},s.isResolvedFromDuration=!0}return s}function Ox(t=Ct.visualDuration,s=Ct.bounce){const i=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=i;const d=i.keyframes[0],u=i.keyframes[i.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:v,duration:b,velocity:_,isResolvedFromDuration:S}=xR({...i,velocity:-Js(i.velocity||0)}),k=_||0,w=g/(2*Math.sqrt(m*v)),N=u-d,T=Js(Math.sqrt(m/v)),C=Math.abs(N)<5;r||(r=C?Ct.restSpeed.granular:Ct.restSpeed.default),c||(c=C?Ct.restDelta.granular:Ct.restDelta.default);let E;if(w<1){const A=Pp(T,w);E=I=>{const O=Math.exp(-w*T*I);return u-O*((k+w*T*N)/A*Math.sin(A*I)+N*Math.cos(A*I))}}else if(w===1)E=A=>u-Math.exp(-T*A)*(N+(k+T*N)*A);else{const A=T*Math.sqrt(w*w-1);E=I=>{const O=Math.exp(-w*T*I),U=Math.min(A*I,300);return u-O*((k+w*T*N)*Math.sinh(U)+A*N*Math.cosh(U))/A}}const B={calculatedDuration:S&&b||null,next:A=>{const I=E(A);if(S)p.done=A>=b;else{let O=0;w<1&&(O=A===0?Ys(k):Ix(E,A,I));const U=Math.abs(O)<=r,P=Math.abs(u-I)<=c;p.done=U&&P}return p.value=p.done?u:I,p},toString:()=>{const A=Math.min(Dx(B),Up),I=ix(O=>B.next(A*O).value,A,30);return A+"ms "+I}};return B}function Ly({keyframes:t,velocity:s=0,power:i=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:p,max:m,restDelta:g=.5,restSpeed:v}){const b=t[0],_={done:!1,value:b},S=U=>p!==void 0&&U<p||m!==void 0&&U>m,k=U=>p===void 0?m:m===void 0||Math.abs(p-U)<Math.abs(m-U)?p:m;let w=i*s;const N=b+w,T=u===void 0?N:u(N);T!==N&&(w=T-b);const C=U=>-w*Math.exp(-U/r),E=U=>T+C(U),B=U=>{const P=C(U),W=E(U);_.done=Math.abs(P)<=g,_.value=_.done?T:W};let A,I;const O=U=>{S(_.value)&&(A=U,I=Ox({keyframes:[_.value,k(_.value)],velocity:Ix(E,U,_.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return O(0),{calculatedDuration:null,next:U=>{let P=!1;return!I&&A===void 0&&(P=!0,B(U),O(U)),A!==void 0&&U>=A?I.next(U-A):(!P&&B(U),_)}}}const kR=il(.42,0,1,1),SR=il(0,0,.58,1),Lx=il(.42,0,.58,1),TR=t=>Array.isArray(t)&&typeof t[0]!="number",wR={linear:An,easeIn:kR,easeInOut:Lx,easeOut:SR,circIn:Bm,circInOut:hx,circOut:mx,backIn:Lm,backInOut:fx,backOut:ux,anticipate:px},By=t=>{if(Om(t)){L_(t.length===4);const[s,i,r,c]=t;return il(s,i,r,c)}else if(typeof t=="string")return wR[t];return t};function jR(t,s,i){const r=[],c=i||Mx,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]||An:s;p=ol(m,p)}r.push(p)}return r}function NR(t,s,{clamp:i=!0,ease:r,mixer:c}={}){const d=t.length;if(L_(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=jR(s,r,c),m=p.length,g=v=>{if(u&&v<t[0])return s[0];let b=0;if(m>1)for(;b<t.length-2&&!(v<t[b+1]);b++);const _=Co(t[b],t[b+1],v);return p[b](_)};return i?v=>g(Qs(t[0],t[d-1],v)):g}function CR(t,s){const i=t[t.length-1];for(let r=1;r<=s;r++){const c=Co(0,s,r);t.push(Tt(i,1,c))}}function ER(t){const s=[0];return CR(s,t.length-1),s}function AR(t,s){return t.map(i=>i*s)}function DR(t,s){return t.map(()=>s||Lx).splice(0,t.length-1)}function ed({duration:t=300,keyframes:s,times:i,ease:r="easeInOut"}){const c=TR(r)?r.map(By):By(r),d={done:!1,value:s[0]},u=AR(i&&i.length===s.length?i:ER(s),t),p=NR(u,s,{ease:Array.isArray(c)?c:DR(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const RR=t=>{const s=({timestamp:i})=>t(i);return{start:()=>_t.update(s,!0),stop:()=>La(s),now:()=>Qt.isProcessing?Qt.timestamp:xs.now()}},MR={decay:Ly,inertia:Ly,tween:ed,keyframes:ed,spring:Ox},IR=t=>t/100;class Vm extends Ax{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:i,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||Pm,p=(m,g)=>this.onKeyframesResolved(m,g);this.resolver=new u(d,p,i,r,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:i="keyframes",repeat:r=0,repeatDelay:c=0,repeatType:d,velocity:u=0}=this.options,p=Im(i)?i:MR[i]||ed;let m,g;p!==ed&&typeof s[0]!="number"&&(m=ol(IR,Mx(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=Dx(v));const{calculatedDuration:b}=v,_=b+c,S=_*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:b,resolvedDuration:_,totalDuration:S}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,i=!1){const{resolved:r}=this;if(!r){const{keyframes:U}=this.options;return{done:!0,value:U[U.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:p,keyframes:m,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=r;if(this.startTime===null)return d.next(0);const{delay:_,repeat:S,repeatType:k,repeatDelay:w,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)),i?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const T=this.currentTime-_*(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 E=this.currentTime,B=d;if(S){const U=Math.min(this.currentTime,v)/b;let P=Math.floor(U),W=U%1;!W&&U>=1&&(W=1),W===1&&P--,P=Math.min(P,S+1),!!(P%2)&&(k==="reverse"?(W=1-W,w&&(W-=w/b)):k==="mirror"&&(B=u)),E=Qs(0,1,W)*b}const A=C?{done:!1,value:m[0]}:B.next(E);p&&(A.value=p(A.value));let{done:I}=A;!C&&g!==null&&(I=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&I);return O&&c!==void 0&&(A.value=kd(m,this.options,c)),N&&N(A.value),O&&this.finish(),A}get duration(){const{resolved:s}=this;return s?Js(s.calculatedDuration):0}get time(){return Js(this.currentTime)}set time(s){s=Ys(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 i=this.playbackSpeed!==s;this.playbackSpeed=s,i&&(this.time=Js(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=RR,onPlay:i,startTime:r}=this.options;this.driver||(this.driver=s(d=>this.tick(d))),i&&i();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 OR=new Set(["opacity","clipPath","filter","transform"]);function LR(t,s,i,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:p="easeInOut",times:m}={}){const g={[s]:i};m&&(g.offset=m);const v=rx(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 BR=Mm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),td=10,zR=2e4;function UR(t){return Im(t.type)||t.type==="spring"||!ox(t.ease)}function $R(t,s){const i=new Vm({...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<zR;)r=i.sample(d),c.push(r.value),d+=td;return{times:void 0,keyframes:c,duration:d-td,ease:"linear"}}const Bx={anticipate:px,backInOut:fx,circInOut:hx};function PR(t){return t in Bx}class zy extends Ax{constructor(s){super(s);const{name:i,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new Ex(d,(u,p)=>this.onKeyframesResolved(u,p),i,r,c),this.resolver.scheduleResolve()}initPlayback(s,i){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"&&Xc()&&PR(d)&&(d=Bx[d]),UR(this.options)){const{onComplete:b,onUpdate:_,motionValue:S,element:k,...w}=this.options,N=$R(s,w);s=N.keyframes,s.length===1&&(s[1]=s[0]),r=N.duration,c=N.times,d=N.ease,u="keyframes"}const v=LR(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(jy(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(kd(s,this.options,i)),b&&b(),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:i}=s;return Js(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Js(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:r}=i;r.currentTime=Ys(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:i}=s;return i.playbackRate}set speed(s){const{resolved:i}=this;if(!i)return;const{animation:r}=i;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:i}=s;return i.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:i}=s;return i.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:i}=this;if(!i)return An;const{animation:r}=i;jy(r,s)}return An}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.playState==="finished"&&this.updateFinishedPromise(),i.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.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:i,keyframes:r,duration:c,type:d,ease:u,times:p}=s;if(i.playState==="idle"||i.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:_,...S}=this.options,k=new Vm({...S,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),w=Ys(this.time);g.setWithVelocity(k.sample(w-td).value,k.sample(w).value,td)}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:i,name:r,repeatDelay:c,repeatType:d,damping:u,type:p}=s;if(!i||!i.owner||!(i.owner.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:g}=i.owner.getProps();return BR()&&r&&OR.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const HR={type:"spring",stiffness:500,damping:25,restSpeed:10},VR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),qR={type:"keyframes",duration:.8},GR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},FR=(t,{keyframes:s})=>s.length>2?qR:wi.has(t)?t.startsWith("scale")?VR(s[1]):HR:GR;function ZR({when:t,delay:s,delayChildren:i,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:p,from:m,elapsed:g,...v}){return!!Object.keys(v).length}const qm=(t,s,i,r={},c,d)=>u=>{const p=Em(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-Ys(m);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:_=>{s.set(_),p.onUpdate&&p.onUpdate(_)},onComplete:()=>{u(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:d?void 0:c};ZR(p)||(v={...v,...FR(t,v)}),v.duration&&(v.duration=Ys(v.duration)),v.repeatDelay&&(v.repeatDelay=Ys(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let b=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(b=!0)),b&&!d&&s.get()!==void 0){const _=kd(v.keyframes,p);if(_!==void 0)return _t.update(()=>{v.onUpdate(_),v.onComplete()}),new wD([])}return!d&&zy.supports(v)?new zy(v):new Vm(v)};function KR({protectedKeys:t,needsAnimating:s},i){const r=t.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,r}function zx(t,s,{delay:i=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 b in m){const _=t.getValue(b,(d=t.latestValues[b])!==null&&d!==void 0?d:null),S=m[b];if(S===void 0||v&&KR(v,b))continue;const k={delay:i,...Em(u||{},b)};let w=!1;if(window.MotionHandoffAnimation){const T=ax(t);if(T){const C=window.MotionHandoffAnimation(T,b,_t);C!==null&&(k.startTime=C,w=!0)}}Mp(t,b),_.start(qm(b,_,S,t.shouldReduceMotion&&nx.has(b)?{type:!1}:k,t,w));const N=_.animation;N&&g.push(N)}return p&&Promise.all(g).then(()=>{_t.update(()=>{p&&xD(t,p)})}),g}function Hp(t,s,i={}){var r;const c=xd(t,s,i.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};i.transitionOverride&&(d=i.transitionOverride);const u=c?()=>Promise.all(zx(t,c,i)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=d;return YR(t,s,v+g,b,_,i)}:()=>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(i.delay)])}function YR(t,s,i=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(JR).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(Hp(g,s,{...d,delay:i+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function JR(t,s){return t.sortNodePosition(s)}function WR(t,s,i={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>Hp(t,d,i));r=Promise.all(c)}else if(typeof s=="string")r=Hp(t,s,i);else{const c=typeof s=="function"?xd(t,s,i.custom):s;r=Promise.all(zx(t,c,i))}return r.then(()=>{t.notify("AnimationComplete",s)})}const XR=vm.length;function Ux(t){if(!t)return;if(!t.isControllingVariants){const i=t.parent?Ux(t.parent)||{}:{};return t.props.initial!==void 0&&(i.initial=t.props.initial),i}const s={};for(let i=0;i<XR;i++){const r=vm[i],c=t.props[r];(Kr(c)||c===!1)&&(s[r]=c)}return s}const QR=[...gm].reverse(),e3=gm.length;function t3(t){return s=>Promise.all(s.map(({animation:i,options:r})=>WR(t,i,r)))}function n3(t){let s=t3(t),i=Uy(),r=!0;const c=m=>(g,v)=>{var b;const _=xd(t,v,m==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:S,transitionEnd:k,...w}=_;g={...g,...w,...k}}return g};function d(m){s=m(t)}function u(m){const{props:g}=t,v=Ux(t.parent)||{},b=[],_=new Set;let S={},k=1/0;for(let N=0;N<e3;N++){const T=QR[N],C=i[T],E=g[T]!==void 0?g[T]:v[T],B=Kr(E),A=T===m?C.isActive:null;A===!1&&(k=N);let I=E===v[T]&&E!==g[T]&&B;if(I&&r&&t.manuallyAnimateOnMount&&(I=!1),C.protectedKeys={...S},!C.isActive&&A===null||!E&&!C.prevProp||bd(E)||typeof E=="boolean")continue;const O=s3(C.prevProp,E);let U=O||T===m&&C.isActive&&!I&&B||N>k&&B,P=!1;const W=Array.isArray(E)?E:[E];let te=W.reduce(c(T),{});A===!1&&(te={});const{prevResolvedValues:H={}}=C,ie={...H,...te},Y=Z=>{U=!0,_.has(Z)&&(P=!0,_.delete(Z)),C.needsAnimating[Z]=!0;const se=t.getValue(Z);se&&(se.liveStyle=!1)};for(const Z in ie){const se=te[Z],ue=H[Z];if(S.hasOwnProperty(Z))continue;let de=!1;Rp(se)&&Rp(ue)?de=!tx(se,ue):de=se!==ue,de?se!=null?Y(Z):_.add(Z):se!==void 0&&_.has(Z)?Y(Z):C.protectedKeys[Z]=!0}C.prevProp=E,C.prevResolvedValues=te,C.isActive&&(S={...S,...te}),r&&t.blockInitialAnimation&&(U=!1),U&&(!(I&&O)||P)&&b.push(...W.map(Z=>({animation:Z,options:{type:T}})))}if(_.size){const N={};_.forEach(T=>{const C=t.getBaseTarget(T),E=t.getValue(T);E&&(E.liveStyle=!0),N[T]=C??null}),b.push({animation:N})}let w=!!b.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(w=!1),r=!1,w?s(b):Promise.resolve()}function p(m,g){var v;if(i[m].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(_=>{var S;return(S=_.animationState)===null||S===void 0?void 0:S.setActive(m,g)}),i[m].isActive=g;const b=u(m);for(const _ in i)i[_].protectedKeys={};return b}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>i,reset:()=>{i=Uy(),r=!0}}}function s3(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!tx(s,t):!1}function ci(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Uy(){return{animate:ci(!0),whileInView:ci(),whileHover:ci(),whileTap:ci(),whileDrag:ci(),whileFocus:ci(),exit:ci()}}class $a{constructor(s){this.isMounted=!1,this.node=s}update(){}}class a3 extends $a{constructor(s){super(s),s.animationState||(s.animationState=n3(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();bd(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:i}=this.node.prevProps||{};s!==i&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let i3=0;class o3 extends $a{constructor(){super(...arguments),this.id=i3++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:i}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===r)return;const c=this.node.animationState.setActive("exit",!s);i&&!s&&c.then(()=>i(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const r3={animation:{Feature:a3},exit:{Feature:o3}},rs={x:!1,y:!1};function $x(){return rs.x||rs.y}function l3(t){return t==="x"||t==="y"?rs[t]?null:(rs[t]=!0,()=>{rs[t]=!1}):rs.x||rs.y?null:(rs.x=rs.y=!0,()=>{rs.x=rs.y=!1})}const Gm=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Xr(t,s,i,r={passive:!0}){return t.addEventListener(s,i,r),()=>t.removeEventListener(s,i)}function rl(t){return{point:{x:t.pageX,y:t.pageY}}}const c3=t=>s=>Gm(s)&&t(s,rl(s));function $r(t,s,i,r){return Xr(t,s,c3(i),r)}const $y=(t,s)=>Math.abs(t-s);function d3(t,s){const i=$y(t.x,s.x),r=$y(t.y,s.y);return Math.sqrt(i**2+r**2)}class Px{constructor(s,i,{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 b=rp(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,S=d3(b.offset,{x:0,y:0})>=3;if(!_&&!S)return;const{point:k}=b,{timestamp:w}=Qt;this.history.push({...k,timestamp:w});const{onStart:N,onMove:T}=this.handlers;_||(N&&N(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=op(_,this.transformPagePoint),_t.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:S,onSessionEnd:k,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=rp(b.type==="pointercancel"?this.lastMoveEventInfo:op(_,this.transformPagePoint),this.history);this.startEvent&&S&&S(b,N),k&&k(b,N)},!Gm(s))return;this.dragSnapToOrigin=d,this.handlers=i,this.transformPagePoint=r,this.contextWindow=c||window;const u=rl(s),p=op(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=Qt;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,rp(p,this.history)),this.removeListeners=ol($r(this.contextWindow,"pointermove",this.handlePointerMove),$r(this.contextWindow,"pointerup",this.handlePointerUp),$r(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),La(this.updatePoint)}}function op(t,s){return s?{point:s(t.point)}:t}function Py(t,s){return{x:t.x-s.x,y:t.y-s.y}}function rp({point:t},s){return{point:t,delta:Py(t,Hx(s)),offset:Py(t,u3(s)),velocity:f3(s,.1)}}function u3(t){return t[0]}function Hx(t){return t[t.length-1]}function f3(t,s){if(t.length<2)return{x:0,y:0};let i=t.length-1,r=null;const c=Hx(t);for(;i>=0&&(r=t[i],!(c.timestamp-r.timestamp>Ys(s)));)i--;if(!r)return{x:0,y:0};const d=Js(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 Vx=1e-4,p3=1-Vx,m3=1+Vx,qx=.01,h3=0-qx,g3=0+qx;function Rn(t){return t.max-t.min}function v3(t,s,i){return Math.abs(t-s)<=i}function Hy(t,s,i,r=.5){t.origin=r,t.originPoint=Tt(s.min,s.max,t.origin),t.scale=Rn(i)/Rn(s),t.translate=Tt(i.min,i.max,t.origin)-t.originPoint,(t.scale>=p3&&t.scale<=m3||isNaN(t.scale))&&(t.scale=1),(t.translate>=h3&&t.translate<=g3||isNaN(t.translate))&&(t.translate=0)}function Pr(t,s,i,r){Hy(t.x,s.x,i.x,r?r.originX:void 0),Hy(t.y,s.y,i.y,r?r.originY:void 0)}function Vy(t,s,i){t.min=i.min+s.min,t.max=t.min+Rn(s)}function y3(t,s,i){Vy(t.x,s.x,i.x),Vy(t.y,s.y,i.y)}function qy(t,s,i){t.min=s.min-i.min,t.max=t.min+Rn(s)}function Hr(t,s,i){qy(t.x,s.x,i.x),qy(t.y,s.y,i.y)}function b3(t,{min:s,max:i},r){return s!==void 0&&t<s?t=r?Tt(s,t,r.min):Math.max(t,s):i!==void 0&&t>i&&(t=r?Tt(i,t,r.max):Math.min(t,i)),t}function Gy(t,s,i){return{min:s!==void 0?t.min+s:void 0,max:i!==void 0?t.max+i-(t.max-t.min):void 0}}function _3(t,{top:s,left:i,bottom:r,right:c}){return{x:Gy(t.x,i,c),y:Gy(t.y,s,r)}}function Fy(t,s){let i=s.min-t.min,r=s.max-t.max;return s.max-s.min<t.max-t.min&&([i,r]=[r,i]),{min:i,max:r}}function x3(t,s){return{x:Fy(t.x,s.x),y:Fy(t.y,s.y)}}function k3(t,s){let i=.5;const r=Rn(t),c=Rn(s);return c>r?i=Co(s.min,s.max-r,t.min):r>c&&(i=Co(t.min,t.max-c,s.min)),Qs(0,1,i)}function S3(t,s){const i={};return s.min!==void 0&&(i.min=s.min-t.min),s.max!==void 0&&(i.max=s.max-t.min),i}const Vp=.35;function T3(t=Vp){return t===!1?t=0:t===!0&&(t=Vp),{x:Zy(t,"left","right"),y:Zy(t,"top","bottom")}}function Zy(t,s,i){return{min:Ky(t,s),max:Ky(t,i)}}function Ky(t,s){return typeof t=="number"?t:t[s]||0}const Yy=()=>({translate:0,scale:1,origin:0,originPoint:0}),_o=()=>({x:Yy(),y:Yy()}),Jy=()=>({min:0,max:0}),Mt=()=>({x:Jy(),y:Jy()});function Kn(t){return[t("x"),t("y")]}function Gx({top:t,left:s,right:i,bottom:r}){return{x:{min:s,max:i},y:{min:t,max:r}}}function w3({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function j3(t,s){if(!s)return t;const i=s({x:t.left,y:t.top}),r=s({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:r.y,right:r.x}}function lp(t){return t===void 0||t===1}function qp({scale:t,scaleX:s,scaleY:i}){return!lp(t)||!lp(s)||!lp(i)}function mi(t){return qp(t)||Fx(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Fx(t){return Wy(t.x)||Wy(t.y)}function Wy(t){return t&&t!=="0%"}function nd(t,s,i){const r=t-i,c=s*r;return i+c}function Xy(t,s,i,r,c){return c!==void 0&&(t=nd(t,c,r)),nd(t,i,r)+s}function Gp(t,s=0,i=1,r,c){t.min=Xy(t.min,s,i,r,c),t.max=Xy(t.max,s,i,r,c)}function Zx(t,{x:s,y:i}){Gp(t.x,s.translate,s.scale,s.originPoint),Gp(t.y,i.translate,i.scale,i.originPoint)}const Qy=.999999999999,eb=1.0000000000001;function N3(t,s,i,r=!1){const c=i.length;if(!c)return;s.x=s.y=1;let d,u;for(let p=0;p<c;p++){d=i[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&&ko(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,Zx(t,u)),r&&mi(d.latestValues)&&ko(t,d.latestValues))}s.x<eb&&s.x>Qy&&(s.x=1),s.y<eb&&s.y>Qy&&(s.y=1)}function xo(t,s){t.min=t.min+s,t.max=t.max+s}function tb(t,s,i,r,c=.5){const d=Tt(t.min,t.max,c);Gp(t,s,i,d,r)}function ko(t,s){tb(t.x,s.x,s.scaleX,s.scale,s.originX),tb(t.y,s.y,s.scaleY,s.scale,s.originY)}function Kx(t,s){return Gx(j3(t.getBoundingClientRect(),s))}function C3(t,s,i){const r=Kx(t,i),{scroll:c}=s;return c&&(xo(r.x,c.offset.x),xo(r.y,c.offset.y)),r}const Yx=({current:t})=>t?t.ownerDocument.defaultView:null,E3=new WeakMap;class A3{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=Mt(),this.visualElement=s}start(s,{snapToCursor:i=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(rl(v).point)},d=(v,b)=>{const{drag:_,dragPropagation:S,onDragStart:k}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=l3(_),!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),Kn(N=>{let T=this.getAxisMotionValue(N).get()||0;if(_s.test(T)){const{projection:C}=this.visualElement;if(C&&C.layout){const E=C.layout.layoutBox[N];E&&(T=Rn(E)*(parseFloat(T)/100))}}this.originPoint[N]=T}),k&&_t.postRender(()=>k(v,b)),Mp(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},u=(v,b)=>{const{dragPropagation:_,dragDirectionLock:S,onDirectionLock:k,onDrag:w}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:N}=b;if(S&&this.currentDirection===null){this.currentDirection=D3(N),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",b.point,N),this.updateAxis("y",b.point,N),this.visualElement.render(),w&&w(v,b)},p=(v,b)=>this.stop(v,b),m=()=>Kn(v=>{var b;return this.getAnimationState(v)==="paused"&&((b=this.getAxisMotionValue(v).animation)===null||b===void 0?void 0:b.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new Px(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:Yx(this.visualElement)})}stop(s,i){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:c}=i;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&_t.postRender(()=>d(s,i))}cancel(){this.isDragging=!1;const{projection:s,animationState:i}=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),i&&i.setActive("whileDrag",!1)}updateAxis(s,i,r){const{drag:c}=this.getProps();if(!r||!Dc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=b3(u,this.constraints[s],this.elastic[s])),d.set(u)}resolveConstraints(){var s;const{dragConstraints:i,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;i&&yo(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=_3(c.layoutBox,i):this.constraints=!1,this.elastic=T3(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Kn(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=S3(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!yo(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=C3(r,c.root,this.visualElement.getTransformPagePoint());let u=x3(c.layout.layoutBox,d);if(i){const p=i(w3(u));this.hasMutatedConstraints=!!p,p&&(u=Gx(p))}return u}startAnimation(s){const{drag:i,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=Kn(v=>{if(!Dc(v,i,this.currentDirection))return;let b=m&&m[v]||{};u&&(b={min:0,max:0});const _=c?200:1e6,S=c?40:1e7,k={type:"inertia",velocity:r?s[v]:0,bounceStiffness:_,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...d,...b};return this.startAxisValueAnimation(v,k)});return Promise.all(g).then(p)}startAxisValueAnimation(s,i){const r=this.getAxisMotionValue(s);return Mp(this.visualElement,s),r.start(qm(s,r,0,i,this.visualElement,!1))}stopAnimation(){Kn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Kn(s=>{var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.pause()})}getAnimationState(s){var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.state}getAxisMotionValue(s){const i=`_drag${s.toUpperCase()}`,r=this.visualElement.getProps(),c=r[i];return c||this.visualElement.getValue(s,(r.initial?r.initial[s]:void 0)||0)}snapToCursor(s){Kn(i=>{const{drag:r}=this.getProps();if(!Dc(i,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(i);if(c&&c.layout){const{min:u,max:p}=c.layout.layoutBox[i];d.set(s[i]-Tt(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:r}=this.visualElement;if(!yo(i)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Kn(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=k3({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(),Kn(u=>{if(!Dc(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(Tt(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;E3.set(this.visualElement,this);const s=this.visualElement.current,i=$r(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();yo(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()),_t.read(r);const u=Xr(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(Kn(v=>{const b=this.getAxisMotionValue(v);b&&(this.originPoint[v]+=m[v].translate,b.set(b.get()+m[v].translate))}),this.visualElement.render())}));return()=>{u(),i(),d(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:u=Vp,dragMomentum:p=!0}=s;return{...s,drag:i,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function Dc(t,s,i){return(s===!0||s===t)&&(i===null||i===t)}function D3(t,s=10){let i=null;return Math.abs(t.y)>s?i="y":Math.abs(t.x)>s&&(i="x"),i}class R3 extends $a{constructor(s){super(s),this.removeGroupControls=An,this.removeListeners=An,this.controls=new A3(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||An}unmount(){this.removeGroupControls(),this.removeListeners()}}const nb=t=>(s,i)=>{t&&_t.postRender(()=>t(s,i))};class M3 extends $a{constructor(){super(...arguments),this.removePointerDownListener=An}onPointerDown(s){this.session=new Px(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Yx(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:nb(s),onStart:nb(i),onMove:r,onEnd:(d,u)=>{delete this.session,c&&_t.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=$r(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 Gc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function sb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Cr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ce.test(t))t=parseFloat(t);else return t;const i=sb(t,s.target.x),r=sb(t,s.target.y);return`${i}% ${r}%`}},I3={correct:(t,{treeScale:s,projectionDelta:i})=>{const r=t,c=Ba.parse(t);if(c.length>5)return r;const d=Ba.createTransformer(t),u=typeof c[0]!="number"?1:0,p=i.x.scale*s.x,m=i.y.scale*s.y;c[0+u]/=p,c[1+u]/=m;const g=Tt(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 O3 extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;rD(L3),d&&(i.group&&i.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()})),Gc.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:i,visualElement:r,drag:c,isPresent:d}=this.props,u=r.projection;return u&&(u.isPresent=d,c||s.layoutDependency!==i||i===void 0?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||_t.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),bm.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:r}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(c),r&&r.deregister&&r.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function Jx(t){const[s,i]=I_(),r=y.useContext(fm);return o.jsx(O3,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(H_),isPresent:s,safeToRemove:i})}const L3={borderRadius:{...Cr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Cr,borderTopRightRadius:Cr,borderBottomLeftRadius:Cr,borderBottomRightRadius:Cr,boxShadow:I3};function B3(t,s,i){const r=an(t)?t:Jr(t);return r.start(qm("",r,s,i)),r.animation}function z3(t){return t instanceof SVGElement&&t.tagName!=="svg"}const U3=(t,s)=>t.depth-s.depth;class $3{constructor(){this.children=[],this.isDirty=!1}add(s){Am(this.children,s),this.isDirty=!0}remove(s){Dm(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(U3),this.isDirty=!1,this.children.forEach(s)}}function P3(t,s){const i=xs.now(),r=({timestamp:c})=>{const d=c-i;d>=s&&(La(r),t(d-s))};return _t.read(r,!0),()=>La(r)}const Wx=["TopLeft","TopRight","BottomLeft","BottomRight"],H3=Wx.length,ab=t=>typeof t=="string"?parseFloat(t):t,ib=t=>typeof t=="number"||Ce.test(t);function V3(t,s,i,r,c,d){c?(t.opacity=Tt(0,i.opacity!==void 0?i.opacity:1,q3(r)),t.opacityExit=Tt(s.opacity!==void 0?s.opacity:1,0,G3(r))):d&&(t.opacity=Tt(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,r));for(let u=0;u<H3;u++){const p=`border${Wx[u]}Radius`;let m=ob(s,p),g=ob(i,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||ib(m)===ib(g)?(t[p]=Math.max(Tt(ab(m),ab(g),r),0),(_s.test(g)||_s.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||i.rotate)&&(t.rotate=Tt(s.rotate||0,i.rotate||0,r))}function ob(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const q3=Xx(0,.5,mx),G3=Xx(.5,.95,An);function Xx(t,s,i){return r=>r<t?0:r>s?1:i(Co(t,s,r))}function rb(t,s){t.min=s.min,t.max=s.max}function Gn(t,s){rb(t.x,s.x),rb(t.y,s.y)}function lb(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function cb(t,s,i,r,c){return t-=s,t=nd(t,1/i,r),c!==void 0&&(t=nd(t,1/c,r)),t}function F3(t,s=0,i=1,r=.5,c,d=t,u=t){if(_s.test(s)&&(s=parseFloat(s),s=Tt(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=Tt(d.min,d.max,r);t===d&&(p-=s),t.min=cb(t.min,s,i,p,c),t.max=cb(t.max,s,i,p,c)}function db(t,s,[i,r,c],d,u){F3(t,s[i],s[r],s[c],s.scale,d,u)}const Z3=["x","scaleX","originX"],K3=["y","scaleY","originY"];function ub(t,s,i,r){db(t.x,s,Z3,i?i.x:void 0,r?r.x:void 0),db(t.y,s,K3,i?i.y:void 0,r?r.y:void 0)}function fb(t){return t.translate===0&&t.scale===1}function Qx(t){return fb(t.x)&&fb(t.y)}function pb(t,s){return t.min===s.min&&t.max===s.max}function Y3(t,s){return pb(t.x,s.x)&&pb(t.y,s.y)}function mb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function e1(t,s){return mb(t.x,s.x)&&mb(t.y,s.y)}function hb(t){return Rn(t.x)/Rn(t.y)}function gb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class J3{constructor(){this.members=[]}add(s){Am(this.members,s),s.scheduleRender()}remove(s){if(Dm(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(s){const i=this.members.findIndex(c=>s===c);if(i===0)return!1;let r;for(let c=i;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){r=d;break}}return r?(this.promote(r),!0):!1}promote(s,i){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,i&&(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:i,resumingFrom:r}=s;i.onExitComplete&&i.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 W3(t,s,i){let r="";const c=t.x.translate/s.x,d=t.y.translate/s.y,u=(i==null?void 0:i.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}) `),i){const{transformPerspective:g,rotate:v,rotateX:b,rotateY:_,skewX:S,skewY:k}=i;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),b&&(r+=`rotateX(${b}deg) `),_&&(r+=`rotateY(${_}deg) `),S&&(r+=`skewX(${S}deg) `),k&&(r+=`skewY(${k}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 hi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Or=typeof window<"u"&&window.MotionDebug!==void 0,cp=["","X","Y","Z"],X3={visibility:"hidden"},vb=1e3;let Q3=0;function dp(t,s,i,r){const{latestValues:c}=s;c[t]&&(i[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function t1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const i=ax(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",_t,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&t1(r)}function n1({attachResizeListener:t,defaultParent:s,measureScroll:i,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=Q3++,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,Or&&(hi.totalNodes=hi.resolvedTargetDeltas=hi.recalculatedProjection=0),this.nodes.forEach(nM),this.nodes.forEach(rM),this.nodes.forEach(lM),this.nodes.forEach(sM),Or&&window.MotionDebug.record(hi)},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 $3)}addEventListener(u,p){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Rm),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=z3(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 b;const _=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=P3(_,250),Gc.hasAnimatedSinceResize&&(Gc.hasAnimatedSinceResize=!1,this.nodes.forEach(bb))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:S,layout:k})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||v.getDefaultTransition()||pM,{onLayoutAnimationStart:N,onLayoutAnimationComplete:T}=v.getProps(),C=!this.targetLayout||!e1(this.targetLayout,k)||S,E=!_&&S;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,E);const B={...Em(w,"layout"),onPlay:N,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(B.delay=0,B.type=!1),this.startAnimation(B)}else _||bb(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=k})}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,La(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(cM),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&&t1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const b=this.path[v];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.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(yb);return}this.isUpdating||this.nodes.forEach(iM),this.isUpdating=!1,this.nodes.forEach(oM),this.nodes.forEach(eM),this.nodes.forEach(tM),this.clearAllSnapshots();const p=xs.now();Qt.delta=Qs(0,1e3/60,p-Qt.timestamp),Qt.timestamp=p,Qt.isProcessing=!0,tp.update.process(Qt),tp.preRender.process(Qt),tp.render.process(Qt),Qt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,bm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(aM),this.sharedNodes.forEach(dM)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,_t.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){_t.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=Mt(),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:i(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&&!Qx(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||mi(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)),mM(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return Mt();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(hM))){const{scroll:v}=this.root;v&&(xo(m.x,v.offset.x),xo(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=Mt();if(Gn(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:b,options:_}=v;v!==this.root&&b&&_.layoutScroll&&(b.wasRoot&&Gn(m,u),xo(m.x,b.offset.x),xo(m.y,b.offset.y))}return m}applyTransform(u,p=!1){const m=Mt();Gn(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&&ko(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),mi(v.latestValues)&&ko(m,v.latestValues)}return mi(this.latestValues)&&ko(m,this.latestValues),m}removeTransform(u){const p=Mt();Gn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!mi(g.latestValues))continue;qp(g.latestValues)&&g.updateSnapshot();const v=Mt(),b=g.measurePageBox();Gn(v,b),ub(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return mi(this.latestValues)&&ub(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!==Qt.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:b,layoutId:_}=this.options;if(!(!this.layout||!(b||_))){if(this.resolvedRelativeTargetAt=Qt.timestamp,!this.targetDelta&&!this.relativeTarget){const S=this.getClosestProjectingParent();S&&S.layout&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Mt(),this.relativeTargetOrigin=Mt(),Hr(this.relativeTargetOrigin,this.layout.layoutBox,S.layout.layoutBox),Gn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Mt(),this.targetWithTransforms=Mt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),y3(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Gn(this.target,this.layout.layoutBox),Zx(this.target,this.targetDelta)):Gn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const S=this.getClosestProjectingParent();S&&!!S.resumingFrom==!!this.resumingFrom&&!S.options.layoutScroll&&S.target&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Mt(),this.relativeTargetOrigin=Mt(),Hr(this.relativeTargetOrigin,this.target,S.target),Gn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Or&&hi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||qp(this.parent.latestValues)||Fx(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===Qt.timestamp&&(g=!1),g)return;const{layout:v,layoutId:b}=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||b))return;Gn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,S=this.treeScale.y;N3(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=Mt());const{target:k}=p;if(!k){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(lb(this.prevProjectionDelta.x,this.projectionDelta.x),lb(this.prevProjectionDelta.y,this.projectionDelta.y)),Pr(this.projectionDelta,this.layoutCorrected,k,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==S||!gb(this.projectionDelta.x,this.prevProjectionDelta.x)||!gb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",k)),Or&&hi.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=_o(),this.projectionDelta=_o(),this.projectionDeltaWithTransform=_o()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},b=_o();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const _=Mt(),S=m?m.source:void 0,k=this.layout?this.layout.source:void 0,w=S!==k,N=this.getStack(),T=!N||N.members.length<=1,C=!!(w&&!T&&this.options.crossfade===!0&&!this.path.some(fM));this.animationProgress=0;let E;this.mixTargetDelta=B=>{const A=B/1e3;_b(b.x,u.x,A),_b(b.y,u.y,A),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Hr(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),uM(this.relativeTarget,this.relativeTargetOrigin,_,A),E&&Y3(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Mt()),Gn(E,this.relativeTarget)),w&&(this.animationValues=v,V3(v,g,this.latestValues,A,C,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=A},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&&(La(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=_t.update(()=>{Gc.hasAnimatedSinceResize=!0,this.currentAnimation=B3(0,vb,{...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(vb),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&&s1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Mt();const b=Rn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const _=Rn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+_}Gn(p,m),ko(p,v),Pr(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new J3),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&&dp("z",u,g,this.animationValues);for(let v=0;v<cp.length;v++)dp(`rotate${cp[v]}`,u,g,this.animationValues),dp(`skew${cp[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 X3;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=Vc(u==null?void 0:u.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const b=this.getLead();if(!this.projectionDelta||!this.layout||!b.target){const w={};return this.options.layoutId&&(w.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,w.pointerEvents=Vc(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!mi(this.latestValues)&&(w.transform=v?v({},""):"none",this.hasProjected=!1),w}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=W3(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x:S,y:k}=this.projectionDelta;g.transformOrigin=`${S.origin*100}% ${k.origin*100}% 0`,b.animationValues?g.opacity=b===this?(m=(p=_.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:g.opacity=b===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const w in Wc){if(_[w]===void 0)continue;const{correct:N,applyTo:T}=Wc[w],C=g.transform==="none"?_[w]:N(_[w],b);if(T){const E=T.length;for(let B=0;B<E;B++)g[T[B]]=C}else g[w]=C}return this.options.layoutId&&(g.pointerEvents=b===this?Vc(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(yb),this.root.sharedNodes.clear()}}}function eM(t){t.updateLayout()}function tM(t){var s;const i=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&i&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:c}=t.layout,{animationType:d}=t.options,u=i.source!==t.layout.source;d==="size"?Kn(b=>{const _=u?i.measuredBox[b]:i.layoutBox[b],S=Rn(_);_.min=r[b].min,_.max=_.min+S}):s1(d,i.layoutBox,r)&&Kn(b=>{const _=u?i.measuredBox[b]:i.layoutBox[b],S=Rn(r[b]);_.max=_.min+S,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+S)});const p=_o();Pr(p,r,i.layoutBox);const m=_o();u?Pr(m,t.applyTransform(c,!0),i.measuredBox):Pr(m,r,i.layoutBox);const g=!Qx(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:S}=b;if(_&&S){const k=Mt();Hr(k,i.layoutBox,_.layoutBox);const w=Mt();Hr(w,r,S.layoutBox),e1(k,w)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=k,t.relativeParent=b)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:i,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 nM(t){Or&&hi.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 sM(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function aM(t){t.clearSnapshot()}function yb(t){t.clearMeasurements()}function iM(t){t.isLayoutDirty=!1}function oM(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function bb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function rM(t){t.resolveTargetDelta()}function lM(t){t.calcProjection()}function cM(t){t.resetSkewAndRotation()}function dM(t){t.removeLeadSnapshot()}function _b(t,s,i){t.translate=Tt(s.translate,0,i),t.scale=Tt(s.scale,1,i),t.origin=s.origin,t.originPoint=s.originPoint}function xb(t,s,i,r){t.min=Tt(s.min,i.min,r),t.max=Tt(s.max,i.max,r)}function uM(t,s,i,r){xb(t.x,s.x,i.x,r),xb(t.y,s.y,i.y,r)}function fM(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const pM={duration:.45,ease:[.4,0,.1,1]},kb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Sb=kb("applewebkit/")&&!kb("chrome/")?Math.round:An;function Tb(t){t.min=Sb(t.min),t.max=Sb(t.max)}function mM(t){Tb(t.x),Tb(t.y)}function s1(t,s,i){return t==="position"||t==="preserve-aspect"&&!v3(hb(s),hb(i),.2)}function hM(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const gM=n1({attachResizeListener:(t,s)=>Xr(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),up={current:void 0},a1=n1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!up.current){const t=new gM({});t.mount(window),t.setOptions({layoutScroll:!0}),up.current=t}return up.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),vM={pan:{Feature:M3},drag:{Feature:R3,ProjectionNode:a1,MeasureLayout:Jx}};function yM(t,s,i){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 i1(t,s){const i=yM(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[i,c,()=>r.abort()]}function wb(t){return s=>{s.pointerType==="touch"||$x()||t(s)}}function bM(t,s,i={}){const[r,c,d]=i1(t,i),u=wb(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=wb(b=>{g(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function jb(t,s,i){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",i==="Start");const c="onHover"+i,d=r[c];d&&_t.postRender(()=>d(s,rl(s)))}class _M extends $a{mount(){const{current:s}=this.node;s&&(this.unmount=bM(s,i=>(jb(this.node,i,"Start"),r=>jb(this.node,r,"End"))))}unmount(){}}class xM extends $a{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=ol(Xr(this.node.current,"focus",()=>this.onFocus()),Xr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const o1=(t,s)=>s?t===s?!0:o1(t,s.parentElement):!1,kM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function SM(t){return kM.has(t.tagName)||t.tabIndex!==-1}const Lr=new WeakSet;function Nb(t){return s=>{s.key==="Enter"&&t(s)}}function fp(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const TM=(t,s)=>{const i=t.currentTarget;if(!i)return;const r=Nb(()=>{if(Lr.has(i))return;fp(i,"down");const c=Nb(()=>{fp(i,"up")}),d=()=>fp(i,"cancel");i.addEventListener("keyup",c,s),i.addEventListener("blur",d,s)});i.addEventListener("keydown",r,s),i.addEventListener("blur",()=>i.removeEventListener("keydown",r),s)};function Cb(t){return Gm(t)&&!$x()}function wM(t,s,i={}){const[r,c,d]=i1(t,i),u=p=>{const m=p.currentTarget;if(!Cb(p)||Lr.has(m))return;Lr.add(m);const g=s(p),v=(S,k)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!Cb(S)||!Lr.has(m))&&(Lr.delete(m),typeof g=="function"&&g(S,{success:k}))},b=S=>{v(S,i.useGlobalTarget||o1(m,S.target))},_=S=>{v(S,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return r.forEach(p=>{!SM(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(i.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>TM(g,c),c)}),d}function Eb(t,s,i){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",i==="Start");const c="onTap"+(i==="End"?"":i),d=r[c];d&&_t.postRender(()=>d(s,rl(s)))}class jM extends $a{mount(){const{current:s}=this.node;s&&(this.unmount=wM(s,i=>(Eb(this.node,i,"Start"),(r,{success:c})=>Eb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Fp=new WeakMap,pp=new WeakMap,NM=t=>{const s=Fp.get(t.target);s&&s(t)},CM=t=>{t.forEach(NM)};function EM({root:t,...s}){const i=t||document;pp.has(i)||pp.set(i,{});const r=pp.get(i),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(CM,{root:t,...s})),r[c]}function AM(t,s,i){const r=EM(s);return Fp.set(t,i),r.observe(t),()=>{Fp.delete(t),r.unobserve(t)}}const DM={some:0,all:1};class RM extends $a{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:i,margin:r,amount:c="some",once:d}=s,u={root:i?i.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:DM[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:b}=this.node.getProps(),_=g?v:b;_&&_(m)};return AM(this.node.current,u,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:i}=this.node;["amount","margin","root"].some(MM(s,i))&&this.startObserver()}unmount(){}}function MM({viewport:t={}},{viewport:s={}}={}){return i=>t[i]!==s[i]}const IM={inView:{Feature:RM},tap:{Feature:jM},focus:{Feature:xM},hover:{Feature:_M}},OM={layout:{ProjectionNode:a1,MeasureLayout:Jx}},sd={current:null},Fm={current:!1};function r1(){if(Fm.current=!0,!!hm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>sd.current=t.matches;t.addListener(s),s()}else sd.current=!1}const LM=[...Cx,sn,Ba],BM=t=>LM.find(Nx(t)),Ab=new WeakMap;function zM(t,s,i){for(const r in s){const c=s[r],d=i[r];if(an(c))t.addValue(r,c);else if(an(d))t.addValue(r,Jr(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,Jr(u!==void 0?u:c,{owner:t}))}}for(const r in i)s[r]===void 0&&t.removeValue(r);return s}const Db=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class UM{scrapeMotionValuesFromProps(s,i,r){return{}}constructor({parent:s,props:i,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=Pm,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 S=xs.now();this.renderScheduledAt<S&&(this.renderScheduledAt=S,_t.render(this.render,!1,!0))};const{latestValues:m,renderState:g,onUpdate:v}=u;this.onUpdate=v,this.latestValues=m,this.baseTarget={...m},this.initialValues=i.initial?{...m}:{},this.renderState=g,this.parent=s,this.props=i,this.presenceContext=r,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=_d(i),this.isVariantNode=$_(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(i,{},this);for(const S in _){const k=_[S];m[S]!==void 0&&an(k)&&k.set(m[S],!1)}}mount(s){this.current=s,Ab.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((i,r)=>this.bindToMotionValue(r,i)),Fm.current||r1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:sd.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Ab.delete(this.current),this.projection&&this.projection.unmount(),La(this.notifyUpdate),La(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 i=this.features[s];i&&(i.unmount(),i.isMounted=!1)}this.current=null}bindToMotionValue(s,i){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const r=wi.has(s),c=i.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&_t.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),d=i.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,s,i)),this.valueSubscriptions.set(s,()=>{c(),d(),u&&u(),i.owner&&i.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 No){const i=No[s];if(!i)continue;const{isEnabled:r,Feature:c}=i;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):Mt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,i){this.latestValues[s]=i}update(s,i){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let r=0;r<Db.length;r++){const c=Db[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=zM(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 i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(s),()=>i.variantChildren.delete(s)}addValue(s,i){const r=this.values.get(s);i!==r&&(r&&this.removeValue(s),this.bindToMotionValue(s,i),this.values.set(s,i),this.latestValues[s]=i.get())}removeValue(s){this.values.delete(s);const i=this.valueSubscriptions.get(s);i&&(i(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,i){if(this.props.values&&this.props.values[s])return this.props.values[s];let r=this.values.get(s);return r===void 0&&i!==void 0&&(r=Jr(i===null?void 0:i,{owner:this}),this.addValue(s,r)),r}readValue(s,i){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"&&(wx(c)||gx(c))?c=parseFloat(c):!BM(c)&&Ba.test(i)&&(c=kx(s,i)),this.setBaseTarget(s,an(c)?c.get():c)),an(c)?c.get():c}setBaseTarget(s,i){this.baseTarget[s]=i}getBaseTarget(s){var i;const{initial:r}=this.props;let c;if(typeof r=="string"||typeof r=="object"){const u=xm(this.props,r,(i=this.presenceContext)===null||i===void 0?void 0:i.custom);u&&(c=u[s])}if(r&&c!==void 0)return c;const d=this.getBaseTargetFromProps(this.props,s);return d!==void 0&&!an(d)?d:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,i){return this.events[s]||(this.events[s]=new Rm),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class l1 extends UM{constructor(){super(...arguments),this.KeyframeResolver=Ex}sortInstanceNodePosition(s,i){return s.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(s,i){return s.style?s.style[i]:void 0}removeValueFromRenderState(s,{vars:i,style:r}){delete i[s],delete r[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;an(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function $M(t){return window.getComputedStyle(t)}class PM extends l1{constructor(){super(...arguments),this.type="html",this.renderInstance=Y_}readValueFromInstance(s,i){if(wi.has(i)){const r=$m(i);return r&&r.default||0}else{const r=$M(s),c=(F_(i)?r.getPropertyValue(i):r[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return Kx(s,i)}build(s,i,r){Tm(s,i,r.transformTemplate)}scrapeMotionValuesFromProps(s,i,r){return Cm(s,i,r)}}class HM extends l1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Mt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(wi.has(i)){const r=$m(i);return r&&r.default||0}return i=J_.has(i)?i:ym(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,r){return Q_(s,i,r)}build(s,i,r){wm(s,i,this.isSVGTag,r.transformTemplate)}renderInstance(s,i,r,c){W_(s,i,r,c)}mount(s){this.isSVGTag=Nm(s.tagName),super.mount(s)}}const VM=(t,s)=>_m(t)?new HM(s):new PM(s,{allowProjection:t!==y.Fragment}),qM=gD({...r3,...IM,...vM,...OM},VM),Et=DA(qM);function GM(){!Fm.current&&r1();const[t]=y.useState(sd.current);return t}const FM="_overlay_cmicx_1",ZM="_dialog_cmicx_11",KM="_title_cmicx_30",YM="_description_cmicx_38",JM="_actions_cmicx_45",WM="_cancelButton_cmicx_52",XM="_confirmButton_cmicx_79",di={overlay:FM,dialog:ZM,title:KM,description:YM,actions:JM,cancelButton:WM,confirmButton:XM};function xi({isOpen:t,title:s,description:i,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return o.jsx(cs,{children:t&&o.jsx(Et.div,{className:di.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":i?p:void 0,children:o.jsxs(Et.div,{className:di.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:[o.jsx("h3",{id:u,className:di.title,children:s}),i&&o.jsx("p",{id:p,className:di.description,children:i}),o.jsxs("div",{className:di.actions,children:[o.jsx("button",{type:"button",className:di.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),o.jsx("button",{type:"button",className:di.confirmButton,onClick:c,children:r})]})]})})})}const QM="_skeleton_1gqp4_9",e6="_circular_1gqp4_17",t6="_textContainer_1gqp4_26",n6="_card_1gqp4_31",ad={skeleton:QM,circular:e6,textContainer:t6,card:n6};function xe({width:t="100%",height:s="1rem",borderRadius:i,variant:r="rectangular",className:c}){const d=[ad.skeleton,r==="circular"?ad.circular:"",c??""].filter(Boolean).join(" ");return o.jsx("div",{className:d,style:{width:t,height:s,...i&&r!=="circular"?{borderRadius:i}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function Zp({lines:t=3,lastLineWidth:s="60%",lineHeight:i="0.75rem",gap:r="var(--space-sm)",className:c}){return o.jsx("div",{className:`${ad.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>o.jsx(xe,{width:u===t-1&&t>1?s:"100%",height:i},u))})}function id({lines:t=2,className:s}){return o.jsxs("div",{className:`${ad.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[o.jsx(xe,{width:"40%",height:"1.25rem"}),o.jsx(Zp,{lines:t})]})}const s6="_spinner_1uyt1_1",a6="_spin_1uyt1_1",i6="_sm_1uyt1_14",o6="_md_1uyt1_20",r6="_lg_1uyt1_26",l6="_xl_1uyt1_32",Rb={spinner:s6,spin:a6,sm:i6,md:o6,lg:r6,xl:l6};function c1({size:t="md",className:s,label:i="Loading",liveRegion:r=!1}){return o.jsx("span",{className:`${Rb.spinner} ${Rb[t]} ${s??""}`,role:r?"status":void 0,"aria-label":i,"aria-hidden":r?void 0:!0})}const c6="_splash_1bn1g_1",d6="_logo_1bn1g_11",Mb={splash:c6,logo:d6};function d1(){return o.jsxs("div",{className:Mb.splash,"data-testid":"splash-screen",children:[o.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Mb.logo}),o.jsx(c1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const u6="_wrapper_4e5yt_1",f6="_wrapperBlock_4e5yt_6",p6="_tooltip_4e5yt_11",m6="_visible_4e5yt_31",h6="_top_4e5yt_41",g6="_bottom_4e5yt_48",v6="_left_4e5yt_55",y6="_right_4e5yt_62",Er={wrapper:u6,wrapperBlock:f6,tooltip:p6,visible:m6,top:h6,bottom:g6,left:v6,right:y6},b6=300,Rc=6;function Ao({text:t,placement:s="top",delayMs:i=b6,inline:r=!0,children:c,className:d,"data-testid":u}){const[p,m]=y.useState(!1),[g,v]=y.useState({top:0,left:0}),b=y.useRef(null),_=y.useRef(null),S=y.useRef(void 0),k=y.useId(),w=typeof document<"u",N=y.useCallback(()=>{if(!b.current||!_.current)return;const P=b.current.getBoundingClientRect(),W=_.current.getBoundingClientRect();let te=0,H=0;switch(s){case"top":te=P.top-W.height-Rc,H=P.left+P.width/2-W.width/2;break;case"bottom":te=P.bottom+Rc,H=P.left+P.width/2-W.width/2;break;case"left":te=P.top+P.height/2-W.height/2,H=P.left-W.width-Rc;break;case"right":te=P.top+P.height/2-W.height/2,H=P.right+Rc;break}v({top:te,left:H})},[s]),T=y.useCallback(P=>{S.current!==void 0&&clearTimeout(S.current),S.current=setTimeout(()=>{N(),m(!0),S.current=void 0},P)},[N]),C=y.useCallback(()=>{T(i)},[i,T]),E=y.useCallback(()=>{T(0)},[T]),B=y.useCallback(()=>{S.current!==void 0&&(clearTimeout(S.current),S.current=void 0),m(!1)},[]);y.useEffect(()=>{if(!p)return;const P=W=>{W.key==="Escape"&&B()};return document.addEventListener("keydown",P),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{document.removeEventListener("keydown",P),window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[p,B,N]),y.useEffect(()=>()=>{S.current!==void 0&&clearTimeout(S.current)},[]);const A=r?"span":"div",I=[r?Er.wrapper:Er.wrapperBlock,d].filter(Boolean).join(" ");let O=c;if(y.isValidElement(c)){const P=c,W=P.props["aria-describedby"],te=p?W?`${W} ${k}`:k:W;O=y.cloneElement(P,{"aria-describedby":te})}const U=o.jsx("div",{ref:_,id:k,role:"tooltip",className:`${Er.tooltip} ${Er[s]} ${p?Er.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return o.jsxs(A,{ref:b,className:I,onMouseEnter:C,onMouseLeave:B,onFocus:E,onBlur:B,children:[O,w?sT.createPortal(U,document.body):null]})}const _6="_row_ldkru_1",x6="_hoverActions_ldkru_5",k6="_hoverButton_ldkru_31",S6="_selectingRow_ldkru_72",T6="_selected_ldkru_83",w6="_checkboxArea_ldkru_90",j6="_checkbox_ldkru_90",N6="_contentArea_ldkru_106",as={row:_6,hoverActions:x6,hoverButton:k6,selectingRow:S6,selected:T6,checkboxArea:w6,checkbox:j6,contentArea:N6};function C6({copyText:t,isContentBearing:s,isSelecting:i,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:p,children:m}){const[g,v]=y.useState(!1),b=y.useRef(void 0);y.useEffect(()=>()=>{b.current!==void 0&&clearTimeout(b.current)},[]);const _=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),p==null||p(),b.current!==void 0&&clearTimeout(b.current),b.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,p]),S=y.useCallback(k=>{!i||k.target.closest("a, button, input, textarea, select, [role=button]")||(k.preventDefault(),u(k.shiftKey))},[i,u]);return s?i?o.jsxs("div",{className:`${as.row} ${as.selectingRow} ${r?as.selected:""}`,onClick:S,"data-testid":"event-selectable-row",children:[o.jsx("div",{className:as.checkboxArea,children:o.jsx("input",{type:"checkbox",checked:r,onChange:k=>{u(k.nativeEvent.shiftKey)},onClick:k=>{k.stopPropagation()},className:as.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),o.jsx("div",{className:as.contentArea,children:m})]}):o.jsxs("div",{className:as.row,"data-testid":"event-hover-row",children:[o.jsxs("div",{className:as.hoverActions,"data-testid":"event-hover-actions",children:[o.jsx("button",{type:"button",className:as.hoverButton,onClick:()=>{_().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?o.jsx(ki,{size:at,"aria-hidden":"true"}):o.jsx(l_,{size:at,"aria-hidden":"true"})}),o.jsx("button",{type:"button",className:as.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:o.jsx(G2,{size:at,"aria-hidden":"true"})})]}),m]}):o.jsx("div",{className:as.row,children:m})}const E6="_bar_1vah7_1",A6="_left_1vah7_21",D6="_right_1vah7_27",R6="_count_1vah7_33",M6="_toggleButton_1vah7_40",I6="_copyButton_1vah7_68",O6="_cancelButton_1vah7_108",ui={bar:E6,left:A6,right:D6,count:R6,toggleButton:M6,copyButton:I6,cancelButton:O6};function L6({selectedCount:t,totalSelectable:s,onSelectAll:i,onDeselectAll:r,onCopy:c,onCancel:d}){const u=t>0&&t>=s;return o.jsxs(Et.div,{className:ui.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:[o.jsxs("div",{className:ui.left,children:[o.jsxs("span",{className:ui.count,"data-testid":"floating-bar-count",children:[t," selected"]}),o.jsx("button",{type:"button",className:ui.toggleButton,onClick:u?r:i,"data-testid":"floating-bar-select-all",children:u?"Deselect all":"Select all"})]}),o.jsxs("div",{className:ui.right,children:[o.jsxs("button",{type:"button",className:ui.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[o.jsx(c2,{size:at,"aria-hidden":"true"}),"Copy"]}),o.jsx("button",{type:"button",className:ui.cancelButton,onClick:d,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:o.jsx(za,{size:at,"aria-hidden":"true"})})]})]})}const u1=50;function B6(t,s,i,r,c=u1){return r?t<c:s-t-i<c}function z6(t,s){const i=s-t;return i>0?i:0}function U6({scrollRef:t,contentLength:s,isReversed:i,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 b=!0;const _=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const S=B6(v.scrollTop,v.scrollHeight,v.clientHeight,i,u1);S!==b&&(b=S,d(S))}))};return v.addEventListener("scroll",_,{passive:!0}),()=>{v.removeEventListener("scroll",_),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[t,i]),y.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,i?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,i]),y.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(i&&!c){const b=z6(u.current,v.scrollHeight);b>0&&(v.scrollTop+=b)}c&&(i?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),u.current=v.scrollHeight}},[s,c,i,r,t]);const g=y.useCallback(()=>{const v=t.current;if(!v)return;const b=i?0:v.scrollHeight;v.scrollTo({top:b,behavior:"smooth"}),d(!0)},[t,i]);return{isAtAnchor:c,scrollToAnchor:g}}const $6=new Set(["text","output","user_input","tool_use","tool_result","error"]);function Qr(t){return $6.has(t.eventType)}function P6(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let i=t.content;if(t.content.trimStart().startsWith("{"))try{const r=JSON.parse(t.content);typeof r.content=="string"&&(i=r.content)}catch{}return i}case"tool_use":try{const i=JSON.parse(t.content),r=i.tool??"tool",c=i.args!==void 0?JSON.stringify(i.args,void 0,2):"";return`${r}
|
|
264
|
-
${c}`}catch{return t.content}default:return t.content}}function Ib(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 H6(t){var i;const s=[];for(const r of t){if(!Qr(r))continue;const c=new Date(r.timestamp).toLocaleTimeString();switch(r.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
|
|
265
|
-
${r.content}`);break}case"user_input":{s.push(`**User** (${c}):
|
|
266
|
-
${r.content}`);break}case"tool_result":{let d=((i=r.toolUseCtx)==null?void 0:i.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=Ib(r.toolUseCtx.args),p=u?`**Tool: ${r.toolUseCtx.tool}** ${u}`:`**Tool: ${r.toolUseCtx.tool}**`;s.push(`${p} (${c}):
|
|
267
|
-
${d}`)}else s.push(`**Tool output** (${c}):
|
|
268
|
-
${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=Ib(u),m=p?`**Tool: ${d}** ${p}`:`**Tool: ${d}**`;u!==void 0?s.push(`${m} (${c}):
|
|
269
|
-
\`\`\`json
|
|
270
|
-
${JSON.stringify(u,void 0,2)}
|
|
271
|
-
\`\`\``):s.push(`${m} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
|
|
272
|
-
${r.content}`);break}}}return s.join(`
|
|
273
|
-
|
|
274
|
-
`)}function V6({events:t,formatForClipboard:s}){const[i,r]=y.useState(!1),[c,d]=y.useState(new Set),u=y.useRef(void 0),p=y.useMemo(()=>c.size,[c]),m=y.useCallback(k=>{r(!0),k!==void 0?(d(new Set([k])),u.current=k):(d(new Set),u.current=void 0)},[]),g=y.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=y.useCallback((k,w)=>{if(w&&u.current!==void 0){const N=Math.min(u.current,k),T=Math.max(u.current,k);d(C=>{const E=new Set(C);for(let B=N;B<=T;B++)B<t.length&&Qr(t[B])&&E.add(B);return E})}else d(N=>{const T=new Set(N);return T.has(k)?T.delete(k):T.add(k),T.size===0?(r(!1),u.current=void 0):u.current=k,T})},[t]),b=y.useCallback(()=>{const k=new Set;for(let w=0;w<t.length;w++)Qr(t[w])&&k.add(w);d(k)},[t]),_=y.useCallback(()=>{d(new Set)},[]),S=y.useCallback(async()=>{const w=[...c].sort((T,C)=>T-C).filter(T=>T<t.length).map(T=>t[T]);if(w.length===0)return!1;const N=s(w);try{return await navigator.clipboard.writeText(N),!0}catch{return!1}},[c,t,s]);return{isSelecting:i,selectedIndices:c,selectedCount:p,enterSelectionMode:m,cancelSelection:g,toggleEvent:v,selectAll:b,deselectAll:_,copySelected:S}}const q6="_wrapper_1cdza_1",G6="_scrollContainer_1cdza_9",F6="_selectingPadding_1cdza_16",Z6="_toolbar_1cdza_20",K6="_directionToggle_1cdza_27",Y6="_scrollToAnchor_1cdza_65",J6="_scrollToAnchorBottom_1cdza_89",W6="_scrollToAnchorTop_1cdza_93",X6="_eventOverflowWarning_1cdza_97",Zs={wrapper:q6,scrollContainer:G6,selectingPadding:F6,toolbar:Z6,directionToggle:K6,scrollToAnchor:Y6,scrollToAnchorBottom:J6,scrollToAnchorTop:W6,eventOverflowWarning:X6};function Q6(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 f1="grackle-stream-direction";function e4(){try{return localStorage.getItem(f1)==="reversed"}catch{return!1}}function t4({eventsDropped:t}){return t<=0?o.jsx(o.Fragment,{}):o.jsxs("div",{className:Zs.eventOverflowWarning,role:"alert",children:[o.jsx(tm,{size:Zt,"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 Zm({events:t,eventsDropped:s,emptyState:i,onShowToast:r}){const c=y.useRef(null),[d,u]=y.useState(e4),p=GM(),m=V6({events:t,formatForClipboard:H6}),g=y.useMemo(()=>t.filter(Qr).length,[t]),v=y.useMemo(()=>d?[...t].reverse():t,[t,d]),{isAtAnchor:b,scrollToAnchor:_}=U6({scrollRef:c,contentLength:t.length,isReversed:d,paused:m.isSelecting}),S=()=>{const T=!d;u(T);try{localStorage.setItem(f1,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 k=y.useCallback(async()=>{await m.copySelected()&&(r==null||r(`Copied ${m.selectedCount} message${m.selectedCount===1?"":"s"} to clipboard`,"success"))},[m,r]),w=p?0:.2,N=d?-8:8;return o.jsxs("div",{className:Zs.wrapper,children:[o.jsx("div",{className:Zs.toolbar,children:o.jsx(Ao,{text:d?"Showing newest first":"Showing oldest first",children:o.jsx("button",{className:Zs.directionToggle,onClick:S,"aria-label":d?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:d?o.jsx(ty,{size:Zt,"aria-hidden":"true"}):o.jsx(ny,{size:Zt,"aria-hidden":"true"})})})}),o.jsxs("div",{ref:c,className:`${Zs.scrollContainer} ${m.isSelecting?Zs.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&i,o.jsx(t4,{eventsDropped:s}),o.jsx(cs,{initial:!1,children:v.map((T,C)=>{const E=d?t.length-1-C:C;return o.jsx(Et.div,{initial:{opacity:0,y:N},animate:{opacity:1,y:0},transition:{duration:w,ease:"easeOut"},children:o.jsx(C6,{copyText:P6(T),isContentBearing:Qr(T),isSelecting:m.isSelecting,isSelected:m.selectedIndices.has(E),checkboxLabel:Q6(T),onSelect:()=>{m.enterSelectionMode(E)},onToggle:B=>{m.toggleEvent(E,B)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:o.jsx(bA,{event:T,toolUseCtx:T.toolUseCtx,settled:T.settled})})},`${T.sessionId}-${T.timestamp}-${E}`)})})]}),o.jsx(cs,{children:m.isSelecting&&o.jsx(L6,{selectedCount:m.selectedCount,totalSelectable:g,onSelectAll:m.selectAll,onDeselectAll:m.deselectAll,onCopy:()=>{k().catch(()=>{})},onCancel:m.cancelSelection})}),o.jsx(cs,{children:!b&&o.jsxs(Et.button,{className:`${Zs.scrollToAnchor} ${d?Zs.scrollToAnchorTop:Zs.scrollToAnchorBottom}`,onClick:_,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?o.jsx(ny,{size:Zt,"aria-hidden":"true"}):o.jsx(ty,{size:Zt,"aria-hidden":"true"})," New events"]})})]})}function Km(t){const{value:s,onSave:i,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:p=!0,trimOnSave:m=!0}=t,[g,v]=y.useState(""),[b,_]=y.useState(""),S=y.useRef(!1),k=d===c,w=y.useCallback(O=>{v(O),_("")},[]),N=y.useCallback(()=>{_("")},[]),T=y.useCallback(()=>{S.current=!1,u==null||u(null),v(""),_("")},[u]),C=y.useCallback(()=>{const O=m?g.trim():g;if(r){const P=r(g);if(P){_(P);return}}const U=m?s.trim():s;if(O===U){T();return}i(O),T()},[g,s,m,r,i,T]),E=y.useCallback(()=>{S.current=!0,u==null||u(c),v(s),_("")},[c,s,u]),B=y.useCallback(O=>{if(S.current){S.current=!1;return}O.relatedTarget instanceof HTMLElement&&O.relatedTarget.dataset.editAction===c||C()},[c,C]),A=y.useCallback(O=>{O.key==="Escape"?T():O.key==="Enter"&&p&&C()},[T,p,C]),I=(()=>{if(!k)return!1;const O=m?s.trim():s;return(m?g.trim():g)!==O})();return y.useEffect(()=>{!k&&(g!==""||b!=="")&&(v(""),_(""))},[k,g,b]),{isEditing:k,draft:g,error:b,isDirty:I,startEdit:E,cancelEdit:T,save:C,setDraft:w,clearError:N,handleBlur:B,handleKeyDown:A,ignoreInitialBlurRef:S}}const n4="_editFieldWrapper_yuzty_1",s4="_editInput_yuzty_10",a4="_editTextarea_yuzty_42",i4="_editSelect_yuzty_78",o4="_editError_yuzty_111",r4="_editInputInvalid_yuzty_118",l4="_editHint_yuzty_123",c4="_unsavedDot_yuzty_132",d4="_metaValueClickable_yuzty_140",u4="_editButton_yuzty_159",f4="_metaPlaceholder_yuzty_175",p4="_worktreeToggle_yuzty_180",Xe={editFieldWrapper:n4,editInput:s4,editTextarea:a4,editSelect:i4,editError:o4,editInputInvalid:r4,editHint:l4,unsavedDot:c4,metaValueClickable:d4,editButton:u4,metaPlaceholder:f4,worktreeToggle:p4};function en(t){const{value:s,onSave:i,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:_,"data-testid":S}=t,k=y.useRef(null),w=Km({value:s,onSave:i,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(w.isEditing){const T=window.setTimeout(()=>{var C;(C=k.current)==null||C.focus()},0);return()=>window.clearTimeout(T)}},[w.isEditing]),c==="create"){const T=E=>{m==null||m(E.target.value)},C=r==null?void 0:r(s);return o.jsxs("div",{className:Xe.editFieldWrapper,children:[o.jsx("input",{className:`${Xe.editInput} ${C?Xe.editInputInvalid:""}`,value:s,onChange:T,maxLength:b,placeholder:v,"aria-label":_,"data-testid":S?`${S}-input`:void 0}),C&&o.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:C})]})}if(w.isEditing)return o.jsxs("div",{className:Xe.editFieldWrapper,children:[o.jsx("input",{ref:k,className:`${Xe.editInput} ${w.error?Xe.editInputInvalid:""}`,value:w.draft,onChange:T=>w.setDraft(T.target.value),onBlur:w.handleBlur,onKeyDown:w.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":S?`${S}-input`:void 0}),w.isDirty&&o.jsx("span",{className:Xe.unsavedDot,title:"Unsaved changes"}),w.error&&o.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:w.error}),o.jsx("span",{className:Xe.editHint,children:"Enter to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return o.jsxs("span",{role:"button",tabIndex:0,className:Xe.metaValueClickable,onClick:()=>w.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),w.startEdit())},title:"Click to edit","aria-label":_,"data-testid":S?`${S}-button`:void 0,children:[N!==void 0?N:s?o.jsx("span",{children:s}):o.jsx("span",{className:Xe.metaPlaceholder,children:v||"None"}),o.jsx("span",{className:Xe.editButton,"aria-hidden":"true",children:"✏️"})]})}function Kp(t){const{value:s,onSave:i,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=t,S=y.useRef(null),k=Km({value:s,onSave:i,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(k.isEditing){const N=window.setTimeout(()=>{var T;(T=S.current)==null||T.focus()},0);return()=>window.clearTimeout(N)}},[k.isEditing]),c==="create"){const N=C=>{m==null||m(C.target.value)},T=r==null?void 0:r(s);return o.jsxs("div",{className:Xe.editFieldWrapper,children:[o.jsx("textarea",{className:`${Xe.editTextarea} ${T?Xe.editInputInvalid:""}`,value:s,onChange:N,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),T&&o.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:T})]})}if(k.isEditing)return o.jsxs("div",{className:Xe.editFieldWrapper,children:[o.jsx("textarea",{ref:S,className:`${Xe.editTextarea} ${k.error?Xe.editInputInvalid:""}`,value:k.draft,onChange:N=>k.setDraft(N.target.value),onBlur:k.handleBlur,onKeyDown:k.handleKeyDown,title:b,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),k.isDirty&&o.jsx("span",{className:Xe.unsavedDot,title:"Unsaved changes"}),k.error&&o.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:k.error}),o.jsx("span",{className:Xe.editHint,children:"Tab to save · Esc to cancel"})]});const w=g==null?void 0:g(s);return o.jsxs("span",{role:"button",tabIndex:0,className:Xe.metaValueClickable,onClick:()=>k.startEdit(),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),k.startEdit())},title:"Click to edit","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[w!==void 0?w:s?o.jsx("span",{children:s}):o.jsx("span",{className:Xe.metaPlaceholder,children:v||"None"}),o.jsx("span",{className:Xe.editButton,"aria-hidden":"true",children:"✏️"})]})}function od(t){var E;const{value:s,onSave:i,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=t,S=y.useRef(null),k=Km({value:s,onSave:i,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(k.isEditing){const B=window.setTimeout(()=>{var A;(A=S.current)==null||A.focus()},0);return()=>window.clearTimeout(B)}},[k.isEditing]);const w=y.useCallback(B=>{const A=B.target.value;k.ignoreInitialBlurRef.current=!1,A!==s&&i(A),k.cancelEdit()},[s,i,k]),N=y.useCallback(B=>{if(k.ignoreInitialBlurRef.current){k.ignoreInitialBlurRef.current=!1;return}B.relatedTarget instanceof HTMLElement&&B.relatedTarget.dataset.editAction===d||k.cancelEdit()},[d,k]);if(r==="create")return o.jsx("select",{className:Xe.editSelect,value:s,onChange:B=>m==null?void 0:m(B.target.value),"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(B=>o.jsx("option",{value:B.value,children:B.label},B.value))});if(k.isEditing)return o.jsx("select",{ref:S,className:Xe.editSelect,value:k.draft,onChange:w,onBlur:N,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(B=>o.jsx("option",{value:B.value,children:B.label},B.value))});const T=g==null?void 0:g(s),C=(E=c.find(B=>B.value===s))==null?void 0:E.label;return o.jsxs("button",{type:"button",className:Xe.metaValueClickable,onClick:()=>k.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[T!==void 0?T:C?o.jsx("span",{children:C}):o.jsx("span",{className:Xe.metaPlaceholder,children:v||"None"}),o.jsx("span",{className:Xe.editButton,"aria-hidden":"true",children:"✏️"})]})}function m4(t){const{checked:s,onChange:i,label:r,ariaLabel:c,"data-testid":d}=t;return o.jsxs("label",{className:Xe.worktreeToggle,"data-testid":d,children:[o.jsx("input",{type:"checkbox",checked:s,onChange:u=>i(u.target.checked),"aria-label":c}),o.jsx("span",{children:r})]})}const h4="_envRow_1e1r5_1",g4="_envDot_1e1r5_7",v4="_envDotGreen_1e1r5_14",y4="_envDotYellow_1e1r5_18",b4="_envDotRed_1e1r5_22",_4="_envDotGray_1e1r5_26",So={envRow:h4,envDot:g4,envDotGreen:v4,envDotYellow:y4,envDotRed:b4,envDotGray:_4};function x4(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?So.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?So.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?So.envDotRed:So.envDotGray}function k4(t){const{value:s,onSave:i,environments:r,allowNone:c=!1,fieldId:d="environment",activeFieldId:u,onActivate:p,placeholder:m="No environment",ariaLabel:g="Environment","data-testid":v}=t,b=r.find(k=>k.id===s),_=[...c?[{value:"",label:"None"}]:[],...r.map(k=>({value:k.id,label:k.displayName}))],S=()=>{if(b)return o.jsxs("span",{className:So.envRow,children:[o.jsx("span",{className:`${So.envDot} ${x4(b.status)}`}),b.displayName]})};return o.jsx(od,{value:s,onSave:i,options:_,fieldId:d,activeFieldId:u,onActivate:p,renderDisplay:S,placeholder:m,ariaLabel:g,"data-testid":v})}const S4="_nav_1snmp_1",T4="_searchForm_1snmp_8",w4="_searchInput_1snmp_15",j4="_searchButton_1snmp_33",N4="_clearButton_1snmp_68",C4="_workspaceSelect_1snmp_85",E4="_listHeader_1snmp_99",A4="_nodeList_1snmp_108",D4="_nodeItem_1snmp_116",R4="_indicator_1snmp_129",M4="_label_1snmp_136",I4="_badge_1snmp_145",Fn={nav:S4,searchForm:T4,searchInput:w4,searchButton:j4,clearButton:N4,workspaceSelect:C4,listHeader:E4,nodeList:A4,nodeItem:D4,indicator:R4,label:M4,badge:I4};function O4({nodes:t,workspaces:s,loading:i,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:p}){const[m,g]=y.useState(""),v=y.useCallback(k=>{k.preventDefault(),m.trim()&&c(m.trim())},[m,c]),b=y.useCallback(()=>{g(""),d()},[d]),_=y.useCallback(k=>{u(k)},[u]),S=y.useCallback(k=>{g(""),p(k)},[p]);return o.jsxs("div",{className:Fn.nav,"data-testid":"knowledge-nav",children:[o.jsxs("form",{className:Fn.searchForm,onSubmit:v,children:[o.jsx("input",{className:Fn.searchInput,type:"text",placeholder:"Search...",value:m,onChange:k=>{g(k.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),o.jsx("button",{type:"submit",className:Fn.searchButton,disabled:i,children:"Go"})]}),r&&o.jsx("button",{type:"button",className:Fn.clearButton,onClick:b,children:"Clear search"}),o.jsxs("select",{className:Fn.workspaceSelect,onChange:k=>{S(k.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[o.jsx("option",{value:"",children:"All workspaces"}),s.map(k=>o.jsx("option",{value:k.id,children:k.name},k.id))]}),o.jsxs("div",{className:Fn.listHeader,children:["Nodes (",t.length,")"]}),o.jsx("ul",{className:Fn.nodeList,children:t.map(k=>o.jsxs("li",{className:Fn.nodeItem,onClick:()=>{_(k.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),_(k.id))},role:"button",tabIndex:0,children:[o.jsx("span",{className:Fn.indicator,style:{backgroundColor:k.kind==="reference"?"#4A9EFF":k.category==="decision"?"#22C55E":k.category==="concept"?"#A855F7":k.category==="snippet"?"#6B7280":"#EAB308"}}),o.jsx("span",{className:Fn.label,children:k.label}),o.jsx("span",{className:Fn.badge,children:k.kind==="reference"?k.sourceType:k.category})]},k.id))})]})}const L4="_container_1mq5u_1",B4="_hamburger_1mq5u_33",z4="_brand_1mq5u_49",U4="_brandLogo_1mq5u_68",$4="_info_1mq5u_75",P4="_connectionLabel_1mq5u_90",H4="_connectionDot_1mq5u_103",V4="_connected_1mq5u_106",q4="_disconnected_1mq5u_110",Gs={container:L4,hamburger:B4,brand:z4,brandLogo:U4,info:$4,connectionLabel:P4,connectionDot:H4,connected:V4,disconnected:q4};function G4({connected:t,environments:s,sessions:i,onToggleSidebar:r,sidebarOpen:c}){const d=xt(),u=s.length,p=s.filter(g=>g.status==="connected").length,m=i.filter(g=>["running","idle"].includes(g.status)).length;return o.jsxs("div",{className:Gs.container,children:[r&&o.jsx("button",{type:"button",className:Gs.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:o.jsx(A2,{size:It,"aria-hidden":"true"})}),o.jsx(Ao,{text:"Home",placement:"bottom",children:o.jsxs("button",{type:"button",className:Gs.brand,onClick:()=>d(_i),"data-testid":"statusbar-brand",children:[o.jsx("img",{src:"/icon-192x192.png",alt:"",className:Gs.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),o.jsxs("div",{className:Gs.info,children:[o.jsxs("span",{"aria-label":t?"Connected":"Disconnected",children:[o.jsx("span",{className:`${Gs.connectionDot} ${t?Gs.connected:Gs.disconnected}`,"aria-hidden":"true",children:o.jsx(Ia,{size:nm,fill:"currentColor"})})," ",o.jsx("span",{className:Gs.connectionLabel,"aria-hidden":"true",children:t?"Connected":"Disconnected"})]}),o.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),o.jsxs("span",{children:[m," active"]})]})]})}const F4="_nav_13gkc_1",Z4="_tab_13gkc_35",K4="_tabIcon_13gkc_68",Y4="_tabLabel_13gkc_79",J4="_tabActive_13gkc_84",Ar={nav:F4,tab:Z4,tabIcon:K4,tabLabel:Y4,tabActive:J4},fi=[{view:"dashboard",label:"Dashboard",icon:o.jsx(v2,{size:It}),route:_i,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:o.jsx(R2,{size:It}),route:eN,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:o.jsx(a2,{size:It}),route:tN,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:o.jsx(I2,{size:It}),route:wo,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:o.jsx(XT,{size:It}),route:D_,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:o.jsx(c_,{size:It}),route:gd,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:o.jsx(V2,{size:It}),route:Jj,testId:"sidebar-tab-settings"}];function W4(t){return t===_i||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(D_)?"knowledge":t.startsWith(gd)?"findings":t.startsWith(To)?"settings":"tasks"}function X4(){const t=Vt(),s=xt(),i=y.useRef(null),r=W4(t.pathname),c=y.useCallback(u=>{s(u.route)},[s]),d=y.useCallback(u=>{var b,_;const p=(b=i.current)==null?void 0:b.querySelectorAll('[role="tab"]');if(!p)return;const m=Array.from(p).findIndex(S=>S===document.activeElement),g=m>=0?m:fi.findIndex(S=>S.view===r);let v=g;if(u.key==="ArrowRight"||u.key==="j"||u.key==="J")u.preventDefault(),v=(g+1)%fi.length;else if(u.key==="ArrowLeft"||u.key==="k"||u.key==="K")u.preventDefault(),v=(g-1+fi.length)%fi.length;else if(u.key==="Home")u.preventDefault(),v=0;else if(u.key==="End")u.preventDefault(),v=fi.length-1;else return;s(fi[v].route),(_=p[v])==null||_.focus()},[r,s]);return o.jsx("nav",{className:Ar.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:d,"data-testid":"sidebar-nav",children:fi.map(u=>{const p=u.view===r;return o.jsx(Ao,{text:u.label,placement:"bottom",children:o.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${Ar.tab} ${p?Ar.tabActive:""}`,onClick:()=>c(u),"data-testid":u.testId,"aria-label":u.label,children:[o.jsx("span",{className:Ar.tabIcon,"aria-hidden":"true",children:u.icon}),o.jsx("span",{className:Ar.tabLabel,children:u.label})]})},u.view)})})}const Q4="_container_pi6ii_1",eI="_content_pi6ii_66",Ob={container:Q4,content:eI},tI=320,p1=220,m1=600,h1="grackle-sidebar-width";function nI(){try{const t=localStorage.getItem(h1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=p1&&s<=m1)return s}}catch{}return tI}function sI(t){try{localStorage.setItem(h1,String(t))}catch{}}function aI({content:t}){const[s]=y.useState(nI),i=y.useRef(null);if(y.useEffect(()=>{const r=i.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>=p1&&m<=m1&&sI(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return o.jsx("div",{className:Ob.container,ref:i,"data-testid":"sidebar",style:{width:s},children:o.jsx("div",{className:Ob.content,children:t})})}const iI="_bar_tnfsh_1",oI="_btnPrimary_tnfsh_32",rI="_statusText_tnfsh_85",lI="_statusCompleted_tnfsh_90",cI="_statusFailed_tnfsh_94",dI="_statusBlocked_tnfsh_98",uI="_hintText_tnfsh_103",St={bar:iI,btnPrimary:oI,statusText:rI,statusCompleted:lI,statusFailed:cI,statusBlocked:dI,hintText:uI};function fI({sessions:t,tasks:s,environments:i}){const r=xt(),c=Vt(),d=Nt("/sessions/:sessionId"),u=Nt("/tasks/:taskId"),p=Nt("/tasks/:taskId/stream"),m=Nt("/tasks/:taskId/findings"),g=Nt("/tasks/:taskId/edit"),v=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),_=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),S=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),k=Nt("/sessions/new"),w=Nt("/environments/:environmentId/workspaces/:workspaceId"),N=Nt("/tasks/new"),T=Nt("/chat"),C=Nt("/"),E=Nt("/settings/*"),B=d==null?void 0:d.params.sessionId,A=(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)??(b==null?void 0:b.params.taskId)??(_==null?void 0:_.params.taskId)??(S==null?void 0:S.params.taskId),I=v??b??_??S,O=(I==null?void 0:I.params.environmentId)??(w==null?void 0:w.params.environmentId),U=c.pathname.startsWith("/environments")&&!w&&!I,P=!!T,W=!!k,te=!!w&&!v&&!b&&!_&&!S,H=!!N;if(!!C&&!W&&!te&&!H||!!E||(!!g||!!S)||H||U||W)return o.jsx(o.Fragment,{});if(P)return i.find(Z=>Z.adapterType==="local"&&Z.status==="connected")?o.jsx(o.Fragment,{}):o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Add a local environment to start chatting"})});if(te)return o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Select a task or click + to create one"})});if(A){const D=s.find(ue=>ue.id===A);if(!D)return o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Loading..."})});const Z=new Map(s.map(ue=>[ue.id,ue])),se=D.dependsOn.some(ue=>{const de=Z.get(ue);return de!==void 0&&de.status!=="complete"});if(D.status==="not_started"){const ue=se?D.dependsOn.map(de=>Z.get(de)).filter(de=>de&&de.status!=="complete").map(de=>de.title):[];return o.jsx("div",{className:St.bar,children:se?o.jsxs("span",{className:St.statusBlocked,children:["Blocked by: ",ue.join(", ")]}):o.jsx("span",{className:St.hintText,children:"Use the buttons above to start or manage this task"})})}if(D.status==="working"||D.status==="paused"){const ue=D.latestSessionId||void 0,de=ue?t.find(De=>De.id===ue):void 0;return de&&de.status!=="stopped"?o.jsx(o.Fragment,{}):o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Waiting for agent..."})})}if(D.status==="complete")return o.jsxs("div",{className:St.bar,children:[o.jsx("span",{className:`${St.statusText} ${St.statusCompleted}`,children:"Task completed"}),o.jsx("button",{onClick:()=>r(Ti(D.workspaceId,void 0,O)),className:St.btnPrimary,children:"+ New Task"})]});if(D.status==="failed")return o.jsx("div",{className:St.bar,children:o.jsx("span",{className:`${St.statusText} ${St.statusFailed}`,children:"Task failed"})})}if(B){const D=t.find(ue=>ue.id===B),Z=(D==null?void 0:D.status)==="stopped";if(D!==void 0&&!Z)return o.jsx(o.Fragment,{});if(Z)return o.jsxs("div",{className:St.bar,children:[o.jsxs("span",{className:`${St.statusText} ${St.hintText}`,children:["Session ",D.endReason||D.status]}),o.jsx("button",{onClick:()=>r(C_(D.environmentId)),className:St.btnPrimary,children:"+ New Chat"})]})}return o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Loading..."})})}const pI="_nav_14i94_1",mI="_tab_14i94_24",hI="_tabActive_14i94_62",gI="_tabLabel_14i94_75",vI="_statusDot_14i94_81",yI="_pulse_14i94_87",bI="_addButton_14i94_99",_I="_empty_14i94_132",Na={nav:pI,tab:mI,tabActive:hI,tabLabel:gI,statusDot:vI,pulse:yI,addButton:bI,empty:_I},xI={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function kI({environments:t}){const s=xt(),i=y.useRef(null),r=Nt("/environments/:environmentId"),c=Nt("/environments/:environmentId/edit"),d=Nt("/environments/:environmentId/workspaces/:workspaceId"),u=Nt("/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(_=>{s(bi(_))},[s]),v=y.useCallback(_=>{var T;const S=(T=i.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!S||S.length===0)return;const k=Array.from(S).findIndex(C=>C===document.activeElement),w=k>=0?k:t.findIndex(C=>C.id===m);let N=w;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),N=(w+1)%S.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),N=(w-1+S.length)%S.length;else if(_.key==="Home")_.preventDefault(),N=0;else if(_.key==="End")_.preventDefault(),N=S.length-1;else return;N<t.length&&s(bi(t[N].id)),S[N].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return o.jsxs("div",{className:Na.nav,"data-testid":"environment-nav",children:[o.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(_=>{const S=_.id===m,k=_.id===b,w=xI[_.status]||"var(--text-tertiary)",N=_.status==="connected";return o.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:k?0:-1,className:`${Na.tab} ${S?Na.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[o.jsx("span",{className:`${Na.statusDot} ${N?Na.pulse:""}`,style:{color:w},"aria-hidden":"true",children:o.jsx(Ia,{size:nm,fill:"currentColor"})}),o.jsx("span",{className:Na.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),o.jsx("button",{type:"button",className:Na.addButton,onClick:()=>s(Kj),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&o.jsx("div",{className:Na.empty,children:"No environments yet."})]})}function Ym(t){const s=new Date(t),i=new Date,r=i.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()===i.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Lb={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 rd(t){return Lb[t]||Lb.general}const SI="_nav_dlm8m_1",TI="_categoryPills_dlm8m_24",wI="_categoryPill_dlm8m_24",jI="_tab_dlm8m_42",NI="_tabActive_dlm8m_80",CI="_tabContent_dlm8m_93",EI="_tabLabel_dlm8m_100",AI="_tabMeta_dlm8m_106",DI="_categoryDot_dlm8m_111",RI="_empty_dlm8m_118",gs={nav:SI,categoryPills:TI,categoryPill:wI,tab:jI,tabActive:NI,tabContent:CI,tabLabel:EI,tabMeta:AI,categoryDot:DI,empty:RI};function MI({findings:t,workspaceId:s,environmentId:i}){const r=xt(),c=y.useRef(null),d=Nt("/findings/:findingId"),u=Nt("/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 _=new Set(t.map(S=>S.category).filter(Boolean));return Array.from(_).sort()},[t]),g=y.useCallback(_=>{r(Ep(_,s,i))},[r,s,i]),v=y.useCallback(_=>{var T;const S=(T=c.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!S||S.length===0)return;const k=Array.from(S).findIndex(C=>C===document.activeElement),w=k>=0?k:t.findIndex(C=>C.id===p);let N=w;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),N=(w+1)%S.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),N=(w-1+S.length)%S.length;else if(_.key==="Home")_.preventDefault(),N=0;else if(_.key==="End")_.preventDefault(),N=S.length-1;else return;N<t.length&&r(Ep(t[N].id,s,i)),S[N].focus()},[p,t,r,s,i]),b=p??(t.length>0?t[0].id:void 0);return o.jsxs("div",{className:gs.nav,"data-testid":"findings-nav",children:[m.length>1&&o.jsx("div",{className:gs.categoryPills,"data-testid":"findings-nav-categories",children:m.map(_=>o.jsx("span",{className:gs.categoryPill,style:{color:rd(_).text},children:_},_))}),o.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(_=>{const S=_.id===p,k=_.id===b;return o.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:k?0:-1,className:`${gs.tab} ${S?gs.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"finding-nav-item",children:[o.jsx("span",{className:gs.categoryDot,style:{color:rd(_.category).text},"aria-hidden":"true",children:o.jsx(Ia,{size:nm,fill:"currentColor"})}),o.jsxs("span",{className:gs.tabContent,children:[o.jsx("span",{className:gs.tabLabel,title:_.title,children:_.title}),o.jsx("span",{className:gs.tabMeta,title:_.createdAt,children:Ym(_.createdAt)})]})]},_.id)})}),t.length===0&&o.jsx("div",{className:gs.empty,children:"No findings yet. Agents will post discoveries here."})]})}function II(t){if(t.length===0)return[];const s=[...t].sort((r,c)=>r[0]-c[0]),i=[[s[0][0],s[0][1]]];for(let r=1;r<s.length;r++){const c=i[i.length-1],[d,u]=s[r];d<=c[1]+1?c[1]=Math.max(c[1],u):i.push([d,u])}return i}function g1({text:t,indices:s,highlightClass:i}){if(!s||s.length===0)return o.jsx(o.Fragment,{children:t});const r=II(s),c=[];let d=0;for(const[u,p]of r)u>d&&c.push(o.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(o.jsx("mark",{className:i,children:t.slice(u,p+1)},`m${u}`)),d=p+1;return d<t.length&&c.push(o.jsx("span",{children:t.slice(d)},`p${d}`)),o.jsx(o.Fragment,{children:c})}function OI(t){const s=new Map(t.map(r=>[r.id,{...r,children:[]}])),i=[];for(const r of s.values())r.parentTaskId&&s.has(r.parentTaskId)?s.get(r.parentTaskId).children.push(r):i.push(r);for(const r of s.values())r.children.sort((c,d)=>c.sortOrder-d.sortOrder);return i.sort((r,c)=>r.sortOrder-c.sortOrder)}function LI(t,s){const i=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=i.get(p);m?m.push(d):i.set(p,[d])}const r=[],c=new Set;for(const d of X2){c.add(d);const u=i.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Oa(d);r.push({status:d,label:p.label,style:p,tasks:u})}}for(const[d,u]of i)if(!c.has(d)&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Oa(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const BI="_container_z4i38_1",zI="_header_z4i38_5",UI="_headerActions_z4i38_17",$I="_searchInput_z4i38_23",PI="_searchHighlight_z4i38_56",HI="_groupToggle_z4i38_62",VI="_groupToggleActive_z4i38_89",qI="_addButton_z4i38_93",GI="_taskRow_z4i38_120",FI="_selected_z4i38_140",ZI="_expandArrow_z4i38_150",KI="_expanded_z4i38_157",YI="_leafSpacer_z4i38_161",JI="_taskStatusIcon_z4i38_166",WI="_taskTitle_z4i38_170",XI="_workspaceBadge_z4i38_177",QI="_childCountBadge_z4i38_195",e5="_dependencyBadge_z4i38_208",t5="_blockedBadge_z4i38_220",n5="_addChildButton_z4i38_225",s5="_emptyState_z4i38_268",a5="_statusGroupHeader_z4i38_275",i5="_statusGroupIcon_z4i38_294",o5="_statusGroupLabel_z4i38_298",r5="_statusGroupCount_z4i38_303",qe={container:BI,header:zI,headerActions:UI,searchInput:$I,searchHighlight:PI,groupToggle:HI,groupToggleActive:VI,addButton:qI,taskRow:GI,selected:FI,expandArrow:ZI,expanded:KI,leafSpacer:YI,taskStatusIcon:JI,taskTitle:WI,workspaceBadge:XI,childCountBadge:QI,dependencyBadge:e5,blockedBadge:t5,addChildButton:n5,emptyState:s5,statusGroupHeader:a5,statusGroupIcon:i5,statusGroupLabel:o5,statusGroupCount:r5},l5=[{name:"title",weight:2},{name:"description",weight:1}],v1=16,c5=16,y1="grackle-task-group-by-status";function Bb(){try{return localStorage.getItem(y1)==="true"}catch{return!1}}function d5(t){try{localStorage.setItem(y1,String(t))}catch{}}function u5({group:t,isExpanded:s,onToggle:i,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return o.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[o.jsxs("div",{className:qe.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:i,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i())},children:[o.jsx("span",{className:`${qe.expandArrow} ${s?qe.expanded:""}`,"aria-hidden":"true",children:o.jsx(ta,{size:at})}),o.jsx("span",{className:qe.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),o.jsx("span",{className:qe.statusGroupLabel,children:t.label}),o.jsx("span",{className:qe.statusGroupCount,children:t.tasks.length})]}),o.jsx(cs,{children:s&&o.jsx(Et.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=Oa(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return o.jsxs("div",{onClick:()=>c(Dn(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(Dn(p.id)))},className:`${qe.taskRow} ${g?qe.selected:""}`,style:{"--task-indent":`${v1}px`},"data-task-id":p.id,children:[o.jsx("span",{className:qe.leafSpacer}),o.jsx("span",{className:qe.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${tl(p.status)}`,children:m.icon}),o.jsx("span",{className:qe.taskTitle,title:p.title,children:o.jsx(g1,{text:p.title,indices:d.get(p.id),highlightClass:qe.searchHighlight})}),v&&o.jsx("span",{className:qe.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function b1({node:t,depth:s,expandedTasks:i,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=Oa(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(T=>u.get(T)!=="complete"),b=i.has(t.id),_=t.children.length>0,S=c===t.id,k=v1+s*c5,N=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{onClick:()=>d(Dn(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:T=>{T.currentTarget===T.target&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),d(Dn(t.id)))},className:`${qe.taskRow} ${S?qe.selected:""}`,style:{"--task-indent":`${k}px`},"data-task-id":t.id,children:[_&&o.jsx("span",{className:`${qe.expandArrow} ${b?qe.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"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:o.jsx(ta,{size:at,"aria-hidden":"true"})}),!_&&o.jsx("span",{className:qe.leafSpacer}),o.jsx("span",{className:qe.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${tl(t.status)}`,children:g.icon}),o.jsx("span",{className:qe.taskTitle,title:t.title,children:o.jsx(g1,{text:t.title,indices:p.get(t.id),highlightClass:qe.searchHighlight})}),N&&o.jsx("span",{className:qe.workspaceBadge,title:N,children:N}),_&&o.jsxs("span",{className:qe.childCountBadge,children:[t.children.filter(T=>T.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&o.jsx("span",{className:`${qe.dependencyBadge} ${v?qe.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<lT&&o.jsx(Ao,{text:"Add child task",children:o.jsx("button",{onClick:T=>{T.stopPropagation(),d(Ti(t.workspaceId,t.id))},"aria-label":"Add child task",className:qe.addChildButton,children:"+"})})]}),o.jsx(cs,{children:_&&b&&o.jsx(Et.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=>o.jsx(b1,{node:T,depth:s+1,expandedTasks:i,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},T.id))})})]})}function f5({workspaces:t,tasks:s}){const i=xt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,m]=y.useState(Bb),[g,v]=y.useState(Bb),[b,_]=y.useState(new Map),S=Nt("/tasks/:taskId/*"),k=(S==null?void 0:S.params.taskId)!=="new"?S==null?void 0:S.params.taskId:void 0,w=y.useMemo(()=>new Map(s.map(Y=>[Y.id,Y.status])),[s]),N=y.useMemo(()=>new Map(t.map(Y=>[Y.id,Y.name])),[t]),T=()=>{const Y=!p;d5(Y),m(Y),Y&&(v(!0),_(new Map))},C=Y=>{_(re=>{const D=new Map(re),Z=D.has(Y)?D.get(Y):g;return D.set(Y,!Z),D})},E=Y=>b.has(Y)?b.get(Y):g,B=Y=>{c(re=>{const D=new Set(re);return D.has(Y)?(D.delete(Y),u(Z=>new Set(Z).add(Y))):(D.add(Y),u(Z=>{const se=new Set(Z);return se.delete(Y),se})),D})};y.useEffect(()=>{const Y=new Set(s.filter(re=>re.parentTaskId).map(re=>re.parentTaskId));Y.size>0&&c(re=>{const D=new Set(re);for(const Z of Y)d.has(Z)||D.add(Z);return D})},[s,d]);const[A,I]=y.useState(""),{directMatchTaskIds:O,treeMatchTaskIds:U,titleHighlights:P}=y.useMemo(()=>{if(!A.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const Y=rT(s,A,l5),re=new Set(Y.map(ue=>ue.item.id)),D=new Map;for(const ue of Y){const de=ue.matches.find(Ge=>Ge.key==="title");de&&D.set(ue.item.id,de.indices)}const Z=new Set(re),se=new Map(s.map(ue=>[ue.id,ue]));for(const ue of[...re]){let de=se.get(ue);for(;de!=null&&de.parentTaskId;)Z.add(de.parentTaskId),de=se.get(de.parentTaskId)}return{directMatchTaskIds:re,treeMatchTaskIds:Z,titleHighlights:D}},[A,s]),W=O!==null,te=W?p?O:U:null,H=te?s.filter(Y=>te.has(Y.id)):s,ie=p?[]:OI(H);return o.jsxs("div",{className:qe.container,children:[o.jsxs("div",{className:qe.header,children:[o.jsx("span",{children:"Tasks"}),o.jsxs("div",{className:qe.headerActions,children:[o.jsx(Ao,{text:p?"Switch to tree view":"Group tasks by status",children:o.jsx("button",{className:`${qe.groupToggle} ${p?qe.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:o.jsx(j2,{size:Zt})})}),o.jsx(Ao,{text:"New task",children:o.jsx("button",{className:qe.addButton,onClick:()=>i(Ti()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&o.jsx("input",{type:"text",value:A,onChange:Y=>I(Y.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:qe.searchInput,"data-testid":"sidebar-search"}),p?LI(H,w).map(Y=>o.jsx(u5,{group:Y,isExpanded:E(Y.status),onToggle:()=>C(Y.status),selectedTaskId:k,navigate:i,titleHighlights:P,workspaceNames:N},Y.status)):ie.map(Y=>o.jsx(b1,{node:Y,depth:0,expandedTasks:r,toggleTask:B,selectedTaskId:k,navigate:i,taskStatusById:w,titleHighlights:P,workspaceNames:N},Y.id)),H.length===0&&!W&&o.jsx("div",{className:qe.emptyState,children:"No tasks yet. Click + to create one."}),H.length===0&&W&&o.jsx("div",{className:qe.emptyState,children:"No matching tasks"})]})}const p5="_toast_ed2dk_1",m5="_success_ed2dk_18",h5="_icon_ed2dk_22",g5="_error_ed2dk_25",v5="_warning_ed2dk_32",y5="_info_ed2dk_38",b5="_message_ed2dk_53",_5="_close_ed2dk_60",Dr={toast:p5,success:m5,icon:h5,error:g5,warning:v5,info:y5,message:b5,close:_5},x5={success:o.jsx(ki,{size:It}),error:o.jsx(za,{size:It}),warning:o.jsx(tm,{size:It}),info:o.jsx(em,{size:It})};function k5({toast:t,onDismiss:s}){return y.useEffect(()=>{const i=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(i)},[t.id,t.duration,s]),o.jsxs(Et.div,{className:`${Dr.toast} ${Dr[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:[o.jsx("span",{className:Dr.icon,"aria-hidden":"true",children:x5[t.variant]}),o.jsx("span",{className:Dr.message,children:t.message}),o.jsx("button",{type:"button",className:Dr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:o.jsx(za,{size:Zt,"aria-hidden":"true"})})]})}const S5="_container_qqse2_1",T5={container:S5};function w5({toasts:t,onDismiss:s}){return o.jsx("div",{className:T5.container,"data-testid":"toast-container",children:o.jsx(cs,{children:t.map(i=>o.jsx(k5,{toast:i,onDismiss:s},i.id))})})}const j5="_callout_e5awm_1",N5="_success_e5awm_11",C5="_icon_e5awm_15",E5="_error_e5awm_18",A5="_warning_e5awm_25",D5="_info_e5awm_32",R5="_content_e5awm_48",M5="_close_e5awm_53",Rr={callout:j5,success:N5,icon:C5,error:E5,warning:A5,info:D5,content:R5,close:M5},I5={success:o.jsx(ki,{size:It}),error:o.jsx(za,{size:It}),warning:o.jsx(tm,{size:It}),info:o.jsx(em,{size:It})};function O5({variant:t="info",children:s,dismissible:i=!1,className:r}){const[c,d]=y.useState(!1);return o.jsx(o.Fragment,{children:!c&&o.jsxs("div",{className:[Rr.callout,Rr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[o.jsx("span",{className:Rr.icon,"aria-hidden":"true",children:I5[t]}),o.jsx("span",{className:Rr.content,children:s}),i&&o.jsx("button",{type:"button",className:Rr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:o.jsx(za,{size:Zt,"aria-hidden":"true"})})]})})}function L5({currentVersion:t,latestVersion:s,updateAvailable:i,isDocker:r}){if(!i)return o.jsx(o.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return o.jsx("div",{"data-testid":"update-banner",children:o.jsxs(O5,{variant:"info",dismissible:!0,children:[o.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",o.jsx("code",{children:c})]})})}const B5="_container_de44x_1",z5="_emptyState_de44x_8",U5="_card_de44x_14",$5="_cardClickable_de44x_34",P5="_cardHeader_de44x_42",H5="_categoryBadge_de44x_54",V5="_findingTitle_de44x_62",q5="_findingDate_de44x_68",G5="_findingContent_de44x_80",F5="_tags_de44x_86",Z5="_tag_de44x_86",is={container:B5,emptyState:z5,card:U5,cardClickable:$5,cardHeader:P5,categoryBadge:H5,findingTitle:V5,findingDate:q5,findingContent:G5,tags:F5,tag:Z5};function _1({findings:t,onFindingClick:s}){return t.length===0?o.jsx("div",{className:is.emptyState,children:"No findings yet. Agents will post discoveries here."}):o.jsx("div",{className:is.container,children:t.map((i,r)=>{const c=rd(i.category),d=s?Et.button:Et.div;return o.jsxs(d,{type:s?"button":void 0,className:`${is.card} ${s?is.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},onClick:s?()=>{s(i.id)}:void 0,children:[o.jsxs("div",{className:is.cardHeader,children:[o.jsx("span",{className:is.categoryBadge,style:{background:c.bg,color:c.text},children:i.category}),o.jsx("span",{className:is.findingTitle,children:i.title}),o.jsx("span",{className:is.findingDate,title:i.createdAt,children:Ym(i.createdAt)})]}),o.jsx("div",{className:is.findingContent,children:i.content.length>300?i.content.slice(0,300)+"...":i.content}),i.tags.length>0&&o.jsx("div",{className:is.tags,children:i.tags.map(u=>o.jsx("span",{className:is.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:u},u))})]},i.id)})})}const K5="_section_1ingb_14",Y5="_sectionTitle_1ingb_26",J5="_sectionDescription_1ingb_35",W5="_tokenList_1ingb_48",X5="_tokenRow_1ingb_55",Q5="_tokenBadge_1ingb_68",eO="_tokenName_1ingb_83",tO="_tokenTarget_1ingb_90",nO="_deleteButton_1ingb_99",sO="_addForm_1ingb_113",aO="_formRow_1ingb_119",iO="_input_1ingb_125",oO="_select_1ingb_155",rO="_addButton_1ingb_187",lO="_emptyStateInfo_1ingb_221",cO="_themeOptions_1ingb_229",dO="_themeOption_1ingb_229",uO="_themeOptionSelected_1ingb_254",fO="_themeOptionHeader_1ingb_259",pO="_themeOptionLabel_1ingb_266",mO="_themeOptionDesc_1ingb_273",hO="_variantToggle_1ingb_279",gO="_variantButton_1ingb_286",vO="_variantActive_1ingb_305",yO="_themeSwatches_1ingb_311",bO="_themeSwatch_1ingb_311",_O="_systemToggle_1ingb_325",xO="_systemToggleHint_1ingb_341",kO="_themeActive_1ingb_348",SO="_aboutGrid_1ingb_354",TO="_aboutItem_1ingb_360",wO="_aboutLabel_1ingb_373",jO="_aboutValue_1ingb_379",NO="_aboutDot_1ingb_387",CO="_aboutDotConnected_1ingb_394",EO="_aboutDotDisconnected_1ingb_398",ge={section:K5,sectionTitle:Y5,sectionDescription:J5,tokenList:W5,tokenRow:X5,tokenBadge:Q5,tokenName:eO,tokenTarget:tO,deleteButton:nO,addForm:sO,formRow:aO,input:iO,select:oO,addButton:rO,emptyStateInfo:lO,themeOptions:cO,themeOption:dO,themeOptionSelected:uO,themeOptionHeader:fO,themeOptionLabel:pO,themeOptionDesc:mO,variantToggle:hO,variantButton:gO,variantActive:vO,themeSwatches:yO,themeSwatch:bO,systemToggle:_O,systemToggleHint:xO,themeActive:kO,aboutGrid:SO,aboutItem:TO,aboutLabel:wO,aboutValue:jO,aboutDot:NO,aboutDotConnected:CO,aboutDotDisconnected:EO},AO=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function DO({tokens:t,onSetToken:s,onDeleteToken:i,onShowToast:r}){const[c,d]=y.useState(""),[u,p]=y.useState(""),[m,g]=y.useState("env_var"),[v,b]=y.useState(""),[_,S]=y.useState(null),k=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(""),b("")},w=T=>{S(T)},N=()=>{_&&(i(_),r==null||r("Token deleted","info")),S(null)};return o.jsxs(o.Fragment,{children:[o.jsx(xi,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>S(null)}),o.jsxs("section",{className:ge.section,children:[o.jsx("h3",{className:ge.sectionTitle,children:"Tokens"}),o.jsx("p",{className:ge.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?o.jsx("div",{className:ge.emptyStateInfo,children:"Add your first API token to enable service integrations."}):o.jsx("div",{className:ge.tokenList,children:t.map(T=>o.jsxs("div",{className:ge.tokenRow,children:[o.jsx("span",{className:ge.tokenBadge,children:T.tokenType}),o.jsx("span",{className:ge.tokenName,children:T.name}),o.jsx("span",{className:ge.tokenTarget,children:T.tokenType==="env_var"?T.envVar:T.filePath}),o.jsx("button",{className:ge.deleteButton,onClick:()=>w(T.name),title:`Delete ${T.name}`,"aria-label":`Delete ${T.name}`,children:o.jsx(za,{size:Zt,"aria-hidden":"true"})})]},T.name))}),o.jsxs("form",{className:ge.addForm,onSubmit:k,children:[o.jsxs("div",{className:ge.formRow,children:[o.jsx("input",{className:ge.input,type:"text",placeholder:"Token name",value:c,onChange:T=>d(T.target.value)}),o.jsx("input",{className:ge.input,type:"password",placeholder:"Value",value:u,onChange:T=>p(T.target.value)})]}),o.jsxs("div",{className:ge.formRow,children:[o.jsx("select",{className:ge.select,value:m,onChange:T=>g(T.target.value),children:AO.map(T=>o.jsx("option",{value:T.value,children:T.label},T.value))}),o.jsx("input",{className:ge.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=>b(T.target.value)}),o.jsx("button",{className:ge.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const Sd=[{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"]}],x1=new Set(Sd.map(t=>t.id)),zb="grackle";function Yp(t){return Sd.find(s=>s.id===t)}function RO({themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:r,onSetPreferSystem:c}){return o.jsxs("section",{className:ge.section,children:[o.jsx("h3",{className:ge.sectionTitle,children:"Appearance"}),o.jsx("p",{className:ge.sectionDescription,children:"Choose how Grackle looks across the app."}),o.jsx("div",{className:ge.themeOptions,children:Sd.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 o.jsxs("button",{type:"button",className:`${ge.themeOption} ${p?ge.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>i(d.id),children:[o.jsxs("span",{className:ge.themeOptionHeader,children:[o.jsxs("span",{children:[o.jsx("span",{className:ge.themeOptionLabel,children:d.label}),o.jsx("span",{className:ge.themeOptionDesc,children:d.description})]}),u&&o.jsxs("span",{className:ge.variantToggle,children:[o.jsx("span",{role:"button",tabIndex:0,className:`${ge.variantButton} ${p&&m?ge.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(d.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(d.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&m,children:"☼"}),o.jsx("span",{role:"button",tabIndex:0,className:`${ge.variantButton} ${p&&!m?ge.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(d.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(d.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!m,children:"☾"})]})]}),d.swatches&&o.jsx("span",{className:ge.themeSwatches,children:d.swatches.map((g,v)=>o.jsx("span",{className:ge.themeSwatch,style:{background:g}},v))})]},d.id)})}),o.jsxs("label",{className:ge.systemToggle,children:[o.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),o.jsx("span",{children:"Match system light/dark preference"})]}),o.jsx("p",{className:ge.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),o.jsxs("p",{className:ge.themeActive,children:["Active theme: ",o.jsx("strong",{children:s})]})]})}function MO({connected:t,environments:s,sessions:i}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=i.filter(u=>["running","idle"].includes(u.status)).length;return o.jsxs("section",{className:ge.section,"data-testid":"about-panel",children:[o.jsx("h3",{className:ge.sectionTitle,children:"About"}),o.jsx("p",{className:ge.sectionDescription,children:"Connection status and application information."}),o.jsxs("div",{className:ge.aboutGrid,children:[o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Connection"}),o.jsxs("span",{className:ge.aboutValue,children:[o.jsx("span",{className:`${ge.aboutDot} ${t?ge.aboutDotConnected:ge.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Environments"}),o.jsxs("span",{className:ge.aboutValue,children:[r,"/",c," connected"]})]}),o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Active Sessions"}),o.jsx("span",{className:ge.aboutValue,children:d})]}),o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Version"}),o.jsx("span",{className:ge.aboutValue,children:"0.91.2"})]})]})]})}const IO="_container_cddyd_1",OO="_header_cddyd_8",LO="_headerTitle_cddyd_35",BO="_badge_cddyd_44",zO="_headerActions_cddyd_54",UO="_body_cddyd_61",$O="_formContent_cddyd_73",PO="_section_cddyd_85",HO="_label_cddyd_91",VO="_titleInput_cddyd_98",qO="_descriptionTextarea_cddyd_131",GO="_parentContext_cddyd_167",FO="_parentLabel_cddyd_175",ZO="_parentName_cddyd_182",KO="_personaSelect_cddyd_186",YO="_depList_cddyd_220",JO="_depItem_cddyd_226",WO="_depItemSelected_cddyd_248",XO="_noDeps_cddyd_252",QO="_btnPrimary_cddyd_258",eL="_btnGhost_cddyd_289",We={container:IO,header:OO,headerTitle:LO,badge:BO,headerActions:zO,body:UO,formContent:$O,section:PO,label:HO,titleInput:VO,descriptionTextarea:qO,parentContext:GO,parentLabel:FO,parentName:ZO,personaSelect:KO,depList:YO,depItem:JO,depItemSelected:WO,noDeps:XO,btnPrimary:QO,btnGhost:eL};function k1({mode:t,taskId:s,workspaceId:i,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:p,onCreateTask:m,onUpdateTask:g,onEditDone:v,onShowToast:b}){const _=xt(),S=t==="edit",k=S&&s?d.find(me=>me.id===s):void 0,w=S?(k==null?void 0:k.workspaceId)??"":i??"",[N,T]=y.useState(w),C=w||N,E=u.find(me=>me.id===C),B=c??(E==null?void 0:E.environmentId),A=!S&&!i,I=S?(k==null?void 0:k.parentTaskId)??"":r??"",O=I?d.find(me=>me.id===I):void 0,[U,P]=y.useState((k==null?void 0:k.title)??""),[W,te]=y.useState((k==null?void 0:k.description)??""),[H,ie]=y.useState((k==null?void 0:k.dependsOn)??[]),[Y,re]=y.useState((k==null?void 0:k.defaultPersonaId)??""),[D,Z]=y.useState((k==null?void 0:k.canDecompose)??!1),[se,ue]=y.useState(!1),de=y.useRef(!1);y.useEffect(()=>{S&&k&&!de.current&&(de.current=!0,P(k.title),te(k.description),ie(k.dependsOn),re(k.defaultPersonaId),Z(k.canDecompose))},[S,k]);const Ge=d.filter(me=>me.workspaceId===C&&(!S||me.id!==s)&&me.id!==I),De=U.trim().length>0&&(!S||k!==void 0)&&C.length>0,Ne=me=>{ie(Ue=>Ue.includes(me)?Ue.filter(pt=>pt!==me):[...Ue,me])},Oe=()=>{!De||se||S&&k===void 0||(S&&s?(g(s,U.trim(),W,H,Y),b==null||b("Task updated","success"),v?v():_(Dn(s,void 0,C,B),{replace:!0})):(ue(!0),m(C,U.trim(),W,H.length>0?H:void 0,I||void 0,Y,D,()=>{b==null||b("Task created","success"),_(i?yi(i,B):"/tasks",{replace:!0})},me=>{b==null||b(me,"error"),ue(!1)})))},fe=()=>{if(v){v();return}_(S&&s?Dn(s,void 0,C,B):i?yi(i,B):"/tasks")},ye=S?"edit task":I?"child task":"new task";return o.jsxs("div",{className:We.container,children:[o.jsxs("div",{className:We.header,children:[o.jsxs("div",{className:We.headerTitle,children:[o.jsx("span",{className:We.badge,children:ye}),O&&o.jsxs("span",{className:We.parentContext,children:[o.jsx("span",{className:We.parentLabel,children:"Child of"}),o.jsx("span",{className:We.parentName,children:O.title})]})]}),o.jsxs("div",{className:We.headerActions,children:[o.jsx("button",{onClick:Oe,disabled:!De||se,className:We.btnPrimary,"data-testid":"task-edit-save",children:se?"Creating…":S?"Save Changes":"Create"}),o.jsx("button",{onClick:fe,className:We.btnGhost,children:"Cancel"})]})]}),o.jsx("div",{className:We.body,children:o.jsxs("div",{className:We.formContent,children:[A&&o.jsxs("div",{className:We.section,children:[o.jsx("label",{className:We.label,htmlFor:"task-edit-workspace",children:"Workspace"}),o.jsxs("select",{id:"task-edit-workspace",value:N,onChange:me=>T(me.target.value),className:We.personaSelect,"data-testid":"task-edit-workspace",children:[o.jsx("option",{value:"",children:"Select a workspace..."}),u.map(me=>o.jsx("option",{value:me.id,children:me.name},me.id))]})]}),o.jsxs("div",{className:We.section,children:[o.jsx("label",{className:We.label,htmlFor:"task-edit-title",children:"Title"}),o.jsx("input",{id:"task-edit-title",type:"text",value:U,onChange:me=>P(me.target.value),placeholder:"Task title...",autoFocus:!0,className:We.titleInput,"data-testid":"task-edit-title",onKeyDown:me=>{me.key==="Enter"&&De&&Oe()}})]}),o.jsxs("div",{className:We.section,children:[o.jsx("label",{className:We.label,htmlFor:"task-edit-description",children:"Description"}),o.jsx("textarea",{id:"task-edit-description",value:W,onChange:me=>te(me.target.value),placeholder:"Describe the task... (markdown supported)",className:We.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),o.jsxs("div",{className:We.section,children:[o.jsx("label",{className:We.label,htmlFor:"task-edit-persona",children:"Default Persona"}),o.jsxs("select",{id:"task-edit-persona",value:Y,onChange:me=>re(me.target.value),className:We.personaSelect,"data-testid":"task-edit-persona",children:[o.jsx("option",{value:"",children:"(Inherit)"}),p.map(me=>o.jsx("option",{value:me.id,children:me.name},me.id))]})]}),!S&&o.jsx("div",{className:We.section,children:o.jsxs("label",{className:We.depItem,"data-testid":"task-edit-can-decompose",children:[o.jsx("input",{type:"checkbox",checked:D,onChange:me=>Z(me.target.checked)}),"Can spawn subtasks"]})}),o.jsxs("div",{className:We.section,children:[o.jsx("div",{className:We.label,children:"Dependencies"}),Ge.length===0?o.jsx("div",{className:We.noDeps,children:"No other tasks in this workspace"}):o.jsx("div",{className:We.depList,children:Ge.map(me=>{const Ue=H.includes(me.id);return o.jsxs("label",{className:`${We.depItem} ${Ue?We.depItemSelected:""}`,"data-testid":`dep-option-${me.id}`,children:[o.jsx("input",{type:"checkbox",checked:Ue,onChange:()=>Ne(me.id)}),me.title,o.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",me.status,")"]})]},me.id)})})]})]})})]})}const tL="_container_legrg_1",nL="_header_legrg_8",sL="_headerTitle_legrg_35",aL="_badge_legrg_44",iL="_headerActions_legrg_54",oL="_body_legrg_61",rL="_formContent_legrg_73",lL="_section_legrg_85",cL="_label_legrg_91",dL="_nameInput_legrg_98",uL="_fieldInput_legrg_131",fL="_adapterSelect_legrg_164",pL="_readOnlyValue_legrg_198",mL="_codespaceSection_legrg_204",hL="_codespaceActions_legrg_210",gL="_creatingHint_legrg_216",vL="_errorHint_legrg_222",yL="_btnPrimary_legrg_235",bL="_btnGhost_legrg_266",oe={container:tL,header:nL,headerTitle:sL,badge:aL,headerActions:iL,body:oL,formContent:rL,section:lL,label:cL,nameInput:dL,fieldInput:uL,adapterSelect:fL,readOnlyValue:pL,codespaceSection:mL,codespaceActions:hL,creatingHint:gL,errorHint:vL,btnPrimary:yL,btnGhost:bL},Fc=1,Zc=65535;function mp(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=Fc&&s<=Zc}function hp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function _L({codespaceName:t,onCodespaceNameChange:s,envName:i,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:m}){const[g,v]=y.useState("pick"),[b,_]=y.useState(""),[S,k]=y.useState("");return g==="create"?o.jsxs("div",{className:oe.codespaceSection,children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Repository"}),o.jsx("input",{type:"text",value:b,onChange:w=>_(w.target.value),placeholder:"owner/repo",className:oe.fieldInput,"data-testid":"env-codespace-repo"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Machine Type"}),o.jsx("input",{type:"text",value:S,onChange:w=>k(w.target.value),placeholder:"Machine type (optional)...",className:oe.fieldInput,"data-testid":"env-codespace-machine"})]}),o.jsxs("div",{className:oe.codespaceActions,children:[o.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),S.trim()||void 0),v("pick"),_(""),k(""))},disabled:!b.trim(),className:oe.btnPrimary,children:"Create"}),o.jsx("button",{onClick:()=>{v("pick"),_(""),k("")},className:oe.btnGhost,children:"Cancel"})]})]}):o.jsx("div",{className:oe.codespaceSection,children:o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Codespace"}),!u&&o.jsxs("select",{value:t,onChange:w=>{w.target.value==="__create__"?(v("create"),s("")):(s(w.target.value),w.target.value&&!i.trim()&&r(w.target.value))},disabled:p,className:oe.adapterSelect,"data-testid":"env-codespace-select",children:[o.jsx("option",{value:"",children:"Select a codespace..."}),c.map(w=>o.jsxs("option",{value:w.name,children:[w.name," (",w.repository,") — ",w.state]},w.name)),o.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&o.jsx("span",{className:oe.creatingHint,children:"Creating codespace..."}),u&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:oe.errorHint,children:u}),o.jsx("input",{type:"text",value:t,onChange:w=>s(w.target.value),placeholder:"Or enter codespace name manually...",className:oe.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&o.jsx("span",{className:oe.errorHint,children:d})]})})}function S1({mode:t,environmentId:s,environments:i,onAddEnvironment:r,onUpdateEnvironment:c,onListCodespaces:d,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v,onShowToast:b}){const _=xt(),S=t==="edit",k=S&&s?i.find(fe=>fe.id===s):void 0,[w,N]=y.useState(""),[T,C]=y.useState("local"),[E,B]=y.useState(""),[A,I]=y.useState(""),[O,U]=y.useState(""),[P,W]=y.useState(""),[te,H]=y.useState(""),[ie,Y]=y.useState(""),[re,D]=y.useState(""),[Z,se]=y.useState(null),ue=y.useCallback(()=>{const fe={};if(T==="local"){if(E.trim()&&(fe.host=E.trim()),A.trim()){const ye=Number(A);Number.isInteger(ye)&&(fe.port=ye)}}else if(T==="ssh"){if(fe.host=E.trim(),O.trim()&&(fe.user=O.trim()),A.trim()){const ye=Number(A);Number.isInteger(ye)&&(fe.sshPort=ye)}P.trim()&&(fe.identityFile=P.trim())}else T==="docker"?(te.trim()&&(fe.image=te.trim()),ie.trim()&&(fe.repo=ie.trim())):T==="codespace"&&(fe.codespaceName=re.trim());return fe},[T,E,A,O,P,te,ie,re]),de=()=>!(!w.trim()||T==="ssh"&&!E.trim()||T==="codespace"&&!re.trim()||(T==="local"||T==="ssh")&&!mp(A)),Ge=()=>{de()&&(r(w.trim(),T,ue()),b==null||b("Environment added successfully","success"),_(wo,{replace:!0}))},De=()=>{_(s?bi(s):wo)},Ne=y.useCallback((fe,ye)=>{if(!k||!s)return;const me=hp(k.adapterConfig),Ue=ye.trim();Ue?me[fe]=Ue:delete me[fe],c(s,{adapterConfig:me})},[k,s,c]),Oe=y.useCallback((fe,ye)=>{if(!k||!s)return;const me=hp(k.adapterConfig);if(ye.trim()){const Ue=Number(ye);Number.isInteger(Ue)&&Ue>=Fc&&Ue<=Zc&&(me[fe]=Ue)}else delete me[fe];c(s,{adapterConfig:me})},[k,s,c]);if(S){if(!k)return o.jsxs("div",{className:oe.container,children:[o.jsxs("div",{className:oe.header,children:[o.jsx("div",{className:oe.headerTitle,children:o.jsx("span",{className:oe.badge,children:"edit environment"})}),o.jsx("div",{className:oe.headerActions,children:o.jsx("button",{onClick:De,className:oe.btnGhost,children:"Back"})})]}),o.jsx("div",{className:oe.body,children:o.jsx("div",{className:oe.formContent,children:o.jsx("span",{className:oe.readOnlyValue,children:"Environment not found"})})})]});const fe=hp(k.adapterConfig);return o.jsxs("div",{className:oe.container,"data-testid":"env-edit-panel",children:[o.jsxs("div",{className:oe.header,children:[o.jsx("div",{className:oe.headerTitle,children:o.jsx("span",{className:oe.badge,children:"edit environment"})}),o.jsx("div",{className:oe.headerActions,children:o.jsx("button",{onClick:De,className:oe.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),o.jsx("div",{className:oe.body,children:o.jsxs("div",{className:oe.formContent,children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Name"}),o.jsx(en,{value:k.displayName,onSave:ye=>{s&&c(s,{displayName:ye})},validate:ye=>ye.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:Z,onActivate:se,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Adapter Type"}),o.jsx("span",{className:oe.readOnlyValue,"data-testid":"env-edit-adapter-type",children:k.adapterType})]}),k.adapterType==="local"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Host"}),o.jsx(en,{value:String(fe.host??""),onSave:ye=>Ne("host",ye),mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:se,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Port"}),o.jsx(en,{value:String(fe.port??""),onSave:ye=>Oe("port",ye),validate:ye=>mp(ye)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:Z,onActivate:se,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),k.adapterType==="ssh"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Host"}),o.jsx(en,{value:String(fe.host??""),onSave:ye=>Ne("host",ye),validate:ye=>ye.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:se,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"User"}),o.jsx(en,{value:String(fe.user??""),onSave:ye=>Ne("user",ye),mode:"edit",fieldId:"user",activeFieldId:Z,onActivate:se,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"SSH Port"}),o.jsx(en,{value:String(fe.sshPort??""),onSave:ye=>Oe("sshPort",ye),validate:ye=>mp(ye)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:Z,onActivate:se,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Identity File"}),o.jsx(en,{value:String(fe.identityFile??""),onSave:ye=>Ne("identityFile",ye),mode:"edit",fieldId:"identityFile",activeFieldId:Z,onActivate:se,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),k.adapterType==="docker"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Image"}),o.jsx(en,{value:String(fe.image??""),onSave:ye=>Ne("image",ye),mode:"edit",fieldId:"image",activeFieldId:Z,onActivate:se,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Repo"}),o.jsx(en,{value:String(fe.repo??""),onSave:ye=>Ne("repo",ye),mode:"edit",fieldId:"repo",activeFieldId:Z,onActivate:se,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),k.adapterType==="codespace"&&o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Codespace Name"}),o.jsx(en,{value:String(fe.codespaceName??""),onSave:ye=>Ne("codespaceName",ye),validate:ye=>ye.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:Z,onActivate:se,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return o.jsxs("div",{className:oe.container,"data-testid":"env-create-panel",children:[o.jsxs("div",{className:oe.header,children:[o.jsx("div",{className:oe.headerTitle,children:o.jsx("span",{className:oe.badge,children:"new environment"})}),o.jsxs("div",{className:oe.headerActions,children:[o.jsx("button",{onClick:Ge,disabled:!de(),className:oe.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),o.jsx("button",{onClick:De,className:oe.btnGhost,children:"Cancel"})]})]}),o.jsx("div",{className:oe.body,children:o.jsxs("div",{className:oe.formContent,children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-name",children:"Name"}),o.jsx("input",{id:"env-create-name",type:"text",value:w,onChange:fe=>N(fe.target.value),placeholder:"Environment name...",autoFocus:!0,className:oe.nameInput,"data-testid":"env-create-name",onKeyDown:fe=>{fe.key==="Enter"&&de()&&Ge()}})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),o.jsxs("select",{id:"env-create-adapter",value:T,onChange:fe=>{C(fe.target.value),fe.target.value==="codespace"&&d()},className:oe.adapterSelect,"data-testid":"env-create-adapter",children:[o.jsx("option",{value:"local",children:"local"}),o.jsx("option",{value:"ssh",children:"ssh"}),o.jsx("option",{value:"docker",children:"docker"}),o.jsx("option",{value:"codespace",children:"codespace"})]})]}),T==="local"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),o.jsx("input",{id:"env-create-host",type:"text",value:E,onChange:fe=>B(fe.target.value),placeholder:"Host (optional)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"Port"}),o.jsx("input",{id:"env-create-port",type:"number",min:Fc,max:Zc,value:A,onChange:fe=>I(fe.target.value),placeholder:"Port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]})]}),T==="ssh"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),o.jsx("input",{id:"env-create-host",type:"text",value:E,onChange:fe=>B(fe.target.value),placeholder:"Host (required)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-user",children:"User"}),o.jsx("input",{id:"env-create-user",type:"text",value:O,onChange:fe=>U(fe.target.value),placeholder:"User (optional)...",className:oe.fieldInput,"data-testid":"env-create-user"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"SSH Port"}),o.jsx("input",{id:"env-create-port",type:"number",min:Fc,max:Zc,value:A,onChange:fe=>I(fe.target.value),placeholder:"SSH port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-identity",children:"Identity File"}),o.jsx("input",{id:"env-create-identity",type:"text",value:P,onChange:fe=>W(fe.target.value),placeholder:"Identity file (optional)...",className:oe.fieldInput,"data-testid":"env-create-identity"})]})]}),T==="docker"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-image",children:"Image"}),o.jsx("input",{id:"env-create-image",type:"text",value:te,onChange:fe=>H(fe.target.value),placeholder:"Image (optional)...",className:oe.fieldInput,"data-testid":"env-create-image"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-repo",children:"Repo"}),o.jsx("input",{id:"env-create-repo",type:"text",value:ie,onChange:fe=>Y(fe.target.value),placeholder:"Repo (optional)...",className:oe.fieldInput,"data-testid":"env-create-repo"})]})]}),T==="codespace"&&o.jsx(_L,{codespaceName:re,onCodespaceNameChange:D,envName:w,onEnvNameChange:N,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v})]})})]})}const xL="_group_1iprv_1",kL="_groupTitle_1iprv_8",SL="_shortcutList_1iprv_17",TL="_shortcutRow_1iprv_23",wL="_keys_1iprv_36",jL="_kbd_1iprv_43",NL="_description_1iprv_60",pi={group:xL,groupTitle:kL,shortcutList:SL,shortcutRow:TL,keys:wL,kbd:jL,description:NL},CL=[{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 EL(){return o.jsxs("section",{className:ge.section,"data-testid":"keyboard-shortcuts-panel",children:[o.jsx("h3",{className:ge.sectionTitle,children:"Keyboard Shortcuts"}),o.jsx("p",{className:ge.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),CL.map(t=>o.jsxs("div",{className:pi.group,children:[o.jsx("h4",{className:pi.groupTitle,children:t.title}),o.jsx("div",{className:pi.shortcutList,children:t.shortcuts.map(s=>o.jsxs("div",{className:pi.shortcutRow,children:[o.jsx("span",{className:pi.keys,children:s.keys.map(i=>o.jsx("kbd",{className:pi.kbd,children:i},i))}),o.jsx("span",{className:pi.description,children:s.description})]},s.description))})]},t.title))]})}const AL="_workpadSection_y8nj9_1",DL="_workpadLabel_y8nj9_9",RL="_workpadStatus_y8nj9_17",ML="_workpadSummary_y8nj9_23",IL="_workpadExtra_y8nj9_29",Ca={workpadSection:AL,workpadLabel:DL,workpadStatus:RL,workpadSummary:ML,workpadExtra:IL};function OL({workpad:t}){if(!t)return;let s;try{const i=JSON.parse(t);if(i==null||typeof i!="object"||Array.isArray(i))return;s=i}catch{return o.jsxs("div",{className:Ca.workpadSection,"data-testid":"workpad-panel",children:[o.jsx("div",{className:Ca.workpadLabel,children:"Workpad"}),o.jsx("div",{className:Ca.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return o.jsxs("div",{className:Ca.workpadSection,"data-testid":"workpad-panel",children:[o.jsx("div",{className:Ca.workpadLabel,children:"Workpad"}),s.status&&o.jsx("div",{className:Ca.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&o.jsx("div",{className:Ca.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&o.jsx("div",{className:Ca.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const LL=[{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 BL({credentialProviders:t,onUpdateCredentialProviders:s}){const i=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return o.jsxs("section",{className:ge.section,children:[o.jsx("h3",{className:ge.sectionTitle,children:"Credential Providers"}),o.jsx("p",{className:ge.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),o.jsx("div",{className:ge.tokenList,children:LL.map(r=>o.jsxs("div",{className:ge.tokenRow,children:[o.jsx("span",{className:ge.tokenName,children:r.label}),o.jsx("span",{className:ge.tokenTarget,children:r.description}),o.jsx("select",{className:ge.select,value:t[r.key],onChange:c=>i(r.key,c.target.value),children:r.options.map(c=>o.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const zL="_container_10efq_1",UL="_header_10efq_7",$L="_list_10efq_105",PL="_card_10efq_111",HL="_cardHeader_10efq_125",VL="_cardTitle_10efq_135",qL="_defaultBadge_10efq_141",GL="_cardActions_10efq_155",FL="_description_10efq_160",ZL="_meta_10efq_166",KL="_empty_10efq_212",YL="_typeBadge_10efq_362",Zn={container:zL,header:UL,list:$L,card:PL,cardHeader:HL,cardTitle:VL,defaultBadge:qL,cardActions:GL,description:FL,meta:ZL,empty:KL,typeBadge:YL};function JL({personas:t,appDefaultPersonaId:s,onDeletePersona:i,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 i(v),p(null)};return o.jsxs("div",{className:Zn.container,children:[o.jsxs("div",{className:Zn.header,children:[o.jsx("h2",{children:"Personas"}),o.jsx(Ks,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?o.jsx("p",{className:Zn.empty,children:"No personas yet. Create one to get started."}):o.jsx("div",{className:Zn.list,children:t.map(v=>{const b=s===v.id,_=v.type==="script";return o.jsxs("div",{className:Zn.card,"data-testid":`persona-card-${v.id}`,onClick:()=>d(v.id),role:"button",tabIndex:0,onKeyDown:S=>{S.currentTarget===S.target&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),d(v.id))},children:[o.jsxs("div",{className:Zn.cardHeader,children:[o.jsxs("span",{className:Zn.cardTitle,children:[o.jsx("strong",{children:v.name}),o.jsx("span",{className:Zn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&o.jsx("span",{className:Zn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),o.jsxs("div",{className:Zn.cardActions,onClick:S=>S.stopPropagation(),children:[!b&&o.jsx(Ks,{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"}),o.jsx(Ks,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),o.jsx(Ks,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&o.jsx("p",{className:Zn.description,children:v.description}),o.jsxs("div",{className:Zn.meta,children:[v.runtime&&o.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&o.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&o.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),o.jsx(xi,{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 WL="_container_uy08i_1",XL="_header_uy08i_7",QL="_count_uy08i_13",eB="_presets_uy08i_18",tB="_presetButton_uy08i_24",nB="_filterInput_uy08i_41",sB="_groups_uy08i_53",aB="_group_uy08i_53",iB="_groupHeader_uy08i_68",oB="_groupName_uy08i_77",rB="_groupCount_uy08i_81",lB="_toolList_uy08i_87",cB="_toolItem_uy08i_95",dB="_toolName_uy08i_103",cn={container:WL,header:XL,count:QL,presets:eB,presetButton:tB,filterInput:nB,groups:sB,group:aB,groupHeader:iB,groupName:oB,groupCount:rB,toolList:lB,toolItem:cB,toolName:dB},uB=(()=>{const t=new Map;for(const s of s_){const i=s==="get_version_status"?"version":s.split("_")[0];t.has(i)||t.set(i,[]),t.get(i).push(s)}return[...t.entries()].sort(([s],[i])=>s.localeCompare(i)).map(([s,i])=>({group:s,tools:i.sort()}))})(),fB=[{name:"default",label:"Default",tools:a_},{name:"worker",label:"Worker",tools:cT},{name:"orchestrator",label:"Orchestrator",tools:dT},{name:"admin",label:"Admin",tools:uT}];function Ub({selectedTools:t,onChange:s,disabled:i}){const[r,c]=y.useState(""),d=y.useMemo(()=>new Set(t),[t]),u=y.useCallback(v=>{if(i)return;const b=new Set(d);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[d,s,i]),p=y.useCallback((v,b)=>{if(i)return;const _=new Set(d);for(const S of v)b?_.delete(S):_.add(S);s([..._].sort())},[d,s,i]),m=y.useCallback(v=>{i||s([...v].sort())},[s,i]),g=r.toLowerCase();return o.jsxs("div",{className:cn.container,"data-testid":"mcp-tool-selector",children:[o.jsx("div",{className:cn.header,children:o.jsx("span",{className:cn.count,children:t.length===0?`Using default (${a_.length} tools)`:`${t.length} of ${s_.size} tools selected`})}),o.jsxs("div",{className:cn.presets,"data-testid":"mcp-tool-presets",children:[fB.map(v=>o.jsx("button",{type:"button",className:cn.presetButton,disabled:i,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),o.jsx("button",{type:"button",className:cn.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),o.jsx("input",{type:"text",className:cn.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),o.jsx("div",{className:cn.groups,children:uB.map(({group:v,tools:b})=>{const _=g?b.filter(k=>k.toLowerCase().includes(g)):b;if(_.length===0)return null;const S=_.every(k=>d.has(k));return o.jsxs("div",{className:cn.group,"data-testid":`tool-group-${v}`,children:[o.jsxs("label",{className:cn.groupHeader,children:[o.jsx("input",{type:"checkbox",checked:S,onChange:()=>p(_,S),disabled:i,"data-testid":`group-toggle-${v}`}),o.jsx("span",{className:cn.groupName,children:v}),o.jsxs("span",{className:cn.groupCount,children:["(",_.filter(k=>d.has(k)).length,"/",_.length,")"]})]}),o.jsx("div",{className:cn.toolList,children:_.map(k=>o.jsxs("label",{className:cn.toolItem,children:[o.jsx("input",{type:"checkbox",checked:d.has(k),onChange:()=>u(k),disabled:i,"data-testid":`tool-${k}`}),o.jsx("span",{className:cn.toolName,children:k})]},k))})]},v)})})]})}const pB="_nav_1bhou_1",mB="_tab_1bhou_24",hB="_tabIcon_1bhou_62",gB="_tabActive_1bhou_68",Mc={nav:pB,tab:mB,tabIcon:hB,tabActive:gB},Fs=[{path:"credentials",label:"Credentials",icon:o.jsx(_2,{size:It})},{path:"personas",label:"Personas",icon:o.jsx(K2,{size:It})},{path:"appearance",label:"Appearance",icon:o.jsx(L2,{size:It})},{path:"shortcuts",label:"Shortcuts",icon:o.jsx(k2,{size:It})},{path:"about",label:"About",icon:o.jsx(em,{size:It})}];function vB(){var u;const t=Vt(),s=xt(),i=y.useRef(null),r=((u=Fs.find(p=>{const m=`${To}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??Fs[0].path,c=y.useCallback(p=>{s(`${To}/${p}`)},[s]),d=y.useCallback(p=>{var S,k;const m=(S=i.current)==null?void 0:S.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(w=>w===document.activeElement),v=g>=0?g:Fs.findIndex(w=>w.path===r);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%Fs.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+Fs.length)%Fs.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=Fs.length-1;else return;const _=Fs[b].path;s(`${To}/${_}`),(k=m[b])==null||k.focus()},[r,s]);return o.jsx("nav",{className:Mc.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:Fs.map(p=>{const m=p.path===r;return o.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Mc.tab} ${m?Mc.tabActive:""}`,onClick:()=>c(p.path),children:[o.jsx("span",{className:Mc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function yB({tasks:t,taskStatusById:s,sessionStatusByTaskId:i}){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(sy.map(d=>[d,[]]));for(const d of t){const u=tl(d.status),p=d.dependsOn.length>0&&d.dependsOn.some(k=>s.get(k)!=="complete"),m=r.get(d.id)??[],g=m.length,v=m.filter(k=>k.status==="complete").length;let b;if(u==="paused"&&i){const k=i.get(d.id);k==="idle"?b="Needs input":k==="completed"&&(b="Ready to complete")}const _={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:b},S=c.get(u);S?S.push(_):c.get("not_started").push(_)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return sy.map(d=>{const u=Oa(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const bB="_boardContainer_1c4y1_1",_B="_column_1c4y1_17",xB="_columnHeader_1c4y1_34",kB="_columnIcon_1c4y1_47",SB="_columnLabel_1c4y1_52",TB="_columnCount_1c4y1_57",wB="_cardList_1c4y1_67",jB="_emptyPlaceholder_1c4y1_76",NB="_card_1c4y1_67",CB="_cardHeader_1c4y1_107",EB="_cardStatusIcon_1c4y1_113",AB="_cardTitle_1c4y1_119",DB="_cardBadges_1c4y1_127",RB="_badge_1c4y1_134",MB="_blockedBadge_1c4y1_146",IB="_childBadge_1c4y1_151",OB="_depBadge_1c4y1_155",LB="_parentBadge_1c4y1_159",BB="_pausedSubBadge_1c4y1_166",zB="_personaBadge_1c4y1_170",UB="_envBadge_1c4y1_174",$B="_emptyCta_1c4y1_178",PB="_ctaButton_1c4y1_188",HB="_ctaDescription_1c4y1_204",tt={boardContainer:bB,column:_B,columnHeader:xB,columnIcon:kB,columnLabel:SB,columnCount:TB,cardList:wB,emptyPlaceholder:jB,card:NB,cardHeader:CB,cardStatusIcon:EB,cardTitle:AB,cardBadges:DB,badge:RB,blockedBadge:MB,childBadge:IB,depBadge:OB,parentBadge:LB,pausedSubBadge:BB,personaBadge:zB,envBadge:UB,emptyCta:$B,ctaButton:PB,ctaDescription:HB};function VB({workspaceId:t,environmentId:s,tasks:i,sessions:r,personas:c,environments:d}){const u=xt(),p=y.useMemo(()=>i.filter(_=>_.workspaceId===t),[i,t]),m=y.useMemo(()=>new Map(i.map(_=>[_.id,_.status])),[i]),g=y.useMemo(()=>new Map(p.map(_=>[_.id,_])),[p]),v=y.useMemo(()=>{const _=new Map(r.map(C=>[C.id,C])),S=new Map(c.map(C=>[C.id,C])),k=new Map(d.map(C=>[C.id,C])),w=new Map,N=new Map,T=new Map;for(const C of p)if(C.latestSessionId){const E=_.get(C.latestSessionId);if(E){if(w.set(C.id,E.endReason||E.status),E.personaId){const B=S.get(E.personaId);B&&N.set(C.id,B.name)}if(E.environmentId){const B=k.get(E.environmentId);B&&T.set(C.id,B.displayName)}}}return{sessionStatusByTaskId:w,personaNameByTaskId:N,environmentNameByTaskId:T}},[p,r,c,d]),b=y.useMemo(()=>yB({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?o.jsxs("div",{className:tt.emptyCta,"data-testid":"board-empty-cta",children:[o.jsx("button",{className:tt.ctaButton,onClick:()=>u(Ti(t,void 0,s)),children:"Create Task"}),o.jsx("div",{className:tt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):o.jsx("div",{className:tt.boardContainer,"data-testid":"board-container",children:b.map(_=>o.jsxs("section",{className:tt.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[o.jsxs("div",{className:tt.columnHeader,children:[o.jsx("span",{className:tt.columnIcon,style:{color:_.style.color},children:_.style.icon}),o.jsx("span",{className:tt.columnLabel,children:_.label}),o.jsx("span",{className:tt.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),o.jsx("div",{className:tt.cardList,children:_.tasks.length===0?o.jsx("div",{className:tt.emptyPlaceholder,children:"No tasks"}):o.jsx(cs,{mode:"popLayout",children:_.tasks.map(S=>o.jsx(Et.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:o.jsx(qB,{boardTask:S,tasksById:g,personaName:v.personaNameByTaskId.get(S.task.id),envName:v.environmentNameByTaskId.get(S.task.id),onClick:()=>u(Dn(S.task.id,void 0,t,s))})},S.task.id))})})]},_.status))})}function qB({boardTask:t,tasksById:s,personaName:i,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=Oa(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return o.jsxs("div",{className:tt.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[o.jsxs("div",{className:tt.cardHeader,children:[o.jsx("span",{className:tt.cardStatusIcon,style:{color:v.color},children:v.icon}),o.jsx("span",{className:tt.cardTitle,children:d.title})]}),o.jsxs("div",{className:tt.cardBadges,children:[b&&o.jsx("span",{className:`${tt.badge} ${tt.parentBadge}`,title:b.title,children:b.title}),p>0&&o.jsxs("span",{className:`${tt.badge} ${tt.childBadge}`,children:[m,"/",p]}),u&&o.jsx("span",{className:`${tt.badge} ${tt.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&o.jsx("span",{className:`${tt.badge} ${tt.depBadge}`,children:"dep"}),g&&o.jsx("span",{className:`${tt.badge} ${tt.pausedSubBadge}`,children:g}),i&&o.jsx("span",{className:`${tt.badge} ${tt.personaBadge}`,children:i}),r&&o.jsx("span",{className:`${tt.badge} ${tt.envBadge}`,children:r})]})]})}const GB="_formContent_ymnez_1",FB="_section_ymnez_13",ZB="_label_ymnez_19",KB="_titleInput_ymnez_26",YB="_descriptionTextarea_ymnez_58",JB="_selectField_ymnez_94",WB="_checkboxRow_ymnez_128",XB="_checkboxLabel_ymnez_141",QB="_fieldError_ymnez_146",yt={formContent:GB,section:FB,label:ZB,titleInput:KB,descriptionTextarea:YB,selectField:JB,checkboxRow:WB,checkboxLabel:XB,fieldError:QB};function e8(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.environmentId)??s??"",defaultPersonaId:(t==null?void 0:t.defaultPersonaId)??"",useWorktrees:(t==null?void 0:t.useWorktrees)??!0,workingDirectory:(t==null?void 0:t.workingDirectory)??""}}const t8=100;function n8({values:t,onChange:s,environments:i,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return o.jsxs("div",{className:yt.formContent,children:[o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-name",children:"Name"}),o.jsx("input",{id:"ws-name",className:yt.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:t8,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&o.jsx("span",{className:yt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-description",children:"Description"}),o.jsx("textarea",{id:"ws-description",className:yt.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-repo",children:"Repository URL"}),o.jsx("input",{id:"ws-repo",className:yt.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)&&o.jsx("span",{className:yt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-environment",children:"Environment"}),o.jsxs("select",{id:"ws-environment",className:yt.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[o.jsx("option",{value:"",children:"Select environment…"}),i.map(m=>o.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&o.jsx("span",{className:yt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-persona",children:"Default Persona"}),o.jsxs("select",{id:"ws-persona",className:yt.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[o.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>o.jsx("option",{value:m.id,children:m.name},m.id))]})]}),o.jsx("div",{className:yt.section,children:o.jsxs("label",{className:yt.checkboxRow,children:[o.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),o.jsx("span",{className:yt.checkboxLabel,children:"Enable worktree isolation"})]})}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-workdir",children:"Working Directory"}),o.jsx("input",{id:"ws-workdir",className:yt.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 T1=y.createContext(void 0),s8=4e3;function a8({children:t}){const[s,i]=y.useState([]),r=y.useRef(0),c=y.useCallback(u=>{i(p=>p.filter(m=>m.id!==u))},[]),d=y.useCallback((u,p="info",m=s8)=>{const g=`toast-${++r.current}`;i(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return o.jsx(T1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function yn(){const t=y.useContext(T1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const Jp="grackle-theme",w1="grackle-prefer-system",j1="(prefers-color-scheme: dark)";let Br=[],Kc;function gp(){Kc=void 0;for(const t of Br)t()}function Wp(){return typeof window>"u"?!1:window.matchMedia(j1).matches}function Vr(){if(typeof localStorage>"u")return zb;try{const t=localStorage.getItem(Jp);if(t!==null&&x1.has(t))return t}catch{}return zb}function ld(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(w1)==="true"}catch{return!1}}function Xp(t){return Sd.find(s=>s.variantLightId===t||s.variantDarkId===t)}function N1(t,s){const i=Yp(t);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?Wp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const r=Xp(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return Wp()?r.variantDarkId:r.variantLightId}return t}function vo(t,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=N1(t,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&vo(Vr(),ld());function i8(){return Kc===void 0&&(Kc={themeId:Vr(),systemDark:Wp(),preferSystem:ld()}),Kc}function o8(t){return Br=[...Br,t],()=>{Br=Br.filter(s=>s!==t)}}function r8(){const t=y.useSyncExternalStore(o8,i8),{themeId:s,preferSystem:i}=t,r=N1(s,i),c=y.useCallback(u=>{if(x1.has(u)){try{localStorage.setItem(Jp,u)}catch{}vo(u,ld(),!0),gp()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(w1,u?"true":"false")}catch{}if(u){const p=Vr(),m=Yp(p);if(m!=null&&m.hidden){const g=Xp(p);if(g)try{localStorage.setItem(Jp,g.id)}catch{}}}vo(Vr(),u,!0),gp()},[]);return y.useEffect(()=>{vo(s,i)},[s,i]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(j1),p=()=>{const m=Vr(),g=ld();if(g){const v=Yp(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&vo(m,g),v!=null&&v.hidden){const b=Xp(m);b!=null&&b.variantDarkId&&b.variantLightId&&vo(m,g)}}gp()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:i,setPreferSystem:d}}const C1=y.createContext(void 0);function l8({children:t}){const s=r8();return o.jsx(C1.Provider,{value:s,children:t})}function E1(){const t=y.useContext(C1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const A1=y.createContext(void 0),D1=y.createContext(void 0);function c8({children:t}){const[s,i]=y.useState(void 0),r=y.useCallback(c=>{i(c)},[]);return o.jsx(D1.Provider,{value:r,children:o.jsx(A1.Provider,{value:s,children:t})})}function d8(){return y.useContext(A1)}function u8(){const t=y.useContext(D1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const Jm=y.createContext(void 0);function lt(){const t=y.useContext(Jm);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function R1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function M1(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function f8(t){return R1(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 p8=new Set(["off","subscription","api_key"]),Ic=new Set(["off","on"]);function m8(t){return R1(t)&&p8.has(t.claude)&&Ic.has(t.github)&&Ic.has(t.copilot)&&Ic.has(t.codex)&&Ic.has(t.goose)}function I1(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 O1(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 go=5e3;function h8(t,s){const i=[];let r=t;const c=new Set;for(;r&&s.has(r)&&!c.has(r);){c.add(r);const d=s.get(r);i.unshift(d),r=d.parentTaskId||void 0}return i}const ea={label:"Home",url:_i};function g8(t){return t?[ea,{label:"Settings",url:To},{label:t,url:void 0}]:[ea,{label:"Settings",url:void 0}]}const Wm={label:"Environments",url:wo};function v8(){return[ea,{label:"Environments",url:void 0}]}function y8(){return[ea,{label:"New Chat",url:void 0}]}function b8(t){return[ea,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function _8(t,s,i,r){const c=i.find(u=>u.id===t),d=r.find(u=>u.id===s);return[ea,Wm,{label:(d==null?void 0:d.displayName)??"Environment",url:bi(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function x8(t,s,i,r,c){const d=h8(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,m=p?i.find(S=>S.id===p):void 0,g=s??(m==null?void 0:m.environmentId),v=g?r.find(S=>S.id===g):void 0,b=[ea];v&&g&&(b.push(Wm),b.push({label:v.displayName,url:bi(g)})),m&&g&&b.push({label:m.name,url:yi(m.id,g)});for(let S=0;S<d.length-1;S++)b.push({label:d[S].title,url:Dn(d[S].id,void 0,p,g)});const _=d[d.length-1];return b.push({label:(_==null?void 0:_.title)??t,url:void 0}),b}const k8={label:"Findings",url:gd};function S8(){return[ea,{label:"Findings",url:void 0}]}function L1(t,s,i,r,c){const d=[ea];if(s&&i){const u=r.find(m=>m.id===s),p=c.find(m=>m.id===i);d.push(Wm),p&&d.push({label:p.displayName,url:bi(i)}),u&&d.push({label:u.name,url:yi(s,i)}),d.push({label:"Findings",url:nN(s,i)})}else d.push(k8);return d.push({label:t,url:void 0}),d}function Xm(t){const s=[];for(const i of t){const r=s[s.length-1];i.eventType==="text"&&(r==null?void 0:r.eventType)==="text"?s[s.length-1]={...r,content:r.content+i.content}:s.push(i)}return s}function Oc(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const i=t.item;if(i&&typeof i.id=="string")return i.id}function T8(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 i=t.item;if(i&&typeof i.id=="string")return i.id}function Qm(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const i=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const b=s.get(v),_=b?Oc(b):void 0;if(_)try{const S=JSON.parse(v.content);i.set(_,{tool:S.tool,args:S.args})}catch{}}const r=new Set,c=new Set,d=t.map((v,b)=>{if(v.eventType!=="tool_result")return v;const _=s.get(v),S=_?T8(_):void 0;if(!S)return v;const k=i.get(S);if(!k)return v;r.add(S),c.add(b);let w;const N=v.content.trim();if(N.startsWith("{"))try{const T=JSON.parse(N);typeof T.detailedContent=="string"&&(w=T.detailedContent)}catch{}return{...v,toolUseCtx:{...k,detailedResult:w}}}),u=[];for(let v=0;v<d.length;v++){if(d[v].eventType!=="tool_use")continue;const b=s.get(d[v]),_=b?Oc(b):void 0;_&&r.has(_)||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 b=p[m];if(b!==v+1)continue;const _=d[v],S=d[b];let k;try{const w=JSON.parse(_.content);k={tool:w.tool,args:w.args}}catch{}if(k){let w;const N=S.content.trim();if(N.startsWith("{"))try{const E=JSON.parse(N);typeof E.detailedContent=="string"&&(w=E.detailedContent)}catch{}d[b]={...S,toolUseCtx:{...k,detailedResult:w}},c.add(b);const T=s.get(_),C=T?Oc(T):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(_,{...T??{},__seqId:`__seq_${v}`})),m++}}const g=d.filter(v=>{if(v.eventType!=="tool_use")return!0;const b=s.get(v);if(!b)return!0;const _=Oc(b);if(_&&r.has(_))return!1;const S=b.__seqId;return!(S&&r.has(S))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let b=!1;for(let _=v+1;_<g.length;_++)if(g[_].eventType!=="tool_use"){b=!0;break}b&&(g[v]={...g[v],settled:!0})}return g}function w8(t,s,i){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=B1(s),d=s.filter(m=>Qp(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||Qp(m,c)).length,p=i.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function B1(t){const s=new Map;for(const i of t)s.set(i.id,i.status);return s}function Qp(t,s){return t.dependsOn.some(i=>s.get(i)!=="complete")}function j8(t,s){var u;const i=new Map;for(const p of s)i.set(p.id,p);const r=B1(t),c=[];for(const p of t){const m=p.workspaceId?((u=i.get(p.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:m}):Qp(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 N8(t,s){const i=new Map;for(const r of s)i.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=i.get(r.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function C8(t,s,i){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 ys=[{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
|
|
275
|
-
export function verifyToken(req: Request, res: Response, next: NextFunction): void {
|
|
276
|
-
const header = req.headers.authorization;
|
|
277
|
-
if (!header?.startsWith("Bearer ")) {
|
|
278
|
-
res.status(401).json({ error: "Missing token" });
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
|
|
282
|
-
req.user = decoded;
|
|
283
|
-
next();
|
|
284
|
-
}
|
|
285
|
-
\`\`\``,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
|
|
286
|
-
CREATE TABLE audit_log (
|
|
287
|
-
id BIGSERIAL PRIMARY KEY,
|
|
288
|
-
user_id UUID REFERENCES users(id),
|
|
289
|
-
action TEXT NOT NULL,
|
|
290
|
-
entity_type TEXT NOT NULL,
|
|
291
|
-
entity_id TEXT NOT NULL,
|
|
292
|
-
old_value JSONB,
|
|
293
|
-
new_value JSONB,
|
|
294
|
-
ip_address INET,
|
|
295
|
-
created_at TIMESTAMPTZ DEFAULT now()
|
|
296
|
-
);
|
|
297
|
-
\`\`\``,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}],Ea=[{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"}],E8=new Map(ys.map(t=>[t.id,t]));function vp(t){const s=E8.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const $b={"kn-auth-flow":{node:vp("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:vp("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:vp("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"}]}},A8=[{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}],D8=[{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,costUsd:.41},{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,costUsd:.22},{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,costUsd:.18},{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,costUsd:.31},{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,costUsd:.1},{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,costUsd:.38}],R8=[{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.
|
|
298
|
-
Project: acme/alpha — Node.js + Express REST API
|
|
299
|
-
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";
|
|
300
|
-
import type { Request, Response, NextFunction } from "express";
|
|
301
|
-
|
|
302
|
-
export function requireAuth(req: Request, res: Response, next: NextFunction): void {
|
|
303
|
-
if (!req.session?.userId) {
|
|
304
|
-
res.status(401).json({ error: "Not authenticated" });
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
next();
|
|
308
|
-
}`,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) {
|
|
309
|
-
src/routes/login.ts:18: req.session.userId = user.id;
|
|
310
|
-
src/routes/login.ts:19: req.session.role = user.role;
|
|
311
|
-
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_usd:.21})},{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";
|
|
312
|
-
import bcrypt from "bcrypt";
|
|
313
|
-
import { db } from "../db.js";
|
|
314
|
-
|
|
315
|
-
const router = Router();
|
|
316
|
-
|
|
317
|
-
router.post("/login", async (req, res) => {
|
|
318
|
-
const { email, password } = req.body;
|
|
319
|
-
const user = await db.users.findByEmail(email);
|
|
320
|
-
if (!user || !await bcrypt.compare(password, user.passwordHash)) {
|
|
321
|
-
return res.status(401).json({ error: "Invalid credentials" });
|
|
322
|
-
}
|
|
323
|
-
req.session.userId = user.id;
|
|
324
|
-
req.session.role = user.role;
|
|
325
|
-
res.json({ ok: true });
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
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.
|
|
329
|
-
Project: acme/alpha — Node.js + Express REST API
|
|
330
|
-
Task: Implement auth middleware using JWT tokens
|
|
331
|
-
|
|
332
|
-
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
|
|
333
|
-
src/routes/login.ts
|
|
334
|
-
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
|
|
335
|
-
|
|
336
|
-
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";
|
|
337
|
-
import type { Request, Response, NextFunction } from "express";
|
|
338
|
-
|
|
339
|
-
const JWT_SECRET = process.env.JWT_SECRET || "change-me";
|
|
340
|
-
|
|
341
|
-
export interface JwtPayload {
|
|
342
|
-
userId: string;
|
|
343
|
-
role: string;
|
|
344
|
-
iat: number;
|
|
345
|
-
exp: number;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export function verifyToken(req: Request, res: Response, next: NextFunction): void {
|
|
349
|
-
const header = req.headers.authorization;
|
|
350
|
-
if (!header?.startsWith("Bearer ")) {
|
|
351
|
-
res.status(401).json({ error: "Missing or malformed token" });
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
try {
|
|
355
|
-
const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
|
|
356
|
-
req.user = decoded;
|
|
357
|
-
next();
|
|
358
|
-
} catch (err) {
|
|
359
|
-
if (err instanceof jwt.TokenExpiredError) {
|
|
360
|
-
res.status(401).json({ error: "Token expired" });
|
|
361
|
-
} else {
|
|
362
|
-
res.status(403).json({ error: "Invalid token" });
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
`}}),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.
|
|
367
|
-
|
|
368
|
-
The new login flow will:
|
|
369
|
-
1. Validate credentials (unchanged)
|
|
370
|
-
2. Generate a JWT with \`userId\` and \`role\` claims
|
|
371
|
-
3. Return the token in the response body
|
|
372
|
-
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";
|
|
373
|
-
import bcrypt from "bcrypt";
|
|
374
|
-
import jwt from "jsonwebtoken";
|
|
375
|
-
import crypto from "node:crypto";
|
|
376
|
-
import { db } from "../db.js";
|
|
377
|
-
|
|
378
|
-
const JWT_SECRET = process.env.JWT_SECRET || "change-me";
|
|
379
|
-
const ACCESS_TOKEN_EXPIRY = "24h";
|
|
380
|
-
const REFRESH_TOKEN_BYTES = 48;
|
|
381
|
-
|
|
382
|
-
const router = Router();
|
|
383
|
-
|
|
384
|
-
router.post("/login", async (req, res) => {
|
|
385
|
-
const { email, password } = req.body;
|
|
386
|
-
const user = await db.users.findByEmail(email);
|
|
387
|
-
if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
|
|
388
|
-
return res.status(401).json({ error: "Invalid credentials" });
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
const accessToken = jwt.sign(
|
|
392
|
-
{ userId: user.id, role: user.role },
|
|
393
|
-
JWT_SECRET,
|
|
394
|
-
{ expiresIn: ACCESS_TOKEN_EXPIRY },
|
|
395
|
-
);
|
|
396
|
-
|
|
397
|
-
const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
|
|
398
|
-
await db.refreshTokens.create({ userId: user.id, token: refreshToken });
|
|
399
|
-
|
|
400
|
-
res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
export default router;
|
|
404
|
-
`}}),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
|
|
405
|
-
PASS src/routes/__tests__/protected.test.ts
|
|
406
|
-
FAIL src/middleware/__tests__/auth.test.ts
|
|
407
|
-
x should reject missing session (12ms)
|
|
408
|
-
x should allow valid session (8ms)
|
|
409
|
-
|
|
410
|
-
2 failed, 12 passed, 14 total
|
|
411
|
-
|
|
412
|
-
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.
|
|
413
|
-
|
|
414
|
-
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";
|
|
415
|
-
import jwt from "jsonwebtoken";
|
|
416
|
-
import { verifyToken } from "../auth.js";
|
|
417
|
-
import { createMockReqRes } from "../../test-utils/mock-express.js";
|
|
418
|
-
|
|
419
|
-
const SECRET = "test-secret";
|
|
420
|
-
process.env.JWT_SECRET = SECRET;
|
|
421
|
-
|
|
422
|
-
describe("verifyToken", () => {
|
|
423
|
-
it("should reject requests without Authorization header", () => {
|
|
424
|
-
const { req, res, next } = createMockReqRes();
|
|
425
|
-
verifyToken(req, res, next);
|
|
426
|
-
expect(res.status).toHaveBeenCalledWith(401);
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
it("should reject expired tokens", () => {
|
|
430
|
-
const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
|
|
431
|
-
const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
|
|
432
|
-
verifyToken(req, res, next);
|
|
433
|
-
expect(res.status).toHaveBeenCalledWith(401);
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
it("should accept valid tokens and attach user to request", () => {
|
|
437
|
-
const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
|
|
438
|
-
const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
|
|
439
|
-
verifyToken(req, res, next);
|
|
440
|
-
expect(next).toHaveBeenCalled();
|
|
441
|
-
expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
|
|
442
|
-
});
|
|
443
|
-
});
|
|
444
|
-
`}}),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
|
|
445
|
-
PASS src/routes/__tests__/protected.test.ts
|
|
446
|
-
PASS src/middleware/__tests__/auth.test.ts
|
|
447
|
-
|
|
448
|
-
Test Suites: 3 passed, 3 total
|
|
449
|
-
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_usd:.22})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:42Z",content:`All 14 tests pass. Here's a summary of the changes:
|
|
450
|
-
|
|
451
|
-
### Changes made
|
|
452
|
-
|
|
453
|
-
| File | Action |
|
|
454
|
-
|------|--------|
|
|
455
|
-
| \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
|
|
456
|
-
| \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
|
|
457
|
-
| \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
|
|
458
|
-
| \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
|
|
459
|
-
|
|
460
|
-
### Key decisions
|
|
461
|
-
- **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
|
|
462
|
-
- **Refresh tokens**: 48-byte random hex, stored in DB
|
|
463
|
-
- **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.
|
|
464
|
-
Project: acme/alpha — Node.js + Express REST API
|
|
465
|
-
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";
|
|
466
|
-
import bcrypt from "bcrypt";
|
|
467
|
-
import { db } from "../db.js";
|
|
468
|
-
import { validateEmail, validatePassword } from "../utils/validators.js";
|
|
469
|
-
|
|
470
|
-
const SALT_ROUNDS = 12;
|
|
471
|
-
const router = Router();
|
|
472
|
-
|
|
473
|
-
router.post("/register", async (req, res) => {
|
|
474
|
-
const { name, email, password } = req.body;
|
|
475
|
-
|
|
476
|
-
if (!name || !email || !password) {
|
|
477
|
-
return res.status(400).json({ error: "Missing required fields" });
|
|
478
|
-
}
|
|
479
|
-
if (!validateEmail(email)) {
|
|
480
|
-
return res.status(400).json({ error: "Invalid email format" });
|
|
481
|
-
}
|
|
482
|
-
if (!validatePassword(password)) {
|
|
483
|
-
return res.status(400).json({ error: "Password too weak" });
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
const existing = await db.users.findByEmail(email);
|
|
487
|
-
if (existing) {
|
|
488
|
-
return res.status(409).json({ error: "Email already registered" });
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
|
|
492
|
-
const user = await db.users.create({ name, email, passwordHash });
|
|
493
|
-
res.status(201).json({ id: user.id, name: user.name, email: user.email });
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
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:
|
|
497
|
-
|
|
498
|
-
1. **Happy path** - valid registration
|
|
499
|
-
2. **Missing fields** - each required field missing
|
|
500
|
-
3. **Invalid email** - malformed email format
|
|
501
|
-
4. **Weak password** - password validation failure
|
|
502
|
-
5. **Duplicate email** - conflict with existing user
|
|
503
|
-
6. **SQL injection** - malicious email input
|
|
504
|
-
7. **XSS payload** - HTML in the name field
|
|
505
|
-
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
|
|
506
|
-
POST /api/register
|
|
507
|
-
✓ should register a valid user (28ms)
|
|
508
|
-
✓ should reject missing name (4ms)
|
|
509
|
-
✓ should reject missing email (3ms)
|
|
510
|
-
✓ should reject missing password (3ms)
|
|
511
|
-
✓ should reject invalid email format (5ms)
|
|
512
|
-
✓ should reject weak password (4ms)
|
|
513
|
-
✓ should reject duplicate email (12ms)
|
|
514
|
-
✓ should sanitize HTML in name field (6ms)
|
|
515
|
-
|
|
516
|
-
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_usd:.18})},{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.
|
|
517
|
-
Project: acme/alpha — Node.js + Express + PostgreSQL
|
|
518
|
-
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 (
|
|
519
|
-
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
520
|
-
name TEXT NOT NULL,
|
|
521
|
-
email TEXT UNIQUE NOT NULL,
|
|
522
|
-
password_hash TEXT NOT NULL,
|
|
523
|
-
role TEXT DEFAULT 'user',
|
|
524
|
-
created_at TIMESTAMPTZ DEFAULT now(),
|
|
525
|
-
updated_at TIMESTAMPTZ DEFAULT now()
|
|
526
|
-
);
|
|
527
|
-
|
|
528
|
-
CREATE TABLE sessions (
|
|
529
|
-
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
530
|
-
user_id UUID REFERENCES users(id),
|
|
531
|
-
expires_at TIMESTAMPTZ NOT NULL,
|
|
532
|
-
created_at TIMESTAMPTZ DEFAULT now()
|
|
533
|
-
);`,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
|
|
534
|
-
-- Add audit logging and user activity tracking
|
|
535
|
-
|
|
536
|
-
BEGIN;
|
|
537
|
-
|
|
538
|
-
-- 1. Add last_login_at to users
|
|
539
|
-
ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
|
|
540
|
-
|
|
541
|
-
-- 2. Index for session cleanup queries
|
|
542
|
-
CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
|
|
543
|
-
|
|
544
|
-
-- 3. Audit log table
|
|
545
|
-
CREATE TABLE audit_log (
|
|
546
|
-
id BIGSERIAL PRIMARY KEY,
|
|
547
|
-
user_id UUID REFERENCES users(id),
|
|
548
|
-
action TEXT NOT NULL,
|
|
549
|
-
entity_type TEXT NOT NULL,
|
|
550
|
-
entity_id TEXT NOT NULL,
|
|
551
|
-
old_value JSONB,
|
|
552
|
-
new_value JSONB,
|
|
553
|
-
ip_address INET,
|
|
554
|
-
created_at TIMESTAMPTZ DEFAULT now()
|
|
555
|
-
);
|
|
556
|
-
|
|
557
|
-
CREATE INDEX idx_audit_log_user ON audit_log (user_id);
|
|
558
|
-
CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
|
|
559
|
-
CREATE INDEX idx_audit_log_created ON audit_log (created_at);
|
|
560
|
-
|
|
561
|
-
COMMIT;
|
|
562
|
-
`}}),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
|
|
563
|
-
- ALTER TABLE users ADD COLUMN last_login_at
|
|
564
|
-
- CREATE INDEX CONCURRENTLY idx_sessions_expires_at
|
|
565
|
-
- CREATE TABLE audit_log
|
|
566
|
-
- 3 indexes on audit_log
|
|
567
|
-
|
|
568
|
-
WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
|
|
569
|
-
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_usd:.31})},{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.
|
|
570
|
-
Project: acme/data-pipeline — ETL pipelines for analytics
|
|
571
|
-
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
|
|
572
|
-
src/middleware/error-handler.ts
|
|
573
|
-
src/middleware/logger.ts
|
|
574
|
-
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:
|
|
575
|
-
|
|
576
|
-
- Uses an **in-memory token bucket** per client IP
|
|
577
|
-
- Supports configurable rate (requests/second) and burst size
|
|
578
|
-
- Returns \`429 Too Many Requests\` with \`Retry-After\` header
|
|
579
|
-
- Has a Redis adapter option for multi-instance deployments
|
|
580
|
-
|
|
581
|
-
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.
|
|
582
|
-
Project: acme/alpha — Node.js + Express + PostgreSQL
|
|
583
|
-
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";
|
|
584
|
-
|
|
585
|
-
const pool = new pg.Pool({
|
|
586
|
-
connectionString: process.env.DATABASE_URL,
|
|
587
|
-
max: 20,
|
|
588
|
-
idleTimeoutMillis: 30000,
|
|
589
|
-
});
|
|
590
|
-
|
|
591
|
-
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:
|
|
592
|
-
|
|
593
|
-
1. **A \`PoolManager\` class** that creates and caches per-tenant pools
|
|
594
|
-
2. **Configurable limits** per tenant (max connections, idle timeout)
|
|
595
|
-
3. **Health checks** with automatic pool eviction for unhealthy connections
|
|
596
|
-
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";
|
|
597
|
-
src/routes/users.ts:2:import { pool } from "../db/pool.js";
|
|
598
|
-
src/routes/register.ts:3:import { pool } from "../db/pool.js";
|
|
599
|
-
src/routes/admin.ts:4:import { pool } from "../db/pool.js";
|
|
600
|
-
src/services/billing.ts:2:import { pool } from "../db/pool.js";
|
|
601
|
-
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:
|
|
602
|
-
1. Create a new \`PoolManager\` abstraction
|
|
603
|
-
2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
|
|
604
|
-
3. Add middleware to extract tenant ID from the request
|
|
605
|
-
|
|
606
|
-
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_usd:.38})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],M8=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",environmentId:"env-local-01",status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",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",environmentId:"env-docker-01",status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",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:"",environmentId:"env-local-01",status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],I8=[{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"}})},{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:""},{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:""},{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:""},{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:""},{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:""},{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:""},{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:""},{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"}}})},{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:""},{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:""},{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:""},{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:""},{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:""},{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:""},{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:""},{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:""}],Lc=[{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"}],O8=[{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:""}],L8=[{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));
|
|
607
|
-
for (const f of files) {
|
|
608
|
-
const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);
|
|
609
|
-
if (eslintResult.exitCode !== 0) {
|
|
610
|
-
env.findings.push({ category: "lint", title: \`Lint issues in \${f.filename}\`, content: eslintResult.stderr });
|
|
611
|
-
}
|
|
612
|
-
const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);
|
|
613
|
-
if (prettierResult.exitCode !== 0) {
|
|
614
|
-
env.findings.push({ category: "format", title: \`Prettier issues in \${f.filename}\`, content: prettierResult.stderr });
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],B8={"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 Ee(t){return new Date(Date.now()+t).toISOString()}const Pb=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(1600),content:`src/routes/users.ts
|
|
618
|
-
src/routes/auth.ts
|
|
619
|
-
src/routes/billing.ts
|
|
620
|
-
src/routes/admin.ts
|
|
621
|
-
src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Ee(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
|
|
622
|
-
|
|
623
|
-
\`\`\`typescript
|
|
624
|
-
const router = Router();
|
|
625
|
-
router.use(authenticate);
|
|
626
|
-
router.use(validateBody);
|
|
627
|
-
|
|
628
|
-
router.get("/", listUsers);
|
|
629
|
-
router.post("/", createUser);
|
|
630
|
-
router.get("/:id", getUser);
|
|
631
|
-
router.put("/:id", updateUser);
|
|
632
|
-
router.delete("/:id", deleteUser);
|
|
633
|
-
\`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(4e3),content:` PASS src/routes/__tests__/users.test.ts
|
|
634
|
-
PASS src/routes/__tests__/auth.test.ts
|
|
635
|
-
PASS src/routes/__tests__/billing.test.ts
|
|
636
|
-
|
|
637
|
-
Test Suites: 3 passed, 3 total
|
|
638
|
-
Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Ee(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_usd:.15})}},{delayMs:5e3,event:{eventType:"text",timestamp:Ee(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Ee(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(1800),content:`CREATE TABLE users (
|
|
639
|
-
id UUID PRIMARY KEY,
|
|
640
|
-
name TEXT NOT NULL,
|
|
641
|
-
email TEXT UNIQUE NOT NULL,
|
|
642
|
-
created_at TIMESTAMPTZ DEFAULT now()
|
|
643
|
-
);
|
|
644
|
-
|
|
645
|
-
CREATE TABLE sessions (
|
|
646
|
-
id UUID PRIMARY KEY,
|
|
647
|
-
user_id UUID REFERENCES users(id),
|
|
648
|
-
expires_at TIMESTAMPTZ NOT NULL
|
|
649
|
-
);`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Ee(2600),content:`I found the tables to modify:
|
|
650
|
-
- **users**: add column \`last_login_at\`
|
|
651
|
-
- **sessions**: add index on \`expires_at\`
|
|
652
|
-
- **audit_log**: new table
|
|
653
|
-
|
|
654
|
-
This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
|
|
655
|
-
|
|
656
|
-
Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Ee(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(1700),content:`Applying 002_add_last_login.sql... done
|
|
657
|
-
Applying 003_sessions_index.sql... done
|
|
658
|
-
Applying 004_audit_log.sql... done
|
|
659
|
-
|
|
660
|
-
3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Ee(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Ee(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(1800),content:`import { StripeClient } from "./stripe-client.js";
|
|
661
|
-
import type { Invoice, LineItem } from "../types/billing.js";
|
|
662
|
-
|
|
663
|
-
export class BillingService {
|
|
664
|
-
constructor(private stripe: StripeClient) {}
|
|
665
|
-
|
|
666
|
-
async calculateMonthlyTotal(userId: string): Promise<number> {
|
|
667
|
-
const invoices = await this.stripe.listInvoices(userId);
|
|
668
|
-
return invoices.reduce((sum, inv) => sum + inv.total, 0);
|
|
669
|
-
}
|
|
670
|
-
}`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Ee(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Ee(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:Ee(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:Ee(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:Ee(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(1800),content:`import jwt from "jsonwebtoken";
|
|
671
|
-
import type { Request, Response, NextFunction } from "express";
|
|
672
|
-
|
|
673
|
-
const JWT_SECRET = process.env.JWT_SECRET || "change-me";
|
|
674
|
-
|
|
675
|
-
export function verifyToken(req: Request, res: Response, next: NextFunction): void {
|
|
676
|
-
const header = req.headers.authorization;
|
|
677
|
-
if (!header?.startsWith("Bearer ")) {
|
|
678
|
-
res.status(401).json({ error: "Missing token" });
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
try {
|
|
682
|
-
const decoded = jwt.verify(header.slice(7), JWT_SECRET);
|
|
683
|
-
if (decoded.exp > Date.now() / 1000) {
|
|
684
|
-
res.status(403).json({ error: "Token expired" });
|
|
685
|
-
return;
|
|
686
|
-
}
|
|
687
|
-
req.user = decoded;
|
|
688
|
-
next();
|
|
689
|
-
} catch {
|
|
690
|
-
res.status(403).json({ error: "Invalid token" });
|
|
691
|
-
}
|
|
692
|
-
}`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Ee(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:Ee(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:Ee(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Ee(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:Ee(5800),content:`[exit 0] > jest --grep auth
|
|
693
|
-
|
|
694
|
-
PASS src/auth.test.ts
|
|
695
|
-
✓ validates JWT token (12ms)
|
|
696
|
-
✓ rejects expired token (3ms)
|
|
697
|
-
✓ handles missing header (1ms)
|
|
698
|
-
|
|
699
|
-
Tests: 3 passed, 3 total
|
|
700
|
-
Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Ee(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:Ee(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
|
|
701
|
-
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:Ee(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:Ee(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_usd:.12})}},{delayMs:8800,event:{eventType:"status",timestamp:Ee(8800),content:"completed"}}]}],vs={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1},Hb=400;function z8({children:t}){const[s,i]=y.useState(A8),[r,c]=y.useState(D8),[d,u]=y.useState(R8),[p,m]=y.useState(void 0),[g,v]=y.useState(M8),[b,_]=y.useState(I8),[S,k]=y.useState(Lc),[w,N]=y.useState(void 0),T=!1,[C,E]=y.useState(O8),[B,A]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[I,O]=y.useState(L8),[U]=y.useState(B8),[P,W]=y.useState(""),[te,H]=y.useState(ys),[ie,Y]=y.useState(Ea),[re,D]=y.useState(void 0),[Z,se]=y.useState(void 0),[ue,de]=y.useState(""),Ge=y.useRef(void 0),De=y.useRef(0),Ne=y.useRef(0),Oe=y.useRef(new Set),fe=y.useRef(new Map),ye=y.useRef(b);ye.current=b;const me=y.useRef(new Map),Ue=y.useRef(new Map),pt=y.useCallback(V=>(De.current+=1,`mock-${V}-${String(De.current).padStart(3,"0")}`),[]),bn=y.useCallback(()=>{const V=Pb[Ne.current%Pb.length];return Ne.current+=1,V},[]),ae=y.useCallback((V,ne,le)=>{const pe=setTimeout(()=>{var he;Oe.current.delete(pe),le&&((he=fe.current.get(le))==null||he.delete(pe)),V()},ne);Oe.current.add(pe),le&&(fe.current.has(le)||fe.current.set(le,new Set),fe.current.get(le).add(pe))},[]),Q=y.useCallback(V=>{const ne=fe.current.get(V);ne&&(ne.forEach(le=>{clearTimeout(le),Oe.current.delete(le)}),fe.current.delete(V))},[]),ct=y.useCallback((V,ne,le)=>{c(pe=>pe.map(he=>he.id===V?{...he,status:ne,...le!==void 0?{endReason:le}:{}}:he))},[]),Le=y.useCallback(V=>{u(ne=>[...ne,V])},[]),$t=y.useCallback((V,ne,le)=>{ne.forEach((pe,he)=>{ae(()=>{const $e={sessionId:V,...pe.event,timestamp:new Date().toISOString()};if(Le($e),pe.event.eventType==="status"){const ke=I1(pe.event.content),Re=O1(pe.event.content);ct(V,ke,Re)}he===ne.length-1&&le&&le()},pe.delayMs,V)})},[ae,Le,ct]),dt=y.useCallback(async(V,ne,le,pe)=>{console.log("[MockGrackle] spawn",{environmentId:V,prompt:ne,runtime:pe});const he=pt("sess"),$e={id:he,environmentId:V,runtime:pe||"claude-code",status:"running",prompt:ne,startedAt:new Date().toISOString()};c(Re=>[...Re,$e]),m(he);const ke=bn();if(console.log(`[MockGrackle] Playing scenario: ${ke.label}`),ke.pauseForInput){const Re=ke.pauseAfterStep??ke.steps.length-1,Ze=ke.steps.slice(0,Re+1),ut=Ze.length>0?Ze[Ze.length-1].delayMs:0;$t(he,Ze),ae(()=>{ct(he,"idle"),Le({sessionId:he,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ut+Hb,he),ke.resumeSteps&&me.current.set(he,ke.resumeSteps)}else $t(he,ke.steps)},[pt,bn,$t,ae,ct,Le]),na=y.useCallback(async V=>{console.log("[MockGrackle] kill",V),Q(V),me.current.delete(V),ct(V,"stopped","killed"),Le({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),_(ne=>ne.map(le=>le.latestSessionId===V&&le.status==="working"?{...le,status:"not_started"}:le))},[Q,ct,Le]),Ss=y.useCallback(async V=>{console.log("[MockGrackle] stopGraceful",V),Q(V),me.current.delete(V),ct(V,"stopped","terminated"),Le({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),_(ne=>ne.map(le=>le.latestSessionId===V&&le.status==="working"?{...le,status:"not_started"}:le))},[Q,ct,Le]),_n=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Ts=y.useCallback(async V=>{console.log("[MockGrackle] loadSessionEvents",V)},[]),us=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),u([])},[]),ji=y.useCallback(async(V,ne,le,pe,he,$e,ke,Re,Ze)=>{console.log("[MockGrackle] createWorkspace",{name:V,description:ne});const ut={id:pt("proj"),name:V,description:ne||"",repoUrl:le||"",environmentId:pe||"",status:"active",workingDirectory:ke||"",useWorktrees:$e??!0,defaultPersonaId:he||"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Ke=>[...Ke,ut]),Re&&Re()},[pt]),Wn=y.useCallback(async V=>{console.log("[MockGrackle] archiveWorkspace",V),v(ne=>ne.map(le=>le.id===V?{...le,status:"archived"}:le))},[]),_e=y.useCallback(async V=>{console.log("[MockGrackle] loadTasks",V)},[]),Qe=y.useCallback(async(V,ne,le,pe,he,$e,ke,Re,Ze)=>{console.log("[MockGrackle] createTask",{workspaceId:V,title:ne,parentTaskId:he}),_(ut=>{const Pt=ut.filter(ht=>ht.workspaceId===V).reduce((ht,qt)=>Math.max(ht,qt.sortOrder),0),Kt=he?ut.find(ht=>ht.id===he):void 0;if(he&&!Kt)return console.warn("[MockGrackle] Parent task not found:",he),ut;if(Kt&&!Kt.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",he),ut;const At=Kt?Kt.depth+1:0,rn={id:pt("task"),workspaceId:V,title:ne,description:le||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:pe||[],reviewNotes:void 0,sortOrder:Pt+1,createdAt:new Date().toISOString(),parentTaskId:he||"",depth:At,childTaskIds:[],canDecompose:ke??!he,defaultPersonaId:$e||"",workpad:""};return[...ut,rn]}),Re&&Re()},[pt]),on=y.useCallback(async(V,ne,le,pe)=>{var ut;console.log("[MockGrackle] startTask",{taskId:V});const he=ye.current.find(Ke=>Ke.id===V),$e=(he==null?void 0:he.title)??"",ke=pt("sess"),Re={id:ke,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:$e||V,startedAt:new Date().toISOString()};c(Ke=>[...Ke,Re]),_(Ke=>Ke.map(Pt=>Pt.id===V?{...Pt,status:"working",latestSessionId:ke,branch:`mock/${V.slice(0,8)}`}:Pt));const Ze=bn();if(console.log(`[MockGrackle] Playing task scenario: ${Ze.label}`),Ze.pauseForInput){const Ke=Ze.pauseAfterStep??Ze.steps.length-1,Pt=Ze.steps.slice(0,Ke+1),Kt=Pt.length>0?Pt[Pt.length-1].delayMs:0;if($t(ke,Pt),ae(()=>{ct(ke,"idle"),Le({sessionId:ke,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},Kt+Hb,ke),Ze.resumeSteps){const At=[...Ze.resumeSteps];me.current.set(ke,At);const rn=At.reduce((ht,qt)=>Math.max(ht,qt.delayMs),0);Ue.current.set(ke,{taskId:V,delayAfterResume:rn+200})}}else{const Ke=Ze.steps.length>0?Ze.steps[Ze.steps.length-1].delayMs:0;$t(ke,Ze.steps);const Pt=(ut=Ze.steps[Ze.steps.length-1])==null?void 0:ut.event.content;ae(()=>{Pt==="completed"?_(Kt=>Kt.map(At=>At.id===V&&At.status==="working"?{...At,status:"paused"}:At)):Pt==="failed"&&_(Kt=>Kt.map(At=>At.id===V&&At.status==="working"?{...At,status:"failed"}:At))},Ke+100,ke)}},[pt,bn,$t,ae,ct,Le]),xn=y.useCallback(async(V,ne)=>{console.log("[MockGrackle] sendInput",{sessionId:V,text:ne}),Le({sessionId:V,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ne}`}),ct(V,"running"),Le({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const le=me.current.get(V);if(le)me.current.delete(V),$t(V,le);else{const he=[{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"}}];$t(V,he)}const pe=Ue.current.get(V);pe&&(Ue.current.delete(V),ae(()=>{_(he=>he.map($e=>$e.id===pe.taskId&&$e.status==="working"?{...$e,status:"paused"}:$e))},pe.delayAfterResume,V))},[Le,ct,$t,ae]),In=y.useCallback(async V=>{console.log("[MockGrackle] completeTask",V),_(ne=>ne.map(le=>le.id===V?{...le,status:"complete"}:le))},[]),Ni=y.useCallback(async V=>{console.log("[MockGrackle] resumeTask",V)},[]),Ha=y.useCallback(async(V,ne,le,pe,he)=>{console.log("[MockGrackle] updateTask",{taskId:V,title:ne}),_($e=>$e.map(ke=>ke.id===V?{...ke,title:ne.trim()||ke.title,description:le,dependsOn:pe,...he!==void 0?{defaultPersonaId:he}:{}}:ke))},[]),Ci=y.useCallback(async V=>{console.log("[MockGrackle] deleteTask",V),_(ne=>ne.filter(le=>le.id!==V))},[]),Ei=y.useCallback(async V=>{console.log("[MockGrackle] loadFindings",V),k(Lc.filter(ne=>ne.workspaceId===V))},[]),sa=y.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),k([...Lc])},[]),tn=y.useCallback(async V=>{console.log("[MockGrackle] loadFinding",V);const ne=Lc.find(le=>le.id===V);N(ne)},[]),Xn=y.useCallback(async(V,ne,le,pe,he)=>{console.log("[MockGrackle] postFinding",{workspaceId:V,title:ne});const $e={id:pt("find"),workspaceId:V,taskId:"",sessionId:"",category:pe||"general",title:ne,content:le,tags:he||[],createdAt:new Date().toISOString()};k(ke=>[...ke,$e])},[pt]),nn=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),cl=y.useCallback(async(V,ne,le)=>{console.log("[MockGrackle] addEnvironment",{displayName:V,adapterType:ne,adapterConfig:le})},[]),dl=y.useCallback(async(V,ne)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:V,...ne}),i(le=>le.map(pe=>pe.id!==V?pe:{...pe,...ne.displayName!==void 0?{displayName:ne.displayName}:{},...ne.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ne.adapterConfig)}:{}}))},[]),ul=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Va=y.useCallback(async(V,ne,le,pe,he)=>{console.log("[MockGrackle] setToken",{name:V,tokenType:le}),E($e=>[...$e.filter(Re=>Re.name!==V),{name:V,tokenType:le,envVar:pe,filePath:he,expiresAt:""}])},[]),qa=y.useCallback(async V=>{console.log("[MockGrackle] deleteToken",V),E(ne=>ne.filter(le=>le.name!==V))},[]),Ga=y.useCallback(async V=>{console.log("[MockGrackle] updateCredentialProviders",V),A(V)},[]);y.useEffect(()=>()=>{Oe.current.forEach(clearTimeout),Oe.current.clear()},[]);const ws=y.useMemo(()=>({connected:!0,environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:nn,addEnvironment:cl,updateEnvironment:dl,provisionEnvironment:async(V,ne)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:vs},sessions:{sessions:r,sessionsLoading:!1,events:d,eventsDropped:0,lastSpawnedId:p,taskSessions:U,spawn:dt,sendInput:xn,kill:na,stopGraceful:Ss,loadSessionEvents:Ts,clearEvents:us,loadTaskSessions:async V=>{console.log("[MockGrackle] loadTaskSessions",V)},domainHook:vs},workspaces:{workspaces:g,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:ji,archiveWorkspace:Wn,updateWorkspace:async(V,ne)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:V,...ne}),v(le=>le.map(pe=>pe.id!==V?pe:{...pe,...ne.name!==void 0?{name:ne.name}:{},...ne.description!==void 0?{description:ne.description}:{},...ne.repoUrl!==void 0?{repoUrl:ne.repoUrl}:{},...ne.environmentId!==void 0?{environmentId:ne.environmentId}:{},...ne.workingDirectory!==void 0?{workingDirectory:ne.workingDirectory}:{},...ne.useWorktrees!==void 0?{useWorktrees:ne.useWorktrees}:{},...ne.defaultPersonaId!==void 0?{defaultPersonaId:ne.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},domainHook:vs},tasks:{tasks:b,tasksLoading:!1,taskStartingId:void 0,loadTasks:_e,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Qe,startTask:on,stopTask:async V=>{console.log("[MockGrackle] stopTask",{taskId:V}),await In(V)},completeTask:In,resumeTask:Ni,updateTask:Ha,deleteTask:Ci,domainHook:vs},findings:{findings:S,selectedFinding:w,findingLoading:T,findingsLoading:!1,loadFindings:Ei,loadAllFindings:sa,loadFinding:tn,postFinding:Xn,domainHook:vs},tokens:{tokens:C,tokensLoading:!1,loadTokens:ul,setToken:Va,deleteToken:qa,domainHook:vs},credentials:{credentialProviders:B,credentialsLoading:!1,updateCredentialProviders:Ga,domainHook:vs},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:vs},personas:{personas:I,personasLoading:!1,createPersona:async(V,ne,le,pe,he,$e,ke,Re,Ze)=>{console.log("[MockGrackle] createPersona",{name:V});const ut={id:`mock-persona-${Date.now()}`,name:V,description:ne,systemPrompt:le,toolConfig:"{}",runtime:pe??"claude-code",model:he||"",maxTurns:$e||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:ke||"agent",script:Re||"",allowedMcpTools:Ze||[]};return O(Ke=>[...Ke,ut]),ut},updatePersona:async(V,ne,le,pe,he,$e,ke,Re,Ze,ut)=>{console.log("[MockGrackle] updatePersona",{personaId:V,name:ne});const Ke=I.find(At=>At.id===V);if(!Ke)throw new Error(`Persona not found: ${V}`);const Pt=new Date().toISOString(),Kt={...Ke,...ne!==void 0?{name:ne}:{},...le!==void 0?{description:le}:{},...pe!==void 0?{systemPrompt:pe}:{},...he!==void 0?{runtime:he}:{},...$e!==void 0?{model:$e}:{},...ke!==void 0?{maxTurns:ke}:{},...Re!==void 0?{type:Re}:{},...Ze!==void 0?{script:Ze}:{},...ut!==void 0?{allowedMcpTools:ut}:{},updatedAt:Pt};return O(At=>At.map(rn=>rn.id===V?Kt:rn)),Kt},deletePersona:async V=>{console.log("[MockGrackle] deletePersona",V),O(ne=>ne.filter(le=>le.id!==V))},domainHook:vs},knowledge:{graphData:{nodes:te,links:ie},selectedNode:re,loading:!1,selectedId:Z,searchQuery:ue,search:async V=>{if(console.log("[MockGrackle] knowledge.search",V),!V.trim()){de(V);return}de(V);const ne=Ge.current,le=ne?ys.filter(ke=>!ke.workspaceId||ke.workspaceId===ne):ys,pe=V.toLowerCase(),he=le.filter(ke=>{var Re,Ze,ut;return ke.label.toLowerCase().includes(pe)||((Re=ke.content)==null?void 0:Re.toLowerCase().includes(pe))||((Ze=ke.tags)==null?void 0:Ze.some(Ke=>Ke.toLowerCase().includes(pe)))||((ut=ke.category)==null?void 0:ut.toLowerCase().includes(pe))});H(he);const $e=new Set(he.map(ke=>ke.id));Y(Ea.filter(ke=>$e.has(ke.source)&&$e.has(ke.target))),se(void 0),D(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),de("");const V=Ge.current,ne=V?ys.filter(pe=>!pe.workspaceId||pe.workspaceId===V):ys;H(ne);const le=new Set(ne.map(pe=>pe.id));Y(Ea.filter(pe=>le.has(pe.source)&&le.has(pe.target)))},selectNode:async V=>{console.log("[MockGrackle] knowledge.selectNode",V),se(V);const ne=V in $b?$b[V]:void 0;if(ne)D(ne);else{const le=ys.find(pe=>pe.id===V);if(le){const pe=Ea.filter(he=>he.source===V||he.target===V).map(he=>({fromId:he.source,toId:he.target,type:he.type}));D({node:le,edges:pe})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),se(void 0),D(void 0)},expandNode:async V=>{console.log("[MockGrackle] knowledge.expandNode",V),H(ne=>{const le=new Set(ne.map(Re=>Re.id)),pe=Ea.filter(Re=>Re.source===V||Re.target===V),he=new Set;for(const Re of pe)le.has(Re.source)||he.add(Re.source),le.has(Re.target)||he.add(Re.target);if(he.size===0)return ne;const $e=ys.filter(Re=>he.has(Re.id)),ke=new Set([...le,...he]);return Y(Re=>{const Ze=new Set(Re.map(Ke=>`${Ke.source}|${Ke.target}|${Ke.type}`)),ut=Ea.filter(Ke=>ke.has(Ke.source)&&ke.has(Ke.target)&&!Ze.has(`${Ke.source}|${Ke.target}|${Ke.type}`));return ut.length>0?[...Re,...ut]:Re}),[...ne,...$e]})},loadRecent:async V=>{if(console.log("[MockGrackle] knowledge.loadRecent",V),Ge.current=V,V){const ne=ys.filter(pe=>!pe.workspaceId||pe.workspaceId===V);H(ne);const le=new Set(ne.map(pe=>pe.id));Y(Ea.filter(pe=>le.has(pe.source)&&le.has(pe.target)))}else H(ys),Y(Ea);de("")},handleEvent:()=>!1,domainHook:vs},appDefaultPersonaId:P,setAppDefaultPersonaId:async V=>{console.log("[MockGrackle] setAppDefaultPersonaId",V),W(V)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costUsd:1.12,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costUsd:.48,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costUsd:.63,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costUsd:.1,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costUsd:.63,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costUsd:.1,sessionCount:1}},loadUsage:async(V,ne)=>{console.log(`[MockGrackle] loadUsage(${V}, ${ne})`)},refresh:_n}),[s,r,d,p,U,g,b,S,w,C,B,I,P,te,ie,re,Z,ue,dt,xn,na,Ss,Ts,us,ji,Wn,_e,Qe,on,In,Ni,Ha,Ci,Ei,sa,tn,Xn,nn,cl,dl,ul,Va,qa,Ga,_n]);return o.jsx(Jm.Provider,{value:ws,children:t})}const U8=3e3;function $8(t){const[s,i]=y.useState(!1),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;async function g(){var v,b;if(!p){try{const _=Te.streamEvents({});i(!0),Promise.resolve((v=d.current)==null?void 0:v.call(d)).catch(()=>{});for await(const S of _){if(p)break;const k=S.event;if(k.case==="sessionEvent"){const w=k.value;r.current({sessionId:w.sessionId,type:w.type,timestamp:w.timestamp,content:w.content,raw:w.raw})}else if(k.case==="domainEvent"){const w=k.value;c.current({id:w.id,type:w.type,timestamp:w.timestamp,payloadJson:w.payloadJson})}}}catch(_){if(_ instanceof el&&_.code===fT.Unauthenticated){window.location.href=Qj;return}}p||(i(!1),(b=u.current)==null||b.call(u),m=setTimeout(()=>{g().catch(()=>{})},U8))}}return g().catch(()=>{}),()=>{p=!0,clearTimeout(m),i(!1)}},[]),{connected:s}}function P8(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped}}function Vb(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,costUsd:t.costUsd}}function H8(t){return{sessionId:t.sessionId,eventType:i_(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function V8(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,environmentId:t.environmentId,status:pT(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,createdAt:t.createdAt,updatedAt:t.updatedAt}}function qb(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:mT(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}}function yp(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 q8(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function G8(t){return{claude:hT(t.claude),github:Tc(t.github),copilot:Tc(t.copilot),codex:Tc(t.codex),goose:Tc(t.goose)}}function F8(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function bp(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 Z8(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd,sessionCount:t.sessionCount}}function Bc(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 _p(t){return{source:t.fromId,target:t.toId,type:t.type}}function Pa(){const[t,s]=y.useState(!1),i=y.useRef(0),r=y.useCallback(c=>(i.current++,i.current===1&&s(!0),c.finally(()=>{i.current--,i.current===0&&s(!1)})),[]);return{loading:t,track:r}}const Gb=5e3;function Mr(t){return t instanceof el?t.message:"Operation failed"}function K8(){const[t,s]=y.useState([]),{loading:i,track:r}=Pa(),[c,d]=y.useState({}),[u,p]=y.useState(""),m=y.useCallback(()=>{p("")},[]),g=y.useCallback(async()=>{try{const C=await r(Te.listEnvironments({}));s(C.environments.map(P8))}catch{}},[r]),v=y.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const E=C.payload.environmentId;return E&&(s(B=>B.filter(A=>A.id!==E)),d(B=>{const A={...B};return delete A[E],A})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const E=C.payload;if(typeof E.environmentId!="string"||typeof E.stage!="string"||typeof E.message!="string"||typeof E.progress!="number")return M1("environment.provision_progress","invalid payload"),!0;if(d(B=>({...B,[E.environmentId]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"){const B=E.environmentId;setTimeout(()=>{d(A=>{const I={...A};return delete I[B],I})},Gb)}return!0}default:return!1}},[g]),b=y.useCallback(C=>{var E;if(C.type==="environments"){const B=Array.isArray((E=C.payload)==null?void 0:E.environments)?C.payload.environments:[];return s(B),!0}return!1},[]),_=y.useCallback(async(C,E,B)=>{p("");try{await Te.addEnvironment({displayName:C,adapterType:E,adapterConfig:JSON.stringify(B??{})})}catch(A){p(Mr(A))}},[]),S=y.useCallback(async(C,E)=>{p("");try{await Te.updateEnvironment({id:C,displayName:E.displayName,adapterConfig:E.adapterConfig?JSON.stringify(E.adapterConfig):void 0})}catch(B){p(Mr(B))}},[]),k=y.useCallback(async(C,E)=>{p("");try{const B=Te.provisionEnvironment({id:C,force:E??!1});for await(const A of B)d(I=>({...I,[C]:{stage:A.stage,message:A.message,progress:A.progress}})),A.stage==="ready"&&setTimeout(()=>{d(I=>{const O={...I};return delete O[C],O})},Gb)}catch(B){d(A=>{const I={...A};return delete I[C],I}),p(Mr(B))}},[]),w=y.useCallback(async C=>{p("");try{await Te.stopEnvironment({id:C})}catch(E){p(Mr(E))}},[]),N=y.useCallback(async C=>{p("");try{await Te.removeEnvironment({id:C})}catch(E){p(Mr(E))}},[]);return{environments:t,environmentsLoading:i,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:g,addEnvironment:_,updateEnvironment:S,provisionEnvironment:k,stopEnvironment:w,removeEnvironment:N,handleEvent:v,handleLegacyMessage:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const xp=new Set(["pending","running","idle"]),Y8=new Set(["completed","failed","interrupted","hibernating","suspended"]),Fb=["pending","running","idle"];function J8(){const[t,s]=y.useState([]),{loading:i,track:r}=Pa(),[c,d]=y.useState([]),[u,p]=y.useState(0),[m,g]=y.useState(void 0),[v,b]=y.useState({}),_=y.useCallback(async()=>{try{const P=(await r(Te.listSessions({}))).sessions.map(Vb);s(W=>{const te=new Map(W.map(H=>[H.id,H]));return P.map(H=>{const ie=te.get(H.id),Y=ie==null?void 0:ie.status;return!Y||Y===H.status?H:Y8.has(Y)&&xp.has(H.status)?{...H,status:Y,...ie.endReason!==void 0?{endReason:ie.endReason}:{}}:xp.has(Y)&&xp.has(H.status)&&Fb.indexOf(Y)>Fb.indexOf(H.status)?{...H,status:Y}:H})})}catch{}},[r]),S=y.useCallback(U=>{if(U.type!=="session_event")return!1;if(!f8(U.payload))return M1("session_event","payload is not a valid SessionEvent"),!0;const P=U.payload;let W=0;if(d(te=>{const H=[...te,P];return H.length>go?(W=H.length-go,H.slice(-go)):H}),W>0&&p(te=>te+W),P.eventType==="usage")try{const te=JSON.parse(P.content),H=Number(te.input_tokens)||0,ie=Number(te.output_tokens)||0,Y=Number(te.cost_usd)||0;(H>0||ie>0||Y>0)&&s(re=>re.map(D=>D.id===P.sessionId?{...D,inputTokens:(D.inputTokens??0)+H,outputTokens:(D.outputTokens??0)+ie,costUsd:(D.costUsd??0)+Y}:D))}catch{}if(P.eventType==="status"){const te=I1(P.content),H=O1(P.content);s(ie=>ie.some(re=>re.id===P.sessionId)?ie.map(re=>re.id===P.sessionId?{...re,status:te,...H!==void 0?{endReason:H}:{}}:re):[...ie,{id:P.sessionId,environmentId:"",runtime:"",status:te,prompt:"",startedAt:P.timestamp,...H!==void 0?{endReason:H}:{}}])}return!0},[]),k=y.useCallback(U=>{S({type:"session_event",payload:U})},[S]),w=y.useCallback(U=>{var P,W,te,H,ie;switch(U.type){case"sessions":{const Y=Array.isArray((P=U.payload)==null?void 0:P.sessions)?U.payload.sessions:[];return s(Y),!0}case"spawned":{const Y=(W=U.payload)==null?void 0:W.sessionId;return typeof Y=="string"&&Y&&g(Y),_().catch(()=>{}),!0}case"session_events":{const Y=Array.isArray((te=U.payload)==null?void 0:te.events)?U.payload.events:[];return Y.length>0&&d(Y),!0}case"task_sessions":{const Y=(H=U.payload)==null?void 0:H.taskId;if(typeof Y=="string"&&Y){const re=Array.isArray((ie=U.payload)==null?void 0:ie.sessions)?U.payload.sessions:[];b(D=>({...D,[Y]:re}))}return!0}default:return!1}},[_]),N=y.useCallback(async(U,P,W,te)=>{try{const H=await Te.spawnAgent({environmentId:U,prompt:P,personaId:W||"",workingDirectory:te||""});g(H.id),await _()}catch{}},[_]),T=y.useCallback(async(U,P)=>{try{await Te.sendInput({sessionId:U,text:P})}catch{}},[]),C=y.useCallback(async U=>{try{await Te.killAgent({id:U,graceful:!1})}catch{}},[]),E=y.useCallback(async U=>{try{await Te.killAgent({id:U,graceful:!0})}catch{}},[]),B=y.useCallback(async U=>{try{const W=(await Te.getSessionEvents({id:U})).events.map(H8);if(W.length>0){let te=0;d(H=>{const ie=new Set;for(const D of H)D.sessionId===U&&ie.add(`${D.timestamp}|${D.eventType}`);const Y=W.filter(D=>!ie.has(`${D.timestamp}|${D.eventType}`)),re=[...H,...Y].sort((D,Z)=>D.sessionId!==Z.sessionId?0:D.timestamp.localeCompare(Z.timestamp));return re.length>go?(te=re.length-go,re.slice(-go)):re}),te>0&&p(H=>H+te)}}catch{}},[]),A=y.useCallback(()=>{d([]),p(0)},[]),I=y.useCallback(async U=>{try{const W=(await Te.getTaskSessions({id:U})).sessions.map(Vb);b(te=>({...te,[U]:W}))}catch{}},[]);return{sessions:t,sessionsLoading:i,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:_,spawn:N,sendInput:T,kill:C,stopGraceful:E,loadSessionEvents:B,clearEvents:A,loadTaskSessions:I,handleMessage:S,handleSessionEvent:k,handleLegacyMessage:w,domainHook:{onConnect:()=>_(),onDisconnect:()=>{A()},handleEvent:()=>!1}}}function W8(){const[t,s]=y.useState([]),{loading:i,track:r}=Pa(),[c,d]=y.useState(!1),u=y.useCallback(async()=>{try{const S=await r(Te.listWorkspaces({}));s(S.workspaces.map(V8))}catch{}},[r]),p=y.useCallback(S=>{switch(S.type){case"workspace.created":return d(!1),u().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return u().catch(()=>{}),!0;default:return!1}},[u]),m=y.useCallback(()=>{d(!1)},[]),g=y.useCallback(async(S,k,w,N,T,C,E,B,A)=>{d(!0);try{await Te.createWorkspace({name:S,description:k||"",repoUrl:w||"",environmentId:N||"",defaultPersonaId:T||void 0,useWorktrees:C??!0,workingDirectory:E||void 0}),d(!1),B==null||B()}catch(I){d(!1);const O=I instanceof el?I.message:"Failed to create workspace";A==null||A(O)}},[]),v=y.useCallback(async S=>{try{await Te.archiveWorkspace({id:S})}catch{}},[]),b=y.useCallback(async(S,k)=>{try{await Te.updateWorkspace({id:S,...k})}catch{}},[]);return{workspaces:t,workspacesLoading:i,workspaceCreating:c,loadWorkspaces:u,createWorkspace:g,archiveWorkspace:v,updateWorkspace:b,handleEvent:p,onDisconnect:m,domainHook:{onConnect:()=>u(),onDisconnect:m,handleEvent:p}}}function X8(){const[t,s]=y.useState([]),{loading:i,track:r}=Pa(),[c,d]=y.useState(void 0),u=y.useRef({}),p=y.useCallback(async A=>{try{const O=(await Te.listTasks({workspaceId:A})).tasks.map(qb);s(U=>[...U.filter(P=>P.workspaceId!==A),...O])}catch{}},[]),m=y.useCallback(async()=>{try{const I=(await r(Te.listTasks({}))).tasks.map(qb);s(O=>{const U=new Set(I.map(P=>P.id));return[...O.filter(P=>!U.has(P.id)),...I]})}catch{}},[r]),g=y.useCallback((A,I)=>{const O=U=>{clearTimeout(u.current[U]),u.current[U]=setTimeout(()=>{delete u.current[U],p(U).catch(()=>{})},200)};A?O(A):I&&s(U=>{const P=U.find(W=>W.id===I);return P!=null&&P.workspaceId?O(P.workspaceId):m().catch(()=>{}),U})},[p,m]),v=y.useCallback(A=>{const I=A.payload;switch(A.type){case"task.created":{const O=typeof I.workspaceId=="string"?I.workspaceId:"";return O&&p(O).catch(()=>{}),!0}case"task.started":{const O=typeof I.taskId=="string"?I.taskId:"",U=typeof I.sessionId=="string"?I.sessionId:"",P=typeof I.workspaceId=="string"?I.workspaceId:"";return d(W=>O&&W===O?void 0:W),U&&O&&s(W=>W.map(te=>te.id===O?{...te,latestSessionId:U}:te)),g(P,O),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const O=typeof I.workspaceId=="string"?I.workspaceId:"",U=typeof I.taskId=="string"?I.taskId:"";return g(O,U),!0}default:return!1}},[p,g]),b=y.useCallback(()=>{d(void 0)},[]),_=y.useCallback(A=>{var I,O;if(A.type==="tasks"){const U=Array.isArray((I=A.payload)==null?void 0:I.tasks)?A.payload.tasks:[],P=typeof((O=A.payload)==null?void 0:O.workspaceId)=="string"&&A.payload.workspaceId?A.payload.workspaceId:"";return s(P?W=>[...W.filter(te=>te.workspaceId!==P),...U]:W=>{const te=new Set(U.map(H=>H.id));return[...W.filter(H=>!te.has(H.id)),...U]}),!0}return!1},[]),S=y.useCallback(async(A,I,O,U,P,W,te,H,ie)=>{try{await Te.createTask({workspaceId:A,title:I,description:O||"",dependsOn:U||[],parentTaskId:P||"",defaultPersonaId:W||void 0,canDecompose:te??void 0}),H==null||H()}catch(Y){const re=Y instanceof el?Y.message:"Failed to create task";ie==null||ie(re)}},[]),k=y.useCallback(async(A,I,O,U)=>{d(A);try{await Te.startTask({taskId:A,personaId:I||"",environmentId:O||"",notes:U||""})}catch{d(void 0)}},[]),w=y.useCallback(async A=>{try{await Te.stopTask({id:A})}catch{}},[]),N=y.useCallback(async A=>{try{await Te.completeTask({id:A})}catch{}},[]),T=y.useCallback(async A=>{try{await Te.resumeTask({id:A})}catch{}},[]),C=y.useCallback(async(A,I,O,U,P)=>{try{await Te.updateTask({id:A,title:I,description:O,dependsOn:U,...P!==void 0?{defaultPersonaId:P}:{}})}catch{}},[]),E=y.useCallback(async A=>{try{await Te.deleteTask({id:A})}catch{}},[]);return{tasks:t,tasksLoading:i,taskStartingId:c,loadTasks:p,loadAllTasks:m,createTask:S,startTask:k,stopTask:w,completeTask:N,resumeTask:T,updateTask:C,deleteTask:E,handleEvent:v,onDisconnect:b,handleLegacyMessage:_,domainHook:{onConnect:()=>m(),onDisconnect:b,handleEvent:v}}}function Q8(){const[t,s]=y.useState([]),[i,r]=y.useState(void 0),[c,d]=y.useState(!1),{loading:u,track:p}=Pa(),m=y.useCallback(async k=>{try{const w=await p(Te.queryFindings({workspaceId:k}));s(w.findings.map(yp))}catch{}},[p]),g=y.useCallback(async()=>{try{const k=await p(Te.queryFindings({workspaceId:""}));s(k.findings.map(yp))}catch{}},[p]),v=y.useCallback(async k=>{r(void 0),d(!0);try{const w=await Te.getFinding({id:k});r(yp(w))}catch{r(void 0)}finally{d(!1)}},[]),b=y.useCallback(k=>{if(k.type==="finding.posted"){const w=typeof k.payload.workspaceId=="string"?k.payload.workspaceId:"";return w&&m(w).catch(()=>{}),!0}return!1},[m]),_=y.useCallback(async(k,w,N,T,C)=>{try{await Te.postFinding({workspaceId:k,title:w,content:N,category:T??"general",tags:C??[]})}catch{}},[]);return{findings:t,selectedFinding:i,findingLoading:c,findingsLoading:u,loadFindings:m,loadAllFindings:g,loadFinding:v,postFinding:_,handleEvent:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:b}}}function ez(){const[t,s]=y.useState([]),{loading:i,track:r}=Pa(),c=y.useCallback(async()=>{try{const g=await r(Te.listTokens({}));s(g.tokens.map(q8))}catch{}},[r]),d=y.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(g,v,b,_,S)=>{try{await Te.setToken({name:g,value:v,type:b,envVar:_,filePath:S})}catch{}},[]),p=y.useCallback(async g=>{try{await Te.deleteToken({name:g})}catch{}},[]);return{tokens:t,tokensLoading:i,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function tz(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:i,track:r}=Pa(),c=y.useCallback(async()=>{try{const m=await r(Te.getCredentialProviders({}));s(G8(m))}catch{}},[r]),d=y.useCallback(m=>m.type==="credential.providers_changed"?(m8(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:b})=>Te.setCredentialProvider({provider:v,value:b})))},[]);return{credentialProviders:t,credentialsLoading:i,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function nz(){const[t,s]=y.useState([]),[i,r]=y.useState(""),[c,d]=y.useState(""),[u,p]=y.useState(!1),m=y.useCallback(async()=>{try{const b=await Te.listCodespaces({});s(b.codespaces.map(F8)),d(b.error)}catch{}},[]),g=y.useCallback(async(b,_)=>{p(!0),r("");try{await Te.createCodespace({repo:b,machine:_??""}),p(!1),await m()}catch(S){p(!1);const k=S instanceof el?S.message:"Failed to create codespace";r(k)}},[m]);return{codespaces:t,codespaceError:i,codespaceListError:c,codespaceCreating:u,listCodespaces:m,createCodespace:g,domainHook:{onConnect:()=>m(),onDisconnect:()=>{},handleEvent:()=>!1}}}function sz(){const[t,s]=y.useState([]),{loading:i,track:r}=Pa(),c=y.useCallback(async()=>{try{const v=await r(Te.listPersonas({}));s(v.personas.map(bp))}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,b,_,S,k,w,N,T,C)=>{const E=await Te.createPersona({name:v,description:b,systemPrompt:_,runtime:S||"",model:k||"",maxTurns:w||0,type:N||"agent",script:T||"",allowedMcpTools:C||[]}),B=bp(E);return s(A=>[...A.filter(I=>I.id!==B.id),B]),B},[]),p=y.useCallback(async(v,b,_,S,k,w,N,T,C,E)=>{const B={id:v};b!==void 0&&(B.name=b),_!==void 0&&(B.description=_),S!==void 0&&(B.systemPrompt=S),k!==void 0&&(B.runtime=k),w!==void 0&&(B.model=w),N!==void 0&&(B.maxTurns=N),T!==void 0&&(B.type=T),C!==void 0&&(B.script=C),E!==void 0&&(B.allowedMcpTools={tools:E});const A=await Te.updatePersona(B),I=bp(A);return s(O=>O.map(U=>U.id===I.id?I:U)),I},[]),m=y.useCallback(async v=>{await Te.deletePersona({id:v}),s(b=>b.filter(_=>_.id!==v))},[]);return{personas:t,personasLoading:i,loadPersonas:c,createPersona:u,updatePersona:p,deletePersona:m,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function az(t){if(t)try{return JSON.parse(t)}catch{return}}function iz(){const[t,s]=y.useState(new Map),[i,r]=y.useState([]),[c,d]=y.useState(void 0),[u,p]=y.useState(void 0),[m,g]=y.useState(!1),[v,b]=y.useState(""),_=y.useRef(""),S=y.useCallback(async A=>{const I=A??"";_.current=I,b(""),g(!0);try{const O=await Te.listRecentKnowledgeNodes({limit:30,workspaceId:I}),U=new Map,P=[];for(const W of O.nodes)U.set(W.id,Bc(W));for(const W of O.edges)P.push(_p(W));for(const W of P){const te=U.get(W.source);te&&(te.val+=1);const H=U.get(W.target);H&&(H.val+=1)}s(U),r(P)}catch{}finally{g(!1)}},[]),k=y.useCallback(async A=>{if(A.trim()){b(A),p(void 0),d(void 0),g(!0);try{const I=await Te.searchKnowledge({query:A,limit:20,workspaceId:_.current}),O=new Map,U=[];for(const P of I.results){P.node&&O.set(P.node.id,Bc(P.node,P.edges.length));for(const W of P.edges)U.push(_p(W))}s(O),r(U)}catch{}finally{g(!1)}}},[]),w=y.useCallback(()=>{S(_.current).catch(()=>{})},[S]),N=y.useCallback(async A=>{p(A);try{const I=await Te.getKnowledgeNode({id:A});if(!I.node){d(void 0);return}d({node:Bc(I.node,I.edges.length),edges:I.edges.map(O=>({fromId:O.fromId,toId:O.toId,type:O.type,metadata:az(O.metadataJson)}))})}catch{d(void 0)}},[]),T=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async A=>{try{const I=await Te.expandKnowledgeNode({id:A,depth:1});s(O=>{const U=new Map(O);for(const P of I.nodes)U.has(P.id)||U.set(P.id,Bc(P));return U}),r(O=>{const U=new Set(O.map(W=>`${W.source}:${W.target}:${W.type}`)),P=[];for(const W of I.edges){const te=_p(W),H=`${te.source}:${te.target}:${te.type}`;U.has(H)||P.push(te)}return[...O,...P]})}catch{}},[]),E=y.useCallback(A=>!1,[]),B={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:E};return{graphData:{nodes:[...t.values()],links:i},selectedNode:c,selectedId:u,loading:m,searchQuery:v,search:k,clearSearch:w,selectNode:N,clearSelection:T,expandNode:C,loadRecent:S,handleEvent:E,domainHook:B}}function oz(){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 rz(){const[t,s]=y.useState(""),[i,r]=y.useState(void 0),[c,d]=y.useState({}),u=K8(),p=J8(),m=W8(),g=X8(),v=Q8(),b=ez(),_=tz(),S=nz(),k=sz(),w=iz(),N=oz(),T=[u.domainHook,p.domainHook,m.domainHook,g.domainHook,v.domainHook,b.domainHook,_.domainHook,S.domainHook,k.domainHook,w.domainHook,N.domainHook],{connected:C}=$8({onSessionEvent:H=>{p.handleSessionEvent({sessionId:H.sessionId,eventType:i_(H.type),timestamp:H.timestamp,content:H.content,raw:H.raw||void 0})},onDomainEvent:H=>{try{const ie=JSON.parse(H.payloadJson);U({id:H.id,type:H.type,timestamp:H.timestamp,payload:ie})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",H.payloadJson)}},onConnect:P,onDisconnect:W}),E="default_persona_id",B="onboarding_completed",A=y.useCallback(async H=>{const ie=await Te.setSetting({key:E,value:H});s(ie.value)},[]),I=y.useCallback(async()=>{r(!0);try{await Te.setSetting({key:B,value:"true"})}catch{}},[]),O=y.useCallback(async(H,ie)=>{try{const Y=await Te.getUsage({scope:H,id:ie}),re=`${H}:${ie}`;d(D=>({...D,[re]:Z8(Y)}))}catch{}},[]);function U(H){const ie=H.payload.key,Y=H.payload.value;if(H.type==="setting.changed"){ie===E&&s(Y??""),ie===B&&r(Y==="true");return}for(const re of T)if(re.handleEvent(H))break;(H.type==="environment.removed"||H.type==="environment.changed"||H.type==="task.started")&&p.loadSessions().catch(()=>{})}async function P(){for(const H of T)H.onConnect().catch(()=>{});try{const H=await Te.getSetting({key:E});s(H.value)}catch{}try{const H=await Te.getSetting({key:B});r(H.value==="true")}catch{}}function W(){T.forEach(H=>H.onDisconnect())}const te=y.useCallback(()=>{u.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),m.loadWorkspaces().catch(()=>{}),b.loadTokens().catch(()=>{})},[u.loadEnvironments,p.loadSessions,m.loadWorkspaces,b.loadTokens]);return{connected:C,environments:{environments:u.environments,environmentsLoading:u.environmentsLoading,provisionStatus:u.provisionStatus,operationError:u.operationError,clearOperationError:u.clearOperationError,loadEnvironments:u.loadEnvironments,addEnvironment:u.addEnvironment,updateEnvironment:u.updateEnvironment,provisionEnvironment:u.provisionEnvironment,stopEnvironment:u.stopEnvironment,removeEnvironment:u.removeEnvironment,domainHook:u.domainHook},sessions:{sessions:p.sessions,sessionsLoading:p.sessionsLoading,events:p.events,eventsDropped:p.eventsDropped,lastSpawnedId:p.lastSpawnedId,taskSessions:p.taskSessions,spawn:p.spawn,sendInput:p.sendInput,kill:p.kill,stopGraceful:p.stopGraceful,loadSessionEvents:p.loadSessionEvents,clearEvents:p.clearEvents,loadTaskSessions:p.loadTaskSessions,domainHook:p.domainHook},workspaces:{workspaces:m.workspaces,workspacesLoading:m.workspacesLoading,workspaceCreating:m.workspaceCreating,loadWorkspaces:m.loadWorkspaces,createWorkspace:m.createWorkspace,archiveWorkspace:m.archiveWorkspace,updateWorkspace:m.updateWorkspace,domainHook:m.domainHook},tasks:{tasks:g.tasks,tasksLoading:g.tasksLoading,taskStartingId:g.taskStartingId,loadTasks:g.loadTasks,loadAllTasks:g.loadAllTasks,createTask:g.createTask,startTask:g.startTask,stopTask:g.stopTask,completeTask:g.completeTask,resumeTask:g.resumeTask,updateTask:g.updateTask,deleteTask:g.deleteTask,domainHook:g.domainHook},findings:{findings:v.findings,selectedFinding:v.selectedFinding,findingLoading:v.findingLoading,findingsLoading:v.findingsLoading,loadFindings:v.loadFindings,loadAllFindings:v.loadAllFindings,loadFinding:v.loadFinding,postFinding:v.postFinding,domainHook:v.domainHook},tokens:{tokens:b.tokens,tokensLoading:b.tokensLoading,loadTokens:b.loadTokens,setToken:b.setToken,deleteToken:b.deleteToken,domainHook:b.domainHook},credentials:{credentialProviders:_.credentialProviders,credentialsLoading:_.credentialsLoading,updateCredentialProviders:_.updateCredentialProviders,domainHook:_.domainHook},codespaces:{codespaces:S.codespaces,codespaceError:S.codespaceError,codespaceListError:S.codespaceListError,codespaceCreating:S.codespaceCreating,listCodespaces:S.listCodespaces,createCodespace:S.createCodespace,domainHook:S.domainHook},personas:{personas:k.personas,personasLoading:k.personasLoading,createPersona:k.createPersona,updatePersona:k.updatePersona,deletePersona:k.deletePersona,domainHook:k.domainHook},knowledge:w,appDefaultPersonaId:t,setAppDefaultPersonaId:A,onboardingCompleted:i,completeOnboarding:I,usageCache:c,loadUsage:O,refresh:te}}function lz({children:t}){const s=rz();return o.jsx(Jm.Provider,{value:s,children:t})}function cz(t,s){const i=y.useRef(null);y.useEffect(()=>{const r=i.current;if(i.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 dz(t,s,i){const r=y.useRef(t);y.useEffect(()=>{t&&t!==r.current&&(i(t,"error"),s()),r.current=t},[t,s,i])}const uz={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 fz(t){return uz[t]}function pz(t,s){if(t===void 0)return[];const i=[],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=fz(d.status);p&&i.push(p)}for(const d of t)c.has(d.id)||i.push({message:"Task deleted",variant:"info"});return i}function mz(t,s){const i=y.useRef(void 0);y.useEffect(()=>{const r=i.current;i.current=t;const c=pz(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const hz="_dashboard_16pzm_1",gz="_kpiStrip_16pzm_11",vz="_kpiCard_16pzm_23",yz="_kpiValue_16pzm_68",bz="_kpiLabel_16pzm_76",_z="_bodyGrid_16pzm_84",xz="_section_16pzm_96",kz="_sectionHeader_16pzm_109",Sz="_sectionIcon_16pzm_118",Tz="_sectionTitle_16pzm_123",wz="_sectionCount_16pzm_131",jz="_sectionBody_16pzm_138",Nz="_emptyHint_16pzm_143",Cz="_sessionRow_16pzm_150",Ez="_sessionPrompt_16pzm_177",Az="_sessionEnv_16pzm_186",Dz="_sessionRuntime_16pzm_192",Rz="_sessionStatus_16pzm_198",Mz="_statusDot_16pzm_207",Iz="_attentionRow_16pzm_233",Oz="_attentionTitle_16pzm_259",Lz="_attentionMeta_16pzm_267",Bz="_reasonBadge_16pzm_274",zz="_bottomGrid_16pzm_301",Uz="_envRow_16pzm_312",$z="_envName_16pzm_323",Pz="_envStatusBadge_16pzm_333",Hz="_workspaceRow_16pzm_369",Vz="_workspaceTop_16pzm_395",qz="_workspaceName_16pzm_401",Gz="_workspaceCounts_16pzm_407",Fz="_progressBar_16pzm_415",Zz="_progressFill_16pzm_422",ce={dashboard:hz,kpiStrip:gz,kpiCard:vz,kpiValue:yz,kpiLabel:bz,bodyGrid:_z,section:xz,sectionHeader:kz,sectionIcon:Sz,sectionTitle:Tz,sectionCount:wz,sectionBody:jz,emptyHint:Nz,sessionRow:Cz,sessionPrompt:Ez,sessionEnv:Az,sessionRuntime:Dz,sessionStatus:Rz,statusDot:Mz,attentionRow:Iz,attentionTitle:Oz,attentionMeta:Lz,reasonBadge:Bz,bottomGrid:zz,envRow:Uz,envName:$z,envStatusBadge:Pz,workspaceRow:Hz,workspaceTop:Vz,workspaceName:qz,workspaceCounts:Gz,progressBar:Fz,progressFill:Zz};function Kz(){return o.jsxs("div",{className:ce.dashboard,"aria-hidden":"true",children:[o.jsx("div",{className:ce.kpiStrip,children:Array.from({length:4},(t,s)=>o.jsxs("div",{className:ce.kpiCard,children:[o.jsx(xe,{width:"3rem",height:"2rem"}),o.jsx(xe,{width:"80%",height:"0.75rem"})]},s))}),o.jsxs("div",{className:ce.bodyGrid,children:[o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"8rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:3},(t,s)=>o.jsxs("div",{className:ce.sessionRow,style:{cursor:"default"},children:[o.jsx(xe,{width:"60%",height:"0.875rem"}),o.jsx(xe,{width:"4rem",height:"0.75rem"}),o.jsx(xe,{width:"3rem",height:"0.75rem"}),o.jsx(xe,{width:"3rem",height:"0.75rem"})]},s))})]}),o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"8rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:2},(t,s)=>o.jsxs("div",{className:ce.attentionRow,style:{cursor:"default"},children:[o.jsxs("div",{className:ce.attentionTitle,children:[o.jsx(xe,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"70%",height:"0.875rem"})]}),o.jsx("div",{className:ce.attentionMeta,children:o.jsx(xe,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),o.jsxs("div",{className:ce.bottomGrid,children:[o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"9rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:2},(t,s)=>o.jsxs("div",{className:ce.envRow,children:[o.jsx(xe,{width:"60%",height:"0.875rem"}),o.jsx(xe,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"6rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:2},(t,s)=>o.jsxs("div",{className:ce.workspaceRow,style:{cursor:"default"},children:[o.jsxs("div",{className:ce.workspaceTop,children:[o.jsx(xe,{width:"50%",height:"0.875rem"}),o.jsx(xe,{width:"2rem",height:"0.75rem"})]}),o.jsx("div",{className:ce.progressBar,children:o.jsx("div",{className:ce.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const Yz={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},zc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function Jz(t,s,i,r){const c=[`${t} of ${s} tasks completed`];return i>0&&c.push(`${i} in progress`),r>0&&c.push(`${r} failed`),c.join(", ")}function Uc({value:t,label:s,accent:i,index:r,testId:c}){return o.jsxs(Et.div,{className:ce.kpiCard,"data-accent":i,"data-testid":c,variants:Yz,initial:"hidden",animate:"visible",custom:r,children:[o.jsx("span",{className:ce.kpiValue,children:t}),o.jsx("span",{className:ce.kpiLabel,children:s})]})}function Wz(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:i,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:p,environmentsLoading:m}}=lt(),g=xt(),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 b=y.useMemo(()=>w8(d,i,p),[d,i,p]),_=y.useMemo(()=>N8(d,p),[d,p]),S=y.useMemo(()=>j8(i,t),[i,t]),k=y.useMemo(()=>C8(t,i),[t,i,p]);return d.length===0&&i.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?o.jsx(Kz,{}):o.jsxs("div",{className:ce.dashboard,"data-testid":"dashboard",children:[o.jsxs("div",{className:ce.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[o.jsx(Uc,{value:b.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),o.jsx(Uc,{value:b.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),o.jsx(Uc,{value:b.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),o.jsx(Uc,{value:b.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),o.jsxs("div",{className:ce.bodyGrid,children:[o.jsxs(Et.div,{className:ce.section,variants:zc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"●"}),o.jsx("span",{className:ce.sectionTitle,children:"Active Sessions"}),o.jsx("span",{className:ce.sectionCount,children:_.length})]}),o.jsx("div",{className:ce.sectionBody,children:_.length===0?o.jsx("div",{className:ce.emptyHint,children:"No active sessions"}):_.map(({session:N,environmentName:T})=>o.jsxs("button",{type:"button",className:ce.sessionRow,onClick:()=>g(um(N.id)),"data-testid":"session-row",children:[o.jsx("span",{className:ce.sessionPrompt,title:N.prompt,children:N.prompt||"—"}),o.jsx("span",{className:ce.sessionEnv,children:T}),o.jsx("span",{className:ce.sessionRuntime,children:N.runtime}),o.jsxs("span",{className:ce.sessionStatus,children:[o.jsx("span",{className:ce.statusDot,"data-status":N.status}),N.status]})]},N.id))})]}),o.jsxs(Et.div,{className:ce.section,variants:zc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"⚑"}),o.jsx("span",{className:ce.sectionTitle,children:"Needs Attention"}),o.jsx("span",{className:ce.sectionCount,children:S.length})]}),o.jsx("div",{className:ce.sectionBody,children:S.length===0?o.jsx("div",{className:ce.emptyHint,children:"All clear"}):S.map(({task:N,reason:T,workspaceName:C})=>o.jsxs("button",{type:"button",className:ce.attentionRow,onClick:()=>g(Dn(N.id)),"data-testid":"attention-row",children:[o.jsxs("div",{className:ce.attentionTitle,children:[o.jsx("span",{className:ce.reasonBadge,"data-reason":T,children:T}),N.title]}),o.jsx("div",{className:ce.attentionMeta,children:o.jsx("span",{children:C})})]},N.id))})]})]}),o.jsxs("div",{className:ce.bottomGrid,children:[o.jsxs(Et.div,{className:ce.section,variants:zc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"◈"}),o.jsx("span",{className:ce.sectionTitle,children:"Environment Health"}),o.jsx("span",{className:ce.sectionCount,children:p.length})]}),o.jsx("div",{className:ce.sectionBody,children:p.length===0?o.jsx("div",{className:ce.emptyHint,children:"No environments configured"}):p.map(N=>o.jsxs("div",{className:ce.envRow,"data-testid":"dashboard-env-row",children:[o.jsx("span",{className:ce.envName,children:N.displayName}),o.jsx("span",{className:ce.envStatusBadge,"data-status":N.status,children:N.status})]},N.id))})]}),o.jsxs(Et.div,{className:ce.section,variants:zc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"▦"}),o.jsx("span",{className:ce.sectionTitle,children:"Workspaces"}),o.jsx("span",{className:ce.sectionCount,children:t.length})]}),o.jsx("div",{className:ce.sectionBody,children:k.length===0?o.jsx("div",{className:ce.emptyHint,children:"No workspaces yet"}):k.map(({workspace:N,totalTasks:T,completedTasks:C,workingTasks:E,failedTasks:B})=>{const A=T>0?Math.round(C/T*100):0;return o.jsxs("button",{type:"button",className:ce.workspaceRow,onClick:()=>g(yi(N.id,N.environmentId)),"data-testid":"workspace-row",children:[o.jsxs("div",{className:ce.workspaceTop,children:[o.jsx("span",{className:ce.workspaceName,children:N.name}),o.jsxs("span",{className:ce.workspaceCounts,"aria-label":Jz(C,T,E,B),children:[C,"/",T,E>0&&o.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",E]}),B>0&&o.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",B]})]})]}),T>0&&o.jsx("div",{className:ce.progressBar,children:o.jsx("div",{className:ce.progressFill,style:{width:`${A}%`}})})]},N.id)})})]})]})]})}const Xz="_panelContainer_101ly_1",Qz="_emptyState_101ly_8",e7="_fadeIn_101ly_1",t7="_workspaceSummary_101ly_17",n7="_workspaceSummaryTitle_101ly_28",s7="_workspaceSummarySubtitle_101ly_32",a7="_header_101ly_36",i7="_headerInfo_101ly_71",o7="_killButton_101ly_77",r7="_headerTitle_101ly_106",l7="_headerActions_101ly_121",c7="_taskStatusBadge_101ly_128",d7="_taskBranch_101ly_137",u7="_taskBlockedBadge_101ly_143",f7="_btnPrimary_101ly_151",p7="_btnDanger_101ly_182",m7="_btnGhost_101ly_221",h7="_rejectInput_101ly_247",g7="_tabBar_101ly_277",v7="_tab_101ly_277",y7="_active_101ly_303",b7="_eventScroll_101ly_308",_7="_tabContent_101ly_314",x7="_noContext_101ly_319",k7="_overviewContent_101ly_325",S7="_overviewDashboard_101ly_334",T7="_overviewHero_101ly_340",w7="_statusBadge_101ly_347",j7="_statusPending_101ly_359",N7="_statusAssigned_101ly_364",C7="_statusInProgress_101ly_369",E7="_statusReview_101ly_374",A7="_statusDone_101ly_379",D7="_statusFailed_101ly_384",R7="_statusWaitingInput_101ly_389",M7="_overviewBranchPill_101ly_394",I7="_branchLink_101ly_409",O7="_overviewSection_101ly_420",L7="_overviewLabel_101ly_426",B7="_overviewValue_101ly_433",z7="_overviewMuted_101ly_438",U7="_overviewMarkdown_101ly_444",$7="_envRow_101ly_513",P7="_envDot_101ly_519",H7="_envDotGreen_101ly_526",V7="_envDotYellow_101ly_530",q7="_envDotRed_101ly_534",G7="_envDotGray_101ly_538",F7="_depList_101ly_542",Z7="_depItem_101ly_548",K7="_depBlocked_101ly_555",Y7="_depDone_101ly_559",J7="_timeline_101ly_563",W7="_timelineRow_101ly_569",X7="_timelineKey_101ly_576",Q7="_timelineValue_101ly_582",eU="_timelineDelta_101ly_586",tU="_reviewNotes_101ly_597",nU="_overviewDescription_101ly_608",sU="_waitingMessage_101ly_614",aU="_errorMessage_101ly_618",iU="_attemptSelector_101ly_622",oU="_attemptLabel_101ly_638",rU="_attemptButton_101ly_642",lU="_attemptActive_101ly_659",cU="_attemptStatus_101ly_665",dU="_emptyCta_101ly_671",uU="_ctaTitle_101ly_683",fU="_ctaDescription_101ly_689",pU="_ctaButton_101ly_696",mU="_ctaCreateForm_101ly_731",hU="_ctaCreateInput_101ly_737",gU="_ctaCreateOk_101ly_768",vU="_ctaLink_101ly_803",yU="_workspaceHeader_101ly_817",bU="_workspaceName_101ly_842",_U="_workspaceMeta_101ly_855",xU="_metaRow_101ly_863",kU="_metaLabel_101ly_876",SU="_metaValue_101ly_891",TU="_archiveButton_101ly_901",wU="_repoLink_101ly_931",jU="_metaToggle_101ly_941",NU="_metaToggleArrow_101ly_962",CU="_metaToggleArrowOpen_101ly_967",EU="_progressBarContainer_101ly_971",AU="_progressBar_101ly_971",DU="_progressFill_101ly_987",RU="_progressLabel_101ly_994",MU="_metaTimestamps_101ly_1001",IU="_metaTimestamp_101ly_1001",L={panelContainer:Xz,emptyState:Qz,fadeIn:e7,workspaceSummary:t7,workspaceSummaryTitle:n7,workspaceSummarySubtitle:s7,header:a7,headerInfo:i7,killButton:o7,headerTitle:r7,headerActions:l7,taskStatusBadge:c7,taskBranch:d7,taskBlockedBadge:u7,btnPrimary:f7,btnDanger:p7,btnGhost:m7,rejectInput:h7,tabBar:g7,tab:v7,active:y7,eventScroll:b7,tabContent:_7,noContext:x7,overviewContent:k7,overviewDashboard:S7,overviewHero:T7,statusBadge:w7,statusPending:j7,statusAssigned:N7,statusInProgress:C7,statusReview:E7,statusDone:A7,statusFailed:D7,statusWaitingInput:R7,overviewBranchPill:M7,branchLink:I7,overviewSection:O7,overviewLabel:L7,overviewValue:B7,overviewMuted:z7,overviewMarkdown:U7,envRow:$7,envDot:P7,envDotGreen:H7,envDotYellow:V7,envDotRed:q7,envDotGray:G7,depList:F7,depItem:Z7,depBlocked:K7,depDone:Y7,timeline:J7,timelineRow:W7,timelineKey:X7,timelineValue:Q7,timelineDelta:eU,reviewNotes:tU,overviewDescription:nU,waitingMessage:sU,errorMessage:aU,attemptSelector:iU,attemptLabel:oU,attemptButton:rU,attemptActive:lU,attemptStatus:cU,emptyCta:dU,ctaTitle:uU,ctaDescription:fU,ctaButton:pU,ctaCreateForm:mU,ctaCreateInput:hU,ctaCreateOk:gU,ctaLink:vU,workspaceHeader:yU,workspaceName:bU,workspaceMeta:_U,metaRow:xU,metaLabel:kU,metaValue:SU,archiveButton:TU,repoLink:wU,metaToggle:jU,metaToggleArrow:NU,metaToggleArrowOpen:CU,progressBarContainer:EU,progressBar:AU,progressFill:DU,progressLabel:RU,metaTimestamps:MU,metaTimestamp:IU};function OU(){return o.jsx("div",{className:L.emptyState,children:"Select a task or click + to create one"})}function LU(){return o.jsx("div",{className:L.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function BU(){const{workspaces:{workspaces:t},environments:{environments:s}}=lt(),i=xt(),r=s.length>0;return t.length>0?o.jsx(Wz,{}):o.jsxs("div",{className:L.emptyCta,"data-testid":"welcome-cta",children:[o.jsx("div",{className:L.ctaTitle,children:"Welcome to Grackle"}),o.jsx("div",{className:L.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),o.jsx("button",{className:L.ctaButton,onClick:()=>i(A_),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&o.jsx("div",{className:L.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const zU="_panelContainer_19poq_1",UU="_chatHeader_19poq_8",$U="_chatHeaderInfo_19poq_37",PU="_emptyState_19poq_43",HU="_emptyTitle_19poq_55",VU="_emptyDescription_19poq_61",qU="_emptyHint_19poq_67",Ma={panelContainer:zU,chatHeader:UU,chatHeaderInfo:$U,emptyState:PU,emptyTitle:HU,emptyDescription:VU,emptyHint:qU};function GU(){return o.jsx("div",{className:Ma.panelContainer,"aria-hidden":"true",children:o.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[o.jsx(xe,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function FU({hasLocalEnvironment:t}){return o.jsxs("div",{className:Ma.emptyState,"data-testid":"chat-empty-state",children:[o.jsx("div",{className:Ma.emptyTitle,children:"Welcome to Grackle"}),o.jsx("div",{className:Ma.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&&o.jsx("div",{className:Ma.emptyHint,children:"Go to Settings → Environments to add one."})]})}function ZU(){const{tasks:{tasks:t,tasksLoading:s,startTask:i},sessions:{sessions:r,sessionsLoading:c,events:d,eventsDropped:u,taskSessions:p,loadTaskSessions:m,loadSessionEvents:g,kill:v,stopGraceful:b,sendInput:_,spawn:S},environments:{environments:k,provisionEnvironment:w},personas:{personas:N}}=lt(),{showToast:T}=yn(),C=y.useRef(void 0),[E,B]=y.useState(),A=t.find(H=>H.id===wr),I=A!=null&&A.latestSessionId?r.find(H=>H.id===A.latestSessionId)??(p[wr]??[]).find(H=>H.id===A.latestSessionId):void 0;y.useEffect(()=>{m(wr).catch(()=>{})},[m]),y.useEffect(()=>{A!=null&&A.latestSessionId&&m(wr).catch(()=>{})},[A==null?void 0:A.latestSessionId,m]),y.useEffect(()=>{I&&I.id!==C.current&&(C.current=I.id,g(I.id).catch(()=>{}))},[I==null?void 0:I.id,g]);const O=y.useMemo(()=>{if(!I)return[];const H=d.filter(ie=>ie.sessionId===I.id);return Qm(Xm(H))},[d,I==null?void 0:I.id]),U=k.find(H=>H.adapterType==="local"&&H.status==="connected"),P=I!==void 0&&I.status!=="stopped"&&I.status!=="suspended",W=(I==null?void 0:I.status)==="idle";y.useEffect(()=>{E&&I&&W&&(_(I.id,E).catch(()=>{}),B(void 0))},[E,W,I==null?void 0:I.id,_]);const te=y.useCallback((H,ie,Y,re)=>{re&&B(re),i(H,ie,Y).catch(()=>{})},[i]);return!A&&(c||s)?o.jsx(GU,{}):o.jsxs("div",{className:Ma.panelContainer,"data-testid":"chat-page",children:[P&&o.jsxs("div",{className:Ma.chatHeader,children:[o.jsxs("span",{className:Ma.chatHeaderInfo,children:["Session: ",I.id.slice(0,8)," | ",I.runtime," | ",I.status]}),o.jsx(R_,{label:"Stop",onClick:()=>{b(I.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{b(I.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{v(I.id).catch(()=>{})}}]})]}),o.jsx(Zm,{events:O,eventsDropped:u,emptyState:o.jsx(FU,{hasLocalEnvironment:!!U}),onShowToast:T}),U&&P&&o.jsx(Gr,{mode:"send",sessionId:I.id,environmentId:I.environmentId,personas:N,environments:k,onSendInput:(H,ie)=>{_(H,ie).catch(()=>{})},onSpawn:(H,ie,Y)=>{S(H,ie,Y).catch(()=>{})},onStartTask:(H,ie,Y)=>{i(H,ie,Y).catch(()=>{})},onProvisionEnvironment:H=>{w(H).catch(()=>{})},onShowToast:T}),U&&!P&&o.jsx(Gr,{mode:"start",taskId:wr,environmentId:U.id,personas:N,environments:k,onSendInput:(H,ie)=>{_(H,ie).catch(()=>{})},onSpawn:(H,ie,Y)=>{S(H,ie,Y).catch(()=>{})},onStartTask:te,onProvisionEnvironment:H=>{w(H).catch(()=>{})},onShowToast:T})]})}function KU(){const t=y8(),[s]=dm(),i=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=lt(),{showToast:g}=yn();return o.jsxs("div",{className:L.panelContainer,children:[o.jsx(ks,{segments:t}),o.jsx("div",{className:L.emptyState,children:"Enter a prompt below to start a new session"}),o.jsx(Gr,{mode:"spawn",environmentId:i,showPersonaSelect:!0,personas:u,environments:p,onSendInput:(v,b)=>{r(v,b).catch(()=>{})},onSpawn:(v,b,_)=>{c(v,b,_).catch(()=>{})},onStartTask:(v,b,_)=>{d(v,b,_).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:g})]})}function YU(){return o.jsxs("div",{className:L.panelContainer,"aria-hidden":"true",children:[o.jsxs("div",{className:L.header,children:[o.jsx("span",{children:o.jsx(xe,{width:"10rem",height:"0.875rem"})}),o.jsx("span",{className:L.headerInfo,children:o.jsx(xe,{width:"16rem",height:"0.875rem"})})]}),o.jsx("div",{className:L.eventScroll,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[o.jsx(xe,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function JU({sessionId:t,session:s,isActive:i,onStop:r,onKill:c}){return o.jsxs("div",{className:L.header,children:[o.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.costUsd?` | ${M_((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${jo(s.costUsd??0)}`:""]}),o.jsxs("span",{className:L.headerInfo,children:[s&&o.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),i&&o.jsx(R_,{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 WU({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),i=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return o.jsx("div",{className:s?L.errorMessage:L.waitingMessage,children:i})}function XU(){const{sessionId:t}=ds(),{sessions:{events:s,eventsDropped:i,sessions:r,sessionsLoading:c,kill:d,stopGraceful:u,loadSessionEvents:p,sendInput:m,spawn:g},tasks:{startTask:v},personas:{personas:b},environments:{environments:_,provisionEnvironment:S}}=lt(),{showToast:k}=yn(),w=y.useRef(void 0),N=b8(t),T=r.find(B=>B.id===t)??void 0,C=y.useMemo(()=>{const B=t?s.filter(A=>A.sessionId===t):[];return Qm(Xm(B))},[s,t]);if(y.useEffect(()=>{t&&t!==w.current&&(w.current=t,p(t).catch(()=>{}))},[t,p]),!T&&c)return o.jsx(YU,{});if(!t)return o.jsx("div",{className:L.emptyState,children:"No session selected"});const E=(T==null?void 0:T.status)==="running"||(T==null?void 0:T.status)==="idle";return o.jsxs("div",{className:L.panelContainer,children:[o.jsx(ks,{segments:N}),o.jsx(JU,{sessionId:t,session:T,isActive:E,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{d(t).catch(()=>{})}}),o.jsx(Zm,{events:C,eventsDropped:i,emptyState:o.jsx(WU,{session:T}),onShowToast:k}),E&&o.jsx(Gr,{mode:"send",sessionId:t,environmentId:T.environmentId,personas:b,environments:_,onSendInput:(B,A)=>{m(B,A).catch(()=>{})},onSpawn:(B,A,I)=>{g(B,A,I).catch(()=>{})},onStartTask:(B,A,I)=>{v(B,A,I).catch(()=>{})},onProvisionEnvironment:B=>{S(B).catch(()=>{})},onShowToast:k})]})}function QU(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Ws(t,s){const i=y.useRef(s);i.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&&QU(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(d&&!g.shiftKey||g.key===r&&i.current())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[r,c,d,u,p])}function e$(){return o.jsxs("div",{className:L.panelContainer,"aria-hidden":"true",children:[o.jsx("div",{className:L.workspaceHeader,children:o.jsx("span",{className:L.workspaceName,children:o.jsx(xe,{width:"12rem",height:"1.25rem"})})}),o.jsx("div",{className:L.metaToggle,style:{cursor:"default"},children:o.jsx(xe,{width:"4rem",height:"0.625rem"})}),o.jsxs("div",{className:L.progressBarContainer,children:[o.jsx("div",{className:L.progressBar,children:o.jsx("div",{className:L.progressFill,style:{width:"0%"}})}),o.jsx(xe,{width:"2rem",height:"0.625rem"})]}),o.jsxs("div",{className:L.tabBar,role:"tablist","aria-label":"Workspace view",children:[o.jsx("span",{className:`${L.tab} ${L.active}`,children:"Graph"}),o.jsx("span",{className:L.tab,children:"Board"}),o.jsx("span",{className:L.tab,children:"Tasks"})]}),o.jsx("div",{className:L.overviewContent,children:Array.from({length:3},(t,s)=>o.jsx(id,{lines:2},s))})]})}function Zb(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 kp=100;function t$(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function n$(){const{workspaceId:t,environmentId:s}=ds(),i=xt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:p,updateWorkspace:m},personas:{personas:g},sessions:{sessions:v},usageCache:b,loadUsage:_}=lt(),{resolvedThemeId:S}=E1(),[k,w]=y.useState("tasks"),[N,T]=y.useState(!1),[C,E]=y.useState(null),[B,A]=y.useState(!1),I=y.useRef(void 0),O=d.find(D=>D.id===t),U=s??(O==null?void 0:O.environmentId)??"",P=_8(t,U,d,c);Ws({key:"1"},()=>w("graph")),Ws({key:"2"},()=>w("board")),Ws({key:"3"},()=>w("tasks")),y.useEffect(()=>{const D=I.current;I.current=t,!(D===void 0||D===t)&&C!==null&&E(null)},[t,C]);const W=v.reduce((D,Z)=>D+(Z.costUsd??0),0);y.useEffect(()=>{t&&_("workspace",t).catch(()=>{})},[t,_,W]);const te=t?b[`workspace:${t}`]:void 0,H=r.filter(D=>D.workspaceId===t),ie=H.filter(D=>D.status==="complete").length,Y=H.length,re=Y>0?Math.round(ie/Y*100):0;return!O&&u?o.jsx(e$,{}):o.jsxs("div",{className:L.panelContainer,children:[o.jsx(ks,{segments:P}),o.jsxs("div",{className:L.workspaceHeader,children:[o.jsx("span",{className:L.workspaceName,"data-testid":"workspace-name",children:o.jsx(en,{value:(O==null?void 0:O.name)||"",onSave:D=>{O&&m(O.id,{name:D}).catch(()=>{})},validate:D=>{const Z=D.trim();if(!Z)return"Name is required";if(Z.length>kp)return`Max ${kp} characters`},maxLength:kp,fieldId:"name",activeFieldId:C,onActivate:E,ariaLabel:"Workspace name",renderDisplay:D=>D||t||void 0,"data-testid":"edit-name"})}),o.jsx("button",{className:L.archiveButton,onClick:()=>T(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),o.jsxs("button",{className:L.metaToggle,onClick:()=>A(!B),"aria-expanded":!B,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[o.jsx("span",{className:`${L.metaToggleArrow} ${B?"":L.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!B&&o.jsxs("div",{className:L.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[o.jsxs("div",{className:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Description"}),o.jsx("div",{className:L.metaValue,children:o.jsx(Kp,{value:(O==null?void 0:O.description)||"",onSave:D=>{O&&m(O.id,{description:D}).catch(()=>{})},fieldId:"description",activeFieldId:C,onActivate:E,renderDisplay:D=>D?o.jsx("span",{className:L.overviewMarkdown,children:o.jsx(dd,{remarkPlugins:[ud],children:D})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),o.jsxs("div",{className:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Repository"}),o.jsx("div",{className:L.metaValue,children:o.jsx(en,{value:(O==null?void 0:O.repoUrl)||"",onSave:D=>{O&&m(O.id,{repoUrl:D}).catch(()=>{})},validate:D=>{const Z=D.trim();if(Z&&!/^https?:\/\/.+/.test(Z))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:C,onActivate:E,renderDisplay:D=>{const Z=t$(D);return Z?o.jsx("a",{className:L.repoLink,href:Z,target:"_blank",rel:"noopener noreferrer",onClick:se=>se.stopPropagation(),children:D}):D?o.jsx("span",{children:D}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),o.jsxs("div",{className:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Environment"}),o.jsx("div",{className:L.metaValue,children:o.jsx(k4,{value:(O==null?void 0:O.environmentId)||"",onSave:D=>{O&&D&&m(O.id,{environmentId:D}).catch(()=>{})},environments:c,fieldId:"environmentId",activeFieldId:C,onActivate:E,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),o.jsxs("div",{className:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Persona"}),o.jsx("div",{className:L.metaValue,children:o.jsx(od,{value:(O==null?void 0:O.defaultPersonaId)||"",onSave:D=>{O&&m(O.id,{defaultPersonaId:D}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...g.map(D=>({value:D.id,label:D.name}))],fieldId:"defaultPersonaId",activeFieldId:C,onActivate:E,renderDisplay:D=>{const Z=g.find(se=>se.id===D);if(Z)return o.jsx("span",{children:Z.name})},placeholder:(O==null?void 0:O.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),o.jsxs("div",{className:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Worktrees"}),o.jsx("div",{className:L.metaValue,children:o.jsx(m4,{checked:(O==null?void 0:O.useWorktrees)??!0,onChange:D=>{O&&m(O.id,{useWorktrees:D}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),o.jsxs("div",{className:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Working Dir"}),o.jsx("div",{className:L.metaValue,children:o.jsx(en,{value:(O==null?void 0:O.workingDirectory)||"",onSave:D=>{O&&m(O.id,{workingDirectory:D}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:C,onActivate:E,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),O&&o.jsxs("div",{className:L.metaTimestamps,children:[o.jsxs("span",{className:L.metaTimestamp,children:["Created ",Zb(O.createdAt)]}),O.updatedAt&&O.updatedAt!==O.createdAt&&o.jsxs("span",{className:L.metaTimestamp,children:["· Updated ",Zb(O.updatedAt)]})]})]}),Y>0&&o.jsxs("div",{className:L.progressBarContainer,"data-testid":"progress-bar",children:[o.jsx("div",{className:L.progressBar,children:o.jsx("div",{className:L.progressFill,style:{width:`${re}%`}})}),o.jsxs("span",{className:L.progressLabel,children:[ie,"/",Y]})]}),te&&te.costUsd>0&&o.jsx("div",{className:L.progressBarContainer,children:o.jsxs("span",{className:L.progressLabel,children:["Usage: ",jo(te.costUsd)," (",te.sessionCount," session",te.sessionCount!==1?"s":"",")"]})}),o.jsxs("div",{className:L.tabBar,role:"tablist","aria-label":"Workspace view",children:[o.jsx("button",{role:"tab","aria-selected":k==="graph",className:`${L.tab} ${k==="graph"?L.active:""}`,onClick:()=>w("graph"),children:"Graph"}),o.jsx("button",{role:"tab","aria-selected":k==="board",className:`${L.tab} ${k==="board"?L.active:""}`,onClick:()=>w("board"),"data-testid":"board-tab",children:"Board"}),o.jsx("button",{role:"tab","aria-selected":k==="tasks",className:`${L.tab} ${k==="tasks"?L.active:""}`,onClick:()=>w("tasks"),children:"Tasks"})]}),k==="tasks"&&Y>0&&o.jsxs("div",{className:L.workspaceSummary,children:[o.jsx("span",{className:L.workspaceSummaryTitle,children:`${ie}/${Y} tasks complete`}),o.jsx("span",{className:L.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),k==="tasks"&&Y===0&&o.jsxs("div",{className:L.emptyCta,children:[o.jsx("button",{className:L.ctaButton,onClick:()=>i(Ti(t,void 0,U)),children:"Create Task"}),o.jsx("div",{className:L.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),k==="board"&&o.jsx(VB,{workspaceId:t,environmentId:U,tasks:r,sessions:v,personas:g,environments:c}),k==="graph"&&o.jsx(iN,{workspaceId:t,environmentId:U,tasks:r,resolvedThemeId:S}),o.jsx(xi,{isOpen:N,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{O&&(p(O.id).catch(()=>{}),i("/",{replace:!0})),T(!1)},onCancel:()=>T(!1)})]})}const s$="_container_3pgew_1",a$="_header_3pgew_8",i$="_headerTitle_3pgew_35",o$="_headerActions_3pgew_44",r$="_body_3pgew_51",l$="_btnPrimary_3pgew_63",c$="_btnGhost_3pgew_94",d$="_error_3pgew_116",Aa={container:s$,header:a$,headerTitle:i$,headerActions:o$,body:r$,btnPrimary:l$,btnGhost:c$,error:d$};function u$(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 f$=[{label:"Home",url:_i},{label:"New Workspace",url:void 0}];function p$(){const[t]=dm(),s=t.get("environment")??void 0,{environments:{environments:i},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=lt(),{showToast:u}=yn(),p=xt(),[m,g]=y.useState(()=>{var N;return e8(void 0,s||((N=i[0])==null?void 0:N.id))}),[v,b]=y.useState(),[_,S]=y.useState();y.useEffect(()=>{s||m.environmentId||i.length===0||g(N=>{var T;return N.environmentId?N:{...N,environmentId:((T=i[0])==null?void 0:T.id)??""}})},[i,s,m.environmentId]);const k=()=>{const N=u$(m);if(N){b(N),S(void 0);return}b(void 0),S(void 0),c(m.name.trim(),m.description,m.repoUrl.trim(),m.environmentId,m.defaultPersonaId,m.useWorktrees,m.workingDirectory,()=>{u("Workspace created","success"),p(_i,{replace:!0})},T=>{S(T)}).catch(()=>{})},w=()=>{p(s?bi(s):_i,{replace:!0})};return o.jsxs("div",{className:Aa.container,children:[o.jsxs("div",{className:Aa.header,children:[o.jsx("div",{className:Aa.headerTitle,children:o.jsx(ks,{segments:f$})}),o.jsxs("div",{className:Aa.headerActions,children:[o.jsx("button",{className:Aa.btnGhost,onClick:w,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),o.jsx("button",{className:Aa.btnPrimary,onClick:k,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?o.jsx(c1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),o.jsxs("div",{className:Aa.body,children:[o.jsx(n8,{values:m,onChange:N=>{g(N),b(void 0),S(void 0)},environments:i,personas:r,errors:v,disabled:d,autoFocusName:!0}),_&&o.jsx("div",{className:Aa.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function Kb(){const{workspaceId:t,environmentId:s}=ds(),[i]=dm(),r=t??i.get("workspace")??"",c=i.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:p},workspaces:{workspaces:m},personas:{personas:g}}=lt(),{showToast:v}=yn();return o.jsx(k1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(b,_,S,k,w,N,T,C,E)=>{u(b,_,S,k,w,N,T,C,E).catch(()=>{})},onUpdateTask:(b,_,S,k,w)=>{p(b,_,S,k,w).catch(()=>{})},onShowToast:v})}function m$(){return o.jsxs("div",{className:L.panelContainer,"aria-hidden":"true",children:[o.jsx("div",{className:L.header,children:o.jsxs("span",{className:L.headerTitle,children:[o.jsx(xe,{width:"12rem",height:"1rem"}),o.jsx(xe,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),o.jsxs("div",{className:L.tabBar,role:"tablist","aria-label":"Task view",children:[o.jsx("span",{className:`${L.tab} ${L.active}`,children:"Overview"}),o.jsx("span",{className:L.tab,children:"Stream"}),o.jsx("span",{className:L.tab,children:"Findings"})]}),o.jsx("div",{className:L.overviewContent,children:o.jsxs("div",{className:L.overviewDashboard,children:[o.jsx("div",{className:L.overviewHero,children:o.jsx(xe,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Description"}),o.jsx(Zp,{lines:2})]}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Environment"}),o.jsxs("div",{className:L.envRow,children:[o.jsx(xe,{width:"0.5rem",height:"0.5rem",variant:"circular"}),o.jsx(xe,{width:"8rem",height:"0.875rem"})]})]}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Dependencies"}),o.jsx(Zp,{lines:2})]}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Timeline"}),o.jsx("div",{className:L.timeline,children:Array.from({length:4},(t,s)=>o.jsxs("div",{className:L.timelineRow,children:[o.jsx(xe,{width:"4rem",height:"0.75rem"}),o.jsx(xe,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function $c(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 Sp(t,s){if(!t||!s)return;const i=new Date(s).getTime()-new Date(t).getTime();if(isNaN(i)||i<0)return;const r=Math.floor(i/6e4),c=Math.floor(i%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 Yb(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?L.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?L.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?L.envDotRed:L.envDotGray}function h$({status:t}){const s=Oa(t),i=W2(t);return o.jsx("span",{className:`${L.statusBadge} ${L[i]??L.statusPending}`,children:s.label})}function g$({task:t,tasksById:s,environments:i,workspaces:r,taskSessions:c,selectedEnvId:d}){const{loadUsage:u,usageCache:p}=lt(),m=c.reduce((E,B)=>E+(B.costUsd??0),0);y.useEffect(()=>{u("task",t.id).catch(()=>{}),t.childTaskIds.length>0&&u("task_tree",t.id).catch(()=>{})},[t.id,t.childTaskIds.length,u,m]);const g=`task:${t.id}`,v=g in p?p[g]:void 0,b=`task_tree:${t.id}`,_=t.childTaskIds.length>0&&b in p?p[b]:void 0,S=c.length>0?c[c.length-1]:void 0,k=(S==null?void 0:S.environmentId)??"",w=k?i.find(E=>E.id===k):void 0,N=r.find(E=>E.id===t.workspaceId),T=i.find(E=>E.id===d),C=t.branch&&(N!=null&&N.repoUrl)?`${N.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return o.jsxs("div",{className:L.overviewDashboard,children:[o.jsxs("div",{className:L.overviewHero,children:[o.jsx(h$,{status:t.status}),t.branch&&o.jsx("span",{className:L.overviewBranchPill,children:C?o.jsxs("a",{href:C,target:"_blank",rel:"noreferrer noopener",className:L.branchLink,children:["🔗"," ",t.branch]}):o.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Description"}),o.jsx("div",{className:L.overviewMarkdown,children:o.jsx(dd,{remarkPlugins:[ud],children:t.description})})]}),t.workpad&&o.jsx(OL,{workpad:t.workpad}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Environment"}),k&&w?o.jsxs("div",{className:L.envRow,"data-testid":"task-overview-environment",children:[o.jsx("span",{className:`${L.envDot} ${Yb(w.status)}`,title:w.status,"aria-label":`Status: ${w.status}`,role:"img"}),o.jsx("span",{className:L.overviewValue,children:w.displayName})]}):T?o.jsxs("div",{className:L.envRow,"data-testid":"task-overview-environment",children:[o.jsx("span",{className:`${L.envDot} ${Yb(T.status)}`,title:T.status,"aria-label":`Status: ${T.status}`,role:"img"}),o.jsx("span",{className:L.overviewValue,children:T.displayName}),o.jsx("span",{className:L.overviewMuted,children:"(workspace default)"})]}):o.jsx("div",{className:L.overviewMuted,children:"Set in workspace settings"})]}),o.jsxs("div",{className:L.overviewSection,"data-testid":"task-overview-dependencies",children:[o.jsx("div",{className:L.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?o.jsx("div",{className:L.overviewMuted,children:"None"}):o.jsx("div",{className:L.depList,children:t.dependsOn.map(E=>{const B=s.get(E),A=(B==null?void 0:B.status)==="complete";return o.jsxs("div",{className:`${L.depItem} ${A?L.depDone:L.depBlocked}`,children:[o.jsx("span",{children:A?"✓":"○"}),o.jsx("span",{children:(B==null?void 0:B.title)??E})]},E)})})]}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Timeline"}),o.jsxs("div",{className:L.timeline,children:[t.createdAt&&o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Created"}),o.jsx("span",{className:L.timelineValue,children:$c(t.createdAt)})]}),t.assignedAt&&(()=>{const E=Sp(t.createdAt,t.assignedAt);return o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Assigned"}),o.jsx("span",{className:L.timelineValue,children:$c(t.assignedAt)}),E!==void 0&&o.jsx("span",{className:L.timelineDelta,children:E})]})})(),t.startedAt&&(()=>{const E=Sp(t.assignedAt??t.createdAt,t.startedAt);return o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Started"}),o.jsx("span",{className:L.timelineValue,children:$c(t.startedAt)}),E!==void 0&&o.jsx("span",{className:L.timelineDelta,children:E})]})})(),t.completedAt&&(()=>{const E=Sp(t.startedAt,t.completedAt);return o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Completed"}),o.jsx("span",{className:L.timelineValue,children:$c(t.completedAt)}),E!==void 0&&o.jsx("span",{className:L.timelineDelta,children:E})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&o.jsx("div",{className:L.overviewMuted,children:"No timing data"})]})]}),v&&v.costUsd>0&&o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Usage"}),o.jsxs("div",{className:L.timeline,children:[o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Cost"}),o.jsx("span",{className:L.timelineValue,children:jo(v.costUsd)}),o.jsxs("span",{className:L.timelineDelta,children:[v.sessionCount," session",v.sessionCount!==1?"s":""]})]}),_&&_.costUsd>v.costUsd&&o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Total (incl. subtasks)"}),o.jsx("span",{className:L.timelineValue,children:jo(_.costUsd)}),o.jsxs("span",{className:L.timelineDelta,children:[_.sessionCount," session",_.sessionCount!==1?"s":""]})]})]})]}),t.reviewNotes&&o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Review Notes"}),o.jsx("div",{className:L.reviewNotes,children:t.reviewNotes})]})]})}function v$({task:t,sessionId:s,isBlocked:i,onStart:r,onResume:c,onStop:d,onPause:u,onDelete:p,onEdit:m}){if(t.status==="not_started")return i?o.jsxs("div",{className:L.headerActions,children:[o.jsx("button",{onClick:m,className:L.btnGhost,children:"Edit"}),o.jsx("button",{onClick:p,className:L.btnDanger,children:"Delete"})]}):o.jsxs("div",{className:L.headerActions,children:[o.jsx("button",{"data-testid":"task-header-start",onClick:r,className:L.btnPrimary,children:"Start"}),o.jsx("button",{onClick:m,className:L.btnGhost,children:"Edit"}),o.jsx("button",{onClick:p,className:L.btnDanger,children:"Delete"})]});if(t.status==="working")return o.jsxs("div",{className:L.headerActions,children:[o.jsx("button",{onClick:d,className:L.btnDanger,children:"Stop"}),o.jsx("button",{onClick:u,disabled:!s,className:L.btnGhost,children:"Pause"})]});if(t.status==="paused")return o.jsxs("div",{className:L.headerActions,children:[o.jsx("button",{onClick:d,className:L.btnPrimary,children:"Stop"}),o.jsx("button",{onClick:c,className:L.btnGhost,children:"Resume"}),o.jsx("button",{onClick:p,className:L.btnDanger,children:"Delete"})]});if(t.status==="complete")return o.jsx("div",{className:L.headerActions,children:o.jsx("button",{onClick:p,className:L.btnDanger,children:"Delete"})});if(t.status==="failed")return o.jsxs("div",{className:L.headerActions,children:[o.jsx("button",{onClick:r,className:L.btnPrimary,children:"Retry"}),o.jsx("button",{onClick:p,className:L.btnDanger,children:"Delete"})]})}function y$({taskSessions:t,selectedSessionId:s,onSelect:i}){if(!(t.length<2))return o.jsxs("div",{className:L.attemptSelector,"data-testid":"attempt-selector",children:[o.jsx("span",{className:L.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 o.jsxs("button",{className:`${L.attemptButton} ${d?L.attemptActive:""}`,onClick:()=>i(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&&o.jsx("span",{className:L.attemptStatus,children:u})]},r.id)})]})}function Da(){const{taskId:t,workspaceId:s,environmentId:i}=ds(),r=Vt(),c=xt(),{showToast:d}=yn(),{sessions:{events:u,eventsDropped:p,sessions:m,loadSessionEvents:g,taskSessions:v,loadTaskSessions:b,sendInput:_,spawn:S,kill:k},tasks:{tasks:w,tasksLoading:N,startTask:T,stopTask:C,resumeTask:E,deleteTask:B,createTask:A,updateTask:I},environments:{environments:O,provisionEnvironment:U},findings:{findings:P,loadFindings:W},workspaces:{workspaces:te},personas:{personas:H}}=lt(),ie=y.useRef(void 0),Y=y.useRef(void 0),re=y.useRef(void 0),D=y.useRef(void 0),Z=y.useRef(void 0),se=r.pathname.endsWith("/stream")?"stream":r.pathname.endsWith("/findings")?"findings":"overview",ue=r.pathname.endsWith("/edit"),[de,Ge]=y.useState(se),[De,Ne]=y.useState(!1),[Oe,fe]=y.useState(void 0),[ye,me]=y.useState(""),[Ue,pt]=y.useState(ue),bn=y.useRef(se),ae=y.useRef(ue),Q=w.find(_e=>_e.id===t),ct=(Q==null?void 0:Q.workspaceId)||void 0,Le=te.find(_e=>_e.id===ct);y.useEffect(()=>{se!==bn.current&&(bn.current=se,se!==de&&Ge(se))},[se,de]),y.useEffect(()=>{ue!==ae.current&&(ae.current=ue,ue!==Ue&&pt(ue))},[ue,Ue]),y.useEffect(()=>{if(ye===""){if(Le!=null&&Le.environmentId)me(Le.environmentId);else if(O.length>0){const _e=O.find(Qe=>Qe.status==="connected");me((_e==null?void 0:_e.id)??O[0].id)}}},[ye,Le==null?void 0:Le.environmentId,O]);const $t=Q?v[Q.id]??[]:[];let dt;Oe&&$t.some(_e=>_e.id===Oe)?dt=Oe:dt=(Q==null?void 0:Q.latestSessionId)||void 0;const na=()=>{Ne(!0)},Ss=()=>{if(!Q)return;B(Q.id).catch(()=>{}),Ne(!1);const _e=i??(Le==null?void 0:Le.environmentId);c(Q.workspaceId&&_e?yi(Q.workspaceId,_e):"/",{replace:!0})};y.useEffect(()=>{(Q==null?void 0:Q.id)!==Y.current&&(Y.current=Q==null?void 0:Q.id,fe(void 0),me(""),pt(ue))},[Q==null?void 0:Q.id,ue]),y.useEffect(()=>{if(!(Q!=null&&Q.id))return;const _e=Q.id!==D.current,Qe=Q.latestSessionId!==Z.current;(_e||Qe)&&(D.current=Q.id,Z.current=Q.latestSessionId,b(Q.id).catch(()=>{}))},[Q==null?void 0:Q.id,Q==null?void 0:Q.latestSessionId,b]),y.useEffect(()=>{if((Q==null?void 0:Q.status)!==re.current){const _e=re.current===void 0;re.current=Q==null?void 0:Q.status;const Qe=(Q==null?void 0:Q.status)==="not_started"?"overview":(Q==null?void 0:Q.status)==="working"||(Q==null?void 0:Q.status)==="paused"?"stream":(Q==null?void 0:Q.status)==="complete"?"findings":void 0;Qe&&Qe!==de&&!(_e&&se!=="overview")&&Ge(Qe)}},[Q==null?void 0:Q.status,de,se]);const _n=y.useMemo(()=>new Map(w.map(_e=>[_e.id,_e])),[w]),Ts=y.useMemo(()=>{const _e=dt?u.filter(Qe=>Qe.sessionId===dt):[];return Qm(Xm(_e))},[u,dt]),us=Q?Q.dependsOn.some(_e=>{const Qe=_n.get(_e);return Qe!==void 0&&Qe.status!=="complete"}):!1,ji=y.useMemo(()=>x8(t,i,te,O,_n),[t,i,te,O,_n]);y.useEffect(()=>{dt&&dt!==ie.current&&(ie.current=dt,g(dt).catch(()=>{}))},[dt,g]),y.useEffect(()=>{de==="findings"&&ct&&W(ct).catch(()=>{})},[de,ct,W]);const Wn=_e=>{Ge(_e),c(Dn(t,_e==="overview"?void 0:_e,s,i))};return Ws({key:"1"},()=>Wn("overview")),Ws({key:"2"},()=>Wn("stream")),Ws({key:"3"},()=>Wn("findings")),!Q&&N?o.jsx(m$,{}):o.jsxs("div",{className:L.panelContainer,children:[o.jsx(ks,{segments:ji}),o.jsxs("div",{className:L.header,children:[o.jsxs("span",{className:L.headerTitle,children:[o.jsx("span",{"data-testid":"task-title",children:(Q==null?void 0:Q.title)||t}),Q&&o.jsx("span",{className:L.taskStatusBadge,"data-testid":"task-status",children:Q.status}),(Q==null?void 0:Q.branch)&&o.jsx("span",{className:L.taskBranch,children:Q.branch}),us&&o.jsx("span",{className:L.taskBlockedBadge,children:"blocked"})]}),Q&&o.jsx(v$,{task:Q,sessionId:dt,isBlocked:us,onStart:()=>{T(Q.id,void 0,ye).catch(()=>{})},onResume:()=>{E(Q.id).catch(()=>{})},onStop:()=>{C(Q.id).catch(()=>{})},onPause:()=>{dt&&k(dt).catch(()=>{})},onDelete:na,onEdit:()=>pt(!0)})]}),o.jsxs("div",{className:L.tabBar,role:"tablist","aria-label":"Task view",children:[o.jsx("button",{role:"tab","aria-selected":de==="overview",className:`${L.tab} ${de==="overview"?L.active:""}`,onClick:()=>Wn("overview"),children:"Overview"}),o.jsx("button",{role:"tab","aria-selected":de==="stream",className:`${L.tab} ${de==="stream"?L.active:""}`,onClick:()=>Wn("stream"),children:"Stream"}),o.jsx("button",{role:"tab","aria-selected":de==="findings",className:`${L.tab} ${de==="findings"?L.active:""}`,onClick:()=>Wn("findings"),children:"Findings"})]}),o.jsxs(cs,{mode:"wait",children:[de==="overview"&&o.jsx(Et.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:L.overviewContent,"data-testid":"task-overview",children:Ue&&Q?o.jsx(k1,{mode:"edit",taskId:Q.id,workspaceId:ct,environmentId:i,tasks:w,workspaces:te,personas:H,onCreateTask:(_e,Qe,on,xn,In,Ni,Ha,Ci,Ei)=>{A(_e,Qe,on,xn,In,Ni,Ha,Ci,Ei).catch(()=>{})},onUpdateTask:(_e,Qe,on,xn,In)=>{I(_e,Qe,on,xn,In).catch(()=>{})},onEditDone:()=>{ue?c(Dn(Q.id,void 0,s,i),{replace:!0}):pt(!1)},onShowToast:d}):Q?o.jsx(g$,{task:Q,tasksById:_n,environments:O,workspaces:te,taskSessions:$t,selectedEnvId:ye}):o.jsx("div",{className:L.waitingMessage,children:"No additional details"})},"overview"),de==="stream"&&o.jsxs(Et.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:[o.jsx(y$,{taskSessions:$t,selectedSessionId:dt,onSelect:_e=>fe(_e)}),o.jsx(Zm,{events:Ts,eventsDropped:p,emptyState:!dt&&Q?us?o.jsx("div",{className:L.emptyCta,"data-testid":"stream-blocked-message",children:o.jsx("div",{className:L.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):o.jsxs("div",{className:L.emptyCta,children:[o.jsx("button",{"data-testid":"stream-start-cta",className:L.ctaButton,onClick:()=>{T(Q.id,void 0,ye).catch(()=>{})},children:"Start Task"}),o.jsx("div",{className:L.ctaDescription,children:"Click to begin agent execution"})]}):dt&&Ts.length===0?o.jsx("div",{className:L.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:d})]},"stream"),de==="findings"&&o.jsx(Et.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:L.tabContent,children:ct?o.jsx(_1,{findings:P.filter(_e=>_e.workspaceId===ct)}):o.jsx("div",{className:L.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!Q||Q.status!=="working"&&Q.status!=="paused")return;const _e=dt?m.find(Qe=>Qe.id===dt):void 0;if(!(!_e||_e.status==="stopped"))return o.jsx(Gr,{mode:"send",sessionId:_e.id,environmentId:_e.environmentId,personas:H,environments:O,onSendInput:(Qe,on)=>{_(Qe,on).catch(()=>{})},onSpawn:(Qe,on,xn)=>{S(Qe,on,xn).catch(()=>{})},onStartTask:(Qe,on,xn)=>{T(Qe,on,xn).catch(()=>{})},onProvisionEnvironment:Qe=>{U(Qe).catch(()=>{})},onShowToast:d})})(),Q&&o.jsx(xi,{isOpen:De,title:"Delete Task?",description:`"${Q.title}" will be permanently removed.`,onConfirm:Ss,onCancel:()=>Ne(!1)})]})}function b$(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:i},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:p,createCodespace:m}}=lt(),{showToast:g}=yn();return o.jsx(S1,{mode:"new",environments:t,onAddEnvironment:(v,b,_)=>{s(v,b,_).catch(()=>{})},onUpdateEnvironment:(v,b)=>{i(v,b).catch(()=>{})},onListCodespaces:()=>{p().catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(v,b)=>{m(v,b).catch(()=>{})},onShowToast:g})}function _$(){const{environmentId:t}=ds(),{environments:{environments:s,addEnvironment:i,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,listCodespaces:m,createCodespace:g}}=lt(),{showToast:v}=yn();return o.jsx(S1,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(b,_,S)=>{i(b,_,S).catch(()=>{})},onUpdateEnvironment:(b,_)=>{r(b,_).catch(()=>{})},onListCodespaces:()=>{m().catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(b,_)=>{g(b,_).catch(()=>{})},onShowToast:v})}const x$="_layout_11u79_1",k$="_content_11u79_8",S$="_tabPanel_11u79_14",qr={layout:x$,content:k$,tabPanel:S$};function T$(){const t=v8();return o.jsxs("div",{className:qr.layout,children:[o.jsx(ks,{segments:t}),o.jsx("div",{className:qr.content,children:o.jsx(Ua,{})})]})}const w$="_container_13sb6_1",j$="_envHeader_13sb6_6",N$="_envTitleRow_13sb6_10",C$="_statusDot_13sb6_16",E$="_envName_13sb6_21",A$="_statusBadge_13sb6_27",D$="_envMeta_13sb6_33",R$="_metaTag_13sb6_39",M$="_actions_13sb6_51",I$="_provisionMessage_13sb6_59",O$="_errorMessage_13sb6_64",L$="_section_13sb6_69",B$="_sectionHeader_13sb6_73",z$="_cardList_13sb6_121",U$="_card_13sb6_121",$$="_cardHeader_13sb6_138",P$="_cardName_13sb6_144",H$="_cardActions_13sb6_149",V$="_cardDescription_13sb6_154",q$="_cardMeta_13sb6_160",G$="_repoLink_13sb6_166",F$="_empty_13sb6_174",Z$="_btnPrimary_13sb6_180",K$="_btnOutline_13sb6_214",Y$="_btnSmall_13sb6_241",J$="_btnDanger_13sb6_267",Ae={container:w$,envHeader:j$,envTitleRow:N$,statusDot:C$,envName:E$,statusBadge:A$,envMeta:D$,metaTag:R$,actions:M$,provisionMessage:I$,errorMessage:O$,section:L$,sectionHeader:B$,cardList:z$,card:U$,cardHeader:$$,cardName:P$,cardActions:H$,cardDescription:V$,cardMeta:q$,repoLink:G$,empty:F$,btnPrimary:Z$,btnOutline:K$,btnSmall:Y$,btnDanger:J$};function W$(){return o.jsxs("div",{className:Ae.container,"aria-hidden":"true",children:[o.jsxs("div",{className:Ae.envHeader,children:[o.jsxs("div",{className:Ae.envTitleRow,children:[o.jsx(xe,{width:"0.875rem",height:"0.875rem",variant:"circular"}),o.jsx(xe,{width:"12rem",height:"1.5rem"}),o.jsx(xe,{width:"4rem",height:"0.875rem"})]}),o.jsxs("div",{className:Ae.envMeta,children:[o.jsx(xe,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),o.jsxs("div",{className:Ae.actions,children:[o.jsx(xe,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),o.jsxs("div",{className:Ae.section,children:[o.jsx("div",{className:Ae.sectionHeader,children:o.jsx("h3",{style:{margin:0},children:"Workspaces"})}),o.jsxs("div",{className:Ae.cardList,children:[o.jsx(id,{lines:2}),o.jsx(id,{lines:2})]})]})]})}const X$={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function Q$(){const{environmentId:t}=ds(),s=xt(),{environments:{environments:i,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:p},workspaces:{workspaces:m,archiveWorkspace:g},sessions:{sessions:v}}=lt(),[b,_]=y.useState(!1),[S,k]=y.useState(!1),[w,N]=y.useState(void 0),T=i.find(ie=>ie.id===t);if(!T&&r)return o.jsx(W$,{});if(!t||!T)return o.jsx(ls,{to:wo,replace:!0});const C=m.filter(ie=>ie.environmentId===T.id),E=v.filter(ie=>ie.environmentId===T.id),B=E.reduce((ie,Y)=>ie+(Y.costUsd??0),0),A=X$[T.status]||"var(--text-tertiary)",I=T.status==="connected",O=T.status==="connecting",U=T.status==="disconnected"||T.status==="error"||T.status==="sleeping",P=T.id in c?c[T.id]:void 0,W=()=>{p(T.id).catch(()=>{}),_(!1),s(wo,{replace:!0})},te=()=>{k(!1),d(T.id,!0).catch(()=>{})},H=ie=>{g(ie).catch(()=>{}),N(void 0)};return o.jsxs("div",{className:Ae.container,children:[o.jsx(xi,{isOpen:b,title:"Delete Environment?",description:`"${T.displayName||T.id}" will be permanently removed along with all its data.`,onConfirm:W,onCancel:()=>_(!1)}),o.jsx(xi,{isOpen:S,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:te,onCancel:()=>k(!1)}),o.jsxs("div",{className:Ae.envHeader,children:[o.jsxs("div",{className:Ae.envTitleRow,children:[o.jsx("span",{className:Ae.statusDot,style:{color:A},children:"●"}),o.jsx("h2",{className:Ae.envName,children:T.displayName||T.id}),o.jsx("span",{className:Ae.statusBadge,style:{color:A},children:T.status})]}),o.jsxs("div",{className:Ae.envMeta,children:[o.jsxs("span",{className:Ae.metaTag,children:["Adapter: ",T.adapterType]}),E.length>0&&o.jsxs("span",{className:Ae.metaTag,children:[E.length," session",E.length!==1?"s":""]}),B>0&&o.jsxs("span",{className:Ae.metaTag,children:["Cost: ",jo(B)]})]})]}),o.jsxs("div",{className:Ae.actions,children:[I&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:Ae.btnPrimary,onClick:()=>s(C_(T.id)),children:"New Chat"}),o.jsx("button",{className:Ae.btnOutline,onClick:()=>{u(T.id).catch(()=>{})},children:"Stop"}),o.jsx("button",{className:Ae.btnOutline,onClick:()=>k(!0),disabled:P!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),U&&o.jsx("button",{className:Ae.btnPrimary,onClick:()=>{d(T.id).catch(()=>{})},children:T.status==="error"?"Retry":T.status==="sleeping"?"Wake":"Connect"}),O&&P!==void 0&&o.jsx("span",{className:Ae.provisionMessage,children:P.message}),T.status==="error"&&(P==null?void 0:P.stage)==="error"&&o.jsx("span",{className:Ae.errorMessage,children:P.message}),o.jsx("button",{className:Ae.btnOutline,onClick:()=>s(Yj(T.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),o.jsx("button",{className:Ae.btnDanger,onClick:()=>_(!0),children:"Delete"})]}),o.jsxs("div",{className:Ae.section,children:[o.jsxs("div",{className:Ae.sectionHeader,children:[o.jsx("h3",{children:"Workspaces"}),o.jsx("button",{className:Ae.btnPrimary,onClick:()=>s(`${A_}?environment=${encodeURIComponent(T.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"})]}),C.length===0&&o.jsx("p",{className:Ae.empty,children:"No workspaces yet. Create one to get started."}),o.jsx("div",{className:Ae.cardList,children:C.map(ie=>o.jsx(e9,{workspace:ie,confirmArchiveId:w,onOpen:()=>s(yi(ie.id,T.id)),onArchive:()=>N(ie.id),onConfirmArchive:()=>H(ie.id),onCancelArchive:()=>N(void 0)},ie.id))})]})]})}function e9({workspace:t,confirmArchiveId:s,onOpen:i,onArchive:r,onConfirmArchive:c,onCancelArchive:d}){const u=s===t.id,p=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return o.jsxs("div",{className:Ae.card,"data-testid":"workspace-card",children:[o.jsxs("div",{className:Ae.cardHeader,children:[o.jsx("strong",{className:Ae.cardName,children:t.name}),o.jsxs("div",{className:Ae.cardActions,children:[o.jsx("button",{className:Ae.btnSmall,onClick:i,children:"Open"}),u?o.jsxs(o.Fragment,{children:[o.jsx("button",{className:Ae.btnDanger,onClick:c,children:"Confirm"}),o.jsx("button",{className:Ae.btnSmall,onClick:d,children:"Cancel"})]}):o.jsx("button",{className:Ae.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&o.jsx("p",{className:Ae.cardDescription,children:t.description}),t.repoUrl&&o.jsx("div",{className:Ae.cardMeta,children:p?o.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Ae.repoLink,children:t.repoUrl}):o.jsx("span",{children:t.repoUrl})})]})}const t9={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function n9(){const s=Vt().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=t9[s],r=g8(i);return o.jsxs("div",{className:qr.layout,children:[o.jsx(ks,{segments:r}),o.jsx("div",{className:qr.content,children:o.jsx("div",{className:qr.tabPanel,children:o.jsx(Ua,{})},s)})]})}function s9(){const{tokens:{tokens:t,setToken:s,deleteToken:i},credentials:{credentialProviders:r,updateCredentialProviders:c}}=lt(),{showToast:d}=yn();return o.jsxs(o.Fragment,{children:[o.jsx(BL,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),o.jsx(DO,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{i(u).catch(()=>{})},onShowToast:d})]})}function a9(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:i,setAppDefaultPersonaId:r}=lt(),{showToast:c}=yn(),d=xt();return o.jsx(JL,{personas:t,appDefaultPersonaId:i,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(Wj),onNavigateToPersona:u=>d(E_(u))})}const i9="_container_1ooin_1",o9="_form_1ooin_7",r9="_formActions_1ooin_75",l9="_editableSection_1ooin_82",c9="_defaultBadge_1ooin_93",d9="_typeToggle_1ooin_107",u9="_scriptEditor_1ooin_121",f9="_optional_1ooin_128",os={container:i9,form:o9,formActions:r9,editableSection:l9,defaultBadge:c9,typeToggle:d9,scriptEditor:u9,optional:f9},Jb=[{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)"}],Wb=[{value:"genaiscript",label:"genaiscript"}],p9="0";function Xb(){const{personaId:t}=ds(),s=xt(),{showToast:i}=yn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:p,setAppDefaultPersonaId:m}=lt(),g=t===void 0,v=g?void 0:r.find(_=>_.id===t);if(!g&&r.length>0&&!v)return o.jsx(ls,{to:$f,replace:!0});const b=[{label:"Settings",url:To},{label:"Personas",url:$f},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return o.jsxs("div",{className:os.container,children:[o.jsx(ks,{segments:b}),o.jsx(m9,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s($f)},showToast:i})]})}function m9({existing:t,isNew:s,appDefaultPersonaId:i,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=xt(),[v,b]=y.useState((t==null?void 0:t.name)??""),[_,S]=y.useState((t==null?void 0:t.description)??""),[k,w]=y.useState((t==null?void 0:t.systemPrompt)??""),[N,T]=y.useState((t==null?void 0:t.runtime)??"claude-code"),[C,E]=y.useState((t==null?void 0:t.model)??"sonnet"),[B,A]=y.useState((t==null?void 0:t.maxTurns)??0),[I,O]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[U,P]=y.useState((t==null?void 0:t.script)??""),[W,te]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[H,ie]=y.useState(!1),[Y,re]=y.useState(null),[D,Z]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!D){Z(!0),b(t.name),S(t.description),w(t.systemPrompt);const ae=t.type==="script"?"script":"agent";T(ae==="script"?t.runtime||"genaiscript":t.runtime),E(t.model),A(t.maxTurns),O(ae),P(t.script||""),te(t.allowedMcpTools)}},[s,t,D]);const se=ae=>{O(ae),ae==="script"?T("genaiscript"):N==="genaiscript"&&T("claude-code")},ue=!s&&t===void 0,de=v.trim().length>0&&!ue&&k.trim().length>0&&(I==="script"?U.trim().length>0:!!N&&!!C),Ge=s&&de,De=!s&&i===(t==null?void 0:t.id),Ne=!s&&t&&!De&&I==="agent"&&!!N&&!!C,Oe=(ae,Q)=>{if(!ae.trim())return`${Q} is required`},fe=ae=>{if(ae.preventDefault(),!(ue||!de)){if(t){c(t.id,v,_,k,N,C,B,I,U).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,_,k,N,C,B,I,U,W).then(Q=>{m("Persona created","success"),g(E_(Q.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},ye=()=>{t&&d(t.id).then(()=>{m("Persona deleted","success"),p()},()=>{m("Failed to delete persona","error")})},me=async(ae,Q,ct,Le)=>ae().then(()=>{Q(),m(ct,"success")},()=>{m(Le,"error")}),Ue=(ae,Q)=>{if(!t)return;const ct=ae==="type"?String(Q):I,Le=ae==="runtime"?String(Q):ae==="type"?String(Q)==="script"?"genaiscript":N==="genaiscript"?"claude-code":N:N,$t=ae==="model"?String(Q):C,dt=ae==="maxTurns"?Number(Q):B,na=ae==="systemPrompt"?String(Q):k,Ss=ae==="script"?String(Q):U;me(()=>c(t.id,ae==="name"?String(Q):v,ae==="description"?String(Q):_,na,Le,$t,dt,ct,Ss),()=>{if(ae==="type"){const _n=String(Q)==="script"?"script":"agent";O(_n),T(Le)}ae==="runtime"&&T(String(Q)),ae==="name"&&b(String(Q)),ae==="description"&&S(String(Q)),ae==="systemPrompt"&&w(String(Q)),ae==="model"&&E(String(Q)),ae==="maxTurns"&&A(Number(Q)),ae==="script"&&P(String(Q))},"Persona updated","Failed to update persona").catch(()=>{})},pt=ae=>{fe(ae)},bn=()=>{t&&u(t.id).then(()=>{m("Set as app default","success")},()=>{m("Failed to set app default","error")})};return o.jsxs(o.Fragment,{children:[ue?o.jsxs("div",{className:os.form,children:[o.jsx("h3",{children:"Edit Persona"}),o.jsx("p",{children:"Loading persona..."})]}):s?o.jsxs("form",{onSubmit:pt,className:os.form,children:[o.jsx("h3",{children:"Create Persona"}),o.jsxs("div",{className:os.typeToggle,"data-testid":"persona-type-toggle",children:[o.jsxs("label",{children:[o.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:I==="agent",onChange:()=>se("agent")}),"Agent"]}),o.jsxs("label",{children:[o.jsx("input",{type:"radio",name:"personaType",value:"script",checked:I==="script",onChange:()=>se("script")}),"Script"]})]}),o.jsxs("label",{children:["Name",o.jsx("input",{type:"text",value:v,onChange:ae=>b(ae.target.value),placeholder:I==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),o.jsxs("label",{children:["Description",o.jsx("input",{type:"text",value:_,onChange:ae=>S(ae.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),o.jsxs("label",{children:["Runtime",o.jsx("select",{value:N,onChange:ae=>T(ae.target.value),"data-testid":"persona-runtime-select",children:(I==="script"?Wb:Jb).map(ae=>o.jsx("option",{value:ae.value,children:ae.label},ae.value))})]}),I==="agent"&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model",o.jsx("input",{type:"text",value:C,onChange:ae=>E(ae.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),o.jsxs("label",{children:["Max Turns",o.jsx("input",{type:"number",value:B,onChange:ae=>A(parseInt(ae.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),o.jsxs("label",{children:["System Prompt",o.jsx("textarea",{value:k,onChange:ae=>w(ae.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),I==="script"&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model ",o.jsx("span",{className:os.optional,children:"(optional)"}),o.jsx("input",{type:"text",value:C,onChange:ae=>E(ae.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),o.jsxs("label",{children:["System Prompt",o.jsx("textarea",{value:k,onChange:ae=>w(ae.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),o.jsxs("label",{children:["Script",o.jsx("textarea",{value:U,onChange:ae=>P(ae.target.value),placeholder:`script({ model: "openai:gpt-4o" });
|
|
702
|
-
|
|
703
|
-
const grackle = await host.mcpServer({
|
|
704
|
-
id: "grackle",
|
|
705
|
-
url: env.vars.GRACKLE_MCP_URL,
|
|
706
|
-
});
|
|
707
|
-
|
|
708
|
-
$\`Summarize the current tasks.\`;`,rows:20,className:os.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),I==="agent"&&o.jsxs("div",{children:[o.jsx("label",{children:"Allowed MCP Tools"}),o.jsx(Ub,{selectedTools:W,onChange:te})]}),o.jsxs("div",{className:os.formActions,children:[o.jsx(Ks,{type:"submit",variant:"primary",size:"md",disabled:!Ge,"data-testid":"persona-detail-save",children:"Create"}),o.jsx(Ks,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?o.jsxs("div",{className:os.form,children:[o.jsx("h3",{children:"Edit Persona"}),o.jsxs("div",{className:os.formActions,children:[o.jsx(Ks,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),Ne&&o.jsx(Ks,{type:"button",variant:"ghost",size:"md",onClick:bn,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),De&&o.jsx("span",{className:os.defaultBadge,children:"App Default"}),o.jsx(Ks,{type:"button",variant:"danger",size:"md",onClick:()=>ie(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),o.jsxs("div",{className:os.editableSection,children:[o.jsxs("label",{children:["Name",o.jsx(en,{value:v,onSave:ae=>{Ue("name",ae)},validate:ae=>Oe(ae,"Name"),fieldId:"persona-name",activeFieldId:Y,onActivate:re,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),o.jsxs("label",{children:["Description",o.jsx(en,{value:_,onSave:ae=>{Ue("description",ae)},fieldId:"persona-description",activeFieldId:Y,onActivate:re,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),o.jsxs("label",{children:["Type",o.jsx(od,{value:I,onSave:ae=>{Ue("type",ae)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:Y,onActivate:re,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),o.jsxs("label",{children:["Runtime",o.jsx(od,{value:N,onSave:ae=>{Ue("runtime",ae)},options:I==="script"?Wb:Jb,fieldId:"persona-runtime",activeFieldId:Y,onActivate:re,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),o.jsxs("label",{children:["Model",I==="script"?" (optional)":"",o.jsx(en,{value:C,onSave:ae=>{Ue("model",ae)},validate:I==="agent"?ae=>Oe(ae,"Model"):void 0,fieldId:"persona-model",activeFieldId:Y,onActivate:re,placeholder:I==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),o.jsxs("label",{children:["Max Turns",o.jsx(en,{value:String(B),onSave:ae=>{Ue("maxTurns",parseInt(ae,10)||0)},validate:ae=>/^\d+$/.test(ae.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:Y,onActivate:re,placeholder:p9,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),o.jsxs("label",{children:["System Prompt",o.jsx(Kp,{value:k,onSave:ae=>{Ue("systemPrompt",ae)},validate:ae=>Oe(ae,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:Y,onActivate:re,placeholder:I==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),I==="script"&&o.jsxs("label",{children:["Script",o.jsx(Kp,{value:U,onSave:ae=>{Ue("script",ae)},validate:ae=>Oe(ae,"Script"),fieldId:"persona-script",activeFieldId:Y,onActivate:re,placeholder:`script({ model: "openai:gpt-4o" });
|
|
709
|
-
|
|
710
|
-
const grackle = await host.mcpServer({
|
|
711
|
-
id: "grackle",
|
|
712
|
-
url: env.vars.GRACKLE_MCP_URL,
|
|
713
|
-
});
|
|
714
|
-
|
|
715
|
-
$\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),I==="agent"&&o.jsxs("div",{children:[o.jsx("label",{children:"Allowed MCP Tools"}),o.jsx(Ub,{selectedTools:W,onChange:ae=>{te(ae),me(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,ae),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Ne&&!De&&o.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,o.jsx(xi,{isOpen:H,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:ye,onCancel:()=>ie(!1)})]})}function h9(){const{themeId:t,resolvedThemeId:s,setTheme:i,preferSystem:r,setPreferSystem:c}=E1();return o.jsx(RO,{themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:r,onSetPreferSystem:c})}function g9(){const[t,s]=y.useState(void 0);return y.useEffect(()=>{let i=!1;return(async()=>{try{const c=await Te.getVersionStatus({});i||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{i=!0}},[]),t}function v9(){const{connected:t,environments:{environments:s},sessions:{sessions:i}}=lt(),r=g9();return o.jsxs(o.Fragment,{children:[r&&o.jsx(L5,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),o.jsx(MO,{connected:t,environments:s,sessions:i})]})}function y9(){return o.jsx(EL,{})}const Qb=Ti();function b9(){const t=xt();return Ws({key:"?"},()=>{t(Xj)}),Ws({key:"n"},()=>{t(Qb)}),Ws({key:"N"},()=>{t(Qb)}),o.jsx(o.Fragment,{})}function ll(t){const s=u8();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function _9(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=lt(),i=y.useMemo(()=>o.jsx(f5,{workspaces:t,tasks:s}),[t,s]);return ll(i),o.jsx(Ua,{})}function x9(){const{environments:{environments:t}}=lt(),s=y.useMemo(()=>o.jsx(kI,{environments:t}),[t]);return ll(s),o.jsx(Ua,{})}function k9(){const t=y.useMemo(()=>o.jsx(vB,{}),[]);return ll(t),o.jsx(Ua,{})}function S9(){const{findings:{findings:t,loadFindings:s,loadAllFindings:i}}=lt(),{workspaceId:r,environmentId:c}=ds();y.useEffect(()=>{r?s(r).catch(()=>{}):i().catch(()=>{})},[r,s,i]);const d=y.useMemo(()=>o.jsx(MI,{findings:t,workspaceId:r,environmentId:c}),[t,r,c]);return ll(d),o.jsx(Ua,{})}function T9(){const{knowledge:t,workspaces:{workspaces:s}}=lt(),i=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(()=>o.jsx(O4,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:i,onClearSearch:r,onSelectNode:c,onWorkspaceChange:d}),[t,s,i,r,c,d]);return ll(u),o.jsx(Ua,{})}const w9="_container_ce571_1",j9="_title_ce571_6",cd={container:w9,title:j9};function N9(){return o.jsxs("div",{className:cd.container,"aria-hidden":"true",children:[o.jsx("h1",{className:cd.title,children:"Findings"}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:Array.from({length:4},(t,s)=>o.jsx(id,{lines:3},s))})]})}function e_(){const{environmentId:t,workspaceId:s}=ds(),{findings:{findings:i,findingsLoading:r,loadFindings:c},workspaces:{workspaces:d},environments:{environments:u}}=lt(),p=xt();y.useEffect(()=>{s&&c(s).catch(()=>{})},[s,c]);const m=y.useCallback(v=>{p(Ep(v,s,t))},[p,s,t]);if(r)return o.jsx(N9,{});const g=s&&t?L1("Findings",s,t,d,u).slice(0,-1):S8();return o.jsxs("div",{className:cd.container,"data-testid":"findings-list-page",children:[o.jsx(ks,{segments:g}),o.jsx("h1",{className:cd.title,children:"Findings"}),o.jsx(_1,{findings:i,onFindingClick:m})]})}const C9="_container_1wwpb_1",E9="_notFound_1wwpb_6",A9="_header_1wwpb_12",D9="_categoryBadge_1wwpb_19",R9="_title_1wwpb_28",M9="_content_1wwpb_35",I9="_tags_1wwpb_77",O9="_tag_1wwpb_77",L9="_meta_1wwpb_92",B9="_metaTimestamp_1wwpb_100",z9="_metaLink_1wwpb_105",dn={container:C9,notFound:E9,header:A9,categoryBadge:D9,title:R9,content:M9,tags:I9,tag:O9,meta:L9,metaTimestamp:B9,metaLink:z9};function t_(){const{findingId:t,environmentId:s,workspaceId:i}=ds(),{findings:{selectedFinding:r,findingLoading:c,loadFinding:d},workspaces:{workspaces:u},environments:{environments:p}}=lt(),m=xt();if(y.useEffect(()=>{t&&d(t).catch(()=>{})},[t,d]),c)return o.jsx("div",{className:dn.container,"data-testid":"finding-detail-page",children:o.jsx("div",{className:dn.notFound,children:"Loading..."})});if(!r)return o.jsx("div",{className:dn.container,"data-testid":"finding-detail-page",children:o.jsx("div",{className:dn.notFound,children:"Finding not found."})});const g=L1(r.title,i,s,u,p),v=rd(r.category);return o.jsxs("div",{className:dn.container,"data-testid":"finding-detail-page",children:[o.jsx(ks,{segments:g}),o.jsxs("div",{className:dn.header,children:[o.jsx("span",{className:dn.categoryBadge,style:{background:v.bg,color:v.text},children:r.category}),o.jsx("h1",{className:dn.title,children:r.title})]}),r.content&&o.jsx("div",{className:dn.content,children:o.jsx(dd,{remarkPlugins:[ud],children:r.content})}),r.tags.length>0&&o.jsx("div",{className:dn.tags,children:r.tags.map(b=>o.jsx("span",{className:dn.tag,children:b},b))}),o.jsxs("div",{className:dn.meta,children:[o.jsx("span",{className:dn.metaTimestamp,title:r.createdAt,children:Ym(r.createdAt)}),r.taskId&&o.jsx("button",{type:"button",className:dn.metaLink,onClick:()=>{m(Dn(r.taskId))},children:"View Task"}),r.sessionId&&o.jsx("button",{type:"button",className:dn.metaLink,onClick:()=>{m(um(r.sessionId))},children:"View Session"})]})]})}const U9="_wizard_1260s_1",$9="_container_1260s_10",P9="_stepContent_1260s_19",H9="_logoArea_1260s_28",V9="_logoImage_1260s_32",q9="_heading_1260s_41",G9="_tagline_1260s_49",F9="_subtitle_1260s_56",Z9="_featureList_1260s_64",K9="_runtimeGrid_1260s_89",Y9="_runtimeCard_1260s_101",J9="_runtimeName_1260s_133",W9="_runtimeDescription_1260s_139",X9="_buttonRow_1260s_144",Q9="_primaryButton_1260s_151",eP="_ghostButton_1260s_185",tP="_dots_1260s_213",nP="_dot_1260s_213",mt={wizard:U9,container:$9,stepContent:P9,logoArea:H9,logoImage:V9,heading:q9,tagline:G9,subtitle:F9,featureList:Z9,runtimeGrid:K9,runtimeCard:Y9,runtimeName:J9,runtimeDescription:W9,buttonRow:X9,primaryButton:Q9,ghostButton:eP,dots:tP,dot:nP};function sP({onNext:t}){return o.jsxs("div",{className:mt.stepContent,"data-testid":"setup-welcome",children:[o.jsx("div",{className:mt.logoArea,children:o.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:mt.logoImage})}),o.jsx("h1",{className:mt.heading,children:"Welcome to Grackle"}),o.jsx("p",{className:mt.tagline,children:"Multi-agent orchestration for software teams"}),o.jsx("button",{type:"button",className:mt.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function aP({onNext:t,onBack:s}){return o.jsxs("div",{className:mt.stepContent,"data-testid":"setup-about",children:[o.jsx("h2",{className:mt.heading,children:"What is Grackle?"}),o.jsxs("ul",{className:mt.featureList,children:[o.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),o.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),o.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),o.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),o.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),o.jsxs("div",{className:mt.buttonRow,children:[o.jsx("button",{type:"button",className:mt.ghostButton,onClick:s,children:"Back"}),o.jsx("button",{type:"button",className:mt.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const iP=[{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 oP({currentRuntime:t,onFinish:s,onBack:i,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),o.jsxs("div",{className:mt.stepContent,"data-testid":"setup-runtime",children:[o.jsx("h2",{className:mt.heading,children:"Choose Your Runtime"}),o.jsx("p",{className:mt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),o.jsx("div",{className:mt.runtimeGrid,children:iP.map(u=>o.jsxs("button",{type:"button",className:mt.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[o.jsx("span",{className:mt.runtimeName,children:u.name}),o.jsx("span",{className:mt.runtimeDescription,children:u.description})]},u.id))}),o.jsxs("div",{className:mt.buttonRow,children:[o.jsx("button",{type:"button",className:mt.ghostButton,onClick:i,children:"Back"}),o.jsx("button",{type:"button",className:mt.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-finish",children:"Finish"})]})]})}const rP=3,n_={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function lP(){const{personas:{personas:t,updatePersona:s},completeOnboarding:i,onboardingCompleted:r}=lt(),{showToast:c}=yn(),d=xt(),[u,p]=y.useState(0),[m,g]=y.useState(!1),v=t.find(_=>_.id==="claude-code"),b=y.useCallback(_=>{g(!0);const S=[];if(v&&_!==v.runtime){const w=n_[_]??"sonnet";S.push(s(v.id,void 0,void 0,void 0,_,w))}const k=t.find(w=>w.id===Z0);if(k&&_!==k.runtime){const w=n_[_]??"sonnet";S.push(s(Z0,void 0,void 0,void 0,_,w))}Promise.all(S).then(()=>i()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,t,s,i,d,c]);return r===!0?o.jsx(ls,{to:"/",replace:!0}):o.jsx("div",{className:mt.wizard,"data-testid":"setup-wizard",children:o.jsxs("div",{className:mt.container,children:[o.jsx(cs,{mode:"wait",children:o.jsxs(Et.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&o.jsx(sP,{onNext:()=>p(1)}),u===1&&o.jsx(aP,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&o.jsx(oP,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:b,onBack:()=>p(1),finishDisabled:!v||m})]},u)}),o.jsx("div",{className:mt.dots,children:Array.from({length:rP},(_,S)=>o.jsx("span",{className:mt.dot,"data-active":S===u},S))})]})})}const cP="_root_zndgp_1",dP="_body_zndgp_7",uP="_main_zndgp_19",fP="_sidebarWrapper_zndgp_26",pP="_overlay_zndgp_51",zr={root:cP,body:dP,main:uP,sidebarWrapper:fP,overlay:pP},mP=y.lazy(()=>NT(()=>import("./KnowledgePage-Ctrxq4X6.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),z1=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function hP(){const{connected:t,environments:{environments:s},sessions:{sessions:i},tasks:{tasks:r}}=lt(),{toasts:c,dismissToast:d}=yn(),u=Vt(),p=d8(),m=p!==void 0,[g,v]=y.useState(!1),b=y.useCallback(()=>v(_=>!_),[]);return y.useEffect(()=>{v(!1)},[u.pathname]),y.useEffect(()=>{if(!g)return;const _=S=>{S.key==="Escape"&&v(!1)};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[g]),o.jsxs(o.Fragment,{children:[o.jsx(G4,{connected:t,environments:s,sessions:i,onToggleSidebar:m?b:void 0,sidebarOpen:g}),o.jsx(X4,{}),o.jsxs("div",{className:zr.body,children:[m&&o.jsx("div",{className:zr.sidebarWrapper,"data-sidebar-open":g,children:o.jsx(aI,{content:p})}),m&&g&&o.jsx("div",{className:zr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),o.jsxs("div",{className:zr.main,children:[o.jsx(Ua,{}),o.jsx(fI,{sessions:i,tasks:r,environments:s})]})]}),o.jsx(w5,{toasts:c,onDismiss:d}),o.jsx(b9,{})]})}function gP(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:i,clearOperationError:r},tasks:{tasks:c},connected:d,onboardingCompleted:u}=lt(),{showToast:p}=yn();cz(s,p),mz(c,p),dz(i,r,p);const m=xt(),g=Vt();return y.useEffect(()=>{t&&!g.pathname.includes("/tasks/")&&m(um(t),{replace:!0})},[t,m,g.pathname]),d&&u===!1?o.jsx(ls,{to:"/setup",replace:!0}):o.jsx(c8,{children:o.jsxs("div",{className:zr.root,children:[z1&&o.jsx(CN,{}),o.jsx(hP,{})]})})}function Tp(){const{workspaceId:t}=ds(),{workspaces:{workspaces:s}}=lt(),i=Vt(),r=s.find(m=>m.id===t);if(!(r!=null&&r.environmentId))return s.length===0?void 0:o.jsx(ls,{to:"/environments",replace:!0});const c=encodeURIComponent(t),d=`/workspaces/${c}`,u=i.pathname.startsWith(d)?i.pathname.slice(d.length):"",p=`/environments/${encodeURIComponent(r.environmentId)}/workspaces/${c}${u}${i.search}${i.hash}`;return o.jsx(ls,{to:p,replace:!0})}function vP(){return o.jsxs(pj,{children:[o.jsx(je,{path:"setup",element:o.jsx(lP,{})}),o.jsxs(je,{element:o.jsx(gP,{}),children:[o.jsx(je,{index:!0,element:o.jsx(BU,{})}),o.jsx(je,{path:"chat",element:o.jsx(ZU,{})}),o.jsx(je,{path:"sessions/new",element:o.jsx(KU,{})}),o.jsx(je,{path:"sessions/:sessionId",element:o.jsx(XU,{})}),o.jsx(je,{element:o.jsx(T9,{}),children:o.jsx(je,{path:"knowledge",element:o.jsx(y.Suspense,{fallback:o.jsx(d1,{}),children:o.jsx(mP,{})})})}),o.jsxs(je,{element:o.jsx(_9,{}),children:[o.jsx(je,{path:"tasks",element:o.jsx(OU,{})}),o.jsx(je,{path:"tasks/new",element:o.jsx(Kb,{})}),o.jsx(je,{path:"tasks/:taskId",element:o.jsx(Da,{})}),o.jsx(je,{path:"tasks/:taskId/edit",element:o.jsx(Da,{})}),o.jsx(je,{path:"tasks/:taskId/stream",element:o.jsx(Da,{})}),o.jsx(je,{path:"tasks/:taskId/findings",element:o.jsx(Da,{})})]}),o.jsxs(je,{element:o.jsx(S9,{}),children:[o.jsx(je,{path:"findings",element:o.jsx(e_,{})}),o.jsx(je,{path:"findings/:findingId",element:o.jsx(t_,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:o.jsx(e_,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:o.jsx(t_,{})})]}),o.jsxs(je,{element:o.jsx(x9,{}),children:[o.jsx(je,{path:"workspaces",element:o.jsx(ls,{to:"/environments",replace:!0})}),o.jsx(je,{path:"workspaces/new",element:o.jsx(p$,{})}),o.jsx(je,{path:"workspaces/:workspaceId",element:o.jsx(Tp,{})}),o.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId",element:o.jsx(Tp,{})}),o.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:o.jsx(Tp,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId",element:o.jsx(n$,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:o.jsx(Kb,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:o.jsx(Da,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:o.jsx(Da,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:o.jsx(Da,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:o.jsx(Da,{})}),o.jsxs(je,{path:"environments",element:o.jsx(T$,{}),children:[o.jsx(je,{index:!0,element:o.jsx(LU,{})}),o.jsx(je,{path:"new",element:o.jsx(b$,{})}),o.jsx(je,{path:":environmentId",element:o.jsx(Q$,{})}),o.jsx(je,{path:":environmentId/edit",element:o.jsx(_$,{})})]})]}),o.jsx(je,{element:o.jsx(k9,{}),children:o.jsxs(je,{path:"settings",element:o.jsx(n9,{}),children:[o.jsx(je,{index:!0,element:o.jsx(ls,{to:"credentials",replace:!0})}),o.jsx(je,{path:"environments",element:o.jsx(ls,{to:"/environments",replace:!0})}),o.jsx(je,{path:"credentials",element:o.jsx(s9,{})}),o.jsx(je,{path:"tokens",element:o.jsx(ls,{to:"../credentials",replace:!0})}),o.jsx(je,{path:"personas",element:o.jsx(a9,{})}),o.jsx(je,{path:"personas/new",element:o.jsx(Xb,{})}),o.jsx(je,{path:"personas/:personaId",element:o.jsx(Xb,{})}),o.jsx(je,{path:"appearance",element:o.jsx(h9,{})}),o.jsx(je,{path:"shortcuts",element:o.jsx(y9,{})}),o.jsx(je,{path:"about",element:o.jsx(v9,{})})]})}),o.jsx(je,{path:"*",element:o.jsx(ls,{to:"/",replace:!0})})]})]})}const yP=1e4;function bP(){const{onboardingCompleted:t}=lt(),[s,i]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>i(!0),yP);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return o.jsx(cs,{mode:"wait",children:r?o.jsx(Et.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:o.jsx(d1,{})},"splash"):o.jsx(Et.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:o.jsx(zj,{basename:"/".replace(/\/$/,""),children:o.jsx(vP,{})})},"app")})}function _P(){const t=z1?z8:lz;return o.jsx(l8,{children:o.jsx(a8,{children:o.jsx(t,{children:o.jsx(bP,{})})})})}TT.createRoot(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(_P,{})}));export{ks as B,D_ as K,lt as a,Ep as f,um as s,Dn as t,xt as u};
|