@grackle-ai/web 0.96.1 → 0.96.2
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.
|
@@ -0,0 +1,715 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-CmClxdks.js","assets/dagview-tHPW3Rz3.js","assets/grpc-CkqXCGns.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as tT,a as nT,b as y,j as i,d as K0,H as Y0,P as J0,i as sT,B as aT,c as iT,C as oT,M as rT,e as lT}from"./dagview-tHPW3Rz3.js";import{c as cT,a as dT,G as uT,f as fT,M as pT,A as lx,D as cx,W as mT,O as hT,b as gT,C as ji,d as dx,e as ux,w as vT,t as yT,p as Ec,g as bT,R as Mr,S as W0}from"./grpc-CkqXCGns.js";import{v as xT,r as _T,t as Ac,i as kT,f as ST,M as hd,a as gd}from"./markdown-Yr3vTPLR.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function o(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=o(c);fetch(c.href,d)}})();var zf={exports:{}},Ir={},$f={exports:{}},Uf={};/**
|
|
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 X0;function TT(){return X0||(X0=1,(function(t){function s(L,Z){var J=L.length;L.push(Z);e:for(;0<J;){var ce=J-1>>>1,X=L[ce];if(0<c(X,Z))L[ce]=Z,L[J]=X,J=ce;else break e}}function o(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var Z=L[0],J=L.pop();if(J!==Z){L[0]=J;e:for(var ce=0,X=L.length,ge=X>>>1;ce<ge;){var pe=2*(ce+1)-1,Ce=L[pe],Ze=pe+1,me=L[Ze];if(0>c(Ce,J))Ze<X&&0>c(me,Ce)?(L[ce]=me,L[Ze]=J,ce=Ze):(L[ce]=Ce,L[pe]=J,ce=pe);else if(Ze<X&&0>c(me,J))L[ce]=me,L[Ze]=J,ce=Ze;else break e}}return Z}function c(L,Z){var J=L.sortIndex-Z.sortIndex;return J!==0?J:L.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,x=3,S=!1,k=!1,w=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function O(L){for(var Z=o(g);Z!==null;){if(Z.callback===null)r(g);else if(Z.startTime<=L)r(g),Z.sortIndex=Z.expirationTime,s(m,Z);else break;Z=o(g)}}function E(L){if(w=!1,O(L),!k)if(o(m)!==null)k=!0,A||(A=!0,H());else{var Z=o(g);Z!==null&&oe(E,Z.startTime-L)}}var A=!1,P=-1,I=5,U=-1;function Q(){return N?!0:!(t.unstable_now()-U<I)}function $(){if(N=!1,A){var L=t.unstable_now();U=L;var Z=!0;try{e:{k=!1,w&&(w=!1,C(P),P=-1),S=!0;var J=x;try{t:{for(O(L),b=o(m);b!==null&&!(b.expirationTime>L&&Q());){var ce=b.callback;if(typeof ce=="function"){b.callback=null,x=b.priorityLevel;var X=ce(b.expirationTime<=L);if(L=t.unstable_now(),typeof X=="function"){b.callback=X,O(L),Z=!0;break t}b===o(m)&&r(m),O(L)}else r(m);b=o(m)}if(b!==null)Z=!0;else{var ge=o(g);ge!==null&&oe(E,ge.startTime-L),Z=!1}}break e}finally{b=null,x=J,S=!1}Z=void 0}}finally{Z?H():A=!1}}}var H;if(typeof D=="function")H=function(){D($)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,W=ue.port2;ue.port1.onmessage=$,H=function(){W.postMessage(null)}}else H=function(){T($,0)};function oe(L,Z){P=T(function(){L(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(L){L.callback=null},t.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<L?Math.floor(1e3/L):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(L){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var J=x;x=Z;try{return L()}finally{x=J}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(L,Z){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var J=x;x=L;try{return Z()}finally{x=J}},t.unstable_scheduleCallback=function(L,Z,J){var ce=t.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?ce+J:ce):J=ce,L){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=J+X,L={id:v++,callback:Z,priorityLevel:L,startTime:J,expirationTime:X,sortIndex:-1},J>ce?(L.sortIndex=J,s(g,L),o(m)===null&&L===o(g)&&(w?(C(P),P=-1):w=!0,oe(E,J-ce))):(L.sortIndex=X,s(m,L),k||S||(k=!0,A||(A=!0,H()))),L},t.unstable_shouldYield=Q,t.unstable_wrapCallback=function(L){var Z=x;return function(){var J=x;x=Z;try{return L.apply(this,arguments)}finally{x=J}}}})(Uf)),Uf}var Q0;function wT(){return Q0||(Q0=1,$f.exports=TT()),$f.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 ey;function jT(){if(ey)return Ir;ey=1;var t=wT(),s=tT(),o=nT();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(d(e)!==e)throw Error(r(188))}function g(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(r(188));return n!==e?null:e}for(var a=e,l=n;;){var f=a.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===a)return m(f),e;if(h===l)return m(f),n;h=h.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=h;else{for(var _=!1,j=f.child;j;){if(j===a){_=!0,a=f,l=h;break}if(j===l){_=!0,l=f,a=h;break}j=j.sibling}if(!_){for(j=h.child;j;){if(j===a){_=!0,a=h,l=f;break}if(j===l){_=!0,l=h,a=f;break}j=j.sibling}if(!_)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,x=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"),D=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function H(e){return e===null||typeof e!="object"?null:(e=$&&e[$]||e["@@iterator"],typeof e=="function"?e:null)}var ue=Symbol.for("react.client.reference");function W(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ue?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 E:return"Suspense";case A:return"SuspenseList";case U:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case D:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case O:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return n=e.displayName||null,n!==null?n:W(e.type)||"Memo";case I:n=e._payload,e=e._init;try{return W(e(n))}catch{}}return null}var oe=Array.isArray,L=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},ce=[],X=-1;function ge(e){return{current:e}}function pe(e){0>X||(e.current=ce[X],ce[X]=null,X--)}function Ce(e,n){X++,ce[X]=e.current,e.current=n}var Ze=ge(null),me=ge(null),_e=ge(null),ve=ge(null);function Le(e,n){switch(Ce(_e,n),Ce(me,e),Ce(Ze,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?v0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=v0(n),e=y0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}pe(Ze),Ce(Ze,e)}function Mt(){pe(Ze),pe(me),pe(_e)}function Tn(e){e.memoizedState!==null&&Ce(ve,e);var n=Ze.current,a=y0(n,e.type);n!==a&&(Ce(me,e),Ce(Ze,a))}function ie(e){me.current===e&&(pe(Ze),pe(me)),ve.current===e&&(pe(ve),Er._currentValue=J)}var Ve,qt;function te(e){if(Ve===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Ve=n&&n[1]||"",qt=-1<a.stack.indexOf(`
|
|
19
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
+
`+Ve+e+qt}var ht=!1;function at(e,n){if(!e||ht)return"";ht=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(K){var F=K}Reflect.construct(e,[],se)}else{try{se.call()}catch(K){F=K}e.call(se.prototype)}}else{try{throw Error()}catch(K){F=K}(se=e())&&typeof se.catch=="function"&&se.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(),_=h[0],j=h[1];if(_&&j){var R=_.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 ee=`
|
|
23
|
+
`+R[l].replace(" at new "," at ");return e.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",e.displayName)),ee}while(1<=l&&0<=f);break}}}finally{ht=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?te(a):""}function Kt(e,n){switch(e.tag){case 26:case 27:case 5:return te(e.type);case 16:return te("Lazy");case 13:return e.child!==n&&n!==null?te("Suspense Fallback"):te("Suspense");case 19:return te("SuspenseList");case 0:case 15:return at(e.type,!1);case 11:return at(e.type.render,!1);case 1:return at(e.type,!0);case 31:return te("Activity");default:return""}}function gt(e){try{var n="",a=null;do n+=Kt(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
|
|
24
|
+
Error generating stack: `+l.message+`
|
|
25
|
+
`+l.stack}}var ps=Object.prototype.hasOwnProperty,aa=t.unstable_scheduleCallback,es=t.unstable_cancelCallback,Fa=t.unstable_shouldYield,ia=t.unstable_requestPaint,Yt=t.unstable_now,Ii=t.unstable_getCurrentPriorityLevel,oa=t.unstable_ImmediatePriority,Za=t.unstable_UserBlockingPriority,ms=t.unstable_NormalPriority,Oi=t.unstable_LowPriority,wn=t.unstable_IdlePriority,Re=t.log,Je=t.unstable_setDisableYieldValue,Jt=null,St=null;function un(e){if(typeof Re=="function"&&Je(e),St&&typeof St.setStrictMode=="function")try{St.setStrictMode(Jt,e)}catch{}}var Wt=Math.clz32?Math.clz32:zi,Bi=Math.log,Li=Math.LN2;function zi(e){return e>>>=0,e===0?32:31-(Bi(e)/Li|0)|0}var Ka=256,Ya=262144,Ja=4194304;function hs(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 Wa(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var j=l&134217727;return j!==0?(l=j&~h,l!==0?f=hs(l):(_&=j,_!==0?f=hs(_):a||(a=j&~e,a!==0&&(f=hs(a))))):(j=l&~h,j!==0?f=hs(j):_!==0?f=hs(_):a||(a=l&~e,a!==0&&(f=hs(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 Xa(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function V(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 ae(){var e=Ja;return Ja<<=1,(Ja&62914560)===0&&(Ja=4194304),e}function le(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function de(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ye(e,n,a,l,f,h){var _=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var j=e.entanglements,R=e.expirationTimes,G=e.hiddenUpdates;for(a=_&~a;0<a;){var ee=31-Wt(a),se=1<<ee;j[ee]=0,R[ee]=-1;var F=G[ee];if(F!==null)for(G[ee]=null,ee=0;ee<F.length;ee++){var K=F[ee];K!==null&&(K.lane&=-536870913)}a&=~se}l!==0&&We(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(_&~n))}function We(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Wt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Te(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-Wt(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function Ie(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 ct(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Xe(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:P0(e.type))}function Xt(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var jt=Math.random().toString(36).slice(2),Ue="__reactFiber$"+jt,It="__reactProps$"+jt,gn="__reactContainer$"+jt,Qa="__reactEvents$"+jt,q1="__reactListeners$"+jt,G1="__reactHandles$"+jt,ah="__reactResources$"+jt,qo="__reactMarker$"+jt;function Ed(e){delete e[Ue],delete e[It],delete e[Qa],delete e[q1],delete e[G1]}function $i(e){var n=e[Ue];if(n)return n;for(var a=e.parentNode;a;){if(n=a[gn]||a[Ue]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=w0(e);e!==null;){if(a=e[Ue])return a;e=w0(e)}return n}e=a,a=e.parentNode}return null}function Ui(e){if(e=e[Ue]||e[gn]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Go(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function Pi(e){var n=e[ah];return n||(n=e[ah]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Qt(e){e[qo]=!0}var ih=new Set,oh={};function ei(e,n){Hi(e,n),Hi(e+"Capture",n)}function Hi(e,n){for(oh[e]=n,e=0;e<n.length;e++)ih.add(n[e])}var F1=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]*$"),rh={},lh={};function Z1(e){return ps.call(lh,e)?!0:ps.call(rh,e)?!1:F1.test(e)?lh[e]=!0:(rh[e]=!0,!1)}function vl(e,n,a){if(Z1(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 yl(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 Cs(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 zn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ch(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function K1(e,n,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(_){a=""+_,h.call(this,_)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Ad(e){if(!e._valueTracker){var n=ch(e)?"checked":"value";e._valueTracker=K1(e,n,""+e[n])}}function dh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=ch(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function bl(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 Y1=/[\n"\\]/g;function $n(e){return e.replace(Y1,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Dd(e,n,a,l,f,h,_,j){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),n!=null?_==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+zn(n)):e.value!==""+zn(n)&&(e.value=""+zn(n)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),n!=null?Rd(e,_,zn(n)):a!=null?Rd(e,_,zn(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=""+zn(j):e.removeAttribute("name")}function uh(e,n,a,l,f,h,_,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)){Ad(e);return}a=a!=null?""+zn(a):"",n=n!=null?""+zn(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,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),Ad(e)}function Rd(e,n,a){n==="number"&&bl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Vi(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=""+zn(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 fh(e,n,a){if(n!=null&&(n=""+zn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+zn(a):""}function ph(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(r(92));if(oe(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=zn(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Ad(e)}function qi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var J1=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 mh(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||J1.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function hh(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&&mh(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&mh(e,h,n[h])}function Md(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 W1=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"]]),X1=/^[\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 xl(e){return X1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Es(){}var Id=null;function Od(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Gi=null,Fi=null;function gh(e){var n=Ui(e);if(n&&(e=n.stateNode)){var a=e[It]||null;e:switch(e=n.stateNode,n.type){case"input":if(Dd(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="'+$n(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[It]||null;if(!f)throw Error(r(90));Dd(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&&dh(l)}break e;case"textarea":fh(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Vi(e,!!a.multiple,n,!1)}}}var Bd=!1;function vh(e,n,a){if(Bd)return e(n,a);Bd=!0;try{var l=e(n);return l}finally{if(Bd=!1,(Gi!==null||Fi!==null)&&(rc(),Gi&&(n=Gi,e=Fi,Fi=Gi=null,gh(n),e)))for(n=0;n<e.length;n++)gh(e[n])}}function Fo(e,n){var a=e.stateNode;if(a===null)return null;var l=a[It]||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 As=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ld=!1;if(As)try{var Zo={};Object.defineProperty(Zo,"passive",{get:function(){Ld=!0}}),window.addEventListener("test",Zo,Zo),window.removeEventListener("test",Zo,Zo)}catch{Ld=!1}var ra=null,zd=null,_l=null;function yh(){if(_l)return _l;var e,n=zd,a=n.length,l,f="value"in ra?ra.value:ra.textContent,h=f.length;for(e=0;e<a&&n[e]===f[e];e++);var _=a-e;for(l=1;l<=_&&n[a-l]===f[h-l];l++);return _l=f.slice(e,1<l?1-l:void 0)}function kl(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 Sl(){return!0}function bh(){return!1}function vn(e){function n(a,l,f,h,_){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=_,this.currentTarget=null;for(var 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)?Sl:bh,this.isPropagationStopped=bh,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=Sl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Sl)},persist:function(){},isPersistent:Sl}),n}var ti={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tl=vn(ti),Ko=b({},ti,{view:0,detail:0}),Q1=vn(Ko),$d,Ud,Yo,wl=b({},Ko,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hd,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!==Yo&&(Yo&&e.type==="mousemove"?($d=e.screenX-Yo.screenX,Ud=e.screenY-Yo.screenY):Ud=$d=0,Yo=e),$d)},movementY:function(e){return"movementY"in e?e.movementY:Ud}}),xh=vn(wl),ek=b({},wl,{dataTransfer:0}),tk=vn(ek),nk=b({},Ko,{relatedTarget:0}),Pd=vn(nk),sk=b({},ti,{animationName:0,elapsedTime:0,pseudoElement:0}),ak=vn(sk),ik=b({},ti,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ok=vn(ik),rk=b({},ti,{data:0}),_h=vn(rk),lk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ck={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"},dk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function uk(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=dk[e])?!!n[e]:!1}function Hd(){return uk}var fk=b({},Ko,{key:function(e){if(e.key){var n=lk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=kl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ck[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hd,charCode:function(e){return e.type==="keypress"?kl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?kl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),pk=vn(fk),mk=b({},wl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kh=vn(mk),hk=b({},Ko,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hd}),gk=vn(hk),vk=b({},ti,{propertyName:0,elapsedTime:0,pseudoElement:0}),yk=vn(vk),bk=b({},wl,{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}),xk=vn(bk),_k=b({},ti,{newState:0,oldState:0}),kk=vn(_k),Sk=[9,13,27,32],Vd=As&&"CompositionEvent"in window,Jo=null;As&&"documentMode"in document&&(Jo=document.documentMode);var Tk=As&&"TextEvent"in window&&!Jo,Sh=As&&(!Vd||Jo&&8<Jo&&11>=Jo),Th=" ",wh=!1;function jh(e,n){switch(e){case"keyup":return Sk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zi=!1;function wk(e,n){switch(e){case"compositionend":return Nh(n);case"keypress":return n.which!==32?null:(wh=!0,Th);case"textInput":return e=n.data,e===Th&&wh?null:e;default:return null}}function jk(e,n){if(Zi)return e==="compositionend"||!Vd&&jh(e,n)?(e=yh(),_l=zd=ra=null,Zi=!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 Sh&&n.locale!=="ko"?null:n.data;default:return null}}var Nk={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 Ch(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Nk[e.type]:n==="textarea"}function Eh(e,n,a,l){Gi?Fi?Fi.push(l):Fi=[l]:Gi=l,n=mc(n,"onChange"),0<n.length&&(a=new Tl("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Wo=null,Xo=null;function Ck(e){u0(e,0)}function jl(e){var n=Go(e);if(dh(n))return e}function Ah(e,n){if(e==="change")return n}var Dh=!1;if(As){var qd;if(As){var Gd="oninput"in document;if(!Gd){var Rh=document.createElement("div");Rh.setAttribute("oninput","return;"),Gd=typeof Rh.oninput=="function"}qd=Gd}else qd=!1;Dh=qd&&(!document.documentMode||9<document.documentMode)}function Mh(){Wo&&(Wo.detachEvent("onpropertychange",Ih),Xo=Wo=null)}function Ih(e){if(e.propertyName==="value"&&jl(Xo)){var n=[];Eh(n,Xo,e,Od(e)),vh(Ck,n)}}function Ek(e,n,a){e==="focusin"?(Mh(),Wo=n,Xo=a,Wo.attachEvent("onpropertychange",Ih)):e==="focusout"&&Mh()}function Ak(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return jl(Xo)}function Dk(e,n){if(e==="click")return jl(n)}function Rk(e,n){if(e==="input"||e==="change")return jl(n)}function Mk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var jn=typeof Object.is=="function"?Object.is:Mk;function Qo(e,n){if(jn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),l=Object.keys(n);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!ps.call(n,f)||!jn(e[f],n[f]))return!1}return!0}function Oh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Bh(e,n){var a=Oh(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=Oh(a)}}function Lh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Lh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function zh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=bl(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=bl(e.document)}return n}function Fd(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 Ik=As&&"documentMode"in document&&11>=document.documentMode,Ki=null,Zd=null,er=null,Kd=!1;function $h(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Kd||Ki==null||Ki!==bl(l)||(l=Ki,"selectionStart"in l&&Fd(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}),er&&Qo(er,l)||(er=l,l=mc(Zd,"onSelect"),0<l.length&&(n=new Tl("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Ki)))}function ni(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Yi={animationend:ni("Animation","AnimationEnd"),animationiteration:ni("Animation","AnimationIteration"),animationstart:ni("Animation","AnimationStart"),transitionrun:ni("Transition","TransitionRun"),transitionstart:ni("Transition","TransitionStart"),transitioncancel:ni("Transition","TransitionCancel"),transitionend:ni("Transition","TransitionEnd")},Yd={},Uh={};As&&(Uh=document.createElement("div").style,"AnimationEvent"in window||(delete Yi.animationend.animation,delete Yi.animationiteration.animation,delete Yi.animationstart.animation),"TransitionEvent"in window||delete Yi.transitionend.transition);function si(e){if(Yd[e])return Yd[e];if(!Yi[e])return e;var n=Yi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Uh)return Yd[e]=n[a];return e}var Ph=si("animationend"),Hh=si("animationiteration"),Vh=si("animationstart"),Ok=si("transitionrun"),Bk=si("transitionstart"),Lk=si("transitioncancel"),qh=si("transitionend"),Gh=new Map,Jd="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(" ");Jd.push("scrollEnd");function ts(e,n){Gh.set(e,n),ei(n,[e])}var Nl=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)},Un=[],Ji=0,Wd=0;function Cl(){for(var e=Ji,n=Wd=Ji=0;n<e;){var a=Un[n];Un[n++]=null;var l=Un[n];Un[n++]=null;var f=Un[n];Un[n++]=null;var h=Un[n];if(Un[n++]=null,l!==null&&f!==null){var _=l.pending;_===null?f.next=f:(f.next=_.next,_.next=f),l.pending=f}h!==0&&Fh(a,f,h)}}function El(e,n,a,l){Un[Ji++]=e,Un[Ji++]=n,Un[Ji++]=a,Un[Ji++]=l,Wd|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Xd(e,n,a,l){return El(e,n,a,l),Al(e)}function ai(e,n){return El(e,null,null,n),Al(e)}function Fh(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-Wt(a),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),h):null}function Al(e){if(50<kr)throw kr=0,lf=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Wi={};function zk(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 Nn(e,n,a,l){return new zk(e,n,a,l)}function Qd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ds(e,n){var a=e.alternate;return a===null?(a=Nn(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 Zh(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 Dl(e,n,a,l,f,h){var _=0;if(l=e,typeof e=="function")Qd(e)&&(_=1);else if(typeof e=="string")_=VS(e,a,Ze.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case U:return e=Nn(31,a,n,f),e.elementType=U,e.lanes=h,e;case w:return ii(a.children,f,h,n);case N:_=8,f|=24;break;case T:return e=Nn(12,a,n,f|2),e.elementType=T,e.lanes=h,e;case E:return e=Nn(13,a,n,f),e.elementType=E,e.lanes=h,e;case A:return e=Nn(19,a,n,f),e.elementType=A,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:_=10;break e;case C:_=9;break e;case O:_=11;break e;case P:_=14;break e;case I:_=16,l=null;break e}_=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=Nn(_,a,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function ii(e,n,a,l){return e=Nn(7,e,l,n),e.lanes=a,e}function eu(e,n,a){return e=Nn(6,e,null,n),e.lanes=a,e}function Kh(e){var n=Nn(18,null,null,0);return n.stateNode=e,n}function tu(e,n,a){return n=Nn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Yh=new WeakMap;function Pn(e,n){if(typeof e=="object"&&e!==null){var a=Yh.get(e);return a!==void 0?a:(n={value:e,source:n,stack:gt(n)},Yh.set(e,n),n)}return{value:e,source:n,stack:gt(n)}}var Xi=[],Qi=0,Rl=null,tr=0,Hn=[],Vn=0,la=null,gs=1,vs="";function Rs(e,n){Xi[Qi++]=tr,Xi[Qi++]=Rl,Rl=e,tr=n}function Jh(e,n,a){Hn[Vn++]=gs,Hn[Vn++]=vs,Hn[Vn++]=la,la=e;var l=gs;e=vs;var f=32-Wt(l)-1;l&=~(1<<f),a+=1;var h=32-Wt(n)+f;if(30<h){var _=f-f%5;h=(l&(1<<_)-1).toString(32),l>>=_,f-=_,gs=1<<32-Wt(n)+f|a<<f|l,vs=h+e}else gs=1<<h|a<<f|l,vs=e}function nu(e){e.return!==null&&(Rs(e,1),Jh(e,1,0))}function su(e){for(;e===Rl;)Rl=Xi[--Qi],Xi[Qi]=null,tr=Xi[--Qi],Xi[Qi]=null;for(;e===la;)la=Hn[--Vn],Hn[Vn]=null,vs=Hn[--Vn],Hn[Vn]=null,gs=Hn[--Vn],Hn[Vn]=null}function Wh(e,n){Hn[Vn++]=gs,Hn[Vn++]=vs,Hn[Vn++]=la,gs=n.id,vs=n.overflow,la=e}var nn=null,vt=null,qe=!1,ca=null,qn=!1,au=Error(r(519));function da(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw nr(Pn(n,e)),au}function Xh(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[Ue]=e,n[It]=l,a){case"dialog":$e("cancel",n),$e("close",n);break;case"iframe":case"object":case"embed":$e("load",n);break;case"video":case"audio":for(a=0;a<Tr.length;a++)$e(Tr[a],n);break;case"source":$e("error",n);break;case"img":case"image":case"link":$e("error",n),$e("load",n);break;case"details":$e("toggle",n);break;case"input":$e("invalid",n),uh(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":$e("invalid",n);break;case"textarea":$e("invalid",n),ph(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||h0(n.textContent,a)?(l.popover!=null&&($e("beforetoggle",n),$e("toggle",n)),l.onScroll!=null&&$e("scroll",n),l.onScrollEnd!=null&&$e("scrollend",n),l.onClick!=null&&(n.onclick=Es),n=!0):n=!1,n||da(e,!0)}function Qh(e){for(nn=e.return;nn;)switch(nn.tag){case 5:case 31:case 13:qn=!1;return;case 27:case 3:qn=!0;return;default:nn=nn.return}}function eo(e){if(e!==nn)return!1;if(!qe)return Qh(e),qe=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Sf(e.type,e.memoizedProps)),a=!a),a&&vt&&da(e),Qh(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));vt=T0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));vt=T0(e)}else n===27?(n=vt,Ta(e.type)?(e=Cf,Cf=null,vt=e):vt=n):vt=nn?Fn(e.stateNode.nextSibling):null;return!0}function oi(){vt=nn=null,qe=!1}function iu(){var e=ca;return e!==null&&(_n===null?_n=e:_n.push.apply(_n,e),ca=null),e}function nr(e){ca===null?ca=[e]:ca.push(e)}var ou=ge(null),ri=null,Ms=null;function ua(e,n,a){Ce(ou,n._currentValue),n._currentValue=a}function Is(e){e._currentValue=ou.current,pe(ou)}function ru(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 lu(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var _=f.child;h=h.firstContext;e:for(;h!==null;){var 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),ru(h.return,a,e),l||(_=null);break e}h=j.next}}else if(f.tag===18){if(_=f.return,_===null)throw Error(r(341));_.lanes|=a,h=_.alternate,h!==null&&(h.lanes|=a),ru(_,a,e),_=null}else _=f.child;if(_!==null)_.return=f;else for(_=f;_!==null;){if(_===e){_=null;break}if(f=_.sibling,f!==null){f.return=_.return,_=f;break}_=_.return}f=_}}function to(e,n,a,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var _=f.alternate;if(_===null)throw Error(r(387));if(_=_.memoizedProps,_!==null){var j=f.type;jn(f.pendingProps.value,_.value)||(e!==null?e.push(j):e=[j])}}else if(f===ve.current){if(_=f.alternate,_===null)throw Error(r(387));_.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Er):e=[Er])}f=f.return}e!==null&&lu(n,e,a,l),n.flags|=262144}function Ml(e){for(e=e.firstContext;e!==null;){if(!jn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function li(e){ri=e,Ms=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function sn(e){return eg(ri,e)}function Il(e,n){return ri===null&&li(e),eg(e,n)}function eg(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Ms===null){if(e===null)throw Error(r(308));Ms=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Ms=Ms.next=n;return a}var $k=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()})}},Uk=t.unstable_scheduleCallback,Pk=t.unstable_NormalPriority,Ut={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function cu(){return{controller:new $k,data:new Map,refCount:0}}function sr(e){e.refCount--,e.refCount===0&&Uk(Pk,function(){e.controller.abort()})}var ar=null,du=0,no=0,so=null;function Hk(e,n){if(ar===null){var a=ar=[];du=0,no=mf(),so={status:"pending",value:void 0,then:function(l){a.push(l)}}}return du++,n.then(tg,tg),n}function tg(){if(--du===0&&ar!==null){so!==null&&(so.status="fulfilled");var e=ar;ar=null,no=0,so=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Vk(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 ng=L.S;L.S=function(e,n){$v=Yt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Hk(e,n),ng!==null&&ng(e,n)};var ci=ge(null);function uu(){var e=ci.current;return e!==null?e:pt.pooledCache}function Ol(e,n){n===null?Ce(ci,ci.current):Ce(ci,n.pool)}function sg(){var e=uu();return e===null?null:{parent:Ut._currentValue,pool:e}}var ao=Error(r(460)),fu=Error(r(474)),Bl=Error(r(542)),Ll={then:function(){}};function ag(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ig(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(Es,Es),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,rg(e),e;default:if(typeof n.status=="string")n.then(Es,Es);else{if(e=pt,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,rg(e),e}throw ui=n,ao}}function di(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ui=a,ao):a}}var ui=null;function og(){if(ui===null)throw Error(r(459));var e=ui;return ui=null,e}function rg(e){if(e===ao||e===Bl)throw Error(r(483))}var io=null,ir=0;function zl(e){var n=ir;return ir+=1,io===null&&(io=[]),ig(io,e,n)}function or(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function $l(e,n){throw n.$$typeof===x?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function lg(e){function n(z,B){if(e){var q=z.deletions;q===null?(z.deletions=[B],z.flags|=16):q.push(B)}}function a(z,B){if(!e)return null;for(;B!==null;)n(z,B),B=B.sibling;return null}function l(z){for(var B=new Map;z!==null;)z.key!==null?B.set(z.key,z):B.set(z.index,z),z=z.sibling;return B}function f(z,B){return z=Ds(z,B),z.index=0,z.sibling=null,z}function h(z,B,q){return z.index=q,e?(q=z.alternate,q!==null?(q=q.index,q<B?(z.flags|=67108866,B):q):(z.flags|=67108866,B)):(z.flags|=1048576,B)}function _(z){return e&&z.alternate===null&&(z.flags|=67108866),z}function j(z,B,q,ne){return B===null||B.tag!==6?(B=eu(q,z.mode,ne),B.return=z,B):(B=f(B,q),B.return=z,B)}function R(z,B,q,ne){var je=q.type;return je===w?ee(z,B,q.props.children,ne,q.key):B!==null&&(B.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===I&&di(je)===B.type)?(B=f(B,q.props),or(B,q),B.return=z,B):(B=Dl(q.type,q.key,q.props,null,z.mode,ne),or(B,q),B.return=z,B)}function G(z,B,q,ne){return B===null||B.tag!==4||B.stateNode.containerInfo!==q.containerInfo||B.stateNode.implementation!==q.implementation?(B=tu(q,z.mode,ne),B.return=z,B):(B=f(B,q.children||[]),B.return=z,B)}function ee(z,B,q,ne,je){return B===null||B.tag!==7?(B=ii(q,z.mode,ne,je),B.return=z,B):(B=f(B,q),B.return=z,B)}function se(z,B,q){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=eu(""+B,z.mode,q),B.return=z,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case S:return q=Dl(B.type,B.key,B.props,null,z.mode,q),or(q,B),q.return=z,q;case k:return B=tu(B,z.mode,q),B.return=z,B;case I:return B=di(B),se(z,B,q)}if(oe(B)||H(B))return B=ii(B,z.mode,q,null),B.return=z,B;if(typeof B.then=="function")return se(z,zl(B),q);if(B.$$typeof===D)return se(z,Il(z,B),q);$l(z,B)}return null}function F(z,B,q,ne){var je=B!==null?B.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return je!==null?null:j(z,B,""+q,ne);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case S:return q.key===je?R(z,B,q,ne):null;case k:return q.key===je?G(z,B,q,ne):null;case I:return q=di(q),F(z,B,q,ne)}if(oe(q)||H(q))return je!==null?null:ee(z,B,q,ne,null);if(typeof q.then=="function")return F(z,B,zl(q),ne);if(q.$$typeof===D)return F(z,B,Il(z,q),ne);$l(z,q)}return null}function K(z,B,q,ne,je){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return z=z.get(q)||null,j(B,z,""+ne,je);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return z=z.get(ne.key===null?q:ne.key)||null,R(B,z,ne,je);case k:return z=z.get(ne.key===null?q:ne.key)||null,G(B,z,ne,je);case I:return ne=di(ne),K(z,B,q,ne,je)}if(oe(ne)||H(ne))return z=z.get(q)||null,ee(B,z,ne,je,null);if(typeof ne.then=="function")return K(z,B,q,zl(ne),je);if(ne.$$typeof===D)return K(z,B,q,Il(B,ne),je);$l(B,ne)}return null}function xe(z,B,q,ne){for(var je=null,Qe=null,ke=B,Be=B=0,He=null;ke!==null&&Be<q.length;Be++){ke.index>Be?(He=ke,ke=null):He=ke.sibling;var et=F(z,ke,q[Be],ne);if(et===null){ke===null&&(ke=He);break}e&&ke&&et.alternate===null&&n(z,ke),B=h(et,B,Be),Qe===null?je=et:Qe.sibling=et,Qe=et,ke=He}if(Be===q.length)return a(z,ke),qe&&Rs(z,Be),je;if(ke===null){for(;Be<q.length;Be++)ke=se(z,q[Be],ne),ke!==null&&(B=h(ke,B,Be),Qe===null?je=ke:Qe.sibling=ke,Qe=ke);return qe&&Rs(z,Be),je}for(ke=l(ke);Be<q.length;Be++)He=K(ke,z,Be,q[Be],ne),He!==null&&(e&&He.alternate!==null&&ke.delete(He.key===null?Be:He.key),B=h(He,B,Be),Qe===null?je=He:Qe.sibling=He,Qe=He);return e&&ke.forEach(function(Ea){return n(z,Ea)}),qe&&Rs(z,Be),je}function Ee(z,B,q,ne){if(q==null)throw Error(r(151));for(var je=null,Qe=null,ke=B,Be=B=0,He=null,et=q.next();ke!==null&&!et.done;Be++,et=q.next()){ke.index>Be?(He=ke,ke=null):He=ke.sibling;var Ea=F(z,ke,et.value,ne);if(Ea===null){ke===null&&(ke=He);break}e&&ke&&Ea.alternate===null&&n(z,ke),B=h(Ea,B,Be),Qe===null?je=Ea:Qe.sibling=Ea,Qe=Ea,ke=He}if(et.done)return a(z,ke),qe&&Rs(z,Be),je;if(ke===null){for(;!et.done;Be++,et=q.next())et=se(z,et.value,ne),et!==null&&(B=h(et,B,Be),Qe===null?je=et:Qe.sibling=et,Qe=et);return qe&&Rs(z,Be),je}for(ke=l(ke);!et.done;Be++,et=q.next())et=K(ke,z,Be,et.value,ne),et!==null&&(e&&et.alternate!==null&&ke.delete(et.key===null?Be:et.key),B=h(et,B,Be),Qe===null?je=et:Qe.sibling=et,Qe=et);return e&&ke.forEach(function(eT){return n(z,eT)}),qe&&Rs(z,Be),je}function ft(z,B,q,ne){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 je=q.key;B!==null;){if(B.key===je){if(je=q.type,je===w){if(B.tag===7){a(z,B.sibling),ne=f(B,q.props.children),ne.return=z,z=ne;break e}}else if(B.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===I&&di(je)===B.type){a(z,B.sibling),ne=f(B,q.props),or(ne,q),ne.return=z,z=ne;break e}a(z,B);break}else n(z,B);B=B.sibling}q.type===w?(ne=ii(q.props.children,z.mode,ne,q.key),ne.return=z,z=ne):(ne=Dl(q.type,q.key,q.props,null,z.mode,ne),or(ne,q),ne.return=z,z=ne)}return _(z);case k:e:{for(je=q.key;B!==null;){if(B.key===je)if(B.tag===4&&B.stateNode.containerInfo===q.containerInfo&&B.stateNode.implementation===q.implementation){a(z,B.sibling),ne=f(B,q.children||[]),ne.return=z,z=ne;break e}else{a(z,B);break}else n(z,B);B=B.sibling}ne=tu(q,z.mode,ne),ne.return=z,z=ne}return _(z);case I:return q=di(q),ft(z,B,q,ne)}if(oe(q))return xe(z,B,q,ne);if(H(q)){if(je=H(q),typeof je!="function")throw Error(r(150));return q=je.call(q),Ee(z,B,q,ne)}if(typeof q.then=="function")return ft(z,B,zl(q),ne);if(q.$$typeof===D)return ft(z,B,Il(z,q),ne);$l(z,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,B!==null&&B.tag===6?(a(z,B.sibling),ne=f(B,q),ne.return=z,z=ne):(a(z,B),ne=eu(q,z.mode,ne),ne.return=z,z=ne),_(z)):a(z,B)}return function(z,B,q,ne){try{ir=0;var je=ft(z,B,q,ne);return io=null,je}catch(ke){if(ke===ao||ke===Bl)throw ke;var Qe=Nn(29,ke,null,z.mode);return Qe.lanes=ne,Qe.return=z,Qe}finally{}}}var fi=lg(!0),cg=lg(!1),fa=!1;function pu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function mu(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 pa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ma(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(st&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=Al(e),Fh(e,null,a),n}return El(e,l,n,a),Al(e)}function rr(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,Te(e,a)}}function hu(e,n){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?f=h=_:h=h.next=_,a=a.next}while(a!==null);h===null?f=h=n:h=h.next=n}else f=h=n;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var gu=!1;function lr(){if(gu){var e=so;if(e!==null)throw e}}function cr(e,n,a,l){gu=!1;var f=e.updateQueue;fa=!1;var h=f.firstBaseUpdate,_=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var R=j,G=R.next;R.next=null,_===null?h=G:_.next=G,_=R;var ee=e.alternate;ee!==null&&(ee=ee.updateQueue,j=ee.lastBaseUpdate,j!==_&&(j===null?ee.firstBaseUpdate=G:j.next=G,ee.lastBaseUpdate=R))}if(h!==null){var se=f.baseState;_=0,ee=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===no&&(gu=!0),ee!==null&&(ee=ee.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var xe=e,Ee=j;F=n;var ft=a;switch(Ee.tag){case 1:if(xe=Ee.payload,typeof xe=="function"){se=xe.call(ft,se,F);break e}se=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=Ee.payload,F=typeof xe=="function"?xe.call(ft,se,F):xe,F==null)break e;se=b({},se,F);break e;case 2:fa=!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},ee===null?(G=ee=K,R=se):ee=ee.next=K,_|=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);ee===null&&(R=se),f.baseState=R,f.firstBaseUpdate=G,f.lastBaseUpdate=ee,h===null&&(f.shared.lanes=0),ba|=_,e.lanes=_,e.memoizedState=se}}function dg(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function ug(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)dg(a[e],n)}var oo=ge(null),Ul=ge(0);function fg(e,n){e=Vs,Ce(Ul,e),Ce(oo,n),Vs=e|n.baseLanes}function vu(){Ce(Ul,Vs),Ce(oo,oo.current)}function yu(){Vs=Ul.current,pe(oo),pe(Ul)}var Cn=ge(null),Gn=null;function ha(e){var n=e.alternate;Ce(Ot,Ot.current&1),Ce(Cn,e),Gn===null&&(n===null||oo.current!==null||n.memoizedState!==null)&&(Gn=e)}function bu(e){Ce(Ot,Ot.current),Ce(Cn,e),Gn===null&&(Gn=e)}function pg(e){e.tag===22?(Ce(Ot,Ot.current),Ce(Cn,e),Gn===null&&(Gn=e)):ga()}function ga(){Ce(Ot,Ot.current),Ce(Cn,Cn.current)}function En(e){pe(Cn),Gn===e&&(Gn=null),pe(Ot)}var Ot=ge(0);function Pl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||jf(a)||Nf(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 Os=0,Oe=null,dt=null,Pt=null,Hl=!1,ro=!1,pi=!1,Vl=0,dr=0,lo=null,qk=0;function Ct(){throw Error(r(321))}function xu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!jn(e[a],n[a]))return!1;return!0}function _u(e,n,a,l,f,h){return Os=h,Oe=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,L.H=e===null||e.memoizedState===null?Jg:Bu,pi=!1,h=a(l,f),pi=!1,ro&&(h=hg(n,a,l,f)),mg(e),h}function mg(e){L.H=pr;var n=dt!==null&&dt.next!==null;if(Os=0,Pt=dt=Oe=null,Hl=!1,dr=0,lo=null,n)throw Error(r(300));e===null||Ht||(e=e.dependencies,e!==null&&Ml(e)&&(Ht=!0))}function hg(e,n,a,l){Oe=e;var f=0;do{if(ro&&(lo=null),dr=0,ro=!1,25<=f)throw Error(r(301));if(f+=1,Pt=dt=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}L.H=Wg,h=n(a,l)}while(ro);return h}function Gk(){var e=L.H,n=e.useState()[0];return n=typeof n.then=="function"?ur(n):n,e=e.useState()[0],(dt!==null?dt.memoizedState:null)!==e&&(Oe.flags|=1024),n}function ku(){var e=Vl!==0;return Vl=0,e}function Su(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Tu(e){if(Hl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Hl=!1}Os=0,Pt=dt=Oe=null,ro=!1,dr=Vl=0,lo=null}function fn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?Oe.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function Bt(){if(dt===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=dt.next;var n=Pt===null?Oe.memoizedState:Pt.next;if(n!==null)Pt=n,dt=e;else{if(e===null)throw Oe.alternate===null?Error(r(467)):Error(r(310));dt=e,e={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},Pt===null?Oe.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function ql(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ur(e){var n=dr;return dr+=1,lo===null&&(lo=[]),e=ig(lo,e,n),n=Oe,(Pt===null?n.memoizedState:Pt.next)===null&&(n=n.alternate,L.H=n===null||n.memoizedState===null?Jg:Bu),e}function Gl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ur(e);if(e.$$typeof===D)return sn(e)}throw Error(r(438,String(e)))}function wu(e){var n=null,a=Oe.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=Oe.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=ql(),Oe.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]=Q;return n.index++,a}function Bs(e,n){return typeof n=="function"?n(e):n}function Fl(e){var n=Bt();return ju(n,dt,e)}function ju(e,n,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var _=f.next;f.next=h.next,h.next=_}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var j=_=null,R=null,G=n,ee=!1;do{var se=G.lane&-536870913;if(se!==G.lane?(Pe&se)===se:(Os&se)===se){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}),se===no&&(ee=!0);else if((Os&F)===F){G=G.next,F===no&&(ee=!0);continue}else se={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},R===null?(j=R=se,_=h):R=R.next=se,Oe.lanes|=F,ba|=F;se=G.action,pi&&a(h,se),h=G.hasEagerState?G.eagerState:a(h,se)}else F={lane:se,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},R===null?(j=R=F,_=h):R=R.next=F,Oe.lanes|=se,ba|=se;G=G.next}while(G!==null&&G!==n);if(R===null?_=h:R.next=j,!jn(h,e.memoizedState)&&(Ht=!0,ee&&(a=so,a!==null)))throw a;e.memoizedState=h,e.baseState=_,e.baseQueue=R,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Nu(e){var n=Bt(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,h=n.memoizedState;if(f!==null){a.pending=null;var _=f=f.next;do h=e(h,_.action),_=_.next;while(_!==f);jn(h,n.memoizedState)||(Ht=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,l]}function gg(e,n,a){var l=Oe,f=Bt(),h=qe;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=n();var _=!jn((dt||f).memoizedState,a);if(_&&(f.memoizedState=a,Ht=!0),f=f.queue,Au(bg.bind(null,l,f,e),[e]),f.getSnapshot!==n||_||Pt!==null&&Pt.memoizedState.tag&1){if(l.flags|=2048,co(9,{destroy:void 0},yg.bind(null,l,f,a,n),null),pt===null)throw Error(r(349));h||(Os&127)!==0||vg(l,n,a)}return a}function vg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Oe.updateQueue,n===null?(n=ql(),Oe.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function yg(e,n,a,l){n.value=a,n.getSnapshot=l,xg(n)&&_g(e)}function bg(e,n,a){return a(function(){xg(n)&&_g(e)})}function xg(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!jn(e,a)}catch{return!0}}function _g(e){var n=ai(e,2);n!==null&&kn(n,e,2)}function Cu(e){var n=fn();if(typeof e=="function"){var a=e;if(e=a(),pi){un(!0);try{a()}finally{un(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:e},n}function kg(e,n,a,l){return e.baseState=a,ju(e,dt,typeof l=="function"?l:Bs)}function Fk(e,n,a,l,f){if(Yl(e))throw Error(r(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){h.listeners.push(_)}};L.T!==null?a(!0):h.isTransition=!1,l(h),a=n.pending,a===null?(h.next=n.pending=h,Sg(n,h)):(h.next=a.next,n.pending=a.next=h)}}function Sg(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=L.T,_={};L.T=_;try{var j=a(f,l),R=L.S;R!==null&&R(_,j),Tg(e,n,j)}catch(G){Eu(e,n,G)}finally{h!==null&&_.types!==null&&(h.types=_.types),L.T=h}}else try{h=a(f,l),Tg(e,n,h)}catch(G){Eu(e,n,G)}}function Tg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){wg(e,n,l)},function(l){return Eu(e,n,l)}):wg(e,n,a)}function wg(e,n,a){n.status="fulfilled",n.value=a,jg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Sg(e,a)))}function Eu(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,jg(n),n=n.next;while(n!==l)}e.action=null}function jg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Ng(e,n){return n}function Cg(e,n){if(qe){var a=pt.formState;if(a!==null){e:{var l=Oe;if(qe){if(vt){t:{for(var f=vt,h=qn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Fn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){vt=Fn(f.nextSibling),l=f.data==="F!";break e}}da(l)}l=!1}l&&(n=a[0])}}return a=fn(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ng,lastRenderedState:n},a.queue=l,a=Zg.bind(null,Oe,l),l.dispatch=a,l=Cu(!1),h=Ou.bind(null,Oe,!1,l.queue),l=fn(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=Fk.bind(null,Oe,f,h,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function Eg(e){var n=Bt();return Ag(n,dt,e)}function Ag(e,n,a){if(n=ju(e,n,Ng)[0],e=Fl(Bs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=ur(n)}catch(_){throw _===ao?Bl:_}else l=n;n=Bt();var f=n.queue,h=f.dispatch;return a!==n.memoizedState&&(Oe.flags|=2048,co(9,{destroy:void 0},Zk.bind(null,f,a),null)),[l,h,e]}function Zk(e,n){e.action=n}function Dg(e){var n=Bt(),a=dt;if(a!==null)return Ag(n,a,e);Bt(),n=n.memoizedState,a=Bt();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function co(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=Oe.updateQueue,n===null&&(n=ql(),Oe.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 Rg(){return Bt().memoizedState}function Zl(e,n,a,l){var f=fn();Oe.flags|=e,f.memoizedState=co(1|n,{destroy:void 0},a,l===void 0?null:l)}function Kl(e,n,a,l){var f=Bt();l=l===void 0?null:l;var h=f.memoizedState.inst;dt!==null&&l!==null&&xu(l,dt.memoizedState.deps)?f.memoizedState=co(n,h,a,l):(Oe.flags|=e,f.memoizedState=co(1|n,h,a,l))}function Mg(e,n){Zl(8390656,8,e,n)}function Au(e,n){Kl(2048,8,e,n)}function Kk(e){Oe.flags|=4;var n=Oe.updateQueue;if(n===null)n=ql(),Oe.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Ig(e){var n=Bt().memoizedState;return Kk({ref:n,nextImpl:e}),function(){if((st&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Og(e,n){return Kl(4,2,e,n)}function Bg(e,n){return Kl(4,4,e,n)}function Lg(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 zg(e,n,a){a=a!=null?a.concat([e]):null,Kl(4,4,Lg.bind(null,n,e),a)}function Du(){}function $g(e,n){var a=Bt();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&xu(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Ug(e,n){var a=Bt();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&xu(n,l[1]))return l[0];if(l=e(),pi){un(!0);try{e()}finally{un(!1)}}return a.memoizedState=[l,n],l}function Ru(e,n,a){return a===void 0||(Os&1073741824)!==0&&(Pe&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Pv(),Oe.lanes|=e,ba|=e,a)}function Pg(e,n,a,l){return jn(a,n)?a:oo.current!==null?(e=Ru(e,a,l),jn(e,n)||(Ht=!0),e):(Os&42)===0||(Os&1073741824)!==0&&(Pe&261930)===0?(Ht=!0,e.memoizedState=a):(e=Pv(),Oe.lanes|=e,ba|=e,n)}function Hg(e,n,a,l,f){var h=Z.p;Z.p=h!==0&&8>h?h:8;var _=L.T,j={};L.T=j,Ou(e,!1,n,a);try{var R=f(),G=L.S;if(G!==null&&G(j,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var ee=Vk(R,l);fr(e,n,ee,Rn(e))}else fr(e,n,l,Rn(e))}catch(se){fr(e,n,{then:function(){},status:"rejected",reason:se},Rn())}finally{Z.p=h,_!==null&&j.types!==null&&(_.types=j.types),L.T=_}}function Yk(){}function Mu(e,n,a,l){if(e.tag!==5)throw Error(r(476));var f=Vg(e).queue;Hg(e,f,n,J,a===null?Yk:function(){return qg(e),a(l)})}function Vg(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:J},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function qg(e){var n=Vg(e);n.next===null&&(n=e.alternate.memoizedState),fr(e,n.next.queue,{},Rn())}function Iu(){return sn(Er)}function Gg(){return Bt().memoizedState}function Fg(){return Bt().memoizedState}function Jk(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Rn();e=pa(a);var l=ma(n,e,a);l!==null&&(kn(l,n,a),rr(l,n,a)),n={cache:cu()},e.payload=n;return}n=n.return}}function Wk(e,n,a){var l=Rn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Yl(e)?Kg(n,a):(a=Xd(e,n,a,l),a!==null&&(kn(a,e,l),Yg(a,n,l)))}function Zg(e,n,a){var l=Rn();fr(e,n,a,l)}function fr(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Yl(e))Kg(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var _=n.lastRenderedState,j=h(_,a);if(f.hasEagerState=!0,f.eagerState=j,jn(j,_))return El(e,n,f,0),pt===null&&Cl(),!1}catch{}finally{}if(a=Xd(e,n,f,l),a!==null)return kn(a,e,l),Yg(a,n,l),!0}return!1}function Ou(e,n,a,l){if(l={lane:2,revertLane:mf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Yl(e)){if(n)throw Error(r(479))}else n=Xd(e,a,l,2),n!==null&&kn(n,e,2)}function Yl(e){var n=e.alternate;return e===Oe||n!==null&&n===Oe}function Kg(e,n){ro=Hl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Yg(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Te(e,a)}}var pr={readContext:sn,use:Gl,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};pr.useEffectEvent=Ct;var Jg={readContext:sn,use:Gl,useCallback:function(e,n){return fn().memoizedState=[e,n===void 0?null:n],e},useContext:sn,useEffect:Mg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Zl(4194308,4,Lg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Zl(4194308,4,e,n)},useInsertionEffect:function(e,n){Zl(4,2,e,n)},useMemo:function(e,n){var a=fn();n=n===void 0?null:n;var l=e();if(pi){un(!0);try{e()}finally{un(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=fn();if(a!==void 0){var f=a(n);if(pi){un(!0);try{a(n)}finally{un(!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=Wk.bind(null,Oe,e),[l.memoizedState,e]},useRef:function(e){var n=fn();return e={current:e},n.memoizedState=e},useState:function(e){e=Cu(e);var n=e.queue,a=Zg.bind(null,Oe,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Du,useDeferredValue:function(e,n){var a=fn();return Ru(a,e,n)},useTransition:function(){var e=Cu(!1);return e=Hg.bind(null,Oe,e.queue,!0,!1),fn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=Oe,f=fn();if(qe){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),pt===null)throw Error(r(349));(Pe&127)!==0||vg(l,n,a)}f.memoizedState=a;var h={value:a,getSnapshot:n};return f.queue=h,Mg(bg.bind(null,l,h,e),[e]),l.flags|=2048,co(9,{destroy:void 0},yg.bind(null,l,h,a,n),null),a},useId:function(){var e=fn(),n=pt.identifierPrefix;if(qe){var a=vs,l=gs;a=(l&~(1<<32-Wt(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Vl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=qk++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Iu,useFormState:Cg,useActionState:Cg,useOptimistic:function(e){var n=fn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Ou.bind(null,Oe,!0,a),a.dispatch=n,[e,n]},useMemoCache:wu,useCacheRefresh:function(){return fn().memoizedState=Jk.bind(null,Oe)},useEffectEvent:function(e){var n=fn(),a={impl:e};return n.memoizedState=a,function(){if((st&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Bu={readContext:sn,use:Gl,useCallback:$g,useContext:sn,useEffect:Au,useImperativeHandle:zg,useInsertionEffect:Og,useLayoutEffect:Bg,useMemo:Ug,useReducer:Fl,useRef:Rg,useState:function(){return Fl(Bs)},useDebugValue:Du,useDeferredValue:function(e,n){var a=Bt();return Pg(a,dt.memoizedState,e,n)},useTransition:function(){var e=Fl(Bs)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:ur(e),n]},useSyncExternalStore:gg,useId:Gg,useHostTransitionStatus:Iu,useFormState:Eg,useActionState:Eg,useOptimistic:function(e,n){var a=Bt();return kg(a,dt,e,n)},useMemoCache:wu,useCacheRefresh:Fg};Bu.useEffectEvent=Ig;var Wg={readContext:sn,use:Gl,useCallback:$g,useContext:sn,useEffect:Au,useImperativeHandle:zg,useInsertionEffect:Og,useLayoutEffect:Bg,useMemo:Ug,useReducer:Nu,useRef:Rg,useState:function(){return Nu(Bs)},useDebugValue:Du,useDeferredValue:function(e,n){var a=Bt();return dt===null?Ru(a,e,n):Pg(a,dt.memoizedState,e,n)},useTransition:function(){var e=Nu(Bs)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:ur(e),n]},useSyncExternalStore:gg,useId:Gg,useHostTransitionStatus:Iu,useFormState:Dg,useActionState:Dg,useOptimistic:function(e,n){var a=Bt();return dt!==null?kg(a,dt,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:wu,useCacheRefresh:Fg};Wg.useEffectEvent=Ig;function Lu(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 zu={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=Rn(),f=pa(l);f.payload=n,a!=null&&(f.callback=a),n=ma(e,f,l),n!==null&&(kn(n,e,l),rr(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=Rn(),f=pa(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=ma(e,f,l),n!==null&&(kn(n,e,l),rr(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Rn(),l=pa(a);l.tag=2,n!=null&&(l.callback=n),n=ma(e,l,a),n!==null&&(kn(n,e,a),rr(n,e,a))}};function Xg(e,n,a,l,f,h,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,_):n.prototype&&n.prototype.isPureReactComponent?!Qo(a,l)||!Qo(f,h):!0}function Qg(e,n,a,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,l),n.state!==e&&zu.enqueueReplaceState(n,n.state,null)}function mi(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 ev(e){Nl(e)}function tv(e){console.error(e)}function nv(e){Nl(e)}function Jl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function sv(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 $u(e,n,a){return a=pa(a),a.tag=3,a.payload={element:null},a.callback=function(){Jl(e,n)},a}function av(e){return e=pa(e),e.tag=3,e}function iv(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(){sv(n,a,l)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){sv(n,a,l),typeof f!="function"&&(xa===null?xa=new Set([this]):xa.add(this));var j=l.stack;this.componentDidCatch(l.value,{componentStack:j!==null?j:""})})}function Xk(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&to(n,a,f,!0),a=Cn.current,a!==null){switch(a.tag){case 31:case 13:return Gn===null?lc():a.alternate===null&&Et===0&&(Et=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Ll?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),uf(e,l,f)),!1;case 22:return a.flags|=65536,l===Ll?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)),uf(e,l,f)),!1}throw Error(r(435,a.tag))}return uf(e,l,f),lc(),!1}if(qe)return n=Cn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==au&&(e=Error(r(422),{cause:l}),nr(Pn(e,a)))):(l!==au&&(n=Error(r(423),{cause:l}),nr(Pn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Pn(l,a),f=$u(e.stateNode,l,f),hu(e,f),Et!==4&&(Et=2)),!1;var h=Error(r(520),{cause:l});if(h=Pn(h,a),_r===null?_r=[h]:_r.push(h),Et!==4&&(Et=2),n===null)return!0;l=Pn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=$u(a.stateNode,l,e),hu(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"&&(xa===null||!xa.has(h))))return a.flags|=65536,f&=-f,a.lanes|=f,f=av(f),iv(f,e,a,l),hu(a,f),!1}a=a.return}while(a!==null);return!1}var Uu=Error(r(461)),Ht=!1;function an(e,n,a,l){n.child=e===null?cg(n,null,a,l):fi(n,e.child,a,l)}function ov(e,n,a,l,f){a=a.render;var h=n.ref;if("ref"in l){var _={};for(var j in l)j!=="ref"&&(_[j]=l[j])}else _=l;return li(n),l=_u(e,n,a,_,h,f),j=ku(),e!==null&&!Ht?(Su(e,n,f),Ls(e,n,f)):(qe&&j&&nu(n),n.flags|=1,an(e,n,l,f),n.child)}function rv(e,n,a,l,f){if(e===null){var h=a.type;return typeof h=="function"&&!Qd(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,lv(e,n,h,l,f)):(e=Dl(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Ku(e,f)){var _=h.memoizedProps;if(a=a.compare,a=a!==null?a:Qo,a(_,l)&&e.ref===n.ref)return Ls(e,n,f)}return n.flags|=1,e=Ds(h,l),e.ref=n.ref,e.return=n,n.child=e}function lv(e,n,a,l,f){if(e!==null){var h=e.memoizedProps;if(Qo(h,l)&&e.ref===n.ref)if(Ht=!1,n.pendingProps=l=h,Ku(e,f))(e.flags&131072)!==0&&(Ht=!0);else return n.lanes=e.lanes,Ls(e,n,f)}return Pu(e,n,a,l,f)}function cv(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 dv(e,n,h,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ol(n,h!==null?h.cachePool:null),h!==null?fg(n,h):vu(),pg(n);else return l=n.lanes=536870912,dv(e,n,h!==null?h.baseLanes|a:a,a,l)}else h!==null?(Ol(n,h.cachePool),fg(n,h),ga(),n.memoizedState=null):(e!==null&&Ol(n,null),vu(),ga());return an(e,n,f,a),n.child}function mr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function dv(e,n,a,l,f){var h=uu();return h=h===null?null:{parent:Ut._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Ol(n,null),vu(),pg(n),e!==null&&to(e,n,l,!0),n.childLanes=f,null}function Wl(e,n){return n=Ql({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function uv(e,n,a){return fi(n,e.child,null,a),e=Wl(n,n.pendingProps),e.flags|=2,En(n),n.memoizedState=null,e}function Qk(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(qe){if(l.mode==="hidden")return e=Wl(n,l),n.lanes=536870912,mr(null,e);if(bu(n),(e=vt)?(e=S0(e,qn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:la!==null?{id:gs,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},a=Kh(e),a.return=n,n.child=a,nn=n,vt=null)):e=null,e===null)throw da(n);return n.lanes=536870912,null}return Wl(n,l)}var h=e.memoizedState;if(h!==null){var _=h.dehydrated;if(bu(n),f)if(n.flags&256)n.flags&=-257,n=uv(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(Ht||to(e,n,a,!1),f=(a&e.childLanes)!==0,Ht||f){if(l=pt,l!==null&&(_=Ie(l,a),_!==0&&_!==h.retryLane))throw h.retryLane=_,ai(e,_),kn(l,e,_),Uu;lc(),n=uv(e,n,a)}else e=h.treeContext,vt=Fn(_.nextSibling),nn=n,qe=!0,ca=null,qn=!1,e!==null&&Wh(n,e),n=Wl(n,l),n.flags|=4096;return n}return e=Ds(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Xl(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 Pu(e,n,a,l,f){return li(n),a=_u(e,n,a,l,void 0,f),l=ku(),e!==null&&!Ht?(Su(e,n,f),Ls(e,n,f)):(qe&&l&&nu(n),n.flags|=1,an(e,n,a,f),n.child)}function fv(e,n,a,l,f,h){return li(n),n.updateQueue=null,a=hg(n,l,a,f),mg(e),l=ku(),e!==null&&!Ht?(Su(e,n,h),Ls(e,n,h)):(qe&&l&&nu(n),n.flags|=1,an(e,n,a,h),n.child)}function pv(e,n,a,l,f){if(li(n),n.stateNode===null){var h=Wi,_=a.contextType;typeof _=="object"&&_!==null&&(h=sn(_)),h=new a(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=zu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},pu(n),_=a.contextType,h.context=typeof _=="object"&&_!==null?sn(_):Wi,h.state=n.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(Lu(n,a,_,l),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(_=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),_!==h.state&&zu.enqueueReplaceState(h,h.state,null),cr(n,l,h,f),lr(),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=mi(a,j);h.props=R;var G=h.context,ee=a.contextType;_=Wi,typeof ee=="object"&&ee!==null&&(_=sn(ee));var se=a.getDerivedStateFromProps;ee=typeof se=="function"||typeof h.getSnapshotBeforeUpdate=="function",j=n.pendingProps!==j,ee||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(j||G!==_)&&Qg(n,h,l,_),fa=!1;var F=n.memoizedState;h.state=F,cr(n,l,h,f),lr(),G=n.memoizedState,j||F!==G||fa?(typeof se=="function"&&(Lu(n,a,se,l),G=n.memoizedState),(R=fa||Xg(n,a,R,l,F,G,_))?(ee||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=G),h.props=l,h.state=G,h.context=_,l=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,mu(e,n),_=n.memoizedProps,ee=mi(a,_),h.props=ee,se=n.pendingProps,F=h.context,G=a.contextType,R=Wi,typeof G=="object"&&G!==null&&(R=sn(G)),j=a.getDerivedStateFromProps,(G=typeof j=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(_!==se||F!==R)&&Qg(n,h,l,R),fa=!1,F=n.memoizedState,h.state=F,cr(n,l,h,f),lr();var K=n.memoizedState;_!==se||F!==K||fa||e!==null&&e.dependencies!==null&&Ml(e.dependencies)?(typeof j=="function"&&(Lu(n,a,j,l),K=n.memoizedState),(ee=fa||Xg(n,a,ee,l,F,K,R)||e!==null&&e.dependencies!==null&&Ml(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"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=K),h.props=l,h.state=K,h.context=R,l=ee):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,Xl(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=fi(n,e.child,null,f),n.child=fi(n,null,a,f)):an(e,n,a,f),n.memoizedState=h.state,e=n.child):e=Ls(e,n,f),e}function mv(e,n,a,l){return oi(),n.flags|=256,an(e,n,a,l),n.child}var Hu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vu(e){return{baseLanes:e,cachePool:sg()}}function qu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Dn),e}function hv(e,n,a){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,_;if((_=h)||(_=e!==null&&e.memoizedState===null?!1:(Ot.current&2)!==0),_&&(f=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,e===null){if(qe){if(f?ha(n):ga(),(e=vt)?(e=S0(e,qn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:la!==null?{id:gs,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},a=Kh(e),a.return=n,n.child=a,nn=n,vt=null)):e=null,e===null)throw da(n);return Nf(e)?n.lanes=32:n.lanes=536870912,null}var j=l.children;return l=l.fallback,f?(ga(),f=n.mode,j=Ql({mode:"hidden",children:j},f),l=ii(l,f,a,null),j.return=n,l.return=n,j.sibling=l,n.child=j,l=n.child,l.memoizedState=Vu(a),l.childLanes=qu(e,_,a),n.memoizedState=Hu,mr(null,l)):(ha(n),Gu(n,j))}var R=e.memoizedState;if(R!==null&&(j=R.dehydrated,j!==null)){if(h)n.flags&256?(ha(n),n.flags&=-257,n=Fu(e,n,a)):n.memoizedState!==null?(ga(),n.child=e.child,n.flags|=128,n=null):(ga(),j=l.fallback,f=n.mode,l=Ql({mode:"visible",children:l.children},f),j=ii(j,f,a,null),j.flags|=2,l.return=n,j.return=n,l.sibling=j,n.child=l,fi(n,e.child,null,a),l=n.child,l.memoizedState=Vu(a),l.childLanes=qu(e,_,a),n.memoizedState=Hu,n=mr(null,l));else if(ha(n),Nf(j)){if(_=j.nextSibling&&j.nextSibling.dataset,_)var G=_.dgst;_=G,l=Error(r(419)),l.stack="",l.digest=_,nr({value:l,source:null,stack:null}),n=Fu(e,n,a)}else if(Ht||to(e,n,a,!1),_=(a&e.childLanes)!==0,Ht||_){if(_=pt,_!==null&&(l=Ie(_,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,ai(e,l),kn(_,e,l),Uu;jf(j)||lc(),n=Fu(e,n,a)}else jf(j)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,vt=Fn(j.nextSibling),nn=n,qe=!0,ca=null,qn=!1,e!==null&&Wh(n,e),n=Gu(n,l.children),n.flags|=4096);return n}return f?(ga(),j=l.fallback,f=n.mode,R=e.child,G=R.sibling,l=Ds(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,G!==null?j=Ds(G,j):(j=ii(j,f,a,null),j.flags|=2),j.return=n,l.return=n,l.sibling=j,n.child=l,mr(null,l),l=n.child,j=e.child.memoizedState,j===null?j=Vu(a):(f=j.cachePool,f!==null?(R=Ut._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=sg(),j={baseLanes:j.baseLanes|a,cachePool:f}),l.memoizedState=j,l.childLanes=qu(e,_,a),n.memoizedState=Hu,mr(e.child,l)):(ha(n),a=e.child,e=a.sibling,a=Ds(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(_=n.deletions,_===null?(n.deletions=[e],n.flags|=16):_.push(e)),n.child=a,n.memoizedState=null,a)}function Gu(e,n){return n=Ql({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Ql(e,n){return e=Nn(22,e,null,n),e.lanes=0,e}function Fu(e,n,a){return fi(n,e.child,null,a),e=Gu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function gv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),ru(e.return,n,a)}function Zu(e,n,a,l,f,h){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:h}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=l,_.tail=a,_.tailMode=f,_.treeForkCount=h)}function vv(e,n,a){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var _=Ot.current,j=(_&2)!==0;if(j?(_=_&1|2,n.flags|=128):_&=1,Ce(Ot,_),an(e,n,l,a),l=qe?tr:0,!j&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gv(e,a,n);else if(e.tag===19)gv(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&&Pl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Zu(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&&Pl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Zu(n,!0,a,null,h,l);break;case"together":Zu(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Ls(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),ba|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(to(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=Ds(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Ds(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Ku(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ml(e)))}function eS(e,n,a){switch(n.tag){case 3:Le(n,n.stateNode.containerInfo),ua(n,Ut,e.memoizedState.cache),oi();break;case 27:case 5:Tn(n);break;case 4:Le(n,n.stateNode.containerInfo);break;case 10:ua(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,bu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(ha(n),n.flags|=128,null):(a&n.child.childLanes)!==0?hv(e,n,a):(ha(n),e=Ls(e,n,a),e!==null?e.sibling:null);ha(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(to(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return vv(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ce(Ot,Ot.current),l)break;return null;case 22:return n.lanes=0,cv(e,n,a,n.pendingProps);case 24:ua(n,Ut,e.memoizedState.cache)}return Ls(e,n,a)}function yv(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)Ht=!0;else{if(!Ku(e,a)&&(n.flags&128)===0)return Ht=!1,eS(e,n,a);Ht=(e.flags&131072)!==0}else Ht=!1,qe&&(n.flags&1048576)!==0&&Jh(n,tr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=di(n.elementType),n.type=e,typeof e=="function")Qd(e)?(l=mi(e,l),n.tag=1,n=pv(null,n,e,l,a)):(n.tag=0,n=Pu(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===O){n.tag=11,n=ov(null,n,e,l,a);break e}else if(f===P){n.tag=14,n=rv(null,n,e,l,a);break e}}throw n=W(e)||e,Error(r(306,n,""))}}return n;case 0:return Pu(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=mi(l,n.pendingProps),pv(e,n,l,f,a);case 3:e:{if(Le(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var h=n.memoizedState;f=h.element,mu(e,n),cr(n,l,null,a);var _=n.memoizedState;if(l=_.cache,ua(n,Ut,l),l!==h.cache&&lu(n,[Ut],a,!0),lr(),l=_.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=mv(e,n,l,a);break e}else if(l!==f){f=Pn(Error(r(424)),n),nr(f),n=mv(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(vt=Fn(e.firstChild),nn=n,qe=!0,ca=null,qn=!0,a=cg(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(oi(),l===f){n=Ls(e,n,a);break e}an(e,n,l,a)}n=n.child}return n;case 26:return Xl(e,n),e===null?(a=E0(n.type,null,n.pendingProps,null))?n.memoizedState=a:qe||(a=n.type,e=n.pendingProps,l=hc(_e.current).createElement(a),l[Ue]=n,l[It]=e,on(l,a,e),Qt(l),n.stateNode=l):n.memoizedState=E0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Tn(n),e===null&&qe&&(l=n.stateNode=j0(n.type,n.pendingProps,_e.current),nn=n,qn=!0,f=vt,Ta(n.type)?(Cf=f,vt=Fn(l.firstChild)):vt=f),an(e,n,n.pendingProps.children,a),Xl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&qe&&((f=l=vt)&&(l=AS(l,n.type,n.pendingProps,qn),l!==null?(n.stateNode=l,nn=n,vt=Fn(l.firstChild),qn=!1,f=!0):f=!1),f||da(n)),Tn(n),f=n.type,h=n.pendingProps,_=e!==null?e.memoizedProps:null,l=h.children,Sf(f,h)?l=null:_!==null&&Sf(f,_)&&(n.flags|=32),n.memoizedState!==null&&(f=_u(e,n,Gk,null,null,a),Er._currentValue=f),Xl(e,n),an(e,n,l,a),n.child;case 6:return e===null&&qe&&((e=a=vt)&&(a=DS(a,n.pendingProps,qn),a!==null?(n.stateNode=a,nn=n,vt=null,e=!0):e=!1),e||da(n)),null;case 13:return hv(e,n,a);case 4:return Le(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=fi(n,null,l,a):an(e,n,l,a),n.child;case 11:return ov(e,n,n.type,n.pendingProps,a);case 7:return an(e,n,n.pendingProps,a),n.child;case 8:return an(e,n,n.pendingProps.children,a),n.child;case 12:return an(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,ua(n,n.type,l.value),an(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,li(n),f=sn(f),l=l(f),n.flags|=1,an(e,n,l,a),n.child;case 14:return rv(e,n,n.type,n.pendingProps,a);case 15:return lv(e,n,n.type,n.pendingProps,a);case 19:return vv(e,n,a);case 31:return Qk(e,n,a);case 22:return cv(e,n,a,n.pendingProps);case 24:return li(n),l=sn(Ut),e===null?(f=uu(),f===null&&(f=pt,h=cu(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=a),f=h),n.memoizedState={parent:l,cache:f},pu(n),ua(n,Ut,f)):((e.lanes&a)!==0&&(mu(e,n),cr(n,null,null,a),lr()),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),ua(n,Ut,l)):(l=h.cache,ua(n,Ut,l),l!==f.cache&&lu(n,[Ut],a,!0))),an(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function zs(e){e.flags|=4}function Yu(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(Gv())e.flags|=8192;else throw ui=Ll,fu}else e.flags&=-16777217}function bv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!I0(n))if(Gv())e.flags|=8192;else throw ui=Ll,fu}function ec(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?ae():536870912,e.lanes|=n,mo|=n)}function hr(e,n){if(!qe)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 yt(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 tS(e,n,a){var l=n.pendingProps;switch(su(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yt(n),null;case 1:return yt(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Is(Ut),Mt(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(eo(n)?zs(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,iu())),yt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(zs(n),h!==null?(yt(n),bv(n,h)):(yt(n),Yu(n,f,null,l,a))):h?h!==e.memoizedState?(zs(n),yt(n),bv(n,h)):(yt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&zs(n),yt(n),Yu(n,f,e,l,a)),null;case 27:if(ie(n),a=_e.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&zs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return yt(n),null}e=Ze.current,eo(n)?Xh(n):(e=j0(f,l,a),n.stateNode=e,zs(n))}return yt(n),null;case 5:if(ie(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&zs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return yt(n),null}if(h=Ze.current,eo(n))Xh(n);else{var _=hc(_e.current);switch(h){case 1:h=_.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=_.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=_.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?_.createElement("select",{is:l.is}):_.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?_.createElement(f,{is:l.is}):_.createElement(f)}}h[Ue]=n,h[It]=l;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)h.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=h;e:switch(on(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&&zs(n)}}return yt(n),Yu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&zs(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=_e.current,eo(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=nn,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[Ue]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||h0(e.nodeValue,a)),e||da(n,!0)}else e=hc(e).createTextNode(l),e[Ue]=n,n.stateNode=e}return yt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=eo(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[Ue]=n}else oi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;yt(n),e=!1}else a=iu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(En(n),n):(En(n),null);if((n.flags&128)!==0)throw Error(r(558))}return yt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=eo(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[Ue]=n}else oi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;yt(n),f=!1}else f=iu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(En(n),n):(En(n),null)}return En(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),ec(n,n.updateQueue),yt(n),null);case 4:return Mt(),e===null&&yf(n.stateNode.containerInfo),yt(n),null;case 10:return Is(n.type),yt(n),null;case 19:if(pe(Ot),l=n.memoizedState,l===null)return yt(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)hr(l,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Pl(e),h!==null){for(n.flags|=128,hr(l,!1),e=h.updateQueue,n.updateQueue=e,ec(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Zh(a,e),a=a.sibling;return Ce(Ot,Ot.current&1|2),qe&&Rs(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Yt()>ic&&(n.flags|=128,f=!0,hr(l,!1),n.lanes=4194304)}else{if(!f)if(e=Pl(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,ec(n,e),hr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!qe)return yt(n),null}else 2*Yt()-l.renderingStartTime>ic&&a!==536870912&&(n.flags|=128,f=!0,hr(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=Yt(),e.sibling=null,a=Ot.current,Ce(Ot,f?a&1|2:a&1),qe&&Rs(n,l.treeForkCount),e):(yt(n),null);case 22:case 23:return En(n),yu(),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&&(yt(n),n.subtreeFlags&6&&(n.flags|=8192)):yt(n),a=n.updateQueue,a!==null&&ec(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&&pe(ci),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Is(Ut),yt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function nS(e,n){switch(su(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Is(Ut),Mt(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ie(n),null;case 31:if(n.memoizedState!==null){if(En(n),n.alternate===null)throw Error(r(340));oi()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(En(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));oi()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return pe(Ot),null;case 4:return Mt(),null;case 10:return Is(n.type),null;case 22:case 23:return En(n),yu(),e!==null&&pe(ci),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Is(Ut),null;case 25:return null;default:return null}}function xv(e,n){switch(su(n),n.tag){case 3:Is(Ut),Mt();break;case 26:case 27:case 5:ie(n);break;case 4:Mt();break;case 31:n.memoizedState!==null&&En(n);break;case 13:En(n);break;case 19:pe(Ot);break;case 10:Is(n.type);break;case 22:case 23:En(n),yu(),e!==null&&pe(ci);break;case 24:Is(Ut)}}function gr(e,n){try{var a=n.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var h=a.create,_=a.inst;l=h(),_.destroy=l}a=a.next}while(a!==f)}}catch(j){rt(n,n.return,j)}}function va(e,n,a){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var _=l.inst,j=_.destroy;if(j!==void 0){_.destroy=void 0,f=n;var R=a,G=j;try{G()}catch(ee){rt(f,R,ee)}}}l=l.next}while(l!==h)}}catch(ee){rt(n,n.return,ee)}}function _v(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{ug(n,a)}catch(l){rt(e,e.return,l)}}}function kv(e,n,a){a.props=mi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){rt(e,n,l)}}function vr(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){rt(e,n,f)}}function ys(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){rt(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){rt(e,n,f)}else a.current=null}function Sv(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){rt(e,e.return,f)}}function Ju(e,n,a){try{var l=e.stateNode;TS(l,e.type,a,n),l[It]=n}catch(f){rt(e,e.return,f)}}function Tv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ta(e.type)||e.tag===4}function Wu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tv(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&&Ta(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 Xu(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=Es));else if(l!==4&&(l===27&&Ta(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Xu(e,n,a),e=e.sibling;e!==null;)Xu(e,n,a),e=e.sibling}function tc(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&&Ta(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(tc(e,n,a),e=e.sibling;e!==null;)tc(e,n,a),e=e.sibling}function wv(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);on(n,l,a),n[Ue]=e,n[It]=a}catch(h){rt(e,e.return,h)}}var $s=!1,Vt=!1,Qu=!1,jv=typeof WeakSet=="function"?WeakSet:Set,en=null;function sS(e,n){if(e=e.containerInfo,_f=kc,e=zh(e),Fd(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var _=0,j=-1,R=-1,G=0,ee=0,se=e,F=null;t:for(;;){for(var K;se!==a||f!==0&&se.nodeType!==3||(j=_+f),se!==h||l!==0&&se.nodeType!==3||(R=_+l),se.nodeType===3&&(_+=se.nodeValue.length),(K=se.firstChild)!==null;)F=se,se=K;for(;;){if(se===e)break t;if(F===a&&++G===f&&(j=_),F===h&&++ee===l&&(R=_),(K=se.nextSibling)!==null)break;se=F,F=se.parentNode}se=K}a=j===-1||R===-1?null:{start:j,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(kf={focusedElem:e,selectionRange:a},kc=!1,en=n;en!==null;)if(n=en,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,en=e;else for(;en!==null;){switch(n=en,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,f=h.memoizedProps,h=h.memoizedState,l=a.stateNode;try{var xe=mi(a.type,f);e=l.getSnapshotBeforeUpdate(xe,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){rt(a,a.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)wf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":wf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=n.sibling,e!==null){e.return=n.return,en=e;break}en=n.return}}function Nv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Ps(e,a),l&4&&gr(5,a);break;case 1:if(Ps(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(_){rt(a,a.return,_)}else{var f=mi(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(_){rt(a,a.return,_)}}l&64&&_v(a),l&512&&vr(a,a.return);break;case 3:if(Ps(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{ug(e,n)}catch(_){rt(a,a.return,_)}}break;case 27:n===null&&l&4&&wv(a);case 26:case 5:Ps(e,a),n===null&&l&4&&Sv(a),l&512&&vr(a,a.return);break;case 12:Ps(e,a);break;case 31:Ps(e,a),l&4&&Av(e,a);break;case 13:Ps(e,a),l&4&&Dv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=fS.bind(null,a),RS(e,a))));break;case 22:if(l=a.memoizedState!==null||$s,!l){n=n!==null&&n.memoizedState!==null||Vt,f=$s;var h=Vt;$s=l,(Vt=n)&&!h?Hs(e,a,(a.subtreeFlags&8772)!==0):Ps(e,a),$s=f,Vt=h}break;case 30:break;default:Ps(e,a)}}function Cv(e){var n=e.alternate;n!==null&&(e.alternate=null,Cv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Ed(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Tt=null,yn=!1;function Us(e,n,a){for(a=a.child;a!==null;)Ev(e,n,a),a=a.sibling}function Ev(e,n,a){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(Jt,a)}catch{}switch(a.tag){case 26:Vt||ys(a,n),Us(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Vt||ys(a,n);var l=Tt,f=yn;Ta(a.type)&&(Tt=a.stateNode,yn=!1),Us(e,n,a),jr(a.stateNode),Tt=l,yn=f;break;case 5:Vt||ys(a,n);case 6:if(l=Tt,f=yn,Tt=null,Us(e,n,a),Tt=l,yn=f,Tt!==null)if(yn)try{(Tt.nodeType===9?Tt.body:Tt.nodeName==="HTML"?Tt.ownerDocument.body:Tt).removeChild(a.stateNode)}catch(h){rt(a,n,h)}else try{Tt.removeChild(a.stateNode)}catch(h){rt(a,n,h)}break;case 18:Tt!==null&&(yn?(e=Tt,_0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ko(e)):_0(Tt,a.stateNode));break;case 4:l=Tt,f=yn,Tt=a.stateNode.containerInfo,yn=!0,Us(e,n,a),Tt=l,yn=f;break;case 0:case 11:case 14:case 15:va(2,a,n),Vt||va(4,a,n),Us(e,n,a);break;case 1:Vt||(ys(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&kv(a,n,l)),Us(e,n,a);break;case 21:Us(e,n,a);break;case 22:Vt=(l=Vt)||a.memoizedState!==null,Us(e,n,a),Vt=l;break;default:Us(e,n,a)}}function Av(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ko(e)}catch(a){rt(n,n.return,a)}}}function Dv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ko(e)}catch(a){rt(n,n.return,a)}}function aS(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new jv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new jv),n;default:throw Error(r(435,e.tag))}}function nc(e,n){var a=aS(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=pS.bind(null,e,l);l.then(f,f)}})}function bn(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],h=e,_=n,j=_;e:for(;j!==null;){switch(j.tag){case 27:if(Ta(j.type)){Tt=j.stateNode,yn=!1;break e}break;case 5:Tt=j.stateNode,yn=!1;break e;case 3:case 4:Tt=j.stateNode.containerInfo,yn=!0;break e}j=j.return}if(Tt===null)throw Error(r(160));Ev(h,_,f),Tt=null,yn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Rv(n,e),n=n.sibling}var ns=null;function Rv(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:bn(n,e),xn(e),l&4&&(va(3,e,e.return),gr(3,e),va(5,e,e.return));break;case 1:bn(n,e),xn(e),l&512&&(Vt||a===null||ys(a,a.return)),l&64&&$s&&(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=ns;if(bn(n,e),xn(e),l&512&&(Vt||a===null||ys(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[qo]||h[Ue]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),on(h,l,a),h[Ue]=e,Qt(h),l=h;break e;case"link":var _=R0("link","href",f).get(l+(a.href||""));if(_){for(var j=0;j<_.length;j++)if(h=_[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)){_.splice(j,1);break t}}h=f.createElement(l),on(h,l,a),f.head.appendChild(h);break;case"meta":if(_=R0("meta","content",f).get(l+(a.content||""))){for(j=0;j<_.length;j++)if(h=_[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)){_.splice(j,1);break t}}h=f.createElement(l),on(h,l,a),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[Ue]=e,Qt(h),l=h}e.stateNode=l}else M0(f,e.type,e.stateNode);else e.stateNode=D0(f,l,e.memoizedProps);else h!==l?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,l===null?M0(f,e.type,e.stateNode):D0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Ju(e,e.memoizedProps,a.memoizedProps)}break;case 27:bn(n,e),xn(e),l&512&&(Vt||a===null||ys(a,a.return)),a!==null&&l&4&&Ju(e,e.memoizedProps,a.memoizedProps);break;case 5:if(bn(n,e),xn(e),l&512&&(Vt||a===null||ys(a,a.return)),e.flags&32){f=e.stateNode;try{qi(f,"")}catch(xe){rt(e,e.return,xe)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,Ju(e,f,a!==null?a.memoizedProps:f)),l&1024&&(Qu=!0);break;case 6:if(bn(n,e),xn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(xe){rt(e,e.return,xe)}}break;case 3:if(yc=null,f=ns,ns=gc(n.containerInfo),bn(n,e),ns=f,xn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{ko(n.containerInfo)}catch(xe){rt(e,e.return,xe)}Qu&&(Qu=!1,Mv(e));break;case 4:l=ns,ns=gc(e.stateNode.containerInfo),bn(n,e),xn(e),ns=l;break;case 12:bn(n,e),xn(e);break;case 31:bn(n,e),xn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,nc(e,l)));break;case 13:bn(n,e),xn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ac=Yt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,nc(e,l)));break;case 22:f=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,G=$s,ee=Vt;if($s=G||f,Vt=ee||R,bn(n,e),Vt=ee,$s=G,xn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||R||$s||Vt||hi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,f)_=h.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{j=R.stateNode;var se=R.memoizedProps.style,F=se!=null&&se.hasOwnProperty("display")?se.display:null;j.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(xe){rt(R,R.return,xe)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(xe){rt(R,R.return,xe)}}}else if(n.tag===18){if(a===null){R=n;try{var K=R.stateNode;f?k0(K,!0):k0(R.stateNode,!1)}catch(xe){rt(R,R.return,xe)}}}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,nc(e,a))));break;case 19:bn(n,e),xn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,nc(e,l)));break;case 30:break;case 21:break;default:bn(n,e),xn(e)}}function xn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(Tv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,h=Wu(e);tc(e,h,f);break;case 5:var _=a.stateNode;a.flags&32&&(qi(_,""),a.flags&=-33);var j=Wu(e);tc(e,j,_);break;case 3:case 4:var R=a.stateNode.containerInfo,G=Wu(e);Xu(e,G,R);break;default:throw Error(r(161))}}catch(ee){rt(e,e.return,ee)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Mv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Mv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Ps(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Nv(e,n.alternate,n),n=n.sibling}function hi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:va(4,n,n.return),hi(n);break;case 1:ys(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&kv(n,n.return,a),hi(n);break;case 27:jr(n.stateNode);case 26:case 5:ys(n,n.return),hi(n);break;case 22:n.memoizedState===null&&hi(n);break;case 30:hi(n);break;default:hi(n)}e=e.sibling}}function Hs(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,_=h.flags;switch(h.tag){case 0:case 11:case 15:Hs(f,h,a),gr(4,h);break;case 1:if(Hs(f,h,a),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(G){rt(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++)dg(R[f],j)}catch(G){rt(l,l.return,G)}}a&&_&64&&_v(h),vr(h,h.return);break;case 27:wv(h);case 26:case 5:Hs(f,h,a),a&&l===null&&_&4&&Sv(h),vr(h,h.return);break;case 12:Hs(f,h,a);break;case 31:Hs(f,h,a),a&&_&4&&Av(f,h);break;case 13:Hs(f,h,a),a&&_&4&&Dv(f,h);break;case 22:h.memoizedState===null&&Hs(f,h,a),vr(h,h.return);break;case 30:break;default:Hs(f,h,a)}n=n.sibling}}function ef(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&&sr(a))}function tf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&sr(e))}function ss(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Iv(e,n,a,l),n=n.sibling}function Iv(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:ss(e,n,a,l),f&2048&&gr(9,n);break;case 1:ss(e,n,a,l);break;case 3:ss(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&&sr(e)));break;case 12:if(f&2048){ss(e,n,a,l),e=n.stateNode;try{var h=n.memoizedProps,_=h.id,j=h.onPostCommit;typeof j=="function"&&j(_,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){rt(n,n.return,R)}}else ss(e,n,a,l);break;case 31:ss(e,n,a,l);break;case 13:ss(e,n,a,l);break;case 23:break;case 22:h=n.stateNode,_=n.alternate,n.memoizedState!==null?h._visibility&2?ss(e,n,a,l):yr(e,n):h._visibility&2?ss(e,n,a,l):(h._visibility|=2,uo(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&ef(_,n);break;case 24:ss(e,n,a,l),f&2048&&tf(n.alternate,n);break;default:ss(e,n,a,l)}}function uo(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,_=n,j=a,R=l,G=_.flags;switch(_.tag){case 0:case 11:case 15:uo(h,_,j,R,f),gr(8,_);break;case 23:break;case 22:var ee=_.stateNode;_.memoizedState!==null?ee._visibility&2?uo(h,_,j,R,f):yr(h,_):(ee._visibility|=2,uo(h,_,j,R,f)),f&&G&2048&&ef(_.alternate,_);break;case 24:uo(h,_,j,R,f),f&&G&2048&&tf(_.alternate,_);break;default:uo(h,_,j,R,f)}n=n.sibling}}function yr(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:yr(a,l),f&2048&&ef(l.alternate,l);break;case 24:yr(a,l),f&2048&&tf(l.alternate,l);break;default:yr(a,l)}n=n.sibling}}var br=8192;function fo(e,n,a){if(e.subtreeFlags&br)for(e=e.child;e!==null;)Ov(e,n,a),e=e.sibling}function Ov(e,n,a){switch(e.tag){case 26:fo(e,n,a),e.flags&br&&e.memoizedState!==null&&qS(a,ns,e.memoizedState,e.memoizedProps);break;case 5:fo(e,n,a);break;case 3:case 4:var l=ns;ns=gc(e.stateNode.containerInfo),fo(e,n,a),ns=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=br,br=16777216,fo(e,n,a),br=l):fo(e,n,a));break;default:fo(e,n,a)}}function Bv(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 xr(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];en=l,zv(l,e)}Bv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Lv(e),e=e.sibling}function Lv(e){switch(e.tag){case 0:case 11:case 15:xr(e),e.flags&2048&&va(9,e,e.return);break;case 3:xr(e);break;case 12:xr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,sc(e)):xr(e);break;default:xr(e)}}function sc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];en=l,zv(l,e)}Bv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:va(8,n,n.return),sc(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,sc(n));break;default:sc(n)}e=e.sibling}}function zv(e,n){for(;en!==null;){var a=en;switch(a.tag){case 0:case 11:case 15:va(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:sr(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,en=l;else e:for(a=e;en!==null;){l=en;var f=l.sibling,h=l.return;if(Cv(l),l===a){en=null;break e}if(f!==null){f.return=h,en=f;break e}en=h}}}var iS={getCacheForType:function(e){var n=sn(Ut),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return sn(Ut).controller.signal}},oS=typeof WeakMap=="function"?WeakMap:Map,st=0,pt=null,ze=null,Pe=0,ot=0,An=null,ya=!1,po=!1,nf=!1,Vs=0,Et=0,ba=0,gi=0,sf=0,Dn=0,mo=0,_r=null,_n=null,af=!1,ac=0,$v=0,ic=1/0,oc=null,xa=null,Gt=0,_a=null,ho=null,qs=0,of=0,rf=null,Uv=null,kr=0,lf=null;function Rn(){return(st&2)!==0&&Pe!==0?Pe&-Pe:L.T!==null?mf():Xe()}function Pv(){if(Dn===0)if((Pe&536870912)===0||qe){var e=Ya;Ya<<=1,(Ya&3932160)===0&&(Ya=262144),Dn=e}else Dn=536870912;return e=Cn.current,e!==null&&(e.flags|=32),Dn}function kn(e,n,a){(e===pt&&(ot===2||ot===9)||e.cancelPendingCommit!==null)&&(go(e,0),ka(e,Pe,Dn,!1)),de(e,a),((st&2)===0||e!==pt)&&(e===pt&&((st&2)===0&&(gi|=a),Et===4&&ka(e,Pe,Dn,!1)),bs(e))}function Hv(e,n,a){if((st&6)!==0)throw Error(r(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||Xa(e,n),f=l?cS(e,n):df(e,n,!0),h=l;do{if(f===0){po&&!l&&ka(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!rS(a)){f=df(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var j=e;f=_r;var R=j.current.memoizedState.isDehydrated;if(R&&(go(j,_).flags|=256),_=df(j,_,!1),_!==2){if(nf&&!R){j.errorRecoveryDisabledLanes|=h,gi|=h,f=4;break e}h=_n,_n=f,h!==null&&(_n===null?_n=h:_n.push.apply(_n,h))}f=_}if(h=!1,f!==2)continue}}if(f===1){go(e,0),ka(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:ka(l,n,Dn,!ya);break e;case 2:_n=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=ac+300-Yt(),10<f)){if(ka(l,n,Dn,!ya),Wa(l,0,!0)!==0)break e;qs=n,l.timeoutHandle=b0(Vv.bind(null,l,a,_n,oc,af,n,Dn,gi,mo,ya,h,"Throttled",-0,0),f);break e}Vv(l,a,_n,oc,af,n,Dn,gi,mo,ya,h,null,-0,0)}}break}while(!0);bs(e)}function Vv(e,n,a,l,f,h,_,j,R,G,ee,se,F,K){if(e.timeoutHandle=-1,se=n.subtreeFlags,se&8192||(se&16785408)===16785408){se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Es},Ov(n,h,se);var xe=(h&62914560)===h?ac-Yt():(h&4194048)===h?$v-Yt():0;if(xe=GS(se,xe),xe!==null){qs=h,e.cancelPendingCommit=xe(Wv.bind(null,e,n,h,a,l,f,_,j,R,ee,se,null,F,K)),ka(e,h,_,!G);return}}Wv(e,n,h,a,l,f,_,j,R)}function rS(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],h=f.getSnapshot;f=f.value;try{if(!jn(h(),f))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function ka(e,n,a,l){n&=~sf,n&=~gi,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-Wt(f),_=1<<h;l[h]=-1,f&=~_}a!==0&&We(e,a,n)}function rc(){return(st&6)===0?(Sr(0),!1):!0}function cf(){if(ze!==null){if(ot===0)var e=ze.return;else e=ze,Ms=ri=null,Tu(e),io=null,ir=0,e=ze;for(;e!==null;)xv(e.alternate,e),e=e.return;ze=null}}function go(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,NS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),qs=0,cf(),pt=e,ze=a=Ds(e.current,null),Pe=n,ot=0,An=null,ya=!1,po=Xa(e,n),nf=!1,mo=Dn=sf=gi=ba=Et=0,_n=_r=null,af=!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-Wt(l),h=1<<f;n|=e[f],l&=~h}return Vs=n,Cl(),a}function qv(e,n){Oe=null,L.H=pr,n===ao||n===Bl?(n=og(),ot=3):n===fu?(n=og(),ot=4):ot=n===Uu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,An=n,ze===null&&(Et=1,Jl(e,Pn(n,e.current)))}function Gv(){var e=Cn.current;return e===null?!0:(Pe&4194048)===Pe?Gn===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?e===Gn:!1}function Fv(){var e=L.H;return L.H=pr,e===null?pr:e}function Zv(){var e=L.A;return L.A=iS,e}function lc(){Et=4,ya||(Pe&4194048)!==Pe&&Cn.current!==null||(po=!0),(ba&134217727)===0&&(gi&134217727)===0||pt===null||ka(pt,Pe,Dn,!1)}function df(e,n,a){var l=st;st|=2;var f=Fv(),h=Zv();(pt!==e||Pe!==n)&&(oc=null,go(e,n)),n=!1;var _=Et;e:do try{if(ot!==0&&ze!==null){var j=ze,R=An;switch(ot){case 8:cf(),_=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(n=!0);var G=ot;if(ot=0,An=null,vo(e,j,R,G),a&&po){_=0;break e}break;default:G=ot,ot=0,An=null,vo(e,j,R,G)}}lS(),_=Et;break}catch(ee){qv(e,ee)}while(!0);return n&&e.shellSuspendCounter++,Ms=ri=null,st=l,L.H=f,L.A=h,ze===null&&(pt=null,Pe=0,Cl()),_}function lS(){for(;ze!==null;)Kv(ze)}function cS(e,n){var a=st;st|=2;var l=Fv(),f=Zv();pt!==e||Pe!==n?(oc=null,ic=Yt()+500,go(e,n)):po=Xa(e,n);e:do try{if(ot!==0&&ze!==null){n=ze;var h=An;t:switch(ot){case 1:ot=0,An=null,vo(e,n,h,1);break;case 2:case 9:if(ag(h)){ot=0,An=null,Yv(n);break}n=function(){ot!==2&&ot!==9||pt!==e||(ot=7),bs(e)},h.then(n,n);break e;case 3:ot=7;break e;case 4:ot=5;break e;case 7:ag(h)?(ot=0,An=null,Yv(n)):(ot=0,An=null,vo(e,n,h,7));break;case 5:var _=null;switch(ze.tag){case 26:_=ze.memoizedState;case 5:case 27:var j=ze;if(_?I0(_):j.stateNode.complete){ot=0,An=null;var R=j.sibling;if(R!==null)ze=R;else{var G=j.return;G!==null?(ze=G,cc(G)):ze=null}break t}}ot=0,An=null,vo(e,n,h,5);break;case 6:ot=0,An=null,vo(e,n,h,6);break;case 8:cf(),Et=6;break e;default:throw Error(r(462))}}dS();break}catch(ee){qv(e,ee)}while(!0);return Ms=ri=null,L.H=l,L.A=f,st=a,ze!==null?0:(pt=null,Pe=0,Cl(),Et)}function dS(){for(;ze!==null&&!Fa();)Kv(ze)}function Kv(e){var n=yv(e.alternate,e,Vs);e.memoizedProps=e.pendingProps,n===null?cc(e):ze=n}function Yv(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=fv(a,n,n.pendingProps,n.type,void 0,Pe);break;case 11:n=fv(a,n,n.pendingProps,n.type.render,n.ref,Pe);break;case 5:Tu(n);default:xv(a,n),n=ze=Zh(n,Vs),n=yv(a,n,Vs)}e.memoizedProps=e.pendingProps,n===null?cc(e):ze=n}function vo(e,n,a,l){Ms=ri=null,Tu(n),io=null,ir=0;var f=n.return;try{if(Xk(e,f,n,a,Pe)){Et=1,Jl(e,Pn(a,e.current)),ze=null;return}}catch(h){if(f!==null)throw ze=f,h;Et=1,Jl(e,Pn(a,e.current)),ze=null;return}n.flags&32768?(qe||l===1?e=!0:po||(Pe&536870912)!==0?e=!1:(ya=e=!0,(l===2||l===9||l===3||l===6)&&(l=Cn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Jv(n,e)):cc(n)}function cc(e){var n=e;do{if((n.flags&32768)!==0){Jv(n,ya);return}e=n.return;var a=tS(n.alternate,n,Vs);if(a!==null){ze=a;return}if(n=n.sibling,n!==null){ze=n;return}ze=n=e}while(n!==null);Et===0&&(Et=5)}function Jv(e,n){do{var a=nS(e.alternate,e);if(a!==null){a.flags&=32767,ze=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){ze=e;return}ze=e=a}while(e!==null);Et=6,ze=null}function Wv(e,n,a,l,f,h,_,j,R){e.cancelPendingCommit=null;do dc();while(Gt!==0);if((st&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=Wd,ye(e,a,h,_,j,R),e===pt&&(ze=pt=null,Pe=0),ho=n,_a=e,qs=a,of=h,rf=f,Uv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,mS(ms,function(){return n0(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=L.T,L.T=null,f=Z.p,Z.p=2,_=st,st|=4;try{sS(e,n,a)}finally{st=_,Z.p=f,L.T=l}}Gt=1,Xv(),Qv(),e0()}}function Xv(){if(Gt===1){Gt=0;var e=_a,n=ho,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=L.T,L.T=null;var l=Z.p;Z.p=2;var f=st;st|=4;try{Rv(n,e);var h=kf,_=zh(e.containerInfo),j=h.focusedElem,R=h.selectionRange;if(_!==j&&j&&j.ownerDocument&&Lh(j.ownerDocument.documentElement,j)){if(R!==null&&Fd(j)){var G=R.start,ee=R.end;if(ee===void 0&&(ee=G),"selectionStart"in j)j.selectionStart=G,j.selectionEnd=Math.min(ee,j.value.length);else{var se=j.ownerDocument||document,F=se&&se.defaultView||window;if(F.getSelection){var K=F.getSelection(),xe=j.textContent.length,Ee=Math.min(R.start,xe),ft=R.end===void 0?Ee:Math.min(R.end,xe);!K.extend&&Ee>ft&&(_=ft,ft=Ee,Ee=_);var z=Bh(j,Ee),B=Bh(j,ft);if(z&&B&&(K.rangeCount!==1||K.anchorNode!==z.node||K.anchorOffset!==z.offset||K.focusNode!==B.node||K.focusOffset!==B.offset)){var q=se.createRange();q.setStart(z.node,z.offset),K.removeAllRanges(),Ee>ft?(K.addRange(q),K.extend(B.node,B.offset)):(q.setEnd(B.node,B.offset),K.addRange(q))}}}}for(se=[],K=j;K=K.parentNode;)K.nodeType===1&&se.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<se.length;j++){var ne=se[j];ne.element.scrollLeft=ne.left,ne.element.scrollTop=ne.top}}kc=!!_f,kf=_f=null}finally{st=f,Z.p=l,L.T=a}}e.current=n,Gt=2}}function Qv(){if(Gt===2){Gt=0;var e=_a,n=ho,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=L.T,L.T=null;var l=Z.p;Z.p=2;var f=st;st|=4;try{Nv(e,n.alternate,n)}finally{st=f,Z.p=l,L.T=a}}Gt=3}}function e0(){if(Gt===4||Gt===3){Gt=0,ia();var e=_a,n=ho,a=qs,l=Uv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Gt=5:(Gt=0,ho=_a=null,t0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(xa=null),ct(a),n=n.stateNode,St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(Jt,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=L.T,f=Z.p,Z.p=2,L.T=null;try{for(var h=e.onRecoverableError,_=0;_<l.length;_++){var j=l[_];h(j.value,{componentStack:j.stack})}}finally{L.T=n,Z.p=f}}(qs&3)!==0&&dc(),bs(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===lf?kr++:(kr=0,lf=e):kr=0,Sr(0)}}function t0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,sr(n)))}function dc(){return Xv(),Qv(),e0(),n0()}function n0(){if(Gt!==5)return!1;var e=_a,n=of;of=0;var a=ct(qs),l=L.T,f=Z.p;try{Z.p=32>a?32:a,L.T=null,a=rf,rf=null;var h=_a,_=qs;if(Gt=0,ho=_a=null,qs=0,(st&6)!==0)throw Error(r(331));var j=st;if(st|=4,Lv(h.current),Iv(h,h.current,_,a),st=j,Sr(0,!1),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(Jt,h)}catch{}return!0}finally{Z.p=f,L.T=l,t0(e,n)}}function s0(e,n,a){n=Pn(a,n),n=$u(e.stateNode,n,2),e=ma(e,n,2),e!==null&&(de(e,2),bs(e))}function rt(e,n,a){if(e.tag===3)s0(e,e,a);else for(;n!==null;){if(n.tag===3){s0(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(xa===null||!xa.has(l))){e=Pn(a,e),a=av(2),l=ma(n,a,2),l!==null&&(iv(a,l,n,e),de(l,2),bs(l));break}}n=n.return}}function uf(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new oS;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)||(nf=!0,f.add(a),e=uS.bind(null,e,n,a),n.then(e,e))}function uS(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,pt===e&&(Pe&a)===a&&(Et===4||Et===3&&(Pe&62914560)===Pe&&300>Yt()-ac?(st&2)===0&&go(e,0):sf|=a,mo===Pe&&(mo=0)),bs(e)}function a0(e,n){n===0&&(n=ae()),e=ai(e,n),e!==null&&(de(e,n),bs(e))}function fS(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),a0(e,a)}function pS(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),a0(e,a)}function mS(e,n){return aa(e,n)}var uc=null,yo=null,ff=!1,fc=!1,pf=!1,Sa=0;function bs(e){e!==yo&&e.next===null&&(yo===null?uc=yo=e:yo=yo.next=e),fc=!0,ff||(ff=!0,gS())}function Sr(e,n){if(!pf&&fc){pf=!0;do for(var a=!1,l=uc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var _=l.suspendedLanes,j=l.pingedLanes;h=(1<<31-Wt(42|e)+1)-1,h&=f&~(_&~j),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,l0(l,h))}else h=Pe,h=Wa(l,l===pt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||Xa(l,h)||(a=!0,l0(l,h));l=l.next}while(a);pf=!1}}function hS(){i0()}function i0(){fc=ff=!1;var e=0;Sa!==0&&jS()&&(e=Sa);for(var n=Yt(),a=null,l=uc;l!==null;){var f=l.next,h=o0(l,n);h===0?(l.next=null,a===null?uc=f:a.next=f,f===null&&(yo=a)):(a=l,(e!==0||(h&3)!==0)&&(fc=!0)),l=f}Gt!==0&&Gt!==5||Sr(e),Sa!==0&&(Sa=0)}function o0(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var _=31-Wt(h),j=1<<_,R=f[_];R===-1?((j&a)===0||(j&l)!==0)&&(f[_]=V(j,n)):R<=n&&(e.expiredLanes|=j),h&=~j}if(n=pt,a=Pe,a=Wa(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(ot===2||ot===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&es(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Xa(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&es(l),ct(a)){case 2:case 8:a=Za;break;case 32:a=ms;break;case 268435456:a=wn;break;default:a=ms}return l=r0.bind(null,e),a=aa(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&es(l),e.callbackPriority=2,e.callbackNode=null,2}function r0(e,n){if(Gt!==0&&Gt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(dc()&&e.callbackNode!==a)return null;var l=Pe;return l=Wa(e,e===pt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Hv(e,l,n),o0(e,Yt()),e.callbackNode!=null&&e.callbackNode===a?r0.bind(null,e):null)}function l0(e,n){if(dc())return null;Hv(e,n,!0)}function gS(){CS(function(){(st&6)!==0?aa(oa,hS):i0()})}function mf(){if(Sa===0){var e=no;e===0&&(e=Ka,Ka<<=1,(Ka&261888)===0&&(Ka=256)),Sa=e}return Sa}function c0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:xl(""+e)}function d0(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 vS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var h=c0((f[It]||null).action),_=l.submitter;_&&(n=(n=_[It]||null)?c0(n.formAction):_.getAttribute("formAction"),n!==null&&(h=n,_=null));var j=new Tl("action","action",null,l,f);e.push({event:j,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Sa!==0){var R=_?d0(f,_):new FormData(f);Mu(a,{pending:!0,data:R,method:f.method,action:h},null,R)}}else typeof h=="function"&&(j.preventDefault(),R=_?d0(f,_):new FormData(f),Mu(a,{pending:!0,data:R,method:f.method,action:h},h,R))},currentTarget:f}]})}}for(var hf=0;hf<Jd.length;hf++){var gf=Jd[hf],yS=gf.toLowerCase(),bS=gf[0].toUpperCase()+gf.slice(1);ts(yS,"on"+bS)}ts(Ph,"onAnimationEnd"),ts(Hh,"onAnimationIteration"),ts(Vh,"onAnimationStart"),ts("dblclick","onDoubleClick"),ts("focusin","onFocus"),ts("focusout","onBlur"),ts(Ok,"onTransitionRun"),ts(Bk,"onTransitionStart"),ts(Lk,"onTransitionCancel"),ts(qh,"onTransitionEnd"),Hi("onMouseEnter",["mouseout","mouseover"]),Hi("onMouseLeave",["mouseout","mouseover"]),Hi("onPointerEnter",["pointerout","pointerover"]),Hi("onPointerLeave",["pointerout","pointerover"]),ei("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ei("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ei("onBeforeInput",["compositionend","keypress","textInput","paste"]),ei("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ei("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ei("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tr="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(" "),xS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tr));function u0(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var _=l.length-1;0<=_;_--){var j=l[_],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(ee){Nl(ee)}f.currentTarget=null,h=R}else for(_=0;_<l.length;_++){if(j=l[_],R=j.instance,G=j.currentTarget,j=j.listener,R!==h&&f.isPropagationStopped())break e;h=j,f.currentTarget=G;try{h(f)}catch(ee){Nl(ee)}f.currentTarget=null,h=R}}}}function $e(e,n){var a=n[Qa];a===void 0&&(a=n[Qa]=new Set);var l=e+"__bubble";a.has(l)||(f0(n,e,2,!1),a.add(l))}function vf(e,n,a){var l=0;n&&(l|=4),f0(a,e,l,n)}var pc="_reactListening"+Math.random().toString(36).slice(2);function yf(e){if(!e[pc]){e[pc]=!0,ih.forEach(function(a){a!=="selectionchange"&&(xS.has(a)||vf(a,!1,e),vf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[pc]||(n[pc]=!0,vf("selectionchange",!1,n))}}function f0(e,n,a,l){switch(P0(n)){case 2:var f=KS;break;case 8:f=YS;break;default:f=Mf}a=f.bind(null,n,a,e),f=void 0,!Ld||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 bf(e,n,a,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var _=l.tag;if(_===3||_===4){var j=l.stateNode.containerInfo;if(j===f)break;if(_===4)for(_=l.return;_!==null;){var R=_.tag;if((R===3||R===4)&&_.stateNode.containerInfo===f)return;_=_.return}for(;j!==null;){if(_=$i(j),_===null)return;if(R=_.tag,R===5||R===6||R===26||R===27){l=h=_;continue e}j=j.parentNode}}l=l.return}vh(function(){var G=h,ee=Od(a),se=[];e:{var F=Gh.get(e);if(F!==void 0){var K=Tl,xe=e;switch(e){case"keypress":if(kl(a)===0)break e;case"keydown":case"keyup":K=pk;break;case"focusin":xe="focus",K=Pd;break;case"focusout":xe="blur",K=Pd;break;case"beforeblur":case"afterblur":K=Pd;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=xh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=tk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=gk;break;case Ph:case Hh:case Vh:K=ak;break;case qh:K=yk;break;case"scroll":case"scrollend":K=Q1;break;case"wheel":K=xk;break;case"copy":case"cut":case"paste":K=ok;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=kh;break;case"toggle":case"beforetoggle":K=kk}var Ee=(n&4)!==0,ft=!Ee&&(e==="scroll"||e==="scrollend"),z=Ee?F!==null?F+"Capture":null:F;Ee=[];for(var B=G,q;B!==null;){var ne=B;if(q=ne.stateNode,ne=ne.tag,ne!==5&&ne!==26&&ne!==27||q===null||z===null||(ne=Fo(B,z),ne!=null&&Ee.push(wr(B,ne,q))),ft)break;B=B.return}0<Ee.length&&(F=new K(F,xe,null,a,ee),se.push({event:F,listeners:Ee}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",F&&a!==Id&&(xe=a.relatedTarget||a.fromElement)&&($i(xe)||xe[gn]))break e;if((K||F)&&(F=ee.window===ee?ee:(F=ee.ownerDocument)?F.defaultView||F.parentWindow:window,K?(xe=a.relatedTarget||a.toElement,K=G,xe=xe?$i(xe):null,xe!==null&&(ft=d(xe),Ee=xe.tag,xe!==ft||Ee!==5&&Ee!==27&&Ee!==6)&&(xe=null)):(K=null,xe=G),K!==xe)){if(Ee=xh,ne="onMouseLeave",z="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=kh,ne="onPointerLeave",z="onPointerEnter",B="pointer"),ft=K==null?F:Go(K),q=xe==null?F:Go(xe),F=new Ee(ne,B+"leave",K,a,ee),F.target=ft,F.relatedTarget=q,ne=null,$i(ee)===G&&(Ee=new Ee(z,B+"enter",xe,a,ee),Ee.target=q,Ee.relatedTarget=ft,ne=Ee),ft=ne,K&&xe)t:{for(Ee=_S,z=K,B=xe,q=0,ne=z;ne;ne=Ee(ne))q++;ne=0;for(var je=B;je;je=Ee(je))ne++;for(;0<q-ne;)z=Ee(z),q--;for(;0<ne-q;)B=Ee(B),ne--;for(;q--;){if(z===B||B!==null&&z===B.alternate){Ee=z;break t}z=Ee(z),B=Ee(B)}Ee=null}else Ee=null;K!==null&&p0(se,F,K,Ee,!1),xe!==null&&ft!==null&&p0(se,ft,xe,Ee,!0)}}e:{if(F=G?Go(G):window,K=F.nodeName&&F.nodeName.toLowerCase(),K==="select"||K==="input"&&F.type==="file")var Qe=Ah;else if(Ch(F))if(Dh)Qe=Rk;else{Qe=Ak;var ke=Ek}else K=F.nodeName,!K||K.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?G&&Md(G.elementType)&&(Qe=Ah):Qe=Dk;if(Qe&&(Qe=Qe(e,G))){Eh(se,Qe,a,ee);break e}ke&&ke(e,F,G),e==="focusout"&&G&&F.type==="number"&&G.memoizedProps.value!=null&&Rd(F,"number",F.value)}switch(ke=G?Go(G):window,e){case"focusin":(Ch(ke)||ke.contentEditable==="true")&&(Ki=ke,Zd=G,er=null);break;case"focusout":er=Zd=Ki=null;break;case"mousedown":Kd=!0;break;case"contextmenu":case"mouseup":case"dragend":Kd=!1,$h(se,a,ee);break;case"selectionchange":if(Ik)break;case"keydown":case"keyup":$h(se,a,ee)}var Be;if(Vd)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 Zi?jh(e,a)&&(He="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(He="onCompositionStart");He&&(Sh&&a.locale!=="ko"&&(Zi||He!=="onCompositionStart"?He==="onCompositionEnd"&&Zi&&(Be=yh()):(ra=ee,zd="value"in ra?ra.value:ra.textContent,Zi=!0)),ke=mc(G,He),0<ke.length&&(He=new _h(He,e,null,a,ee),se.push({event:He,listeners:ke}),Be?He.data=Be:(Be=Nh(a),Be!==null&&(He.data=Be)))),(Be=Tk?wk(e,a):jk(e,a))&&(He=mc(G,"onBeforeInput"),0<He.length&&(ke=new _h("onBeforeInput","beforeinput",null,a,ee),se.push({event:ke,listeners:He}),ke.data=Be)),vS(se,e,G,a,ee)}u0(se,n)})}function wr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function mc(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=Fo(e,a),f!=null&&l.unshift(wr(e,f,h)),f=Fo(e,n),f!=null&&l.push(wr(e,f,h))),e.tag===3)return l;e=e.return}return[]}function _S(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function p0(e,n,a,l,f){for(var h=n._reactName,_=[];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=Fo(a,h),G!=null&&_.unshift(wr(a,G,R))):f||(G=Fo(a,h),G!=null&&_.push(wr(a,G,R)))),a=a.return}_.length!==0&&e.push({event:n,listeners:_})}var kS=/\r\n?/g,SS=/\u0000|\uFFFD/g;function m0(e){return(typeof e=="string"?e:""+e).replace(kS,`
|
|
26
|
+
`).replace(SS,"")}function h0(e,n){return n=m0(n),m0(e)===n}function ut(e,n,a,l,f,h){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||qi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&qi(e,""+l);break;case"className":yl(e,"class",l);break;case"tabIndex":yl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":yl(e,a,l);break;case"style":hh(e,l,h);break;case"data":if(n!=="object"){yl(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=xl(""+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"&&ut(e,n,"name",f.name,f,null),ut(e,n,"formEncType",f.formEncType,f,null),ut(e,n,"formMethod",f.formMethod,f,null),ut(e,n,"formTarget",f.formTarget,f,null)):(ut(e,n,"encType",f.encType,f,null),ut(e,n,"method",f.method,f,null),ut(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=xl(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Es);break;case"onScroll":l!=null&&$e("scroll",e);break;case"onScrollEnd":l!=null&&$e("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=xl(""+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":$e("beforetoggle",e),$e("toggle",e),vl(e,"popover",l);break;case"xlinkActuate":Cs(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Cs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Cs(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Cs(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Cs(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Cs(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Cs(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Cs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Cs(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":vl(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=W1.get(a)||a,vl(e,a,l))}}function xf(e,n,a,l,f,h){switch(a){case"style":hh(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"?qi(e,l):(typeof l=="number"||typeof l=="bigint")&&qi(e,""+l);break;case"onScroll":l!=null&&$e("scroll",e);break;case"onScrollEnd":l!=null&&$e("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Es);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!oh.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[It]||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,""):vl(e,a,l)}}}function on(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":$e("error",e),$e("load",e);var l=!1,f=!1,h;for(h in a)if(a.hasOwnProperty(h)){var _=a[h];if(_!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ut(e,n,h,_,a,null)}}f&&ut(e,n,"srcSet",a.srcSet,a,null),l&&ut(e,n,"src",a.src,a,null);return;case"input":$e("invalid",e);var j=h=_=f=null,R=null,G=null;for(l in a)if(a.hasOwnProperty(l)){var ee=a[l];if(ee!=null)switch(l){case"name":f=ee;break;case"type":_=ee;break;case"checked":R=ee;break;case"defaultChecked":G=ee;break;case"value":h=ee;break;case"defaultValue":j=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(137,n));break;default:ut(e,n,l,ee,a,null)}}uh(e,h,j,R,G,_,f,!1);return;case"select":$e("invalid",e),l=_=h=null;for(f in a)if(a.hasOwnProperty(f)&&(j=a[f],j!=null))switch(f){case"value":h=j;break;case"defaultValue":_=j;break;case"multiple":l=j;default:ut(e,n,f,j,a,null)}n=h,a=_,e.multiple=!!l,n!=null?Vi(e,!!l,n,!1):a!=null&&Vi(e,!!l,a,!0);return;case"textarea":$e("invalid",e),h=f=l=null;for(_ in a)if(a.hasOwnProperty(_)&&(j=a[_],j!=null))switch(_){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:ut(e,n,_,j,a,null)}ph(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:ut(e,n,R,l,a,null)}return;case"dialog":$e("beforetoggle",e),$e("toggle",e),$e("cancel",e),$e("close",e);break;case"iframe":case"object":$e("load",e);break;case"video":case"audio":for(l=0;l<Tr.length;l++)$e(Tr[l],e);break;case"image":$e("error",e),$e("load",e);break;case"details":$e("toggle",e);break;case"embed":case"source":case"link":$e("error",e),$e("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:ut(e,n,G,l,a,null)}return;default:if(Md(n)){for(ee in a)a.hasOwnProperty(ee)&&(l=a[ee],l!==void 0&&xf(e,n,ee,l,a,void 0));return}}for(j in a)a.hasOwnProperty(j)&&(l=a[j],l!=null&&ut(e,n,j,l,a,null))}function TS(e,n,a,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,_=null,j=null,R=null,G=null,ee=null;for(K in a){var se=a[K];if(a.hasOwnProperty(K)&&se!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=se;default:l.hasOwnProperty(K)||ut(e,n,K,null,l,se)}}for(var F in l){var K=l[F];if(se=a[F],l.hasOwnProperty(F)&&(K!=null||se!=null))switch(F){case"type":h=K;break;case"name":f=K;break;case"checked":G=K;break;case"defaultChecked":ee=K;break;case"value":_=K;break;case"defaultValue":j=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,n));break;default:K!==se&&ut(e,n,F,K,l,se)}}Dd(e,_,j,R,G,ee,h,f);return;case"select":K=_=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)||ut(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":_=h;default:h!==R&&ut(e,n,f,h,l,R)}n=j,a=_,l=K,F!=null?Vi(e,!!a,F,!1):!!l!=!!a&&(n!=null?Vi(e,!!a,n,!0):Vi(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:ut(e,n,j,null,l,f)}for(_ in l)if(f=l[_],h=a[_],l.hasOwnProperty(_)&&(f!=null||h!=null))switch(_){case"value":F=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&ut(e,n,_,f,l,h)}fh(e,F,K);return;case"option":for(var xe in a)if(F=a[xe],a.hasOwnProperty(xe)&&F!=null&&!l.hasOwnProperty(xe))switch(xe){case"selected":e.selected=!1;break;default:ut(e,n,xe,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:ut(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 Ee in a)F=a[Ee],a.hasOwnProperty(Ee)&&F!=null&&!l.hasOwnProperty(Ee)&&ut(e,n,Ee,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:ut(e,n,G,F,l,K)}return;default:if(Md(n)){for(var ft in a)F=a[ft],a.hasOwnProperty(ft)&&F!==void 0&&!l.hasOwnProperty(ft)&&xf(e,n,ft,void 0,l,F);for(ee in l)F=l[ee],K=a[ee],!l.hasOwnProperty(ee)||F===K||F===void 0&&K===void 0||xf(e,n,ee,F,l,K);return}}for(var z in a)F=a[z],a.hasOwnProperty(z)&&F!=null&&!l.hasOwnProperty(z)&&ut(e,n,z,null,l,F);for(se in l)F=l[se],K=a[se],!l.hasOwnProperty(se)||F===K||F==null&&K==null||ut(e,n,se,F,l,K)}function g0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],h=f.transferSize,_=f.initiatorType,j=f.duration;if(h&&j&&g0(_)){for(_=0,j=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],G=R.startTime;if(G>j)break;var ee=R.transferSize,se=R.initiatorType;ee&&g0(se)&&(R=R.responseEnd,_+=ee*(R<j?1:(j-G)/(R-G)))}if(--l,n+=8*(h+_)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var _f=null,kf=null;function hc(e){return e.nodeType===9?e:e.ownerDocument}function v0(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 y0(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 Sf(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 Tf=null;function jS(){var e=window.event;return e&&e.type==="popstate"?e===Tf?!1:(Tf=e,!0):(Tf=null,!1)}var b0=typeof setTimeout=="function"?setTimeout:void 0,NS=typeof clearTimeout=="function"?clearTimeout:void 0,x0=typeof Promise=="function"?Promise:void 0,CS=typeof queueMicrotask=="function"?queueMicrotask:typeof x0<"u"?function(e){return x0.resolve(null).then(e).catch(ES)}:b0;function ES(e){setTimeout(function(){throw e})}function Ta(e){return e==="head"}function _0(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),ko(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")jr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,jr(a);for(var h=a.firstChild;h;){var _=h.nextSibling,j=h.nodeName;h[qo]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=_}}else a==="body"&&jr(e.ownerDocument.body);a=f}while(a);ko(n)}function k0(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 wf(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":wf(a),Ed(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function AS(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[qo])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=Fn(e.nextSibling),e===null)break}return null}function DS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Fn(e.nextSibling),e===null))return null;return e}function S0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Fn(e.nextSibling),e===null))return null;return e}function jf(e){return e.data==="$?"||e.data==="$~"}function Nf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function RS(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 Fn(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 Cf=null;function T0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Fn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function w0(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 j0(e,n,a){switch(n=hc(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 jr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Ed(e)}var Zn=new Map,N0=new Set;function gc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Gs=Z.d;Z.d={f:MS,r:IS,D:OS,C:BS,L:LS,m:zS,X:US,S:$S,M:PS};function MS(){var e=Gs.f(),n=rc();return e||n}function IS(e){var n=Ui(e);n!==null&&n.tag===5&&n.type==="form"?qg(n):Gs.r(e)}var bo=typeof document>"u"?null:document;function C0(e,n,a){var l=bo;if(l&&typeof n=="string"&&n){var f=$n(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),N0.has(f)||(N0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),on(n,"link",e),Qt(n),l.head.appendChild(n)))}}function OS(e){Gs.D(e),C0("dns-prefetch",e,null)}function BS(e,n){Gs.C(e,n),C0("preconnect",e,n)}function LS(e,n,a){Gs.L(e,n,a);var l=bo;if(l&&e&&n){var f='link[rel="preload"][as="'+$n(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+$n(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+$n(a.imageSizes)+'"]')):f+='[href="'+$n(e)+'"]';var h=f;switch(n){case"style":h=xo(e);break;case"script":h=_o(e)}Zn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Zn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(Nr(h))||n==="script"&&l.querySelector(Cr(h))||(n=l.createElement("link"),on(n,"link",e),Qt(n),l.head.appendChild(n)))}}function zS(e,n){Gs.m(e,n);var a=bo;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+$n(l)+'"][href="'+$n(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=_o(e)}if(!Zn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Zn.set(h,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Cr(h)))return}l=a.createElement("link"),on(l,"link",e),Qt(l),a.head.appendChild(l)}}}function $S(e,n,a){Gs.S(e,n,a);var l=bo;if(l&&e){var f=Pi(l).hoistableStyles,h=xo(e);n=n||"default";var _=f.get(h);if(!_){var j={loading:0,preload:null};if(_=l.querySelector(Nr(h)))j.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Zn.get(h))&&Ef(e,a);var R=_=l.createElement("link");Qt(R),on(R,"link",e),R._p=new Promise(function(G,ee){R.onload=G,R.onerror=ee}),R.addEventListener("load",function(){j.loading|=1}),R.addEventListener("error",function(){j.loading|=2}),j.loading|=4,vc(_,n,l)}_={type:"stylesheet",instance:_,count:1,state:j},f.set(h,_)}}}function US(e,n){Gs.X(e,n);var a=bo;if(a&&e){var l=Pi(a).hoistableScripts,f=_o(e),h=l.get(f);h||(h=a.querySelector(Cr(f)),h||(e=b({src:e,async:!0},n),(n=Zn.get(f))&&Af(e,n),h=a.createElement("script"),Qt(h),on(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function PS(e,n){Gs.M(e,n);var a=bo;if(a&&e){var l=Pi(a).hoistableScripts,f=_o(e),h=l.get(f);h||(h=a.querySelector(Cr(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Zn.get(f))&&Af(e,n),h=a.createElement("script"),Qt(h),on(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function E0(e,n,a,l){var f=(f=_e.current)?gc(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=xo(a.href),a=Pi(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=xo(a.href);var h=Pi(f).hoistableStyles,_=h.get(e);if(_||(f=f.ownerDocument||f,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,_),(h=f.querySelector(Nr(e)))&&!h._p&&(_.instance=h,_.state.loading=5),Zn.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},Zn.set(e,a),h||HS(f,e,a,_.state))),n&&l===null)throw Error(r(528,""));return _}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=_o(a),a=Pi(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 xo(e){return'href="'+$n(e)+'"'}function Nr(e){return'link[rel="stylesheet"]['+e+"]"}function A0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function HS(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}),on(n,"link",a),Qt(n),e.head.appendChild(n))}function _o(e){return'[src="'+$n(e)+'"]'}function Cr(e){return"script[async]"+e}function D0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+$n(a.href)+'"]');if(l)return n.instance=l,Qt(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"),Qt(l),on(l,"style",f),vc(l,a.precedence,e),n.instance=l;case"stylesheet":f=xo(a.href);var h=e.querySelector(Nr(f));if(h)return n.state.loading|=4,n.instance=h,Qt(h),h;l=A0(a),(f=Zn.get(f))&&Ef(l,f),h=(e.ownerDocument||e).createElement("link"),Qt(h);var _=h;return _._p=new Promise(function(j,R){_.onload=j,_.onerror=R}),on(h,"link",l),n.state.loading|=4,vc(h,a.precedence,e),n.instance=h;case"script":return h=_o(a.src),(f=e.querySelector(Cr(h)))?(n.instance=f,Qt(f),f):(l=a,(f=Zn.get(h))&&(l=b({},a),Af(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),Qt(f),on(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,vc(l,a.precedence,e));return n.instance}function vc(e,n,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,_=0;_<l.length;_++){var j=l[_];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 Ef(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Af(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var yc=null;function R0(e,n,a){if(yc===null){var l=new Map,f=yc=new Map;f.set(a,l)}else f=yc,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[qo]||h[Ue]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var _=h.getAttribute(n)||"";_=e+_;var j=l.get(_);j?j.push(h):l.set(_,[h])}}return l}function M0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function VS(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 I0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function qS(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=xo(l.href),h=n.querySelector(Nr(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=bc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,Qt(h);return}h=n.ownerDocument||n,l=A0(l),(f=Zn.get(f))&&Ef(l,f),h=h.createElement("link"),Qt(h);var _=h;_._p=new Promise(function(j,R){_.onload=j,_.onerror=R}),on(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=bc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Df=0;function GS(e,n){return e.stylesheets&&e.count===0&&_c(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&_c(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Df===0&&(Df=62500*wS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&_c(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Df?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function bc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_c(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var xc=null;function _c(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,xc=new Map,n.forEach(FS,e),xc=null,bc.call(e))}function FS(e,n){if(!(n.state.loading&4)){var a=xc.get(e);if(a)var l=a.get(null);else{a=new Map,xc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var _=f[h];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),l=_)}l&&a.set(null,l)}f=n.instance,_=f.getAttribute("data-precedence"),h=a.get(_)||l,h===l&&a.set(null,f),a.set(_,f),this.count++,l=bc.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 Er={$$typeof:D,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function ZS(e,n,a,l,f,h,_,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=le(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=le(0),this.hiddenUpdates=le(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function O0(e,n,a,l,f,h,_,j,R,G,ee,se){return e=new ZS(e,n,a,_,R,G,ee,se,j),n=1,h===!0&&(n|=24),h=Nn(3,null,null,n),e.current=h,h.stateNode=e,n=cu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:a,cache:n},pu(h),e}function B0(e){return e?(e=Wi,e):Wi}function L0(e,n,a,l,f,h){f=B0(f),l.context===null?l.context=f:l.pendingContext=f,l=pa(n),l.payload={element:a},h=h===void 0?null:h,h!==null&&(l.callback=h),a=ma(e,l,n),a!==null&&(kn(a,e,n),rr(a,e,n))}function z0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Rf(e,n){z0(e,n),(e=e.alternate)&&z0(e,n)}function $0(e){if(e.tag===13||e.tag===31){var n=ai(e,67108864);n!==null&&kn(n,e,67108864),Rf(e,67108864)}}function U0(e){if(e.tag===13||e.tag===31){var n=Rn();n=Ke(n);var a=ai(e,n);a!==null&&kn(a,e,n),Rf(e,n)}}var kc=!0;function KS(e,n,a,l){var f=L.T;L.T=null;var h=Z.p;try{Z.p=2,Mf(e,n,a,l)}finally{Z.p=h,L.T=f}}function YS(e,n,a,l){var f=L.T;L.T=null;var h=Z.p;try{Z.p=8,Mf(e,n,a,l)}finally{Z.p=h,L.T=f}}function Mf(e,n,a,l){if(kc){var f=If(l);if(f===null)bf(e,n,l,Sc,a),H0(e,l);else if(WS(f,e,n,a,l))l.stopPropagation();else if(H0(e,l),n&4&&-1<JS.indexOf(e)){for(;f!==null;){var h=Ui(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var _=hs(h.pendingLanes);if(_!==0){var j=h;for(j.pendingLanes|=2,j.entangledLanes|=2;_;){var R=1<<31-Wt(_);j.entanglements[1]|=R,_&=~R}bs(h),(st&6)===0&&(ic=Yt()+500,Sr(0))}}break;case 31:case 13:j=ai(h,2),j!==null&&kn(j,h,2),rc(),Rf(h,2)}if(h=If(l),h===null&&bf(e,n,l,Sc,a),h===f)break;f=h}f!==null&&l.stopPropagation()}else bf(e,n,l,null,a)}}function If(e){return e=Od(e),Of(e)}var Sc=null;function Of(e){if(Sc=null,e=$i(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 Sc=e,null}function P0(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(Ii()){case oa:return 2;case Za:return 8;case ms:case Oi:return 32;case wn:return 268435456;default:return 32}default:return 32}}var Bf=!1,wa=null,ja=null,Na=null,Ar=new Map,Dr=new Map,Ca=[],JS="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 H0(e,n){switch(e){case"focusin":case"focusout":wa=null;break;case"dragenter":case"dragleave":ja=null;break;case"mouseover":case"mouseout":Na=null;break;case"pointerover":case"pointerout":Ar.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dr.delete(n.pointerId)}}function Rr(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=Ui(n),n!==null&&$0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function WS(e,n,a,l,f){switch(n){case"focusin":return wa=Rr(wa,e,n,a,l,f),!0;case"dragenter":return ja=Rr(ja,e,n,a,l,f),!0;case"mouseover":return Na=Rr(Na,e,n,a,l,f),!0;case"pointerover":var h=f.pointerId;return Ar.set(h,Rr(Ar.get(h)||null,e,n,a,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Dr.set(h,Rr(Dr.get(h)||null,e,n,a,l,f)),!0}return!1}function V0(e){var n=$i(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,Xt(e.priority,function(){U0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Xt(e.priority,function(){U0(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 Tc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=If(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Id=l,a.target.dispatchEvent(l),Id=null}else return n=Ui(a),n!==null&&$0(n),e.blockedOn=a,!1;n.shift()}return!0}function q0(e,n,a){Tc(e)&&a.delete(n)}function XS(){Bf=!1,wa!==null&&Tc(wa)&&(wa=null),ja!==null&&Tc(ja)&&(ja=null),Na!==null&&Tc(Na)&&(Na=null),Ar.forEach(q0),Dr.forEach(q0)}function wc(e,n){e.blockedOn===n&&(e.blockedOn=null,Bf||(Bf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,XS)))}var jc=null;function G0(e){jc!==e&&(jc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jc===e&&(jc=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(Of(l||a)===null)continue;break}var h=Ui(a);h!==null&&(e.splice(n,3),n-=3,Mu(h,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function ko(e){function n(R){return wc(R,e)}wa!==null&&wc(wa,e),ja!==null&&wc(ja,e),Na!==null&&wc(Na,e),Ar.forEach(n),Dr.forEach(n);for(var a=0;a<Ca.length;a++){var l=Ca[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ca.length&&(a=Ca[0],a.blockedOn===null);)V0(a),a.blockedOn===null&&Ca.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],h=a[l+1],_=f[It]||null;if(typeof h=="function")_||G0(a);else if(_){var j=null;if(h&&h.hasAttribute("formAction")){if(f=h,_=h[It]||null)j=_.formAction;else if(Of(f)!==null)continue}else j=_.action;typeof j=="function"?a[l+1]=j:(a.splice(l,3),l-=3),G0(a)}}}function F0(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(_){return f=_})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Lf(e){this._internalRoot=e}Nc.prototype.render=Lf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,l=Rn();L0(a,l,e,n,null,null)},Nc.prototype.unmount=Lf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;L0(e.current,2,null,e,null,null),rc(),n[gn]=null}};function Nc(e){this._internalRoot=e}Nc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Xe();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Ca.length&&n!==0&&n<Ca[a].priority;a++);Ca.splice(a,0,e),a===0&&V0(e)}};var Z0=s.version;if(Z0!=="19.2.4")throw Error(r(527,Z0,"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 QS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Cc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cc.isDisabled&&Cc.supportsFiber)try{Jt=Cc.inject(QS),St=Cc}catch{}}return Ir.createRoot=function(e,n){if(!c(e))throw Error(r(299));var a=!1,l="",f=ev,h=tv,_=nv;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=O0(e,1,!1,null,null,a,l,null,f,h,_,F0),e[gn]=n.current,yf(e),new Lf(n)},Ir.hydrateRoot=function(e,n,a){if(!c(e))throw Error(r(299));var l=!1,f="",h=ev,_=tv,j=nv,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=O0(e,1,!0,n,a??null,l,f,R,h,_,j,F0),n.context=B0(null),a=n.current,l=Rn(),l=Ke(l),f=pa(l),f.callback=null,ma(a,f,l),a=l,n.current.lanes=a,de(n,a),bs(n),e[gn]=n.current,yf(e),new Nc(n)},Ir.version="19.2.4",Ir}var ty;function NT(){if(ty)return zf.exports;ty=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),zf.exports=jT(),zf.exports}var CT=NT();const ET="modulepreload",AT=function(t){return"/"+t},ny={},DT=function(s,o,r){let c=Promise.resolve();if(o&&o.length>0){let u=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(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(o.map(g=>{if(g=AT(g),g in ny)return;ny[g]=!0;const v=g.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":ET,v||(x.as="script"),x.crossOrigin="",x.href=g,m&&x.setAttribute("nonce",m),document.head.appendChild(x),v)return new Promise((S,k)=>{x.addEventListener("load",S),x.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)})},RT=new Proxy(globalThis.fetch,{apply(t,s,o){return Reflect.apply(globalThis.fetch,s,o)}}),MT=cT({baseUrl:"/",fetch:RT}),Ne=dT(uT,MT),IT="_bar_1xhb4_1",OT="_input_1xhb4_32",BT="_select_1xhb4_67",LT="_btnPrimary_1xhb4_103",zT="_btnGhost_1xhb4_173",$T="_badge_1xhb4_195",UT="_disconnectHint_1xhb4_205",Mn={bar:IT,input:OT,select:BT,btnPrimary:LT,btnGhost:zT,badge:$T,disconnectHint:UT};function PT(t,s){if(!t)return!1;const o=s.find(r=>r.id===t);return o!==void 0&&(o.status==="disconnected"||o.status==="error")}function HT({environmentId:t,onReconnect:s}){return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:Mn.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),i.jsx("button",{type:"button",onClick:()=>s(t),className:Mn.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function el({mode:t,sessionId:s,environmentId:o,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:p,onSpawn:m,onStartTask:g,onProvisionEnvironment:v,onShowToast:b}){const[x,S]=y.useState(""),[k,w]=y.useState(""),N=PT(o,u),T=C=>{if(C.preventDefault(),!!x.trim())if(t==="send"){if(!s||N)return;p(s,x),S("")}else if(t==="spawn"){if(!o)return;m(o,x,k),b==null||b("Session started","success"),S(""),w("")}else{if(!r)return;g(r,void 0,o,x),S("")}};return t==="spawn"?i.jsxs("form",{onSubmit:T,className:Mn.bar,children:[i.jsx("span",{className:Mn.badge,children:"new chat"}),i.jsx("input",{type:"text",value:x,onChange:C=>S(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:Mn.input,"aria-label":"Enter prompt"}),c&&i.jsxs("select",{value:k,onChange:C=>w(C.target.value),className:Mn.select,"aria-label":"Select persona",children:[i.jsx("option",{value:"",children:"(Default)"}),d.map(C=>i.jsx("option",{value:C.id,children:C.name},C.id))]}),i.jsx("button",{type:"submit",disabled:!x.trim()||!o,className:Mn.btnPrimary,children:"Go"})]}):t==="start"?i.jsxs("form",{onSubmit:T,className:Mn.bar,children:[i.jsx("input",{type:"text",value:x,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:Mn.input,"aria-label":"Type a message"}),i.jsx("button",{type:"submit",disabled:!x.trim(),className:Mn.btnPrimary,children:"Send"})]}):i.jsxs("form",{onSubmit:T,className:Mn.bar,children:[N&&o&&i.jsx(HT,{environmentId:o,onReconnect:v}),i.jsx("input",{type:"text",value:x,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!N,disabled:N,className:Mn.input,"aria-label":"Type a message"}),i.jsx("span",{title:N?"Environment is unavailable — reconnect first":void 0,children:i.jsx("button",{type:"submit",disabled:!x.trim()||N,className:Mn.btnPrimary,children:"Send"})})]})}const sy=220,ay=70,VT=40,qT=60,GT="hierarchy",FT="dependency";function ZT(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new K0.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:VT,ranksep:qT});const o=new Map(t.map(u=>[u.id,u])),r=new Map;for(const u of t)if(u.parentTaskId&&o.has(u.parentTaskId)){const p=r.get(u.parentTaskId)||[];p.push(u),r.set(u.parentTaskId,p)}for(const u of t)s.setNode(u.id,{width:sy,height:ay});const c=[];for(const u of t){if(u.parentTaskId&&o.has(u.parentTaskId)){const p=`hierarchy-${u.parentTaskId}-${u.id}`;s.setEdge(u.parentTaskId,u.id,{},p),c.push({id:p,source:u.parentTaskId,target:u.id,type:"smoothstep",data:{edgeType:GT},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of u.dependsOn)if(o.has(p)){const m=`dependency-${p}-${u.id}`;s.setEdge(p,u.id,{},m),c.push({id:m,source:p,target:u.id,type:"smoothstep",data:{edgeType:FT},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return K0.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-sy/2,y:p.y-ay/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 KT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fx=(...t)=>t.filter((s,o,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===o).join(" ").trim();/**
|
|
32
|
+
* @license lucide-react v0.474.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/var YT={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 JT=y.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...p},m)=>y.createElement("svg",{ref:m,...YT,width:s,height:s,stroke:t,strokeWidth:r?Number(o)*24/Number(s):o,className:fx("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 Ye=(t,s)=>{const o=y.forwardRef(({className:r,...c},d)=>y.createElement(JT,{ref:d,iconNode:s,className:fx(`lucide-${KT(t)}`,r),...c}));return o.displayName=`${t}`,o};/**
|
|
47
|
+
* @license lucide-react v0.474.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const WT=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],iy=Ye("ArrowDown",WT);/**
|
|
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 XT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],oy=Ye("ArrowUp",XT);/**
|
|
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 QT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],e2=Ye("Ban",QT);/**
|
|
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 t2=[["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"}]],n2=Ye("Brain",t2);/**
|
|
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 s2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ai=Ye("Check",s2);/**
|
|
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 a2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],px=Ye("ChevronDown",a2);/**
|
|
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 i2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],sa=Ye("ChevronRight",i2);/**
|
|
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 o2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],La=Ye("Circle",o2);/**
|
|
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 r2=[["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"}]],l2=Ye("ClipboardList",r2);/**
|
|
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 c2=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],mx=Ye("Clipboard",c2);/**
|
|
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 d2=[["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"}]],u2=Ye("Cog",d2);/**
|
|
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 f2=[["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"}]],p2=Ye("Copy",f2);/**
|
|
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 m2=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],h2=Ye("CornerDownRight",m2);/**
|
|
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 g2=[["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"}]],v2=Ye("FilePen",g2);/**
|
|
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 y2=[["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"}]],b2=Ye("FileText",y2);/**
|
|
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 x2=[["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"}]],_2=Ye("House",x2);/**
|
|
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 k2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],am=Ye("Info",k2);/**
|
|
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 S2=[["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"}]],T2=Ye("Key",S2);/**
|
|
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 w2=[["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"}]],j2=Ye("Keyboard",w2);/**
|
|
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 N2=[["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"}]],C2=Ye("ListChecks",N2);/**
|
|
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 E2=[["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"}]],A2=Ye("List",E2);/**
|
|
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 D2=[["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"}]],R2=Ye("Loader",D2);/**
|
|
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 M2=[["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"}]],I2=Ye("Menu",M2);/**
|
|
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 O2=[["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"}]],B2=Ye("MessageSquare",O2);/**
|
|
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 L2=[["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"}]],z2=Ye("Monitor",L2);/**
|
|
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 $2=[["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"}]],U2=Ye("Palette",$2);/**
|
|
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 P2=[["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"}]],H2=Ye("Pause",P2);/**
|
|
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 V2=[["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"}]],q2=Ye("Pencil",V2);/**
|
|
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 G2=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],hx=Ye("Search",G2);/**
|
|
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 F2=[["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"}]],Z2=Ye("Settings",F2);/**
|
|
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 K2=[["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"}]],Y2=Ye("SquareCheckBig",K2);/**
|
|
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 J2=[["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"}]],im=Ye("TriangleAlert",J2);/**
|
|
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 W2=[["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"}]],X2=Ye("User",W2);/**
|
|
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 Q2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ha=Ye("X",Q2),om=8,lt=12,tn=14,zt=16,Ep={not_started:{color:"var(--text-tertiary)",icon:i.jsx(La,{size:lt}),label:"Not Started"},working:{color:"var(--accent-green)",icon:i.jsx(La,{size:lt,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:i.jsx(H2,{size:lt}),label:"Paused"},complete:{color:"var(--accent-green)",icon:i.jsx(Ai,{size:lt}),label:"Complete"},failed:{color:"var(--accent-red)",icon:i.jsx(Ha,{size:lt}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:i.jsx(e2,{size:lt}),label:"Blocked"}};function za(t){return t==="blocked"?Ep.blocked:Ep[cl(t)]}const ew={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function tw(t){return ew[cl(t)]??"statusPending"}const nw=["working","paused","failed","not_started","blocked","complete"],ry=["not_started","working","paused","complete","failed"],sw={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function cl(t){return t in Ep&&t!=="blocked"?t:sw[t]??"not_started"}const aw={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"},iw="_dagContainer_js4w6_1",ow="_taskNode_js4w6_26",rw="_taskNodeBorder_js4w6_54",lw="_taskNodeContent_js4w6_60",cw="_taskNodeHeader_js4w6_70",dw="_taskNodeIcon_js4w6_77",uw="_taskNodeTitle_js4w6_82",fw="_taskNodeBadges_js4w6_90",pw="_childBadge_js4w6_95",mw="_depBadge_js4w6_107",hw="_handle_js4w6_119",gw="_emptyCta_js4w6_126",vw="_ctaDescription_js4w6_137",yw="_ctaButton_js4w6_144",hn={dagContainer:iw,taskNode:ow,taskNodeBorder:rw,taskNodeContent:lw,taskNodeHeader:cw,taskNodeIcon:dw,taskNodeTitle:uw,taskNodeBadges:fw,childBadge:pw,depBadge:mw,handle:hw,emptyCta:gw,ctaDescription:vw,ctaButton:yw};function bw({data:t}){const{task:s,childCount:o,doneChildCount:r,hasDependencies:c}=t,d=za(s.status);return i.jsxs("div",{className:hn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[i.jsx(Y0,{type:"target",position:J0.Top,className:hn.handle}),i.jsx("div",{className:hn.taskNodeBorder,style:{backgroundColor:d.color}}),i.jsxs("div",{className:hn.taskNodeContent,children:[i.jsxs("div",{className:hn.taskNodeHeader,children:[i.jsx("span",{className:hn.taskNodeIcon,style:{color:d.color},children:d.icon}),i.jsx("span",{className:hn.taskNodeTitle,children:s.title})]}),i.jsxs("div",{className:hn.taskNodeBadges,children:[o>0&&i.jsxs("span",{className:hn.childBadge,children:[r,"/",o]}),c&&i.jsx("span",{className:hn.depBadge,children:"dep"})]})]}),i.jsx(Y0,{type:"source",position:J0.Bottom,className:hn.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 ly="popstate";function cy(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function xw(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 Ap("",{pathname:u,search:p,hash:m},c.state&&c.state.usr||null,c.state&&c.state.key||"default",d?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function o(r,c){return typeof c=="string"?c:tl(c)}return kw(s,o,null,t)}function xt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Xn(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function _w(){return Math.random().toString(36).substring(2,10)}function dy(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 Ap(t,s,o=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?$o(s):s,state:o,key:s&&s.key||r||_w(),unstable_mask:c}}function tl({pathname:t="/",search:s="",hash:o=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),o&&o!=="#"&&(t+=o.charAt(0)==="#"?o:"#"+o),t}function $o(t){let s={};if(t){let o=t.indexOf("#");o>=0&&(s.hash=t.substring(o),t=t.substring(0,o));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function kw(t,s,o,r={}){let{window:c=document.defaultView,v5Compat:d=!1}=r,u=c.history,p="POP",m=null,g=v();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function v(){return(u.state||{idx:null}).idx}function b(){p="POP";let N=v(),T=N==null?null:N-g;g=N,m&&m({action:p,location:w.location,delta:T})}function x(N,T){p="PUSH";let C=cy(N)?N:Ap(w.location,N,T);g=v()+1;let D=dy(C,g),O=w.createHref(C.unstable_mask||C);try{u.pushState(D,"",O)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;c.location.assign(O)}d&&m&&m({action:p,location:w.location,delta:1})}function S(N,T){p="REPLACE";let C=cy(N)?N:Ap(w.location,N,T);g=v();let D=dy(C,g),O=w.createHref(C.unstable_mask||C);u.replaceState(D,"",O),d&&m&&m({action:p,location:w.location,delta:0})}function k(N){return Sw(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(ly,b),m=N,()=>{c.removeEventListener(ly,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:x,replace:S,go(N){return u.go(N)}};return w}function Sw(t,s=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),xt(o,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:tl(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=o+r),new URL(r,o)}function gx(t,s,o="/"){return Tw(t,s,o,!1)}function Tw(t,s,o,r){let c=typeof s=="string"?$o(s):s,d=ea(c.pathname||"/",o);if(d==null)return null;let u=vx(t);ww(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=bx(d);p=Iw(u[m],g,r)}return p}function vx(t,s=[],o=[],r="",c=!1){let d=(u,p,m=c,g)=>{let v={relativePath:g===void 0?u.path||"":g,caseSensitive:u.caseSensitive===!0,childrenIndex:p,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(r)&&m)return;xt(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=Ts([r,v.relativePath]),x=o.concat(v);u.children&&u.children.length>0&&(xt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),vx(u.children,s,x,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:Rw(b,u.index),routesMeta:x})};return t.forEach((u,p)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))d(u,p);else for(let g of yx(u.path))d(u,p,!0,g)}),s}function yx(t){let s=t.split("/");if(s.length===0)return[];let[o,...r]=s,c=o.endsWith("?"),d=o.replace(/\?$/,"");if(r.length===0)return c?[d,""]:[d];let u=yx(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 ww(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:Mw(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var jw=/^:[\w-]+$/,Nw=3,Cw=2,Ew=1,Aw=10,Dw=-2,uy=t=>t==="*";function Rw(t,s){let o=t.split("/"),r=o.length;return o.some(uy)&&(r+=Dw),s&&(r+=Cw),o.filter(c=>!uy(c)).reduce((c,d)=>c+(jw.test(d)?Nw:d===""?Ew:Aw),r)}function Mw(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 Iw(t,s,o=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let p=0;p<r.length;++p){let m=r[p],g=p===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",b=nl({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),x=m.route;if(!b&&g&&o&&!r[r.length-1].route.index&&(b=nl({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:Ts([d,b.pathname]),pathnameBase:$w(Ts([d,b.pathnameBase])),route:x}),b.pathnameBase!=="/"&&(d=Ts([d,b.pathnameBase]))}return u}function nl(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=Ow(t.path,t.caseSensitive,t.end),c=s.match(o);if(!c)return null;let d=c[0],u=d.replace(/(.)\/+$/,"$1"),p=c.slice(1);return{params:r.reduce((g,{paramName:v,isOptional:b},x)=>{if(v==="*"){let k=p[x]||"";u=d.slice(0,d.length-k.length).replace(/(.)\/+$/,"$1")}const S=p[x];return b&&!S?g[v]=void 0:g[v]=(S||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function Ow(t,s=!1,o=!0){Xn(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==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),r]}function bx(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Xn(!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 ea(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let o=s.endsWith("/")?s.length-1:s.length,r=t.charAt(o);return r&&r!=="/"?null:t.slice(o)||"/"}var Bw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Lw(t,s="/"){let{pathname:o,search:r="",hash:c=""}=typeof t=="string"?$o(t):t,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=fy(o.substring(1),"/"):d=fy(o,s)):d=s,{pathname:d,search:Uw(r),hash:Pw(c)}}function fy(t,s){let o=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?o.length>1&&o.pop():c!=="."&&o.push(c)}),o.length>1?o.join("/"):"/"}function Pf(t,s,o,r){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function zw(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function rm(t){let s=zw(t);return s.map((o,r)=>r===s.length-1?o.pathname:o.pathnameBase)}function vd(t,s,o,r=!1){let c;typeof t=="string"?c=$o(t):(c={...t},xt(!c.pathname||!c.pathname.includes("?"),Pf("?","pathname","search",c)),xt(!c.pathname||!c.pathname.includes("#"),Pf("#","pathname","hash",c)),xt(!c.search||!c.search.includes("#"),Pf("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=o;else{let b=s.length-1;if(!r&&u.startsWith("..")){let x=u.split("/");for(;x[0]==="..";)x.shift(),b-=1;c.pathname=x.join("/")}p=b>=0?s[b]:"/"}let m=Lw(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&o.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var Ts=t=>t.join("/").replace(/\/\/+/g,"/"),$w=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Uw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Pw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Hw=class{constructor(t,s,o,r=!1){this.status=t,this.statusText=s||"",this.internal=r,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function Vw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function qw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var xx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _x(t,s){let o=t;if(typeof o!="string"||!Bw.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let r=o,c=!1;if(xx)try{let d=new URL(window.location.href),u=o.startsWith("//")?new URL(d.protocol+o):new URL(o),p=ea(u.pathname,s);u.origin===d.origin&&p!=null?o=p+u.search+u.hash:c=!0}catch{Xn(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:c,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var kx=["POST","PUT","PATCH","DELETE"];new Set(kx);var Gw=["GET",...kx];new Set(Gw);var Uo=y.createContext(null);Uo.displayName="DataRouter";var yd=y.createContext(null);yd.displayName="DataRouterState";var Fw=y.createContext(!1),Sx=y.createContext({isTransitioning:!1});Sx.displayName="ViewTransition";var Zw=y.createContext(new Map);Zw.displayName="Fetchers";var Kw=y.createContext(null);Kw.displayName="Await";var Ln=y.createContext(null);Ln.displayName="Navigation";var dl=y.createContext(null);dl.displayName="Location";var Qn=y.createContext({outlet:null,matches:[],isDataRoute:!1});Qn.displayName="Route";var lm=y.createContext(null);lm.displayName="RouteError";var Tx="REACT_ROUTER_ERROR",Yw="REDIRECT",Jw="ROUTE_ERROR_RESPONSE";function Ww(t){if(t.startsWith(`${Tx}:${Yw}:{`))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 Xw(t){if(t.startsWith(`${Tx}:${Jw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Hw(s.status,s.statusText,s.data)}catch{}}function Qw(t,{relative:s}={}){xt(Di(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=y.useContext(Ln),{hash:c,pathname:d,search:u}=ul(t,{relative:s}),p=d;return o!=="/"&&(p=d==="/"?o:Ts([o,d])),r.createHref({pathname:p,search:u,hash:c})}function Di(){return y.useContext(dl)!=null}function Zt(){return xt(Di(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(dl).location}function At(t){xt(Di(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Zt();return y.useMemo(()=>nl(t,bx(s)),[s,t])}var wx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function jx(t){y.useContext(Ln).static||y.useLayoutEffect(t)}function bd(){let{isDataRoute:t}=y.useContext(Qn);return t?mj():ej()}function ej(){xt(Di(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Uo),{basename:s,navigator:o}=y.useContext(Ln),{matches:r}=y.useContext(Qn),{pathname:c}=Zt(),d=JSON.stringify(rm(r)),u=y.useRef(!1);return jx(()=>{u.current=!0}),y.useCallback((m,g={})=>{if(Xn(u.current,wx),!u.current)return;if(typeof m=="number"){o.go(m);return}let v=vd(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Ts([s,v.pathname])),(g.replace?o.replace:o.push)(v,g.state,g)},[s,o,d,c,t])}var tj=y.createContext(null);function nj(t){let s=y.useContext(Qn).outlet;return y.useMemo(()=>s&&y.createElement(tj.Provider,{value:t},s),[s,t])}function fs(){let{matches:t}=y.useContext(Qn),s=t[t.length-1];return s?s.params:{}}function ul(t,{relative:s}={}){let{matches:o}=y.useContext(Qn),{pathname:r}=Zt(),c=JSON.stringify(rm(o));return y.useMemo(()=>vd(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function sj(t,s){return Nx(t,s)}function Nx(t,s,o){var N;xt(Di(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Ln),{matches:c}=y.useContext(Qn),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||"";Ex(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=Zt(),b;if(s){let T=typeof s=="string"?$o(s):s;xt(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 x=b.pathname||"/",S=x;if(m!=="/"){let T=m.replace(/^\//,"").split("/");S="/"+x.replace(/^\//,"").split("/").slice(T.length).join("/")}let k=gx(t,{pathname:S});Xn(g||k!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Xn(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=lj(k&&k.map(T=>Object.assign({},T,{params:Object.assign({},u,T.params),pathname:Ts([m,r.encodeLocation?r.encodeLocation(T.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?m:Ts([m,r.encodeLocation?r.encodeLocation(T.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),c,o);return s&&w?y.createElement(dl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},w):w}function aj(){let t=pj(),s=Vw(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),o=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:r},d={padding:"2px 4px",backgroundColor:r},u=null;return console.error("Error handled by React Router default ErrorBoundary:",t),u=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:d},"ErrorBoundary")," or"," ",y.createElement("code",{style:d},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},s),o?y.createElement("pre",{style:c},o):null,u)}var ij=y.createElement(aj,null),Cx=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){this.props.onError?this.props.onError(t,s):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const o=Xw(t.digest);o&&(t=o)}let s=t!==void 0?y.createElement(Qn.Provider,{value:this.props.routeContext},y.createElement(lm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(oj,{error:t},s):s}};Cx.contextType=Fw;var Hf=new WeakMap;function oj({children:t,error:s}){let{basename:o}=y.useContext(Ln);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=Ww(s.digest);if(r){let c=Hf.get(s);if(c)throw c;let d=_x(r.location,o);if(xx&&!Hf.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 Hf.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function rj({routeContext:t,match:s,children:o}){let r=y.useContext(Uo);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(Qn.Provider,{value:t},o)}function lj(t,s=[],o){let r=o==null?void 0:o.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(s.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let c=t,d=r==null?void 0:r.errors;if(d!=null){let v=c.findIndex(b=>b.route.id&&(d==null?void 0:d[b.route.id])!==void 0);xt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let u=!1,p=-1;if(o&&r){u=r.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=v),b.route.id){let{loaderData:x,errors:S}=r,k=b.route.loader&&!x.hasOwnProperty(b.route.id)&&(!S||S[b.route.id]===void 0);if(b.route.lazy||k){o.isStatic&&(u=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let m=o==null?void 0:o.onError,g=r&&m?(v,b)=>{var x,S;m(v,{location:r.location,params:((S=(x=r.matches)==null?void 0:x[0])==null?void 0:S.params)??{},unstable_pattern:qw(r.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,x)=>{let S,k=!1,w=null,N=null;r&&(S=d&&b.route.id?d[b.route.id]:void 0,w=b.route.errorElement||ij,u&&(p<0&&x===0?(Ex("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,N=null):p===x&&(k=!0,N=b.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,x+1)),C=()=>{let D;return S?D=w:k?D=N:b.route.Component?D=y.createElement(b.route.Component,null):b.route.element?D=b.route.element:D=v,y.createElement(rj,{match:b,routeContext:{outlet:v,matches:T,isDataRoute:r!=null},children:D})};return r&&(b.route.ErrorBoundary||b.route.errorElement||x===0)?y.createElement(Cx,{location:r.location,revalidation:r.revalidation,component:w,error:S,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:g}):C()},null)}function cm(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cj(t){let s=y.useContext(Uo);return xt(s,cm(t)),s}function dj(t){let s=y.useContext(yd);return xt(s,cm(t)),s}function uj(t){let s=y.useContext(Qn);return xt(s,cm(t)),s}function dm(t){let s=uj(t),o=s.matches[s.matches.length-1];return xt(o.route.id,`${t} can only be used on routes that contain a unique "id"`),o.route.id}function fj(){return dm("useRouteId")}function pj(){var r;let t=y.useContext(lm),s=dj("useRouteError"),o=dm("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function mj(){let{router:t}=cj("useNavigate"),s=dm("useNavigate"),o=y.useRef(!1);return jx(()=>{o.current=!0}),y.useCallback(async(c,d={})=>{Xn(o.current,wx),o.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var py={};function Ex(t,s,o){!s&&!py[t]&&(py[t]=!0,Xn(!1,o))}y.memo(hj);function hj({routes:t,future:s,state:o,isStatic:r,onError:c}){return Nx(t,void 0,{state:o,isStatic:r,onError:c})}function ds({to:t,replace:s,state:o,relative:r}){xt(Di(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Ln);Xn(!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(Qn),{pathname:u}=Zt(),p=bd(),m=vd(t,rm(d),u,r==="path"),g=JSON.stringify(m);return y.useEffect(()=>{p(JSON.parse(g),{replace:s,state:o,relative:r})},[p,g,r,s,o]),null}function Va(t){return nj(t.context)}function Ae(t){xt(!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 gj({basename:t="/",children:s=null,location:o,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){xt(!Di(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=t.replace(/^\/*/,"/"),m=y.useMemo(()=>({basename:p,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[p,c,d,u]);typeof o=="string"&&(o=$o(o));let{pathname:g="/",search:v="",hash:b="",state:x=null,key:S="default",unstable_mask:k}=o,w=y.useMemo(()=>{let N=ea(g,p);return N==null?null:{location:{pathname:N,search:v,hash:b,state:x,key:S,unstable_mask:k},navigationType:r}},[p,g,v,b,x,S,r,k]);return Xn(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(Ln.Provider,{value:m},y.createElement(dl.Provider,{children:s,value:w}))}function vj({children:t,location:s}){return sj(Dp(t),s)}function Dp(t,s=[]){let o=[];return y.Children.forEach(t,(r,c)=>{if(!y.isValidElement(r))return;let d=[...s,c];if(r.type===y.Fragment){o.push.apply(o,Dp(r.props.children,d));return}xt(r.type===Ae,`[${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>`),xt(!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=Dp(r.props.children,d)),o.push(u)}),o}var Fc="get",Zc="application/x-www-form-urlencoded";function xd(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function yj(t){return xd(t)&&t.tagName.toLowerCase()==="button"}function bj(t){return xd(t)&&t.tagName.toLowerCase()==="form"}function xj(t){return xd(t)&&t.tagName.toLowerCase()==="input"}function _j(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function kj(t,s){return t.button===0&&(!s||s==="_self")&&!_j(t)}function Rp(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((s,o)=>{let r=t[o];return s.concat(Array.isArray(r)?r.map(c=>[o,c]):[[o,r]])},[]))}function Sj(t,s){let o=Rp(t);return s&&s.forEach((r,c)=>{o.has(c)||s.getAll(c).forEach(d=>{o.append(c,d)})}),o}var Dc=null;function Tj(){if(Dc===null)try{new FormData(document.createElement("form"),0),Dc=!1}catch{Dc=!0}return Dc}var wj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Vf(t){return t!=null&&!wj.has(t)?(Xn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Zc}"`),null):t}function jj(t,s){let o,r,c,d,u;if(bj(t)){let p=t.getAttribute("action");r=p?ea(p,s):null,o=t.getAttribute("method")||Fc,c=Vf(t.getAttribute("enctype"))||Zc,d=new FormData(t)}else if(yj(t)||xj(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?ea(m,s):null,o=t.getAttribute("formmethod")||p.getAttribute("method")||Fc,c=Vf(t.getAttribute("formenctype"))||Vf(p.getAttribute("enctype"))||Zc,d=new FormData(p,t),!Tj()){let{name:g,type:v,value:b}=t;if(v==="image"){let x=g?`${g}.`:"";d.append(`${x}x`,"0"),d.append(`${x}y`,"0")}else g&&d.append(g,b)}}else{if(xd(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Fc,r=null,c=Zc,u=t}return d&&c==="text/plain"&&(u=d,d=void 0),{action:r,method:o.toLowerCase(),encType:c,formData:d,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function um(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Nj(t,s,o,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return o?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&ea(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function Cj(t,s){if(t.id in s)return s[t.id];try{let o=await import(t.module);return s[t.id]=o,o}catch(o){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ej(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 Aj(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await Cj(d,o);return u.links?u.links():[]}return[]}));return Ij(r.flat(1).filter(Ej).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function my(t,s,o,r,c,d){let u=(m,g)=>o[g]?m.route.id!==o[g].route.id:!0,p=(m,g)=>{var v;return o[g].pathname!==m.pathname||((v=o[g].route.path)==null?void 0:v.endsWith("*"))&&o[g].params["*"]!==m.params["*"]};return d==="assets"?s.filter((m,g)=>u(m,g)||p(m,g)):d==="data"?s.filter((m,g)=>{var 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 x=m.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((b=o[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function Dj(t,s,{includeHydrateFallback:o}={}){return Rj(t.map(r=>{let c=s.routes[r.route.id];if(!c)return[];let d=[c.module];return c.clientActionModule&&(d=d.concat(c.clientActionModule)),c.clientLoaderModule&&(d=d.concat(c.clientLoaderModule)),o&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function Rj(t){return[...new Set(t)]}function Mj(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function Ij(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(Mj(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function Ax(){let t=y.useContext(Uo);return um(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Oj(){let t=y.useContext(yd);return um(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var fm=y.createContext(void 0);fm.displayName="FrameworkContext";function Dx(){let t=y.useContext(fm);return um(t,"You must render this element inside a <HydratedRouter> element"),t}function Bj(t,s){let o=y.useContext(fm),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,x=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 x.current&&N.observe(x.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 o?t!=="intent"?[d,x,{}]:[d,x,{onFocus:Or(p,S),onBlur:Or(m,k),onMouseEnter:Or(g,S),onMouseLeave:Or(v,k),onTouchStart:Or(b,S)}]:[!1,x,{}]}function Or(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function Lj({page:t,...s}){let{router:o}=Ax(),r=y.useMemo(()=>gx(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?y.createElement($j,{page:t,matches:r,...s}):null}function zj(t){let{manifest:s,routeModules:o}=Dx(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return Aj(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function $j({page:t,matches:s,...o}){let r=Zt(),{future:c,manifest:d,routeModules:u}=Dx(),{basename:p}=Ax(),{loaderData:m,matches:g}=Oj(),v=y.useMemo(()=>my(t,s,g,d,r,"data"),[t,s,g,d,r]),b=y.useMemo(()=>my(t,s,g,d,r,"assets"),[t,s,g,d,r]),x=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let w=new Set,N=!1;if(s.forEach(C=>{var O;let D=d.routes[C.route.id];!D||!D.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((O=u[C.route.id])!=null&&O.shouldRevalidate)||D.hasClientLoader?N=!0:w.add(C.route.id))}),w.size===0)return[];let T=Nj(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(()=>Dj(b,d),[b,d]),k=zj(b);return y.createElement(y.Fragment,null,x.map(w=>y.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...o})),S.map(w=>y.createElement("link",{key:w,rel:"modulepreload",href:w,...o})),k.map(({key:w,link:N})=>y.createElement("link",{key:w,nonce:o.nonce,...N,crossOrigin:N.crossOrigin??o.crossOrigin})))}function Uj(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var Pj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Pj&&(window.__reactRouterVersion="7.13.2")}catch{}function Hj({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=y.useRef();c.current==null&&(c.current=xw({window:r,v5Compat:!0}));let d=c.current,[u,p]=y.useState({action:d.action,location:d.location}),m=y.useCallback(g=>{o===!1?p(g):y.startTransition(()=>p(g))},[o]);return y.useLayoutEffect(()=>d.listen(m),[d,m]),y.createElement(gj,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var Rx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pm=y.forwardRef(function({onClick:s,discover:o="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:p,state:m,target:g,to:v,preventScrollReset:b,viewTransition:x,unstable_defaultShouldRevalidate:S,...k},w){let{basename:N,navigator:T,unstable_useTransitions:C}=y.useContext(Ln),D=typeof v=="string"&&Rx.test(v),O=_x(v,N);v=O.to;let E=Qw(v,{relative:c}),A=Zt(),P=null;if(p){let oe=vd(p,[],A.unstable_mask?A.unstable_mask.pathname:"/",!0);N!=="/"&&(oe.pathname=oe.pathname==="/"?N:Ts([N,oe.pathname])),P=T.createHref(oe)}let[I,U,Q]=Bj(r,k),$=Fj(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:b,relative:c,viewTransition:x,unstable_defaultShouldRevalidate:S,unstable_useTransitions:C});function H(oe){s&&s(oe),oe.defaultPrevented||$(oe)}let ue=!(O.isExternal||d),W=y.createElement("a",{...k,...Q,href:(ue?P:void 0)||O.absoluteURL||E,onClick:ue?H:s,ref:Uj(w,U),target:g,"data-discover":!D&&o==="render"?"true":void 0});return I&&!D?y.createElement(y.Fragment,null,W,y.createElement(Lj,{page:E})):W});pm.displayName="Link";var Vj=y.forwardRef(function({"aria-current":s="page",caseSensitive:o=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:p,children:m,...g},v){let b=ul(u,{relative:g.relative}),x=Zt(),S=y.useContext(yd),{navigator:k,basename:w}=y.useContext(Ln),N=S!=null&&Wj(b)&&p===!0,T=k.encodeLocation?k.encodeLocation(b).pathname:b.pathname,C=x.pathname,D=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;o||(C=C.toLowerCase(),D=D?D.toLowerCase():null,T=T.toLowerCase()),D&&w&&(D=ea(D,w)||D);const O=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let E=C===T||!c&&C.startsWith(T)&&C.charAt(O)==="/",A=D!=null&&(D===T||!c&&D.startsWith(T)&&D.charAt(T.length)==="/"),P={isActive:E,isPending:A,isTransitioning:N},I=E?s:void 0,U;typeof r=="function"?U=r(P):U=[r,E?"active":null,A?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let Q=typeof d=="function"?d(P):d;return y.createElement(pm,{...g,"aria-current":I,className:U,ref:v,style:Q,to:u,viewTransition:p},typeof m=="function"?m(P):m)});Vj.displayName="NavLink";var qj=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:o,reloadDocument:r,replace:c,state:d,method:u=Fc,action:p,onSubmit:m,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:x,...S},k)=>{let{unstable_useTransitions:w}=y.useContext(Ln),N=Yj(),T=Jj(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",D=typeof p=="string"&&Rx.test(p),O=E=>{if(m&&m(E),E.defaultPrevented)return;E.preventDefault();let A=E.nativeEvent.submitter,P=(A==null?void 0:A.getAttribute("formmethod"))||u,I=()=>N(A||E.currentTarget,{fetcherKey:s,method:P,navigate:o,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:x});w&&o!==!1?y.startTransition(()=>I()):I()};return y.createElement("form",{ref:k,method:C,action:T,onSubmit:r?m:O,...S,"data-discover":!D&&t==="render"?"true":void 0})});qj.displayName="Form";function Gj(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mx(t){let s=y.useContext(Uo);return xt(s,Gj(t)),s}function Fj(t,{target:s,replace:o,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=bd(),b=Zt(),x=ul(t,{relative:u});return y.useCallback(S=>{if(kj(S,s)){S.preventDefault();let k=o!==void 0?o:tl(b)===tl(x),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,x,o,r,c,s,t,d,u,p,m,g])}function mm(t){Xn(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(Rp(t)),o=y.useRef(!1),r=Zt(),c=y.useMemo(()=>Sj(r.search,o.current?null:s.current),[r.search]),d=bd(),u=y.useCallback((p,m)=>{const g=Rp(typeof p=="function"?p(new URLSearchParams(c)):p);o.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var Zj=0,Kj=()=>`__${String(++Zj)}__`;function Yj(){let{router:t}=Mx("useSubmit"),{basename:s}=y.useContext(Ln),o=fj(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:b}=jj(d,s);if(u.navigate===!1){let x=u.fetcherKey||Kj();await r(x,o,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:o,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,o])}function Jj(t,{relative:s}={}){let{basename:o}=y.useContext(Ln),r=y.useContext(Qn);xt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...ul(t||".",{relative:s})},u=Zt();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"),o!=="/"&&(d.pathname=d.pathname==="/"?o:Ts([o,d.pathname])),tl(d)}function Wj(t,{relative:s}={}){let o=y.useContext(Sx);xt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Mx("useViewTransitionState"),c=ul(t,{relative:s});if(!o.isTransitioning)return!1;let d=ea(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=ea(o.nextLocation.pathname,r)||o.nextLocation.pathname;return nl(c.pathname,u)!=null||nl(c.pathname,d)!=null}function kt(){const t=bd();return y.useCallback((s,o)=>{typeof s=="number"?t(s):t(s,o)},[t])}function hm(t){return`/sessions/${encodeURIComponent(t)}`}function $a(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function On(t,s,o,r){const c=encodeURIComponent(t);let d;return o&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(o)}/tasks/${c}`:o?d=`/workspaces/${encodeURIComponent(o)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Ri(t,s,o){const r=new URLSearchParams;t&&r.set("workspace",t),s&&r.set("parent",s);const c=r.toString();if(t&&o){const d=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${d}?parent=${encodeURIComponent(s)}`:d}return c?`/tasks/new?${c}`:"/tasks/new"}function Ix(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const Mo="/environments",Xj="/environments/new";function Ni(t){return`/environments/${encodeURIComponent(t)}`}function Qj(t){return`/environments/${encodeURIComponent(t)}/edit`}const Ro="/settings",eN="/settings/credentials",qf="/settings/personas",tN="/settings/personas/new";function Ox(t){return`/settings/personas/${encodeURIComponent(t)}`}const nN="/settings/shortcuts",sN="/pair",aN="/chat",Ci="/",iN="/tasks",Bx="/workspaces/new",Lx="/knowledge",_d="/findings";function oN(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:_d}function Mp(t,s,o){const r=encodeURIComponent(t);return s&&o?`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(s)}/findings/${r}`:`/findings/${r}`}const rN=aw,lN={task:bw};function cN({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=kt(),d=y.useMemo(()=>o.filter(b=>b.workspaceId===t),[o,t]),{nodes:u,edges:p}=ZT(d),m=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),x={};for(const[S,k]of Object.entries(rN))x[S]=b.getPropertyValue(k).trim()||"#6b7a8d";return x},[r]),g=y.useCallback((b,x)=>{c(On(x.id,void 0,t,s))},[c,t,s]),v=y.useCallback(b=>{const x=b.data;return m[x.task.status]||m.pending},[m]);return d.length===0?i.jsxs("div",{className:hn.emptyCta,children:[i.jsx("button",{className:hn.ctaButton,onClick:()=>c(Ri(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:hn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):i.jsx("div",{className:hn.dagContainer,children:i.jsxs(sT,{nodes:u,edges:p,nodeTypes:lN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[i.jsx(aT,{variant:iT.Dots,gap:24,size:1,color:"var(--text-disabled)"}),i.jsx(oT,{showInteractive:!1}),i.jsx(rT,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const dN="_breadcrumbs_17or2_1",uN="_list_17or2_11",fN="_item_17or2_21",pN="_separator_17or2_28",mN="_link_17or2_34",hN="_current_17or2_57",So={breadcrumbs:dN,list:uN,item:fN,separator:pN,link:mN,current:hN};function Ns({segments:t}){return i.jsx("nav",{className:So.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:i.jsx("ol",{className:So.list,children:t.map((s,o)=>{const r=o===t.length-1;return i.jsxs("li",{className:So.item,children:[o>0&&i.jsx("span",{className:So.separator,"aria-hidden":"true",children:i.jsx(sa,{size:lt})}),s.url&&!r?i.jsx(pm,{className:So.link,to:s.url,title:s.label,children:s.label}):i.jsx("span",{className:So.current,"aria-current":"page",title:s.label,children:s.label})]},o)})})})}const gN="_btn_dwk2o_1",vN="_sm_dwk2o_22",yN="_md_dwk2o_28",bN="_lg_dwk2o_34",xN="_primary_dwk2o_40",_N="_danger_dwk2o_55",kN="_outline_dwk2o_70",SN="_ghost_dwk2o_80",Gf={btn:gN,sm:vN,md:yN,lg:bN,primary:xN,danger:_N,outline:kN,ghost:SN},Js=y.forwardRef(function({variant:s="primary",size:o="md",className:r,children:c,...d},u){const p=[Gf.btn,Gf[s],Gf[o],r].filter(Boolean).join(" ");return i.jsx("button",{ref:u,className:p,...d,children:c})}),TN="_copyButton_1bqk0_1",wN={copyButton:TN},jN=2e3;function NN({text:t,className:s,"data-testid":o}){const[r,c]=y.useState(!1),d=y.useRef(void 0);y.useEffect(()=>()=>{d.current!==void 0&&clearTimeout(d.current)},[]);const u=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),c(!0),d.current!==void 0&&clearTimeout(d.current),d.current=setTimeout(()=>{c(!1),d.current=void 0},jN)}catch{}},[t]);return i.jsx("button",{type:"button",className:`${wN.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":o??"copy-button",children:r?i.jsx(Ai,{size:tn,"aria-hidden":"true"}):i.jsx(mx,{size:tn,"aria-hidden":"true"})})}const CN="_banner_bxqlh_1",EN="_label_bxqlh_15",AN="_text_bxqlh_25",DN="_link_bxqlh_29",Rc={banner:CN,label:EN,text:AN,link:DN};function RN(){return i.jsxs("div",{className:Rc.banner,"data-testid":"demo-banner",children:[i.jsx("span",{className:Rc.label,children:"DEMO"}),i.jsxs("span",{className:Rc.text,children:["This is an interactive demo with mock data."," ",i.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:Rc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const MN="_container_og0yp_1",IN="_chevronButton_og0yp_6",ON="_mainButton_og0yp_6",BN="_sm_og0yp_34",LN="_md_og0yp_34",zN="_lg_og0yp_34",$N="_primary_og0yp_57",UN="_danger_og0yp_70",PN="_outline_og0yp_83",HN="_ghost_og0yp_92",VN="_dropdown_og0yp_100",qN="_option_og0yp_113",GN="_optionLabel_og0yp_130",FN="_optionDesc_og0yp_135",Fs={container:MN,chevronButton:IN,mainButton:ON,sm:BN,md:LN,lg:zN,primary:$N,danger:UN,outline:PN,ghost:HN,dropdown:VN,option:qN,optionLabel:GN,optionDesc:FN};function zx({label:t,onClick:s,options:o,variant:r="primary",size:c="md","data-testid":d}){const[u,p]=y.useState(!1),m=y.useRef(null);y.useEffect(()=>{if(!u)return;function x(S){m.current&&S.target instanceof Node&&!m.current.contains(S.target)&&p(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]),y.useEffect(()=>{if(!u)return;function x(S){S.key==="Escape"&&p(!1)}return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[u]);const g=Fs[r]||"",v=Fs[c]||"",b=()=>{u&&p(!1),s()};return i.jsxs("div",{ref:m,className:Fs.container,"data-testid":d,children:[i.jsx("button",{type:"button",className:`${Fs.mainButton} ${g} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),i.jsx("button",{type:"button",className:`${Fs.chevronButton} ${g} ${v}`,onClick:()=>p(x=>!x),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:i.jsx(px,{size:tn,"aria-hidden":"true"})}),u&&i.jsx("div",{className:Fs.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((x,S)=>i.jsxs("button",{type:"button",className:Fs.option,onClick:()=>{x.onClick(),p(!1)},children:[i.jsx("span",{className:Fs.optionLabel,children:x.label}),x.description&&i.jsx("span",{className:Fs.optionDesc,children:x.description})]},S))})]})}function Ip(){Ip=function(c,d){return new o(c,void 0,d)};var t=RegExp.prototype,s=new WeakMap;function o(c,d,u){var p=new RegExp(c,d);return s.set(p,u||s.get(c)),ed(p,o.prototype)}function r(c,d){var u=s.get(d);return Object.keys(u).reduce(function(p,m){var g=u[m];if(typeof g=="number")p[m]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;p[m]=c[g[v]]}return p},Object.create(null))}return(function(c,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(d&&d.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),d&&ed(c,d)})(o,RegExp),o.prototype.exec=function(c){var d=t.exec.call(this,c);if(d){d.groups=r(d,this);var u=d.indices;u&&(u.groups=r(u,this))}return d},o.prototype[Symbol.replace]=function(c,d){if(typeof d=="string"){var u=s.get(this);return t[Symbol.replace].call(this,c,d.replace(/\$<([^>]+)>/g,function(m,g){var v=u[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof d=="function"){var p=this;return t[Symbol.replace].call(this,c,function(){var m=arguments;return typeof m[m.length-1]!="object"&&(m=[].slice.call(m)).push(r(m,p)),d.apply(this,m)})}return t[Symbol.replace].call(this,c,d)},Ip.apply(this,arguments)}function ed(t,s){return ed=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},ed(t,s)}function hy(t,s){(s==null||s>t.length)&&(s=t.length);for(var o=0,r=new Array(s);o<s;o++)r[o]=t[o];return r}function Ff(t,s){var o=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(o)return(o=o.call(t)).next.bind(o);if(Array.isArray(t)||(o=(function(c,d){if(c){if(typeof c=="string")return hy(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)?hy(c,d):void 0}})(t))||s){o&&(t=o);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
228
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ZN=(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){xT(r,"element",o)};function o(r,c,d){var u,p;if(d&&d.tagName==="pre"&&r.tagName==="code"){var m=(r==null||(u=r.data)==null?void 0:u.meta)||(r==null||(p=r.properties)==null?void 0:p.metastring)||"";r.properties.className?typeof r.properties.className=="boolean"?r.properties.className=[]:Array.isArray(r.properties.className)||(r.properties.className=[r.properties.className]):r.properties.className=[];var g,v,b=(function(E){for(var A,P=Ff(E.properties.className);!(A=P()).done;){var I=A.value;if(I.slice(0,9)==="language-")return I.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 x,S;S=(x=b)!=null&&x.includes("diff-")?b.split("-")[1]:b,g=t.highlight(Ac(r),S),d.properties.className=(d.properties.className||[]).concat("language-"+S)}catch(E){if(!s.ignoreMissing||!/Unknown language/.test(E.message))throw E;g=r}else g=r;g.children=(v=1,function E(A){return A.reduce(function(P,I){if(I.type==="text"){var U=I.value,Q=(U.match(/\n/g)||"").length;if(Q===0)I.position={start:{line:v,column:1},end:{line:v,column:1}},P.push(I);else for(var $,H=U.split(`
|
|
229
|
+
`),ue=Ff(H.entries());!($=ue()).done;){var W=$.value,oe=W[0],L=W[1];P.push({type:"text",value:oe===H.length-1?L:L+`
|
|
230
|
+
`,position:{start:{line:v+oe,column:1},end:{line:v+oe,column:1}}})}return v+=Q,P}if(Object.prototype.hasOwnProperty.call(I,"children")){var Z=v;return I.children=E(I.children),P.push(I),I.position={start:{line:Z,column:1},end:{line:v,column:1}},P}return P.push(I),P},[])})(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(E){var A=/{([\d,-]+)}/,P=E.split(",").map(function(Q){return Q.trim()}).join();if(A.test(P)){var I=A.exec(P)[1],U=kT(I);return function(Q){return U.includes(Q+1)}}return function(){return!1}})(m),N=(function(E){var A=Ip(/showLineNumbers=(\d+)/i,{lines:1});if(A.test(E)){var P=A.exec(E);return Number(P.groups.lines)}return 1})(m),T=(function(E){for(var A=new Array(E),P=0;P<E;P++)A[P]={type:"element",tagName:"span",properties:{className:[]},children:[]};return A})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],D=function(){var E,A,P=k.value,I=P[0],U=P[1];U.properties.className=["code-line"];var Q=ST(g,function($){return $.position.start.line<=I+1&&$.position.end.line>=I+1});U.children=Q.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function($){return m.toLowerCase().includes($)})&&(U.properties.line=[(I+N).toString()],U.properties.className.push("line-number")),w(I)&&U.properties.className.push("highlight-line"),(b==="diff"||(E=b)!=null&&E.includes("diff-"))&&Ac(U).substring(0,1)==="-"?U.properties.className.push("deleted"):(b==="diff"||(A=b)!=null&&A.includes("diff-"))&&Ac(U).substring(0,1)==="+"&&U.properties.className.push("inserted")},O=Ff(T.entries());!(k=O()).done;)D();T.length>0&&Ac(T[T.length-1]).trim()===""&&T.pop(),r.children=T}}}})(_T);function Io(t){if(t>=1e6)return`${(t/1e6).toFixed(1)}M`;if(t>=1e3){const s=Number((t/1e3).toFixed(1));return s>=1e3?`${(t/1e6).toFixed(1)}M`:`${s.toFixed(1)}k`}return String(t)}function Ss(t){return t===0?"-":t<.01?`$${t.toFixed(4)}`:`$${t.toFixed(2)}`}const gy=new Set(["grackle"]);function Po(t){if(t.startsWith("mcp__")){const o=t.indexOf("__",5);if(o>5){const r=t.slice(5,o);if(gy.has(r))return t.slice(o+2)}}const s=t.indexOf("-");if(s>0){const o=t.slice(0,s);if(gy.has(o))return t.slice(s+1)}return t}const KN={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 YN(t){const s=Po(t);return KN[s.toLowerCase()]??"generic"}const JN="_card_qkm9i_2",WN="_cardBlue_qkm9i_20",XN="_cardOrange_qkm9i_24",QN="_cardGreen_qkm9i_28",eC="_cardPurple_qkm9i_32",tC="_cardNeutral_qkm9i_36",nC="_cardRed_qkm9i_40",sC="_cardTeal_qkm9i_44",aC="_header_qkm9i_48",iC="_icon_qkm9i_55",oC="_toolName_qkm9i_64",rC="_fileName_qkm9i_71",lC="_badge_qkm9i_80",cC="_spacer_qkm9i_87",dC="_bodyToggle_qkm9i_91",uC="_chevron_qkm9i_109",fC="_chevronExpanded_qkm9i_115",pC="_pre_qkm9i_119",mC="_diffAdd_qkm9i_143",hC="_diffRemove_qkm9i_155",gC="_diffContext_qkm9i_167",vC="_diffHeader_qkm9i_176",yC="_diffLine_qkm9i_182",bC="_exitOk_qkm9i_188",xC="_exitError_qkm9i_194",_C="_exitPending_qkm9i_200",kC="_inProgress_qkm9i_228",SC="_metadata_qkm9i_232",TC="_metadataPrefix_qkm9i_239",M={card:JN,cardBlue:WN,cardOrange:XN,cardGreen:QN,cardPurple:eC,cardNeutral:tC,cardRed:nC,cardTeal:sC,header:aC,icon:iC,toolName:oC,fileName:rC,badge:lC,spacer:cC,bodyToggle:dC,chevron:uC,chevronExpanded:fC,pre:pC,diffAdd:mC,diffRemove:hC,diffContext:gC,diffHeader:vC,diffLine:yC,exitOk:bC,exitError:xC,exitPending:_C,inProgress:kC,metadata:SC,metadataPrefix:TC};function wC(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 jC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const Zf=5;function vy({tool:t,args:s,result:o,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=wC(s),m=jC(p),g=o===void 0,v=r?M.cardRed:c?M.cardGreen:M.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",x=c?i.jsx(v2,{size:tn}):i.jsx(b2,{size:tn}),S=c?"tool-card-file-write":"tool-card-file-read",k=(o==null?void 0:o.split(`
|
|
231
|
+
`))??[],w=k.length>Zf,N=d?k:k.slice(0,Zf);return i.jsxs("div",{className:`${M.card} ${v} ${g?M.inProgress:""}`,"data-testid":S,children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,children:x}),i.jsx("span",{className:M.toolName,style:{color:b},children:t}),m&&i.jsx("span",{className:M.fileName,title:p,children:m}),!g&&k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,children:[k.length," lines"]})]})]}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-content",children:N.map((T,C)=>i.jsxs("span",{className:M.diffLine,children:[i.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),T]},C))}),w&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(T=>!T)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${d?M.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(sa,{size:lt})}),d?"collapse":`${k.length-Zf} more lines`]})]})]})}function NC(t){const s=t.split(`
|
|
232
|
+
`),o=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?o.push({type:"header",content:r}):r.startsWith("+")?o.push({type:"add",content:r.slice(1)}):r.startsWith("-")?o.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?o.push({type:"context",content:r.slice(1)}):r===""&&o.push({type:"context",content:""}));return o}function CC(t,s){const o=t.split(`
|
|
233
|
+
`),r=s.split(`
|
|
234
|
+
`),c=[];for(const d of o)c.push({type:"remove",content:d});for(const d of r)c.push({type:"add",content:d});return c}function EC(t){let s=0,o=0;for(const r of t)r.type==="add"&&s++,r.type==="remove"&&o++;return{added:s,removed:o}}function AC(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 DC(t){if(t===void 0||typeof t!="object"||t===null)return;const s=t,o=(typeof s.old_string=="string"?s.old_string:void 0)??(typeof s.old_str=="string"?s.old_str:void 0),r=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(o!==void 0&&r!==void 0)return{oldStr:o,newStr:r}}function RC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function MC(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=NC(r);if(c.length>0)return c}}const o=DC(t);if(o)return CC(o.oldStr,o.newStr)}const Kf=5;function IC({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=AC(s),m=RC(p),g=o===void 0,v=MC(s,c),b=v?EC(v):null,x=((v==null?void 0:v.length)??0)>Kf,S=d?v:v==null?void 0:v.slice(0,Kf);return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardOrange} ${g?M.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,children:i.jsx(q2,{size:tn})}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&i.jsx("span",{className:M.fileName,title:p,children:m}),b&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-diff-stats",children:[i.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",i.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]})]}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&S&&S.length>0&&i.jsxs(i.Fragment,{children:[i.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),i.jsx("span",{className:`${M.diffLine} ${N}`,children:k.content},w)})}),x&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(k=>!k)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${d?M.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(sa,{size:lt})}),d?"collapse":`${((v==null?void 0:v.length)??0)-Kf} more lines`]})]}),!r&&!v&&!g&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-content",children:o})]})}const OC=/^\[exit (\d+)\]\s*/;function BC(t){const s=OC.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function LC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function zC(t){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'([^']*)'\s*$/i.exec(t);if(s)return s[1];const o=/pwsh(?:\.exe)?["']?\s+-Command\s+"([^"]*)"\s*$/i.exec(t);return o?o[1]:t}const Yf=3;function $C({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=LC(s),p=zC(u),m=o===void 0,g=o?BC(o):null,v=(g==null?void 0:g.output.split(`
|
|
235
|
+
`))??[],b=v.length>Yf,x=c?v:v.slice(0,Yf),S=g==null?void 0:g.exitCode,k=r||S!==void 0&&S!==0;return i.jsxs("div",{className:`${M.card} ${k?M.cardRed:M.cardNeutral}`,"data-testid":"tool-card-shell",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),i.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&&i.jsxs("span",{className:S===0?M.exitOk:M.exitError,"data-testid":"tool-card-exit-code",children:[S===0?i.jsx(Ai,{size:lt,"aria-hidden":"true"}):i.jsx(Ha,{size:lt,"aria-hidden":"true"})," ","exit ",S]}),m&&i.jsx("span",{className:M.exitPending,"data-testid":"tool-card-pending",children:i.jsx(R2,{size:lt,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-output",children:x.join(`
|
|
236
|
+
`)}),b&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(w=>!w)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(sa,{size:lt})}),c?"collapse":`${v.length-Yf} more lines`]})]})]})}function UC(t){if(t==null||typeof t!="object")return{pattern:"",path:""};const s=t,o=typeof s.pattern=="string"?s.pattern:"",r=typeof s.path=="string"?s.path:"";return{pattern:o,path:r}}const Jf=5;function PC({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=UC(s),m=o===void 0,g=(o==null?void 0:o.split(`
|
|
237
|
+
`).filter(x=>x.length>0))??[],v=g.length>Jf,b=c?g:g.slice(0,Jf);return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-search",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,children:i.jsx(hx,{size:tn})}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&i.jsxs("span",{className:M.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&i.jsxs("span",{className:M.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!m&&!r&&g.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&b.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-results",children:b.join(`
|
|
238
|
+
`)}),v&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(x=>!x)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(sa,{size:lt})}),c?"collapse":`${g.length-Jf} more matches`]})]})]})}const HC="_progressBar_14f5c_1",VC="_progressFill_14f5c_9",qC="_activeTask_14f5c_16",GC="_activeIcon_14f5c_27",FC="_todoPulse_14f5c_1",ZC="_activeText_14f5c_34",KC="_checklist_14f5c_48",YC="_item_14f5c_55",JC="_itemIcon_14f5c_65",WC="_itemText_14f5c_73",XC="_pending_14f5c_78",QC="_in_progress_14f5c_85",eE="_completed_14f5c_97",tE="_emptyMessage_14f5c_108",as={progressBar:HC,progressFill:VC,activeTask:qC,activeIcon:GC,todoPulse:FC,activeText:ZC,checklist:KC,item:YC,itemIcon:JC,itemText:WC,pending:XC,in_progress:QC,completed:eE,emptyMessage:tE},nE=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function sE(t){if(t===void 0||typeof t!="object"||t===null)return[];const s=t;return Array.isArray(s.todos)?s.todos.filter(o=>typeof o=="object"&&o!==null&&typeof o.content=="string"&&typeof o.status=="string").map(o=>({content:o.content,activeForm:typeof o.activeForm=="string"?o.activeForm:void 0,status:yy(o.status)})):Array.isArray(s.plan)?s.plan.filter(o=>typeof o=="object"&&o!==null&&typeof o.step=="string"&&typeof o.status=="string").map(o=>({content:o.step,status:yy(o.status)})):typeof s.content=="string"?aE(s.content):[]}function yy(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 aE(t){const s=t.split(`
|
|
239
|
+
`),o=[];for(const r of s){const c=nE.exec(r.trim());if(c){const d=c[1],u=c[2].trim();let p="pending";d==="x"||d==="X"?p="completed":(d==="~"||d==="/"||d==="!")&&(p="in_progress"),o.push({content:u,status:p})}}return o}function iE(t){switch(t){case"completed":return i.jsx(Ai,{size:lt});case"in_progress":return i.jsx(La,{size:lt,fill:"currentColor"});default:return i.jsx(La,{size:lt})}}function oE({args:t}){const s=sE(t),o=s.filter(d=>d.status==="completed").length,r=s.find(d=>d.status==="in_progress"),c=s.length===0;return i.jsxs("div",{className:`${M.card} ${M.cardBlue}`,"data-testid":"tool-card-todo",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,children:i.jsx(C2,{size:tn})}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-todo-progress",children:[o,"/",s.length]})]})]}),!c&&i.jsx("div",{className:as.progressBar,"data-testid":"tool-card-todo-bar",children:i.jsx("div",{className:as.progressFill,style:{width:`${o/s.length*100}%`}})}),r&&i.jsxs("div",{className:as.activeTask,"data-testid":"tool-card-todo-active",children:[i.jsx("span",{className:as.activeIcon,children:i.jsx(La,{size:lt,fill:"currentColor"})}),i.jsx("span",{className:as.activeText,children:r.activeForm||r.content})]}),!c&&i.jsx("div",{className:as.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>i.jsxs("div",{className:`${as.item} ${as[d.status]}`,"data-testid":"tool-card-todo-item",children:[i.jsx("span",{className:as.itemIcon,children:iE(d.status)}),i.jsx("span",{className:as.itemText,children:d.content})]},u))}),c&&i.jsx("div",{className:as.emptyMessage,children:"All items completed and cleared."})]})}function rE(t,s){if(s==null||typeof s!="object")return"";const o=s;if(typeof o.intent=="string")return o.intent;for(const r of Object.values(o))if(typeof r=="string")return r;return t}function lE({tool:t,args:s}){const o=rE(t,s);return i.jsxs("div",{className:M.metadata,"data-testid":"tool-card-metadata",children:[i.jsx("span",{className:M.metadataPrefix,children:i.jsx(h2,{size:lt})}),o]})}function cE(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 dE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(o=>o!==null&&typeof o=="object")};if(typeof s=="object"&&s!==null)return{single:s}}catch{}return{}}const Wf=5,Xf=5;function uE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Po(t),p=cE(s),m=o===void 0,{single:g,list:v}=dE(o),b=(g==null?void 0:g.title)??p.title,x=v?void 0:(g==null?void 0:g.category)??p.category,S=v?void 0:(g==null?void 0:g.tags)??p.tags;return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-finding",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"💡"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),b&&i.jsxs("span",{className:M.fileName,"data-testid":"tool-card-finding-title",children:['"',b,'"']}),x&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsx("span",{className:M.badge,"data-testid":"tool-card-finding-category",children:x})]}),v&&!x&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]})]}),S&&S.length>0&&i.jsx("div",{className:M.pre,style:{padding:"4px 8px",whiteSpace:"normal"},"data-testid":"tool-card-finding-tags",children:S.map((k,w)=>i.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",k]},w))}),m&&!b&&s!==null&&s!==void 0&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&(g==null?void 0:g.content)&&i.jsx(i.Fragment,{children:(()=>{const k=g.content.split(`
|
|
240
|
+
`),w=k.length>Xf,N=c?g.content:k.slice(0,Xf).join(`
|
|
241
|
+
`);return i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-finding-content",children:N}),w&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${k.length-Xf} more lines`]})]})})()}),!r&&v&&v.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-finding-list",children:(c?v:v.slice(0,Wf)).map((k,w)=>`${k.category?`[${k.category}] `:""}${k.title??k.id??`Finding ${w+1}`}`).join(`
|
|
242
|
+
`)}),v.length>Wf&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Wf} more findings`]})]})]})}function fE(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 pE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(o=>o!==null&&typeof o=="object")};if(typeof s=="object"&&s!==null){const o=s;return typeof o.sessionId=="string"?{sessionId:o.sessionId,single:o}:{single:o}}}catch{}return{}}function by(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function mE(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 Qf=5;function hE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Po(t),p=fE(s),m=o===void 0,{single:g,list:v,sessionId:b}=pE(o),x=(g==null?void 0:g.title)??p.title,S=(g==null?void 0:g.status)??p.status;return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardBlue} ${m?M.inProgress:""}`,"data-testid":"tool-card-task",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"📋"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:u}),x&&i.jsxs("span",{className:M.fileName,"data-testid":"tool-card-task-title",children:['"',x,'"']}),!x&&p.taskId&&i.jsx("span",{className:M.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),S&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,style:{color:mE(S)},"data-testid":"tool-card-task-status",children:[by(S)," ",S]})]}),v&&!S&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),m&&!x&&!p.taskId&&s!==null&&s!==void 0&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&b&&i.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&&i.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&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,Qf)).map(k=>{const w=by(k.status),N=k.title??k.id??"untitled";return`${w} ${N}`}).join(`
|
|
244
|
+
`)}),v.length>Qf&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Qf} more tasks`]})]})]})}function gE(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 vE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s,r=typeof o.workpad=="object"&&o.workpad!==null?o.workpad:o;return{status:typeof r.status=="string"?r.status:void 0,summary:typeof r.summary=="string"?r.summary:void 0,extra:typeof r.extra=="object"&&r.extra!==null?r.extra:void 0}}catch{}return{}}function yE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Po(t),p=gE(s),m=o===void 0,g=vE(o),v=g.status??p.status,b=g.summary??p.summary;return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardGreen} ${m?M.inProgress:""}`,"data-testid":"tool-card-workpad",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"📓"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsx("span",{className:M.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&i.jsx("pre",{className:M.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&!b&&!v&&!g.extra&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:o}),!r&&g.extra&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(x=>!x)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function bE(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 xE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s;if(Array.isArray(o.results))return{results:o.results.filter(r=>r!==null&&typeof r=="object")};if(typeof o.node=="object"&&o.node!==null){const r=Array.isArray(o.edges)?o.edges.length:0;return{node:o.node,edgeCount:r}}if(typeof o.id=="string")return{node:o}}catch{}return{}}const ep=5;function _E({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Po(t),p=bE(s),m=o===void 0,g=xE(o);return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🧠"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&i.jsxs("span",{className:M.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&i.jsx("span",{className:M.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.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&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.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&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&g.results&&g.results.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,ep)).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",x=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${b}${x}`}).join(`
|
|
245
|
+
`)}),g.results.length>ep&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-ep} more results`]})]}),!r&&g.node&&!g.results&&i.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 kE(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 SE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s;return{sessionId:typeof o.sessionId=="string"?o.sessionId:void 0,fd:typeof o.fd=="number"?o.fd:void 0,fds:Array.isArray(o.fds)?o.fds.filter(r=>r!==null&&typeof r=="object"):void 0,success:typeof o.success=="boolean"?o.success:void 0,output:typeof o.output=="string"?o.output:void 0}}catch{}return{}}function TE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Po(t),p=kE(s),m=o===void 0,g=SE(o);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 i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardOrange} ${m?M.inProgress:""}`,"data-testid":"tool-card-ipc",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🔀"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&i.jsx("span",{className:M.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&i.jsx("span",{className:M.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.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&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.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&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&g.sessionId&&i.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&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(x=>{const S=[`fd:${x.fd??"?"}`,x.permission??"",x.deliveryMode??""];return x.streamName&&S.push(x.streamName),x.owned&&S.push("(owned)"),S.filter(Boolean).join(" ")}).join(`
|
|
247
|
+
`)}),g.fds.length>5&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(x=>!x)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function wE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const tp=8;function jE({args:t,result:s,isError:o}){const[r,c]=y.useState(!1),d=wE(t),u=s===void 0,p=(s==null?void 0:s.split(`
|
|
248
|
+
`))??[],m=p.length>tp,g=r?s:p.slice(0,tp).join(`
|
|
249
|
+
`);return i.jsxs("div",{className:`${M.card} ${o?M.cardRed:M.cardNeutral} ${u?M.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🔧"}),i.jsx("span",{className:M.toolName,children:"ToolSearch"}),d&&i.jsxs("span",{className:M.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!o&&s&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),o&&s&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:s}),!o&&!u&&s&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${r?M.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-tp} more lines`]})]})]})}function NE(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function CE(t){if(t==null)return"";if(typeof t!="object")return String(t);const s=t;if(typeof s.command=="string")return s.command;if(typeof s.file_path=="string")return s.file_path;if(typeof s.path=="string")return s.path;if(typeof s.query=="string")return s.query;if(typeof s.url=="string")return s.url;try{const o=JSON.stringify(t);return o.length>120?`${o.slice(0,120)}…`:o}catch{return""}}const np=5;function EE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{display:u}=NE(t),p=CE(s),m=o===void 0,g=(o==null?void 0:o.split(`
|
|
250
|
+
`))??[],v=g.length>np,b=c?o:g.slice(0,np).join(`
|
|
251
|
+
`);let x="";if(s!=null)try{x=JSON.stringify(s,null,2)}catch{x=String(s)}return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardBlue} ${m?M.inProgress:""}`,"data-testid":"tool-card-generic",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,children:i.jsx(u2,{size:tn,"aria-hidden":"true"})}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&i.jsx("span",{className:M.fileName,children:p})]}),m&&x&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:x}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:b}),v&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(sa,{size:lt})}),c?"collapse":`${g.length-np} more lines`]})]})]})}const AE="_badgePill_o7eqc_1",DE="_modelBadge_o7eqc_14",RE="_backgroundBadge_o7eqc_26",ME="_backgroundDot_o7eqc_36",IE="_backgroundDotPulsing_o7eqc_41",OE="_description_o7eqc_55",BE="_statusLine_o7eqc_62",LE="_statusCompleted_o7eqc_72",zE="_statusRunning_o7eqc_77",$E="_statusError_o7eqc_83",UE="_promptToggle_o7eqc_88",is={badgePill:AE,modelBadge:DE,backgroundBadge:RE,backgroundDot:ME,backgroundDotPulsing:IE,description:OE,statusLine:BE,statusCompleted:LE,statusRunning:zE,statusError:$E,promptToggle:UE};function PE(t,s){if(s==null||typeof s!="object")return{};const o=s;return t.toLowerCase()==="read_agent"?{agentId:typeof o.agent_id=="string"?o.agent_id:void 0,isPoll:!0}:typeof o.agent_type=="string"||typeof o.name=="string"?{agentType:typeof o.agent_type=="string"?o.agent_type:void 0,description:typeof o.description=="string"?o.description:void 0,prompt:typeof o.prompt=="string"?o.prompt:void 0,isBackground:o.mode==="background",agentName:typeof o.name=="string"?o.name:void 0}:{agentType:typeof o.subagent_type=="string"?o.subagent_type:void 0,description:typeof o.description=="string"?o.description:void 0,prompt:typeof o.prompt=="string"?o.prompt:void 0,isBackground:o.run_in_background===!0,model:typeof o.model=="string"?o.model:void 0,isResume:typeof o.resume=="string"&&o.resume.length>0}}const HE=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function VE(t){const s=HE.exec(t);if(!s)return;const o=s[4];return{status:s[1].toLowerCase(),agentId:s[2].replace(/,$/,""),metadata:s[3].trim(),content:o?o.trim():void 0}}const sp=5;function qE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),m=PE(t,s),g=o===void 0,v=m.isPoll&&o?VE(o):void 0,b=(v==null?void 0:v.content)??o,x=(b==null?void 0:b.split(`
|
|
252
|
+
`))??[],S=x.length>sp,k=c?b:x.slice(0,sp).join(`
|
|
253
|
+
`),w=m.isPoll?"Subagent":"Agent";return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardTeal} ${g?M.inProgress:""}`,"data-testid":"tool-card-agent",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:w}),m.agentType&&i.jsx("span",{className:is.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&i.jsx("span",{className:is.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&i.jsxs("span",{className:is.backgroundBadge,"data-testid":"tool-card-agent-background",children:[i.jsx("span",{className:g?is.backgroundDotPulsing:is.backgroundDot,children:"●"}),"BG"]}),m.agentName&&i.jsx("span",{className:M.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&i.jsx("span",{className:M.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),i.jsx("span",{className:M.spacer}),g&&!m.isBackground&&i.jsx("span",{className:M.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&i.jsx("div",{className:is.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&i.jsxs("div",{className:is.statusLine,"data-testid":"tool-card-agent-status",children:[i.jsx("span",{className:v.status==="completed"?is.statusCompleted:v.status==="running"?is.statusRunning:is.statusError,children:v.status}),v.metadata&&i.jsx("span",{children:v.metadata})]}),m.prompt&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:is.promptToggle,onClick:()=>{p(N=>!N)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[i.jsx("span",{className:`${M.chevron} ${u?M.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&b&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:k}),S&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${x.length-sp} more lines`]})]})]})}function ap(t){switch(YN(t.tool)){case"file-read":return i.jsx(vy,{...t});case"file-edit":return i.jsx(IC,{...t});case"file-write":return i.jsx(vy,{...t,writeVariant:!0});case"shell":return i.jsx($C,{...t});case"search":return i.jsx(PC,{...t});case"todo":return i.jsx(oE,{...t});case"metadata":return i.jsx(lE,{...t});case"finding":return i.jsx(uE,{...t});case"task":return i.jsx(hE,{...t});case"workpad":return i.jsx(yE,{...t});case"knowledge":return i.jsx(_E,{...t});case"ipc":return i.jsx(TE,{...t});case"tool-search":return i.jsx(jE,{...t});case"agent":return i.jsx(qE,{...t});default:return i.jsx(EE,{...t})}}const GE="_systemContextEvent_hmqlm_1",FE="_systemContextHeader_hmqlm_7",ZE="_systemContextBadge_hmqlm_28",KE="_systemContextToggle_hmqlm_37",YE="_systemContextPre_hmqlm_43",JE="_systemContextEllipsis_hmqlm_54",WE="_systemEvent_hmqlm_58",XE="_systemTimestamp_hmqlm_65",QE="_textEvent_hmqlm_69",eA="_codeBlockWrapper_hmqlm_156",tA="_codeBlockCopyButton_hmqlm_159",nA="_errorEvent_hmqlm_163",sA="_statusEvent_hmqlm_171",aA="_userInputEvent_hmqlm_180",iA="_userInputContent_hmqlm_186",oA="_signalEvent_hmqlm_203",rA="_signalBadge_hmqlm_214",lA="_signalContent_hmqlm_223",cA="_usageEvent_hmqlm_228",dA="_usageBadge_hmqlm_235",uA="_defaultEvent_hmqlm_244",$t={systemContextEvent:GE,systemContextHeader:FE,systemContextBadge:ZE,systemContextToggle:KE,systemContextPre:YE,systemContextEllipsis:JE,systemEvent:WE,systemTimestamp:XE,textEvent:QE,codeBlockWrapper:eA,codeBlockCopyButton:tA,errorEvent:nA,statusEvent:sA,userInputEvent:aA,userInputContent:iA,signalEvent:oA,signalBadge:rA,signalContent:lA,usageEvent:cA,usageBadge:dA,defaultEvent:uA},xy=3;function fA({content:t}){const[s,o]=y.useState(!1),r=t.split(`
|
|
254
|
+
`),c=r.length>xy,d=s?t:r.slice(0,xy).join(`
|
|
255
|
+
`);return i.jsxs("div",{className:$t.systemContextEvent,"data-testid":"system-context-event",children:[i.jsxs("button",{type:"button",className:$t.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[i.jsx("span",{className:$t.systemContextBadge,children:"SYSTEM PROMPT"}),c&&i.jsx("span",{className:$t.systemContextToggle,"aria-hidden":"true",children:s?i.jsx(px,{size:lt}):i.jsx(sa,{size:lt})})]}),i.jsxs("pre",{className:$t.systemContextPre,children:[d,!s&&c&&i.jsx("span",{className:$t.systemContextEllipsis,children:"…"})]})]})}function pA({time:t,content:s}){return i.jsxs("div",{className:$t.systemEvent,children:[i.jsxs("span",{className:$t.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Op(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Op).join(""):t!=null&&typeof t=="object"&&"props"in t?Op(t.props.children):""}function mA({children:t,node:s,...o}){const r=Op(t);return i.jsxs("div",{className:$t.codeBlockWrapper,children:[i.jsx("pre",{...o,children:t}),i.jsx(NN,{text:r,"data-testid":"copy-code-block",className:$t.codeBlockCopyButton})]})}const hA={pre:mA};function gA({content:t}){return i.jsx("div",{className:$t.textEvent,children:i.jsx(hd,{remarkPlugins:[gd],rehypePlugins:[ZN],components:hA,children:t})})}function vA({content:t}){return i.jsxs("div",{className:$t.errorEvent,children:["Error: ",t]})}function yA({content:t}){return i.jsxs("div",{className:$t.statusEvent,children:["--- ",t," ---"]})}function bA({content:t}){return i.jsx("div",{className:$t.userInputEvent,children:i.jsx("span",{className:$t.userInputContent,children:t})})}function xA({content:t}){return i.jsxs("div",{className:$t.signalEvent,"data-testid":"signal-event",children:[i.jsx("span",{className:$t.signalBadge,children:"SIGNAL"}),i.jsx("span",{className:$t.signalContent,children:t})]})}function _A({content:t}){let s=t;try{const o=JSON.parse(t),r=Number(o.input_tokens)||0,c=Number(o.output_tokens)||0,d=Io(r+c),u=Ss(Number(o.cost_usd)||0);s=`${d} tokens · ${u}`}catch{}return i.jsx("div",{className:$t.usageEvent,"data-testid":"usage-event",children:i.jsx("span",{className:$t.usageBadge,children:s})})}function kA({content:t}){return i.jsx("div",{className:$t.defaultEvent,children:t})}function SA({event:t,toolUseCtx:s,settled:o}){const r=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return i.jsx(fA,{content:t.content})}catch{}return i.jsx(pA,{time:r,content:t.content})}case"text":case"output":return i.jsx(gA,{content:t.content});case"tool_use":{let c="",d={};try{const u=JSON.parse(t.content);c=u.tool||"",d=u.args}catch{}return i.jsx(ap,{tool:c,args:d,result:o?"":void 0})}case"tool_result":{let c=!1;if(t.raw)try{c=JSON.parse(t.raw).is_error===!0}catch{}let d=t.content;if(t.content.trimStart().startsWith("{"))try{const u=JSON.parse(t.content);typeof u.content=="string"&&(d=u.content)}catch{}return s?i.jsx(ap,{tool:s.tool,args:s.args,result:d,isError:c,detailedResult:s.detailedResult}):i.jsx(ap,{tool:"Tool output",args:void 0,result:d,isError:c})}case"error":return i.jsx(vA,{content:t.content});case"status":return i.jsx(yA,{content:t.content});case"user_input":return i.jsx(bA,{content:t.content});case"signal":return i.jsx(xA,{content:t.content});case"usage":return i.jsx(_A,{content:t.content});default:return i.jsx(kA,{content:t.content})}}const gm=y.createContext({});function vm(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const kd=y.createContext(null),ym=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class TA extends y.Component{getSnapshotBeforeUpdate(s){const o=this.props.childRef.current;if(o&&s.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=o.offsetHeight||0,r.width=o.offsetWidth||0,r.top=o.offsetTop,r.left=o.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function wA({children:t,isPresent:s}){const o=y.useId(),r=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0}),{nonce:d}=y.useContext(ym);return y.useInsertionEffect(()=>{const{width:u,height:p,top:m,left:g}=c.current;if(s||!r.current||!u||!p)return;r.current.dataset.motionPopId=o;const v=document.createElement("style");return d&&(v.nonce=d),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
|
|
256
|
+
[data-motion-pop-id="${o}"] {
|
|
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]),i.jsx(TA,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const jA=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=vm(NA),m=y.useId(),g=y.useCallback(b=>{p.set(b,!0);for(const x of p.values())if(!x)return;r&&r()},[p,r]),v=y.useMemo(()=>({id:m,initial:s,isPresent:o,custom:c,onExitComplete:g,register:b=>(p.set(b,!1),()=>p.delete(b))}),d?[Math.random(),g]:[o,g]);return y.useMemo(()=>{p.forEach((b,x)=>p.set(x,!1))},[o]),y.useEffect(()=>{!o&&!p.size&&r&&r()},[o]),u==="popLayout"&&(t=i.jsx(wA,{isPresent:o,children:t})),i.jsx(kd.Provider,{value:v,children:t})};function NA(){return new Map}function $x(t=!0){const s=y.useContext(kd);if(s===null)return[!0,null];const{isPresent:o,onExitComplete:r,register:c}=s,d=y.useId();y.useEffect(()=>{t&&c(d)},[t]);const u=y.useCallback(()=>t&&r&&r(d),[d,r,t]);return!o&&r?[!1,u]:[!0]}const Mc=t=>t.key||"";function _y(t){const s=[];return y.Children.forEach(t,o=>{y.isValidElement(o)&&s.push(o)}),s}const bm=typeof window<"u",Ux=bm?y.useLayoutEffect:y.useEffect,us=({children:t,custom:s,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=$x(u),g=y.useMemo(()=>_y(t),[t]),v=u&&!p?[]:g.map(Mc),b=y.useRef(!0),x=y.useRef(g),S=vm(()=>new Map),[k,w]=y.useState(g),[N,T]=y.useState(g);Ux(()=>{b.current=!1,x.current=g;for(let O=0;O<N.length;O++){const E=Mc(N[O]);v.includes(E)?S.delete(E):S.get(E)!==!0&&S.set(E,!1)}},[N,v.length,v.join("-")]);const C=[];if(g!==k){let O=[...g];for(let E=0;E<N.length;E++){const A=N[E],P=Mc(A);v.includes(P)||(O.splice(E,0,A),C.push(A))}d==="wait"&&C.length&&(O=C),T(_y(O)),w(g);return}const{forceRender:D}=y.useContext(gm);return i.jsx(i.Fragment,{children:N.map(O=>{const E=Mc(O),A=u&&!p?!1:g===N||v.includes(E),P=()=>{if(S.has(E))S.set(E,!0);else return;let I=!0;S.forEach(U=>{U||(I=!1)}),I&&(D==null||D(),T(x.current),u&&(m==null||m()),r&&r())};return i.jsx(jA,{isPresent:A,initial:!b.current||o?void 0:!1,custom:A?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:A?void 0:P,children:O},E)})})},In=t=>t;let Px=In;const CA={useManualTiming:!1};function EA(t){let s=new Set,o=new Set,r=!1,c=!1;const d=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function p(g){d.has(g)&&(m.schedule(g),t()),g(u)}const m={schedule:(g,v=!1,b=!1)=>{const S=b&&r?s:o;return v&&d.add(g),S.has(g)||S.add(g),g},cancel:g=>{o.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,o]=[o,s],s.forEach(p),s.clear(),r=!1,c&&(c=!1,m.process(g))}};return m}const Ic=["read","resolveKeyframes","update","preRender","render","postRender"],AA=40;function Hx(t,s){let o=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>o=!0,u=Ic.reduce((T,C)=>(T[C]=EA(d),T),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:b,postRender:x}=u,S=()=>{const T=performance.now();o=!1,c.delta=r?1e3/60:Math.max(Math.min(T-c.timestamp,AA),1),c.timestamp=T,c.isProcessing=!0,p.process(c),m.process(c),g.process(c),v.process(c),b.process(c),x.process(c),c.isProcessing=!1,o&&s&&(r=!1,t(S))},k=()=>{o=!0,r=!0,c.isProcessing||t(S)};return{schedule:Ic.reduce((T,C)=>{const D=u[C];return T[C]=(O,E=!1,A=!1)=>(o||k(),D.schedule(O,E,A)),T},{}),cancel:T=>{for(let C=0;C<Ic.length;C++)u[Ic[C]].cancel(T)},state:c,steps:u}}const{schedule:_t,cancel:Ua,state:rn,steps:ip}=Hx(typeof requestAnimationFrame<"u"?requestAnimationFrame:In,!0),Vx=y.createContext({strict:!1}),ky={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Oo={};for(const t in ky)Oo[t]={isEnabled:s=>ky[t].some(o=>!!s[o])};function DA(t){for(const s in t)Oo[s]={...Oo[s],...t[s]}}const RA=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 td(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||RA.has(t)}let qx=t=>!td(t);function MA(t){t&&(qx=s=>s.startsWith("on")?!td(s):t(s))}try{MA(require("@emotion/is-prop-valid").default)}catch{}function IA(t,s,o){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(qx(c)||o===!0&&td(c)||!s&&!td(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function OA(t){if(typeof Proxy>"u")return t;const s=new Map,o=(...r)=>t(...r);return new Proxy(o,{get:(r,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const Sd=y.createContext({});function sl(t){return typeof t=="string"||Array.isArray(t)}function Td(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const xm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],_m=["initial",...xm];function wd(t){return Td(t.animate)||_m.some(s=>sl(t[s]))}function Gx(t){return!!(wd(t)||t.variants)}function BA(t,s){if(wd(t)){const{initial:o,animate:r}=t;return{initial:o===!1||sl(o)?o:void 0,animate:sl(r)?r:void 0}}return t.inherit!==!1?s:{}}function LA(t){const{initial:s,animate:o}=BA(t,y.useContext(Sd));return y.useMemo(()=>({initial:s,animate:o}),[Sy(s),Sy(o)])}function Sy(t){return Array.isArray(t)?t.join(" "):t}const zA=Symbol.for("motionComponentSymbol");function jo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function $A(t,s,o){return y.useCallback(r=>{r&&t.onMount&&t.onMount(r),s&&(r?s.mount(r):s.unmount()),o&&(typeof o=="function"?o(r):jo(o)&&(o.current=r))},[s])}const km=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),UA="framerAppearId",Fx="data-"+km(UA),{schedule:Sm}=Hx(queueMicrotask,!1),Zx=y.createContext({});function PA(t,s,o,r,c){var d,u;const{visualElement:p}=y.useContext(Sd),m=y.useContext(Vx),g=y.useContext(kd),v=y.useContext(ym).reducedMotion,b=y.useRef(null);r=r||m.renderer,!b.current&&r&&(b.current=r(t,{visualState:s,parent:p,props:o,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const x=b.current,S=y.useContext(Zx);x&&!x.projection&&c&&(x.type==="html"||x.type==="svg")&&HA(b.current,o,c,S);const k=y.useRef(!1);y.useInsertionEffect(()=>{x&&k.current&&x.update(o,g)});const w=o[Fx],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 Ux(()=>{x&&(k.current=!0,window.MotionIsMounted=!0,x.updateFeatures(),Sm.render(x.render),N.current&&x.animationState&&x.animationState.animateChanges())}),y.useEffect(()=>{x&&(!N.current&&x.animationState&&x.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,w)}),N.current=!1))}),x}function HA(t,s,o,r){const{layoutId:c,layout:d,drag:u,dragConstraints:p,layoutScroll:m,layoutRoot:g}=s;t.projection=new o(t.latestValues,s["data-framer-portal-id"]?void 0:Kx(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&jo(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function Kx(t){if(t)return t.options.allowProjection!==!1?t.projection:Kx(t.parent)}function VA({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&DA(t);function p(g,v){let b;const x={...y.useContext(ym),...g,layoutId:qA(g)},{isStatic:S}=x,k=LA(g),w=r(g,S);if(!S&&bm){GA();const N=FA(x);b=N.MeasureLayout,k.visualElement=PA(c,w,x,s,N.ProjectionNode)}return i.jsxs(Sd.Provider,{value:k,children:[b&&k.visualElement?i.jsx(b,{visualElement:k.visualElement,...x}):null,o(c,g,$A(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[zA]=c,m}function qA({layoutId:t}){const s=y.useContext(gm).id;return s&&t!==void 0?s+"-"+t:t}function GA(t,s){y.useContext(Vx).strict}function FA(t){const{drag:s,layout:o}=Oo;if(!s&&!o)return{};const r={...s,...o};return{MeasureLayout:s!=null&&s.isEnabled(t)||o!=null&&o.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const ZA=["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 Tm(t){return typeof t!="string"||t.includes("-")?!1:!!(ZA.indexOf(t)>-1||/[A-Z]/u.test(t))}function Ty(t){const s=[{},{}];return t==null||t.values.forEach((o,r)=>{s[0][r]=o.get(),s[1][r]=o.getVelocity()}),s}function wm(t,s,o,r){if(typeof s=="function"){const[c,d]=Ty(r);s=s(o!==void 0?o:t.custom,c,d)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,d]=Ty(r);s=s(o!==void 0?o:t.custom,c,d)}return s}const Bp=t=>Array.isArray(t),KA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),YA=t=>Bp(t)?t[t.length-1]||0:t,dn=t=>!!(t&&t.getVelocity);function Kc(t){const s=dn(t)?t.get():t;return KA(s)?s.toValue():s}function JA({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:WA(r,c,d,t),renderState:s()};return o&&(u.onMount=p=>o({props:r,current:p,...u}),u.onUpdate=p=>o(p)),u}const Yx=t=>(s,o)=>{const r=y.useContext(Sd),c=y.useContext(kd),d=()=>JA(t,s,r,c);return o?d():vm(d)};function WA(t,s,o,r){const c={},d=r(t,{});for(const x in d)c[x]=Kc(d[x]);let{initial:u,animate:p}=t;const m=wd(t),g=Gx(t);s&&g&&!m&&t.inherit!==!1&&(u===void 0&&(u=s.initial),p===void 0&&(p=s.animate));let v=o?o.initial===!1:!1;v=v||u===!1;const b=v?p:u;if(b&&typeof b!="boolean"&&!Td(b)){const x=Array.isArray(b)?b:[b];for(let S=0;S<x.length;S++){const k=wm(t,x[S]);if(k){const{transitionEnd:w,transition:N,...T}=k;for(const C in T){let D=T[C];if(Array.isArray(D)){const O=v?D.length-1:0;D=D[O]}D!==null&&(c[C]=D)}for(const C in w)c[C]=w[C]}}}return c}const Ho=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Mi=new Set(Ho),Jx=t=>s=>typeof s=="string"&&s.startsWith(t),Wx=Jx("--"),XA=Jx("var(--"),jm=t=>XA(t)?QA.test(t.split("/*")[0].trim()):!1,QA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Xx=(t,s)=>s&&typeof t=="number"?s.transform(t):t,ta=(t,s,o)=>o>s?s:o<t?t:o,Vo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},al={...Vo,transform:t=>ta(0,1,t)},Oc={...Vo,default:1},fl=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Oa=fl("deg"),ws=fl("%"),De=fl("px"),eD=fl("vh"),tD=fl("vw"),wy={...ws,parse:t=>ws.parse(t)/100,transform:t=>ws.transform(t*100)},nD={borderWidth:De,borderTopWidth:De,borderRightWidth:De,borderBottomWidth:De,borderLeftWidth:De,borderRadius:De,radius:De,borderTopLeftRadius:De,borderTopRightRadius:De,borderBottomRightRadius:De,borderBottomLeftRadius:De,width:De,maxWidth:De,height:De,maxHeight:De,top:De,right:De,bottom:De,left:De,padding:De,paddingTop:De,paddingRight:De,paddingBottom:De,paddingLeft:De,margin:De,marginTop:De,marginRight:De,marginBottom:De,marginLeft:De,backgroundPositionX:De,backgroundPositionY:De},sD={rotate:Oa,rotateX:Oa,rotateY:Oa,rotateZ:Oa,scale:Oc,scaleX:Oc,scaleY:Oc,scaleZ:Oc,skew:Oa,skewX:Oa,skewY:Oa,distance:De,translateX:De,translateY:De,translateZ:De,x:De,y:De,z:De,perspective:De,transformPerspective:De,opacity:al,originX:wy,originY:wy,originZ:De},jy={...Vo,transform:Math.round},Nm={...nD,...sD,zIndex:jy,size:De,fillOpacity:al,strokeOpacity:al,numOctaves:jy},aD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},iD=Ho.length;function oD(t,s,o){let r="",c=!0;for(let d=0;d<iD;d++){const u=Ho[d],p=t[u];if(p===void 0)continue;let m=!0;if(typeof p=="number"?m=p===(u.startsWith("scale")?1:0):m=parseFloat(p)===0,!m||o){const g=Xx(p,Nm[u]);if(!m){c=!1;const v=aD[u]||u;r+=`${v}(${g}) `}o&&(s[u]=g)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Cm(t,s,o){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,p=!1;for(const m in s){const g=s[m];if(Mi.has(m)){u=!0;continue}else if(Wx(m)){c[m]=g;continue}else{const v=Xx(g,Nm[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||o?r.transform=oD(s,t.transform,o):r.transform&&(r.transform="none")),p){const{originX:m="50%",originY:g="50%",originZ:v=0}=d;r.transformOrigin=`${m} ${g} ${v}`}}const rD={offset:"stroke-dashoffset",array:"stroke-dasharray"},lD={offset:"strokeDashoffset",array:"strokeDasharray"};function cD(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?rD:lD;t[d.offset]=De.transform(-r);const u=De.transform(s),p=De.transform(o);t[d.array]=`${u} ${p}`}function Ny(t,s,o){return typeof t=="string"?t:De.transform(s+o*t)}function dD(t,s,o){const r=Ny(s,t.x,t.width),c=Ny(o,t.y,t.height);return`${r} ${c}`}function Em(t,{attrX:s,attrY:o,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,b){if(Cm(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:x,style:S,dimensions:k}=t;x.transform&&(k&&(S.transform=x.transform),delete x.transform),k&&(c!==void 0||d!==void 0||S.transform)&&(S.transformOrigin=dD(k,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(x.x=s),o!==void 0&&(x.y=o),r!==void 0&&(x.scale=r),u!==void 0&&cD(x,u,p,m,!1)}const Am=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Qx=()=>({...Am(),attrs:{}}),Dm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function e_(t,{style:s,vars:o},r,c){Object.assign(t.style,s,c&&c.getProjectionStyles(r));for(const d in o)t.style.setProperty(d,o[d])}const t_=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 n_(t,s,o,r){e_(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(t_.has(c)?c:km(c),s.attrs[c])}const nd={};function uD(t){Object.assign(nd,t)}function s_(t,{layout:s,layoutId:o}){return Mi.has(t)||t.startsWith("origin")||(s||o!==void 0)&&(!!nd[t]||t==="opacity")}function Rm(t,s,o){var r;const{style:c}=t,d={};for(const u in c)(dn(c[u])||s.style&&dn(s.style[u])||s_(u,t)||((r=o==null?void 0:o.getValue(u))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(d[u]=c[u]);return d}function a_(t,s,o){const r=Rm(t,s,o);for(const c in t)if(dn(t[c])||dn(s[c])){const d=Ho.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function fD(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 Cy=["x","y","width","height","cx","cy","r"],pD={useVisualState:Yx({scrapeMotionValuesFromProps:a_,createRenderState:Qx,onUpdate:({props:t,prevProps:s,current:o,renderState:r,latestValues:c})=>{if(!o)return;let d=!!t.drag;if(!d){for(const p in c)if(Mi.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<Cy.length;p++){const m=Cy[p];t[m]!==s[m]&&(u=!0)}u&&_t.read(()=>{fD(o,r),_t.render(()=>{Em(r,c,Dm(o.tagName),t.transformTemplate),n_(o,r)})})}})},mD={useVisualState:Yx({scrapeMotionValuesFromProps:Rm,createRenderState:Am})};function i_(t,s,o){for(const r in s)!dn(s[r])&&!s_(r,o)&&(t[r]=s[r])}function hD({transformTemplate:t},s){return y.useMemo(()=>{const o=Am();return Cm(o,s,t),Object.assign({},o.vars,o.style)},[s])}function gD(t,s){const o=t.style||{},r={};return i_(r,o,t),Object.assign(r,hD(t,s)),r}function vD(t,s){const o={},r=gD(t,s);return t.drag&&t.dragListener!==!1&&(o.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(o.tabIndex=0),o.style=r,o}function yD(t,s,o,r){const c=y.useMemo(()=>{const d=Qx();return Em(d,s,Dm(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};i_(d,t.style,t),c.style={...d,...c.style}}return c}function bD(t=!1){return(o,r,c,{latestValues:d},u)=>{const m=(Tm(o)?yD:vD)(r,d,u,o),g=IA(r,typeof o=="string",t),v=o!==y.Fragment?{...g,...m,ref:c}:{},{children:b}=r,x=y.useMemo(()=>dn(b)?b.get():b,[b]);return y.createElement(o,{...v,children:x})}}function xD(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Tm(r)?pD:mD,preloadedFeatures:t,useRender:bD(c),createVisualElement:s,Component:r};return VA(u)}}function o_(t,s){if(!Array.isArray(s))return!1;const o=s.length;if(o!==t.length)return!1;for(let r=0;r<o;r++)if(s[r]!==t[r])return!1;return!0}function jd(t,s,o){const r=t.getProps();return wm(r,s,o!==void 0?o:r.custom,t)}function Mm(t,s){return t?t[s]||t.default||t:void 0}const r_=new Set(["width","height","top","left","right","bottom",...Ho]);let Yc;function _D(){Yc=void 0}const js={now:()=>(Yc===void 0&&js.set(rn.isProcessing||CA.useManualTiming?rn.timestamp:performance.now()),Yc),set:t=>{Yc=t,queueMicrotask(_D)}};function Im(t,s){t.indexOf(s)===-1&&t.push(s)}function Om(t,s){const o=t.indexOf(s);o>-1&&t.splice(o,1)}class Bm{constructor(){this.subscriptions=[]}add(s){return Im(this.subscriptions,s),()=>Om(this.subscriptions,s)}notify(s,o,r){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,o,r);else for(let d=0;d<c;d++){const u=this.subscriptions[d];u&&u(s,o,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function l_(t,s){return s?t*(1e3/s):0}const Ey=30,kD=t=>!isNaN(parseFloat(t));class SD{constructor(s,o={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=js.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=o.owner}setCurrent(s){this.current=s,this.updatedAt=js.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=kD(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,o){this.events[s]||(this.events[s]=new Bm);const r=this.events[s].add(o);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,o){this.passiveEffect=s,this.stopPassiveEffect=o}set(s,o=!0){!o||!this.passiveEffect?this.updateAndNotify(s,o):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,o,r){this.set(o),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,o=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=js.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Ey)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,Ey);return l_(parseFloat(this.current)-parseFloat(this.prevFrameValue),o)}start(s){return this.stop(),new Promise(o=>{this.hasAnimated=!0,this.animation=s(o),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function il(t,s){return new SD(t,s)}function TD(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,il(o))}function wD(t,s){const o=jd(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const p=YA(d[u]);TD(t,u,p)}}function jD(t){return!!(dn(t)&&t.add)}function Lp(t,s){const o=t.getValue("willChange");if(jD(o))return o.add(s)}function c_(t){return t.props[Fx]}function Lm(t){let s;return()=>(s===void 0&&(s=t()),s)}const ND=Lm(()=>window.ScrollTimeline!==void 0);class CD{constructor(s){this.stop=()=>this.runAll("stop"),this.animations=s.filter(Boolean)}get finished(){return Promise.all(this.animations.map(s=>"finished"in s?s.finished:s))}getAll(s){return this.animations[0][s]}setAll(s,o){for(let r=0;r<this.animations.length;r++)this.animations[r][s]=o}attachTimeline(s,o){const r=this.animations.map(c=>{if(ND()&&c.attachTimeline)return c.attachTimeline(s);if(typeof o=="function")return o(c)});return()=>{r.forEach((c,d)=>{c&&c(),this.animations[d].stop()})}}get time(){return this.getAll("time")}set time(s){this.setAll("time",s)}get speed(){return this.getAll("speed")}set speed(s){this.setAll("speed",s)}get startTime(){return this.getAll("startTime")}get duration(){let s=0;for(let o=0;o<this.animations.length;o++)s=Math.max(s,this.animations[o].duration);return s}runAll(s){this.animations.forEach(o=>o[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class ED extends CD{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const Ws=t=>t*1e3,Xs=t=>t/1e3;function zm(t){return typeof t=="function"}function Ay(t,s){t.timeline=s,t.onfinish=null}const $m=t=>Array.isArray(t)&&typeof t[0]=="number",AD={linearEasing:void 0};function DD(t,s){const o=Lm(t);return()=>{var r;return(r=AD[s])!==null&&r!==void 0?r:o()}}const sd=DD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Bo=(t,s,o)=>{const r=s-t;return r===0?1:(o-t)/r},d_=(t,s,o=10)=>{let r="";const c=Math.max(Math.round(s/o),2);for(let d=0;d<c;d++)r+=t(Bo(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function u_(t){return!!(typeof t=="function"&&sd()||!t||typeof t=="string"&&(t in zp||sd())||$m(t)||Array.isArray(t)&&t.every(u_))}const Vr=([t,s,o,r])=>`cubic-bezier(${t}, ${s}, ${o}, ${r})`,zp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Vr([0,.65,.55,1]),circOut:Vr([.55,0,1,.45]),backIn:Vr([.31,.01,.66,-.59]),backOut:Vr([.33,1.53,.69,.99])};function f_(t,s){if(t)return typeof t=="function"&&sd()?d_(t,s):$m(t)?Vr(t):Array.isArray(t)?t.map(o=>f_(o,s)||zp.easeOut):zp[t]}const p_=(t,s,o)=>(((1-3*o+3*s)*t+(3*o-6*s))*t+3*s)*t,RD=1e-7,MD=12;function ID(t,s,o,r,c){let d,u,p=0;do u=s+(o-s)/2,d=p_(u,r,c)-t,d>0?o=u:s=u;while(Math.abs(d)>RD&&++p<MD);return u}function pl(t,s,o,r){if(t===s&&o===r)return In;const c=d=>ID(d,0,1,t,o);return d=>d===0||d===1?d:p_(c(d),s,r)}const m_=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,h_=t=>s=>1-t(1-s),g_=pl(.33,1.53,.69,.99),Um=h_(g_),v_=m_(Um),y_=t=>(t*=2)<1?.5*Um(t):.5*(2-Math.pow(2,-10*(t-1))),Pm=t=>1-Math.sin(Math.acos(t)),b_=h_(Pm),x_=m_(Pm),__=t=>/^0[^.\s]+$/u.test(t);function OD(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||__(t):!0}const Kr=t=>Math.round(t*1e5)/1e5,Hm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function BD(t){return t==null}const LD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Vm=(t,s)=>o=>!!(typeof o=="string"&&LD.test(o)&&o.startsWith(t)||s&&!BD(o)&&Object.prototype.hasOwnProperty.call(o,s)),k_=(t,s,o)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(Hm);return{[t]:parseFloat(c),[s]:parseFloat(d),[o]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},zD=t=>ta(0,255,t),op={...Vo,transform:t=>Math.round(zD(t))},Ti={test:Vm("rgb","red"),parse:k_("red","green","blue"),transform:({red:t,green:s,blue:o,alpha:r=1})=>"rgba("+op.transform(t)+", "+op.transform(s)+", "+op.transform(o)+", "+Kr(al.transform(r))+")"};function $D(t){let s="",o="",r="",c="";return t.length>5?(s=t.substring(1,3),o=t.substring(3,5),r=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),o=t.substring(2,3),r=t.substring(3,4),c=t.substring(4,5),s+=s,o+=o,r+=r,c+=c),{red:parseInt(s,16),green:parseInt(o,16),blue:parseInt(r,16),alpha:c?parseInt(c,16)/255:1}}const $p={test:Vm("#"),parse:$D,transform:Ti.transform},No={test:Vm("hsl","hue"),parse:k_("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:o,alpha:r=1})=>"hsla("+Math.round(t)+", "+ws.transform(Kr(s))+", "+ws.transform(Kr(o))+", "+Kr(al.transform(r))+")"},cn={test:t=>Ti.test(t)||$p.test(t)||No.test(t),parse:t=>Ti.test(t)?Ti.parse(t):No.test(t)?No.parse(t):$p.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ti.transform(t):No.transform(t)},UD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function PD(t){var s,o;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Hm))===null||s===void 0?void 0:s.length)||0)+(((o=t.match(UD))===null||o===void 0?void 0:o.length)||0)>0}const S_="number",T_="color",HD="var",VD="var(",Dy="${}",qD=/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 ol(t){const s=t.toString(),o=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace(qD,m=>(cn.test(m)?(r.color.push(d),c.push(T_),o.push(cn.parse(m))):m.startsWith(VD)?(r.var.push(d),c.push(HD),o.push(m)):(r.number.push(d),c.push(S_),o.push(parseFloat(m))),++d,Dy)).split(Dy);return{values:o,split:p,indexes:r,types:c}}function w_(t){return ol(t).values}function j_(t){const{split:s,types:o}=ol(t),r=s.length;return c=>{let d="";for(let u=0;u<r;u++)if(d+=s[u],c[u]!==void 0){const p=o[u];p===S_?d+=Kr(c[u]):p===T_?d+=cn.transform(c[u]):d+=c[u]}return d}}const GD=t=>typeof t=="number"?0:t;function FD(t){const s=w_(t);return j_(t)(s.map(GD))}const Pa={test:PD,parse:w_,createTransformer:j_,getAnimatableNone:FD},ZD=new Set(["brightness","contrast","saturate","opacity"]);function KD(t){const[s,o]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=o.match(Hm)||[];if(!r)return t;const c=o.replace(r,"");let d=ZD.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const YD=/\b([a-z-]*)\(.*?\)/gu,Up={...Pa,getAnimatableNone:t=>{const s=t.match(YD);return s?s.map(KD).join(" "):t}},JD={...Nm,color:cn,backgroundColor:cn,outlineColor:cn,fill:cn,stroke:cn,borderColor:cn,borderTopColor:cn,borderRightColor:cn,borderBottomColor:cn,borderLeftColor:cn,filter:Up,WebkitFilter:Up},qm=t=>JD[t];function N_(t,s){let o=qm(t);return o!==Up&&(o=Pa),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const WD=new Set(["auto","none","0"]);function XD(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!WD.has(d)&&ol(d).values.length&&(c=t[r]),r++}if(c&&o)for(const d of s)t[d]=N_(o,c)}const Ry=t=>t===Vo||t===De,My=(t,s)=>parseFloat(t.split(", ")[s]),Iy=(t,s)=>(o,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return My(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?My(d[1],t):0}},QD=new Set(["x","y","z"]),eR=Ho.filter(t=>!QD.has(t));function tR(t){const s=[];return eR.forEach(o=>{const r=t.getValue(o);r!==void 0&&(s.push([o,r.get()]),r.set(o.startsWith("scale")?1:0))}),s}const Lo={width:({x:t},{paddingLeft:s="0",paddingRight:o="0"})=>t.max-t.min-parseFloat(s)-parseFloat(o),height:({y:t},{paddingTop:s="0",paddingBottom:o="0"})=>t.max-t.min-parseFloat(s)-parseFloat(o),top:(t,{top:s})=>parseFloat(s),left:(t,{left:s})=>parseFloat(s),bottom:({y:t},{top:s})=>parseFloat(s)+(t.max-t.min),right:({x:t},{left:s})=>parseFloat(s)+(t.max-t.min),x:Iy(4,13),y:Iy(5,14)};Lo.translateX=Lo.x;Lo.translateY=Lo.y;const wi=new Set;let Pp=!1,Hp=!1;function C_(){if(Hp){const t=Array.from(wi).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),o=new Map;s.forEach(r=>{const c=tR(r);c.length&&(o.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=o.get(r);c&&c.forEach(([d,u])=>{var p;(p=r.getValue(d))===null||p===void 0||p.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Hp=!1,Pp=!1,wi.forEach(t=>t.complete()),wi.clear()}function E_(){wi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Hp=!0)})}function nR(){E_(),C_()}class Gm{constructor(s,o,r,c,d,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=o,this.name=r,this.motionValue=c,this.element=d,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(wi.add(this),Pp||(Pp=!0,_t.read(E_),_t.resolveKeyframes(C_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:o,element:r,motionValue:c}=this;for(let d=0;d<s.length;d++)if(s[d]===null)if(d===0){const u=c==null?void 0:c.get(),p=s[s.length-1];if(u!==void 0)s[0]=u;else if(r&&o){const m=r.readValue(o,p);m!=null&&(s[0]=m)}s[0]===void 0&&(s[0]=p),c&&u===void 0&&c.set(s[0])}else s[d]=s[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),wi.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,wi.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const A_=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),sR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function aR(t){const s=sR.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function D_(t,s,o=1){const[r,c]=aR(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return A_(u)?parseFloat(u):u}return jm(c)?D_(c,s,o+1):c}const R_=t=>s=>s.test(t),iR={test:t=>t==="auto",parse:t=>t},M_=[Vo,De,ws,Oa,tD,eD,iR],Oy=t=>M_.find(R_(t));class I_ extends Gm{constructor(s,o,r,c,d){super(s,o,r,c,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:o,name:r}=this;if(!o||!o.current)return;super.readKeyframes();for(let m=0;m<s.length;m++){let g=s[m];if(typeof g=="string"&&(g=g.trim(),jm(g))){const v=D_(g,o.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!r_.has(r)||s.length!==2)return;const[c,d]=s,u=Oy(c),p=Oy(d);if(u!==p)if(Ry(u)&&Ry(p))for(let m=0;m<s.length;m++){const g=s[m];typeof g=="string"&&(s[m]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:o}=this,r=[];for(let c=0;c<s.length;c++)OD(s[c])&&r.push(c);r.length&&XD(s,r,o)}measureInitialState(){const{element:s,unresolvedKeyframes:o,name:r}=this;if(!s||!s.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Lo[r](s.measureViewportBox(),window.getComputedStyle(s.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&s.getValue(r,c).jump(c,!1)}measureEndState(){var s;const{element:o,name:r,unresolvedKeyframes:c}=this;if(!o||!o.current)return;const d=o.getValue(r);d&&d.jump(this.measuredOrigin,!1);const u=c.length-1,p=c[u];c[u]=Lo[r](o.measureViewportBox(),window.getComputedStyle(o.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([m,g])=>{o.getValue(m).set(g)}),this.resolveNoneKeyframes()}}const By=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Pa.test(t)||t==="0")&&!t.startsWith("url("));function oR(t){const s=t[0];if(t.length===1)return!0;for(let o=0;o<t.length;o++)if(t[o]!==s)return!0}function rR(t,s,o,r){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const d=t[t.length-1],u=By(c,s),p=By(d,s);return!u||!p?!1:oR(t)||(o==="spring"||zm(o))&&r}const lR=t=>t!==null;function Nd(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(lR),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const cR=40;class O_{constructor({autoplay:s=!0,delay:o=0,type:r="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:u="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=js.now(),this.options={autoplay:s,delay:o,type:r,repeat:c,repeatDelay:d,repeatType:u,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>cR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&nR(),this._resolved}onKeyframesResolved(s,o){this.resolvedAt=js.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!rR(s,r,c,d))if(u)this.options.duration=0;else{m&&m(Nd(s,this.options,o)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,o);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:o,...v},this.onPostResolved())}onPostResolved(){}then(s,o){return this.currentFinishedPromise.then(s,o)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const Vp=2e4;function B_(t){let s=0;const o=50;let r=t.next(s);for(;!r.done&&s<Vp;)s+=o,r=t.next(s);return s>=Vp?1/0:s}const Nt=(t,s,o)=>t+(s-t)*o;function rp(t,s,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+(s-t)*6*o:o<1/2?s:o<2/3?t+(s-t)*(2/3-o)*6:t}function dR({hue:t,saturation:s,lightness:o,alpha:r}){t/=360,s/=100,o/=100;let c=0,d=0,u=0;if(!s)c=d=u=o;else{const p=o<.5?o*(1+s):o+s-o*s,m=2*o-p;c=rp(m,p,t+1/3),d=rp(m,p,t),u=rp(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function ad(t,s){return o=>o>0?s:t}const lp=(t,s,o)=>{const r=t*t,c=o*(s*s-r)+r;return c<0?0:Math.sqrt(c)},uR=[$p,Ti,No],fR=t=>uR.find(s=>s.test(t));function Ly(t){const s=fR(t);if(!s)return!1;let o=s.parse(t);return s===No&&(o=dR(o)),o}const zy=(t,s)=>{const o=Ly(t),r=Ly(s);if(!o||!r)return ad(t,s);const c={...o};return d=>(c.red=lp(o.red,r.red,d),c.green=lp(o.green,r.green,d),c.blue=lp(o.blue,r.blue,d),c.alpha=Nt(o.alpha,r.alpha,d),Ti.transform(c))},pR=(t,s)=>o=>s(t(o)),ml=(...t)=>t.reduce(pR),qp=new Set(["none","hidden"]);function mR(t,s){return qp.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function hR(t,s){return o=>Nt(t,s,o)}function Fm(t){return typeof t=="number"?hR:typeof t=="string"?jm(t)?ad:cn.test(t)?zy:yR:Array.isArray(t)?L_:typeof t=="object"?cn.test(t)?zy:gR:ad}function L_(t,s){const o=[...t],r=o.length,c=t.map((d,u)=>Fm(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)o[u]=c[u](d);return o}}function gR(t,s){const o={...t,...s},r={};for(const c in o)t[c]!==void 0&&s[c]!==void 0&&(r[c]=Fm(t[c])(t[c],s[c]));return c=>{for(const d in r)o[d]=r[d](c);return o}}function vR(t,s){var o;const r=[],c={color:0,var:0,number:0};for(let d=0;d<s.values.length;d++){const u=s.types[d],p=t.indexes[u][c[u]],m=(o=t.values[p])!==null&&o!==void 0?o:0;r[d]=m,c[u]++}return r}const yR=(t,s)=>{const o=Pa.createTransformer(s),r=ol(t),c=ol(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?qp.has(t)&&!c.values.length||qp.has(s)&&!r.values.length?mR(t,s):ml(L_(vR(r,c),c.values),o):ad(t,s)};function z_(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?Nt(t,s,o):Fm(t)(t,s)}const bR=5;function $_(t,s,o){const r=Math.max(s-bR,0);return l_(o-t(r),s-r)}const Dt={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},cp=.001;function xR({duration:t=Dt.duration,bounce:s=Dt.bounce,velocity:o=Dt.velocity,mass:r=Dt.mass}){let c,d,u=1-s;u=ta(Dt.minDamping,Dt.maxDamping,u),t=ta(Dt.minDuration,Dt.maxDuration,Xs(t)),u<1?(c=g=>{const v=g*u,b=v*t,x=v-o,S=Gp(g,u),k=Math.exp(-b);return cp-x/S*k},d=g=>{const b=g*u*t,x=b*o+o,S=Math.pow(u,2)*Math.pow(g,2)*t,k=Math.exp(-b),w=Gp(Math.pow(g,2),u);return(-c(g)+cp>0?-1:1)*((x-S)*k)/w}):(c=g=>{const v=Math.exp(-g*t),b=(g-o)*t+1;return-cp+v*b},d=g=>{const v=Math.exp(-g*t),b=(o-g)*(t*t);return v*b});const p=5/t,m=kR(c,d,p);if(t=Ws(t),isNaN(m))return{stiffness:Dt.stiffness,damping:Dt.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const _R=12;function kR(t,s,o){let r=o;for(let c=1;c<_R;c++)r=r-t(r)/s(r);return r}function Gp(t,s){return t*Math.sqrt(1-s*s)}const SR=["duration","bounce"],TR=["stiffness","damping","mass"];function $y(t,s){return s.some(o=>t[o]!==void 0)}function wR(t){let s={velocity:Dt.velocity,stiffness:Dt.stiffness,damping:Dt.damping,mass:Dt.mass,isResolvedFromDuration:!1,...t};if(!$y(t,TR)&&$y(t,SR))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*ta(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Dt.mass,stiffness:c,damping:d}}else{const o=xR(t);s={...s,...o,mass:Dt.mass},s.isResolvedFromDuration=!0}return s}function U_(t=Dt.visualDuration,s=Dt.bounce){const o=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=o;const d=o.keyframes[0],u=o.keyframes[o.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:v,duration:b,velocity:x,isResolvedFromDuration:S}=wR({...o,velocity:-Xs(o.velocity||0)}),k=x||0,w=g/(2*Math.sqrt(m*v)),N=u-d,T=Xs(Math.sqrt(m/v)),C=Math.abs(N)<5;r||(r=C?Dt.restSpeed.granular:Dt.restSpeed.default),c||(c=C?Dt.restDelta.granular:Dt.restDelta.default);let D;if(w<1){const E=Gp(T,w);D=A=>{const P=Math.exp(-w*T*A);return u-P*((k+w*T*N)/E*Math.sin(E*A)+N*Math.cos(E*A))}}else if(w===1)D=E=>u-Math.exp(-T*E)*(N+(k+T*N)*E);else{const E=T*Math.sqrt(w*w-1);D=A=>{const P=Math.exp(-w*T*A),I=Math.min(E*A,300);return u-P*((k+w*T*N)*Math.sinh(I)+E*N*Math.cosh(I))/E}}const O={calculatedDuration:S&&b||null,next:E=>{const A=D(E);if(S)p.done=E>=b;else{let P=0;w<1&&(P=E===0?Ws(k):$_(D,E,A));const I=Math.abs(P)<=r,U=Math.abs(u-A)<=c;p.done=I&&U}return p.value=p.done?u:A,p},toString:()=>{const E=Math.min(B_(O),Vp),A=d_(P=>O.next(E*P).value,E,30);return E+"ms "+A}};return O}function Uy({keyframes:t,velocity:s=0,power:o=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:p,max:m,restDelta:g=.5,restSpeed:v}){const b=t[0],x={done:!1,value:b},S=I=>p!==void 0&&I<p||m!==void 0&&I>m,k=I=>p===void 0?m:m===void 0||Math.abs(p-I)<Math.abs(m-I)?p:m;let w=o*s;const N=b+w,T=u===void 0?N:u(N);T!==N&&(w=T-b);const C=I=>-w*Math.exp(-I/r),D=I=>T+C(I),O=I=>{const U=C(I),Q=D(I);x.done=Math.abs(U)<=g,x.value=x.done?T:Q};let E,A;const P=I=>{S(x.value)&&(E=I,A=U_({keyframes:[x.value,k(x.value)],velocity:$_(D,I,x.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return P(0),{calculatedDuration:null,next:I=>{let U=!1;return!A&&E===void 0&&(U=!0,O(I),P(I)),E!==void 0&&I>=E?A.next(I-E):(!U&&O(I),x)}}}const jR=pl(.42,0,1,1),NR=pl(0,0,.58,1),P_=pl(.42,0,.58,1),CR=t=>Array.isArray(t)&&typeof t[0]!="number",ER={linear:In,easeIn:jR,easeInOut:P_,easeOut:NR,circIn:Pm,circInOut:x_,circOut:b_,backIn:Um,backInOut:v_,backOut:g_,anticipate:y_},Py=t=>{if($m(t)){Px(t.length===4);const[s,o,r,c]=t;return pl(s,o,r,c)}else if(typeof t=="string")return ER[t];return t};function AR(t,s,o){const r=[],c=o||z_,d=t.length-1;for(let u=0;u<d;u++){let p=c(t[u],t[u+1]);if(s){const m=Array.isArray(s)?s[u]||In:s;p=ml(m,p)}r.push(p)}return r}function DR(t,s,{clamp:o=!0,ease:r,mixer:c}={}){const d=t.length;if(Px(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=AR(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 x=Bo(t[b],t[b+1],v);return p[b](x)};return o?v=>g(ta(t[0],t[d-1],v)):g}function RR(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=Bo(0,s,r);t.push(Nt(o,1,c))}}function MR(t){const s=[0];return RR(s,t.length-1),s}function IR(t,s){return t.map(o=>o*s)}function OR(t,s){return t.map(()=>s||P_).splice(0,t.length-1)}function id({duration:t=300,keyframes:s,times:o,ease:r="easeInOut"}){const c=CR(r)?r.map(Py):Py(r),d={done:!1,value:s[0]},u=IR(o&&o.length===s.length?o:MR(s),t),p=DR(u,s,{ease:Array.isArray(c)?c:OR(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const BR=t=>{const s=({timestamp:o})=>t(o);return{start:()=>_t.update(s,!0),stop:()=>Ua(s),now:()=>rn.isProcessing?rn.timestamp:js.now()}},LR={decay:Uy,inertia:Uy,tween:id,keyframes:id,spring:U_},zR=t=>t/100;class Zm extends O_{constructor(s){super(s),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:m}=this.options;m&&m()};const{name:o,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||Gm,p=(m,g)=>this.onKeyframesResolved(m,g);this.resolver=new u(d,p,o,r,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:o="keyframes",repeat:r=0,repeatDelay:c=0,repeatType:d,velocity:u=0}=this.options,p=zm(o)?o:LR[o]||id;let m,g;p!==id&&typeof s[0]!="number"&&(m=ml(zR,z_(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=B_(v));const{calculatedDuration:b}=v,x=b+c,S=x*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:b,resolvedDuration:x,totalDuration:S}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,o=!1){const{resolved:r}=this;if(!r){const{keyframes:I}=this.options;return{done:!0,value:I[I.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:x,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)),o?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const T=this.currentTime-x*(this.speed>=0?1:-1),C=this.speed>=0?T<0:T>v;this.currentTime=Math.max(T,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let D=this.currentTime,O=d;if(S){const I=Math.min(this.currentTime,v)/b;let U=Math.floor(I),Q=I%1;!Q&&I>=1&&(Q=1),Q===1&&U--,U=Math.min(U,S+1),!!(U%2)&&(k==="reverse"?(Q=1-Q,w&&(Q-=w/b)):k==="mirror"&&(O=u)),D=ta(0,1,Q)*b}const E=C?{done:!1,value:m[0]}:O.next(D);p&&(E.value=p(E.value));let{done:A}=E;!C&&g!==null&&(A=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const P=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return P&&c!==void 0&&(E.value=Nd(m,this.options,c)),N&&N(E.value),P&&this.finish(),E}get duration(){const{resolved:s}=this;return s?Xs(s.calculatedDuration):0}get time(){return Xs(this.currentTime)}set time(s){s=Ws(s),this.currentTime=s,this.holdTime!==null||this.speed===0?this.holdTime=s:this.driver&&(this.startTime=this.driver.now()-s/this.speed)}get speed(){return this.playbackSpeed}set speed(s){const o=this.playbackSpeed!==s;this.playbackSpeed=s,o&&(this.time=Xs(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=BR,onPlay:o,startTime:r}=this.options;this.driver||(this.driver=s(d=>this.tick(d))),o&&o();const c=this.driver.now();this.holdTime!==null?this.startTime=c-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=c):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var s;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(s=this.currentTime)!==null&&s!==void 0?s:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:s}=this.options;s&&s()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(s){return this.startTime=0,this.tick(s,!0)}}const $R=new Set(["opacity","clipPath","filter","transform"]);function UR(t,s,o,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:p="easeInOut",times:m}={}){const g={[s]:o};m&&(g.offset=m);const v=f_(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 PR=Lm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),od=10,HR=2e4;function VR(t){return zm(t.type)||t.type==="spring"||!u_(t.ease)}function qR(t,s){const o=new Zm({...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<HR;)r=o.sample(d),c.push(r.value),d+=od;return{times:void 0,keyframes:c,duration:d-od,ease:"linear"}}const H_={anticipate:y_,backInOut:v_,circInOut:x_};function GR(t){return t in H_}class Hy extends O_{constructor(s){super(s);const{name:o,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new I_(d,(u,p)=>this.onKeyframesResolved(u,p),o,r,c),this.resolver.scheduleResolve()}initPlayback(s,o){let{duration:r=300,times:c,ease:d,type:u,motionValue:p,name:m,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof d=="string"&&sd()&&GR(d)&&(d=H_[d]),VR(this.options)){const{onComplete:b,onUpdate:x,motionValue:S,element:k,...w}=this.options,N=qR(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=UR(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(Ay(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(Nd(s,this.options,o)),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:o}=s;return Xs(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return Xs(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=Ws(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:o}=s;return o.playbackRate}set speed(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:o}=s;return o.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:o}=s;return o.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:o}=this;if(!o)return In;const{animation:r}=o;Ay(r,s)}return In}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:o,keyframes:r,duration:c,type:d,ease:u,times:p}=s;if(o.playState==="idle"||o.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:x,...S}=this.options,k=new Zm({...S,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),w=Ws(this.time);g.setWithVelocity(k.sample(w-od).value,k.sample(w).value,od)}const{onStop:m}=this.options;m&&m(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:o,name:r,repeatDelay:c,repeatType:d,damping:u,type:p}=s;if(!o||!o.owner||!(o.owner.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:g}=o.owner.getProps();return PR()&&r&&$R.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const FR={type:"spring",stiffness:500,damping:25,restSpeed:10},ZR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),KR={type:"keyframes",duration:.8},YR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},JR=(t,{keyframes:s})=>s.length>2?KR:Mi.has(t)?t.startsWith("scale")?ZR(s[1]):FR:YR;function WR({when:t,delay:s,delayChildren:o,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:p,from:m,elapsed:g,...v}){return!!Object.keys(v).length}const Km=(t,s,o,r={},c,d)=>u=>{const p=Mm(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-Ws(m);let v={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:x=>{s.set(x),p.onUpdate&&p.onUpdate(x)},onComplete:()=>{u(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:d?void 0:c};WR(p)||(v={...v,...JR(t,v)}),v.duration&&(v.duration=Ws(v.duration)),v.repeatDelay&&(v.repeatDelay=Ws(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 x=Nd(v.keyframes,p);if(x!==void 0)return _t.update(()=>{v.onUpdate(x),v.onComplete()}),new ED([])}return!d&&Hy.supports(v)?new Hy(v):new Zm(v)};function XR({protectedKeys:t,needsAnimating:s},o){const r=t.hasOwnProperty(o)&&s[o]!==!0;return s[o]=!1,r}function V_(t,s,{delay:o=0,transitionOverride:r,type:c}={}){var d;let{transition:u=t.getDefaultTransition(),transitionEnd:p,...m}=s;r&&(u=r);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const b in m){const x=t.getValue(b,(d=t.latestValues[b])!==null&&d!==void 0?d:null),S=m[b];if(S===void 0||v&&XR(v,b))continue;const k={delay:o,...Mm(u||{},b)};let w=!1;if(window.MotionHandoffAnimation){const T=c_(t);if(T){const C=window.MotionHandoffAnimation(T,b,_t);C!==null&&(k.startTime=C,w=!0)}}Lp(t,b),x.start(Km(b,x,S,t.shouldReduceMotion&&r_.has(b)?{type:!1}:k,t,w));const N=x.animation;N&&g.push(N)}return p&&Promise.all(g).then(()=>{_t.update(()=>{p&&wD(t,p)})}),g}function Fp(t,s,o={}){var r;const c=jd(t,s,o.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(d=o.transitionOverride);const u=c?()=>Promise.all(V_(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:x}=d;return QR(t,s,v+g,b,x,o)}:()=>Promise.resolve(),{when:m}=d;if(m){const[g,v]=m==="beforeChildren"?[u,p]:[p,u];return g().then(()=>v())}else return Promise.all([u(),p(o.delay)])}function QR(t,s,o=0,r=0,c=1,d){const u=[],p=(t.variantChildren.size-1)*r,m=c===1?(g=0)=>g*r:(g=0)=>p-g*r;return Array.from(t.variantChildren).sort(eM).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(Fp(g,s,{...d,delay:o+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function eM(t,s){return t.sortNodePosition(s)}function tM(t,s,o={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>Fp(t,d,o));r=Promise.all(c)}else if(typeof s=="string")r=Fp(t,s,o);else{const c=typeof s=="function"?jd(t,s,o.custom):s;r=Promise.all(V_(t,c,o))}return r.then(()=>{t.notify("AnimationComplete",s)})}const nM=_m.length;function q_(t){if(!t)return;if(!t.isControllingVariants){const o=t.parent?q_(t.parent)||{}:{};return t.props.initial!==void 0&&(o.initial=t.props.initial),o}const s={};for(let o=0;o<nM;o++){const r=_m[o],c=t.props[r];(sl(c)||c===!1)&&(s[r]=c)}return s}const sM=[...xm].reverse(),aM=xm.length;function iM(t){return s=>Promise.all(s.map(({animation:o,options:r})=>tM(t,o,r)))}function oM(t){let s=iM(t),o=Vy(),r=!0;const c=m=>(g,v)=>{var b;const x=jd(t,v,m==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(x){const{transition:S,transitionEnd:k,...w}=x;g={...g,...w,...k}}return g};function d(m){s=m(t)}function u(m){const{props:g}=t,v=q_(t.parent)||{},b=[],x=new Set;let S={},k=1/0;for(let N=0;N<aM;N++){const T=sM[N],C=o[T],D=g[T]!==void 0?g[T]:v[T],O=sl(D),E=T===m?C.isActive:null;E===!1&&(k=N);let A=D===v[T]&&D!==g[T]&&O;if(A&&r&&t.manuallyAnimateOnMount&&(A=!1),C.protectedKeys={...S},!C.isActive&&E===null||!D&&!C.prevProp||Td(D)||typeof D=="boolean")continue;const P=rM(C.prevProp,D);let I=P||T===m&&C.isActive&&!A&&O||N>k&&O,U=!1;const Q=Array.isArray(D)?D:[D];let $=Q.reduce(c(T),{});E===!1&&($={});const{prevResolvedValues:H={}}=C,ue={...H,...$},W=Z=>{I=!0,x.has(Z)&&(U=!0,x.delete(Z)),C.needsAnimating[Z]=!0;const J=t.getValue(Z);J&&(J.liveStyle=!1)};for(const Z in ue){const J=$[Z],ce=H[Z];if(S.hasOwnProperty(Z))continue;let X=!1;Bp(J)&&Bp(ce)?X=!o_(J,ce):X=J!==ce,X?J!=null?W(Z):x.add(Z):J!==void 0&&x.has(Z)?W(Z):C.protectedKeys[Z]=!0}C.prevProp=D,C.prevResolvedValues=$,C.isActive&&(S={...S,...$}),r&&t.blockInitialAnimation&&(I=!1),I&&(!(A&&P)||U)&&b.push(...Q.map(Z=>({animation:Z,options:{type:T}})))}if(x.size){const N={};x.forEach(T=>{const C=t.getBaseTarget(T),D=t.getValue(T);D&&(D.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(o[m].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(x=>{var S;return(S=x.animationState)===null||S===void 0?void 0:S.setActive(m,g)}),o[m].isActive=g;const b=u(m);for(const x in o)o[x].protectedKeys={};return b}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>o,reset:()=>{o=Vy(),r=!0}}}function rM(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!o_(s,t):!1}function vi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Vy(){return{animate:vi(!0),whileInView:vi(),whileHover:vi(),whileTap:vi(),whileDrag:vi(),whileFocus:vi(),exit:vi()}}class qa{constructor(s){this.isMounted=!1,this.node=s}update(){}}class lM extends qa{constructor(s){super(s),s.animationState||(s.animationState=oM(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Td(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:o}=this.node.prevProps||{};s!==o&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let cM=0;class dM extends qa{constructor(){super(...arguments),this.id=cM++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:o}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===r)return;const c=this.node.animationState.setActive("exit",!s);o&&!s&&c.then(()=>o(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const uM={animation:{Feature:lM},exit:{Feature:dM}},cs={x:!1,y:!1};function G_(){return cs.x||cs.y}function fM(t){return t==="x"||t==="y"?cs[t]?null:(cs[t]=!0,()=>{cs[t]=!1}):cs.x||cs.y?null:(cs.x=cs.y=!0,()=>{cs.x=cs.y=!1})}const Ym=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function rl(t,s,o,r={passive:!0}){return t.addEventListener(s,o,r),()=>t.removeEventListener(s,o)}function hl(t){return{point:{x:t.pageX,y:t.pageY}}}const pM=t=>s=>Ym(s)&&t(s,hl(s));function Yr(t,s,o,r){return rl(t,s,pM(o),r)}const qy=(t,s)=>Math.abs(t-s);function mM(t,s){const o=qy(t.x,s.x),r=qy(t.y,s.y);return Math.sqrt(o**2+r**2)}class F_{constructor(s,o,{transformPagePoint:r,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=up(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,S=mM(b.offset,{x:0,y:0})>=3;if(!x&&!S)return;const{point:k}=b,{timestamp:w}=rn;this.history.push({...k,timestamp:w});const{onStart:N,onMove:T}=this.handlers;x||(N&&N(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,b)},this.handlePointerMove=(b,x)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=dp(x,this.transformPagePoint),_t.update(this.updatePoint,!0)},this.handlePointerUp=(b,x)=>{this.end();const{onEnd:S,onSessionEnd:k,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=up(b.type==="pointercancel"?this.lastMoveEventInfo:dp(x,this.transformPagePoint),this.history);this.startEvent&&S&&S(b,N),k&&k(b,N)},!Ym(s))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=r,this.contextWindow=c||window;const u=hl(s),p=dp(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=rn;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=o;v&&v(s,up(p,this.history)),this.removeListeners=ml(Yr(this.contextWindow,"pointermove",this.handlePointerMove),Yr(this.contextWindow,"pointerup",this.handlePointerUp),Yr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Ua(this.updatePoint)}}function dp(t,s){return s?{point:s(t.point)}:t}function Gy(t,s){return{x:t.x-s.x,y:t.y-s.y}}function up({point:t},s){return{point:t,delta:Gy(t,Z_(s)),offset:Gy(t,hM(s)),velocity:gM(s,.1)}}function hM(t){return t[0]}function Z_(t){return t[t.length-1]}function gM(t,s){if(t.length<2)return{x:0,y:0};let o=t.length-1,r=null;const c=Z_(t);for(;o>=0&&(r=t[o],!(c.timestamp-r.timestamp>Ws(s)));)o--;if(!r)return{x:0,y:0};const d=Xs(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 K_=1e-4,vM=1-K_,yM=1+K_,Y_=.01,bM=0-Y_,xM=0+Y_;function Bn(t){return t.max-t.min}function _M(t,s,o){return Math.abs(t-s)<=o}function Fy(t,s,o,r=.5){t.origin=r,t.originPoint=Nt(s.min,s.max,t.origin),t.scale=Bn(o)/Bn(s),t.translate=Nt(o.min,o.max,t.origin)-t.originPoint,(t.scale>=vM&&t.scale<=yM||isNaN(t.scale))&&(t.scale=1),(t.translate>=bM&&t.translate<=xM||isNaN(t.translate))&&(t.translate=0)}function Jr(t,s,o,r){Fy(t.x,s.x,o.x,r?r.originX:void 0),Fy(t.y,s.y,o.y,r?r.originY:void 0)}function Zy(t,s,o){t.min=o.min+s.min,t.max=t.min+Bn(s)}function kM(t,s,o){Zy(t.x,s.x,o.x),Zy(t.y,s.y,o.y)}function Ky(t,s,o){t.min=s.min-o.min,t.max=t.min+Bn(s)}function Wr(t,s,o){Ky(t.x,s.x,o.x),Ky(t.y,s.y,o.y)}function SM(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?Nt(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?Nt(o,t,r.max):Math.min(t,o)),t}function Yy(t,s,o){return{min:s!==void 0?t.min+s:void 0,max:o!==void 0?t.max+o-(t.max-t.min):void 0}}function TM(t,{top:s,left:o,bottom:r,right:c}){return{x:Yy(t.x,o,c),y:Yy(t.y,s,r)}}function Jy(t,s){let o=s.min-t.min,r=s.max-t.max;return s.max-s.min<t.max-t.min&&([o,r]=[r,o]),{min:o,max:r}}function wM(t,s){return{x:Jy(t.x,s.x),y:Jy(t.y,s.y)}}function jM(t,s){let o=.5;const r=Bn(t),c=Bn(s);return c>r?o=Bo(s.min,s.max-r,t.min):r>c&&(o=Bo(t.min,t.max-c,s.min)),ta(0,1,o)}function NM(t,s){const o={};return s.min!==void 0&&(o.min=s.min-t.min),s.max!==void 0&&(o.max=s.max-t.min),o}const Zp=.35;function CM(t=Zp){return t===!1?t=0:t===!0&&(t=Zp),{x:Wy(t,"left","right"),y:Wy(t,"top","bottom")}}function Wy(t,s,o){return{min:Xy(t,s),max:Xy(t,o)}}function Xy(t,s){return typeof t=="number"?t:t[s]||0}const Qy=()=>({translate:0,scale:1,origin:0,originPoint:0}),Co=()=>({x:Qy(),y:Qy()}),eb=()=>({min:0,max:0}),Lt=()=>({x:eb(),y:eb()});function Wn(t){return[t("x"),t("y")]}function J_({top:t,left:s,right:o,bottom:r}){return{x:{min:s,max:o},y:{min:t,max:r}}}function EM({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function AM(t,s){if(!s)return t;const o=s({x:t.left,y:t.top}),r=s({x:t.right,y:t.bottom});return{top:o.y,left:o.x,bottom:r.y,right:r.x}}function fp(t){return t===void 0||t===1}function Kp({scale:t,scaleX:s,scaleY:o}){return!fp(t)||!fp(s)||!fp(o)}function ki(t){return Kp(t)||W_(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function W_(t){return tb(t.x)||tb(t.y)}function tb(t){return t&&t!=="0%"}function rd(t,s,o){const r=t-o,c=s*r;return o+c}function nb(t,s,o,r,c){return c!==void 0&&(t=rd(t,c,r)),rd(t,o,r)+s}function Yp(t,s=0,o=1,r,c){t.min=nb(t.min,s,o,r,c),t.max=nb(t.max,s,o,r,c)}function X_(t,{x:s,y:o}){Yp(t.x,s.translate,s.scale,s.originPoint),Yp(t.y,o.translate,o.scale,o.originPoint)}const sb=.999999999999,ab=1.0000000000001;function DM(t,s,o,r=!1){const c=o.length;if(!c)return;s.x=s.y=1;let d,u;for(let p=0;p<c;p++){d=o[p],u=d.projectionDelta;const{visualElement:m}=d.options;m&&m.props.style&&m.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Ao(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,X_(t,u)),r&&ki(d.latestValues)&&Ao(t,d.latestValues))}s.x<ab&&s.x>sb&&(s.x=1),s.y<ab&&s.y>sb&&(s.y=1)}function Eo(t,s){t.min=t.min+s,t.max=t.max+s}function ib(t,s,o,r,c=.5){const d=Nt(t.min,t.max,c);Yp(t,s,o,d,r)}function Ao(t,s){ib(t.x,s.x,s.scaleX,s.scale,s.originX),ib(t.y,s.y,s.scaleY,s.scale,s.originY)}function Q_(t,s){return J_(AM(t.getBoundingClientRect(),s))}function RM(t,s,o){const r=Q_(t,o),{scroll:c}=s;return c&&(Eo(r.x,c.offset.x),Eo(r.y,c.offset.y)),r}const e1=({current:t})=>t?t.ownerDocument.defaultView:null,MM=new WeakMap;class IM{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=Lt(),this.visualElement=s}start(s,{snapToCursor:o=!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(),o&&this.snapToCursor(hl(v).point)},d=(v,b)=>{const{drag:x,dragPropagation:S,onDragStart:k}=this.getProps();if(x&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=fM(x),!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),Wn(N=>{let T=this.getAxisMotionValue(N).get()||0;if(ws.test(T)){const{projection:C}=this.visualElement;if(C&&C.layout){const D=C.layout.layoutBox[N];D&&(T=Bn(D)*(parseFloat(T)/100))}}this.originPoint[N]=T}),k&&_t.postRender(()=>k(v,b)),Lp(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},u=(v,b)=>{const{dragPropagation:x,dragDirectionLock:S,onDirectionLock:k,onDrag:w}=this.getProps();if(!x&&!this.openDragLock)return;const{offset:N}=b;if(S&&this.currentDirection===null){this.currentDirection=OM(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=()=>Wn(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 F_(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:e1(this.visualElement)})}stop(s,o){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&_t.postRender(()=>d(s,o))}cancel(){this.isDragging=!1;const{projection:s,animationState:o}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(s,o,r){const{drag:c}=this.getProps();if(!r||!Bc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=SM(u,this.constraints[s],this.elastic[s])),d.set(u)}resolveConstraints(){var s;const{dragConstraints:o,dragElastic:r}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)===null||s===void 0?void 0:s.layout,d=this.constraints;o&&jo(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=TM(c.layoutBox,o):this.constraints=!1,this.elastic=CM(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Wn(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=NM(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:o}=this.getProps();if(!s||!jo(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=RM(r,c.root,this.visualElement.getTransformPagePoint());let u=wM(c.layout.layoutBox,d);if(o){const p=o(EM(u));this.hasMutatedConstraints=!!p,p&&(u=J_(p))}return u}startAnimation(s){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=Wn(v=>{if(!Bc(v,o,this.currentDirection))return;let b=m&&m[v]||{};u&&(b={min:0,max:0});const x=c?200:1e6,S=c?40:1e7,k={type:"inertia",velocity:r?s[v]:0,bounceStiffness:x,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...d,...b};return this.startAxisValueAnimation(v,k)});return Promise.all(g).then(p)}startAxisValueAnimation(s,o){const r=this.getAxisMotionValue(s);return Lp(this.visualElement,s),r.start(Km(s,r,0,o,this.visualElement,!1))}stopAnimation(){Wn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Wn(s=>{var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(s){var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(s){const o=`_drag${s.toUpperCase()}`,r=this.visualElement.getProps(),c=r[o];return c||this.visualElement.getValue(s,(r.initial?r.initial[s]:void 0)||0)}snapToCursor(s){Wn(o=>{const{drag:r}=this.getProps();if(!Bc(o,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:u,max:p}=c.layout.layoutBox[o];d.set(s[o]-Nt(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!jo(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Wn(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=jM({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(),Wn(u=>{if(!Bc(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(Nt(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;MM.set(this.visualElement,this);const s=this.visualElement.current,o=Yr(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();jo(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=rl(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(Wn(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(),o(),d(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:u=Zp,dragMomentum:p=!0}=s;return{...s,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function Bc(t,s,o){return(s===!0||s===t)&&(o===null||o===t)}function OM(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class BM extends qa{constructor(s){super(s),this.removeGroupControls=In,this.removeListeners=In,this.controls=new IM(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||In}unmount(){this.removeGroupControls(),this.removeListeners()}}const ob=t=>(s,o)=>{t&&_t.postRender(()=>t(s,o))};class LM extends qa{constructor(){super(...arguments),this.removePointerDownListener=In}onPointerDown(s){this.session=new F_(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:e1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:o,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:ob(s),onStart:ob(o),onMove:r,onEnd:(d,u)=>{delete this.session,c&&_t.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Yr(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 Jc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function rb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Br={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(De.test(t))t=parseFloat(t);else return t;const o=rb(t,s.target.x),r=rb(t,s.target.y);return`${o}% ${r}%`}},zM={correct:(t,{treeScale:s,projectionDelta:o})=>{const r=t,c=Pa.parse(t);if(c.length>5)return r;const d=Pa.createTransformer(t),u=typeof c[0]!="number"?1:0,p=o.x.scale*s.x,m=o.y.scale*s.y;c[0+u]/=p,c[1+u]/=m;const g=Nt(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 $M extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;uD(UM),d&&(o.group&&o.group.add(d),r&&r.register&&c&&r.register(d),d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,onExitComplete:()=>this.safeToRemove()})),Jc.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:o,visualElement:r,drag:c,isPresent:d}=this.props,u=r.projection;return u&&(u.isPresent=d,c||s.layoutDependency!==o||o===void 0?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||_t.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Sm.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),r&&r.deregister&&r.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function t1(t){const[s,o]=$x(),r=y.useContext(gm);return i.jsx($M,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(Zx),isPresent:s,safeToRemove:o})}const UM={borderRadius:{...Br,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Br,borderTopRightRadius:Br,borderBottomLeftRadius:Br,borderBottomRightRadius:Br,boxShadow:zM};function PM(t,s,o){const r=dn(t)?t:il(t);return r.start(Km("",r,s,o)),r.animation}function HM(t){return t instanceof SVGElement&&t.tagName!=="svg"}const VM=(t,s)=>t.depth-s.depth;class qM{constructor(){this.children=[],this.isDirty=!1}add(s){Im(this.children,s),this.isDirty=!0}remove(s){Om(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(VM),this.isDirty=!1,this.children.forEach(s)}}function GM(t,s){const o=js.now(),r=({timestamp:c})=>{const d=c-o;d>=s&&(Ua(r),t(d-s))};return _t.read(r,!0),()=>Ua(r)}const n1=["TopLeft","TopRight","BottomLeft","BottomRight"],FM=n1.length,lb=t=>typeof t=="string"?parseFloat(t):t,cb=t=>typeof t=="number"||De.test(t);function ZM(t,s,o,r,c,d){c?(t.opacity=Nt(0,o.opacity!==void 0?o.opacity:1,KM(r)),t.opacityExit=Nt(s.opacity!==void 0?s.opacity:1,0,YM(r))):d&&(t.opacity=Nt(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<FM;u++){const p=`border${n1[u]}Radius`;let m=db(s,p),g=db(o,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||cb(m)===cb(g)?(t[p]=Math.max(Nt(lb(m),lb(g),r),0),(ws.test(g)||ws.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||o.rotate)&&(t.rotate=Nt(s.rotate||0,o.rotate||0,r))}function db(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const KM=s1(0,.5,b_),YM=s1(.5,.95,In);function s1(t,s,o){return r=>r<t?0:r>s?1:o(Bo(t,s,r))}function ub(t,s){t.min=s.min,t.max=s.max}function Kn(t,s){ub(t.x,s.x),ub(t.y,s.y)}function fb(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function pb(t,s,o,r,c){return t-=s,t=rd(t,1/o,r),c!==void 0&&(t=rd(t,1/c,r)),t}function JM(t,s=0,o=1,r=.5,c,d=t,u=t){if(ws.test(s)&&(s=parseFloat(s),s=Nt(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=Nt(d.min,d.max,r);t===d&&(p-=s),t.min=pb(t.min,s,o,p,c),t.max=pb(t.max,s,o,p,c)}function mb(t,s,[o,r,c],d,u){JM(t,s[o],s[r],s[c],s.scale,d,u)}const WM=["x","scaleX","originX"],XM=["y","scaleY","originY"];function hb(t,s,o,r){mb(t.x,s,WM,o?o.x:void 0,r?r.x:void 0),mb(t.y,s,XM,o?o.y:void 0,r?r.y:void 0)}function gb(t){return t.translate===0&&t.scale===1}function a1(t){return gb(t.x)&&gb(t.y)}function vb(t,s){return t.min===s.min&&t.max===s.max}function QM(t,s){return vb(t.x,s.x)&&vb(t.y,s.y)}function yb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function i1(t,s){return yb(t.x,s.x)&&yb(t.y,s.y)}function bb(t){return Bn(t.x)/Bn(t.y)}function xb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class e4{constructor(){this.members=[]}add(s){Im(this.members,s),s.scheduleRender()}remove(s){if(Om(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const o=this.members[this.members.length-1];o&&this.promote(o)}}relegate(s){const o=this.members.findIndex(c=>s===c);if(o===0)return!1;let r;for(let c=o;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){r=d;break}}return r?(this.promote(r),!0):!1}promote(s,o){const r=this.lead;if(s!==r&&(this.prevLead=r,this.lead=s,s.show(),r)){r.instance&&r.scheduleRender(),s.scheduleRender(),s.resumeFrom=r,o&&(s.resumeFrom.preserveOpacity=!0),r.snapshot&&(s.snapshot=r.snapshot,s.snapshot.latestValues=r.animationValues||r.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:o,resumingFrom:r}=s;o.onExitComplete&&o.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function t4(t,s,o){let r="";const c=t.x.translate/s.x,d=t.y.translate/s.y,u=(o==null?void 0:o.z)||0;if((c||d||u)&&(r=`translate3d(${c}px, ${d}px, ${u}px) `),(s.x!==1||s.y!==1)&&(r+=`scale(${1/s.x}, ${1/s.y}) `),o){const{transformPerspective:g,rotate:v,rotateX:b,rotateY:x,skewX:S,skewY:k}=o;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),b&&(r+=`rotateX(${b}deg) `),x&&(r+=`rotateY(${x}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 Si={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},qr=typeof window<"u"&&window.MotionDebug!==void 0,pp=["","X","Y","Z"],n4={visibility:"hidden"},_b=1e3;let s4=0;function mp(t,s,o,r){const{latestValues:c}=s;c[t]&&(o[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function o1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const o=c_(s);if(window.MotionHasOptimisedAnimation(o,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(o,"transform",_t,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&o1(r)}function r1({attachResizeListener:t,defaultParent:s,measureScroll:o,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=s4++,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,qr&&(Si.totalNodes=Si.resolvedTargetDeltas=Si.recalculatedProjection=0),this.nodes.forEach(o4),this.nodes.forEach(u4),this.nodes.forEach(f4),this.nodes.forEach(r4),qr&&window.MotionDebug.record(Si)},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 qM)}addEventListener(u,p){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Bm),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=HM(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 x=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=GM(x,250),Jc.hasAnimatedSinceResize&&(Jc.hasAnimatedSinceResize=!1,this.nodes.forEach(Sb))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:x,hasRelativeTargetChanged:S,layout:k})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||v.getDefaultTransition()||v4,{onLayoutAnimationStart:N,onLayoutAnimationComplete:T}=v.getProps(),C=!this.targetLayout||!i1(this.targetLayout,k)||S,D=!x&&S;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||D||x&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,D);const O={...Mm(w,"layout"),onPlay:N,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(O.delay=0,O.type=!1),this.startAnimation(O)}else x||Sb(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,Ua(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(p4),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&&o1(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(kb);return}this.isUpdating||this.nodes.forEach(c4),this.isUpdating=!1,this.nodes.forEach(d4),this.nodes.forEach(a4),this.nodes.forEach(i4),this.clearAllSnapshots();const p=js.now();rn.delta=ta(0,1e3/60,p-rn.timestamp),rn.timestamp=p,rn.isProcessing=!0,ip.update.process(rn),ip.preRender.process(rn),ip.render.process(rn),rn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Sm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(l4),this.sharedNodes.forEach(m4)}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=Lt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(p=!1),p){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:o(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!a1(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||ki(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)),y4(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return Lt();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(b4))){const{scroll:v}=this.root;v&&(Eo(m.x,v.offset.x),Eo(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=Lt();if(Kn(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:x}=v;v!==this.root&&b&&x.layoutScroll&&(b.wasRoot&&Kn(m,u),Eo(m.x,b.offset.x),Eo(m.y,b.offset.y))}return m}applyTransform(u,p=!1){const m=Lt();Kn(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&&Ao(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),ki(v.latestValues)&&Ao(m,v.latestValues)}return ki(this.latestValues)&&Ao(m,this.latestValues),m}removeTransform(u){const p=Lt();Kn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!ki(g.latestValues))continue;Kp(g.latestValues)&&g.updateSnapshot();const v=Lt(),b=g.measurePageBox();Kn(v,b),hb(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return ki(this.latestValues)&&hb(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!==rn.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:x}=this.options;if(!(!this.layout||!(b||x))){if(this.resolvedRelativeTargetAt=rn.timestamp,!this.targetDelta&&!this.relativeTarget){const S=this.getClosestProjectingParent();S&&S.layout&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Lt(),this.relativeTargetOrigin=Lt(),Wr(this.relativeTargetOrigin,this.layout.layoutBox,S.layout.layoutBox),Kn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Lt(),this.targetWithTransforms=Lt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),kM(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Kn(this.target,this.layout.layoutBox),X_(this.target,this.targetDelta)):Kn(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=Lt(),this.relativeTargetOrigin=Lt(),Wr(this.relativeTargetOrigin,this.target,S.target),Kn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}qr&&Si.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Kp(this.parent.latestValues)||W_(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===rn.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;Kn(this.layoutCorrected,this.layout.layoutBox);const x=this.treeScale.x,S=this.treeScale.y;DM(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=Lt());const{target:k}=p;if(!k){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(fb(this.prevProjectionDelta.x,this.projectionDelta.x),fb(this.prevProjectionDelta.y,this.projectionDelta.y)),Jr(this.projectionDelta,this.layoutCorrected,k,this.latestValues),(this.treeScale.x!==x||this.treeScale.y!==S||!xb(this.projectionDelta.x,this.prevProjectionDelta.x)||!xb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",k)),qr&&Si.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=Co(),this.projectionDelta=Co(),this.projectionDeltaWithTransform=Co()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},b=Co();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const x=Lt(),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(g4));this.animationProgress=0;let D;this.mixTargetDelta=O=>{const E=O/1e3;Tb(b.x,u.x,E),Tb(b.y,u.y,E),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Wr(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),h4(this.relativeTarget,this.relativeTargetOrigin,x,E),D&&QM(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=Lt()),Kn(D,this.relativeTarget)),w&&(this.animationValues=v,ZM(v,g,this.latestValues,E,C,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ua(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=_t.update(()=>{Jc.hasAnimatedSinceResize=!0,this.currentAnimation=PM(0,_b,{...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(_b),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&&l1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Lt();const b=Bn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const x=Bn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+x}Kn(p,m),Ao(p,v),Jr(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new e4),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&&mp("z",u,g,this.animationValues);for(let v=0;v<pp.length;v++)mp(`rotate${pp[v]}`,u,g,this.animationValues),mp(`skew${pp[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 n4;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=Kc(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=Kc(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!ki(this.latestValues)&&(w.transform=v?v({},""):"none",this.hasProjected=!1),w}const x=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=t4(this.projectionDeltaWithTransform,this.treeScale,x),v&&(g.transform=v(x,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=x.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:x.opacityExit:g.opacity=b===this?x.opacity!==void 0?x.opacity:"":x.opacityExit!==void 0?x.opacityExit:0;for(const w in nd){if(x[w]===void 0)continue;const{correct:N,applyTo:T}=nd[w],C=g.transform==="none"?x[w]:N(x[w],b);if(T){const D=T.length;for(let O=0;O<D;O++)g[T[O]]=C}else g[w]=C}return this.options.layoutId&&(g.pointerEvents=b===this?Kc(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(kb),this.root.sharedNodes.clear()}}}function a4(t){t.updateLayout()}function i4(t){var s;const o=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:c}=t.layout,{animationType:d}=t.options,u=o.source!==t.layout.source;d==="size"?Wn(b=>{const x=u?o.measuredBox[b]:o.layoutBox[b],S=Bn(x);x.min=r[b].min,x.max=x.min+S}):l1(d,o.layoutBox,r)&&Wn(b=>{const x=u?o.measuredBox[b]:o.layoutBox[b],S=Bn(r[b]);x.max=x.min+S,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+S)});const p=Co();Jr(p,r,o.layoutBox);const m=Co();u?Jr(m,t.applyTransform(c,!0),o.measuredBox):Jr(m,r,o.layoutBox);const g=!a1(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:x,layout:S}=b;if(x&&S){const k=Lt();Wr(k,o.layoutBox,x.layoutBox);const w=Lt();Wr(w,r,S.layoutBox),i1(k,w)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=k,t.relativeParent=b)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:o,delta:m,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function o4(t){qr&&Si.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 r4(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function l4(t){t.clearSnapshot()}function kb(t){t.clearMeasurements()}function c4(t){t.isLayoutDirty=!1}function d4(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function Sb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function u4(t){t.resolveTargetDelta()}function f4(t){t.calcProjection()}function p4(t){t.resetSkewAndRotation()}function m4(t){t.removeLeadSnapshot()}function Tb(t,s,o){t.translate=Nt(s.translate,0,o),t.scale=Nt(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function wb(t,s,o,r){t.min=Nt(s.min,o.min,r),t.max=Nt(s.max,o.max,r)}function h4(t,s,o,r){wb(t.x,s.x,o.x,r),wb(t.y,s.y,o.y,r)}function g4(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const v4={duration:.45,ease:[.4,0,.1,1]},jb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Nb=jb("applewebkit/")&&!jb("chrome/")?Math.round:In;function Cb(t){t.min=Nb(t.min),t.max=Nb(t.max)}function y4(t){Cb(t.x),Cb(t.y)}function l1(t,s,o){return t==="position"||t==="preserve-aspect"&&!_M(bb(s),bb(o),.2)}function b4(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const x4=r1({attachResizeListener:(t,s)=>rl(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),hp={current:void 0},c1=r1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!hp.current){const t=new x4({});t.mount(window),t.setOptions({layoutScroll:!0}),hp.current=t}return hp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),_4={pan:{Feature:LM},drag:{Feature:BM,ProjectionNode:c1,MeasureLayout:t1}};function k4(t,s,o){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let c=document;const d=(r=void 0)!==null&&r!==void 0?r:c.querySelectorAll(t);return d?Array.from(d):[]}return Array.from(t)}function d1(t,s){const o=k4(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[o,c,()=>r.abort()]}function Eb(t){return s=>{s.pointerType==="touch"||G_()||t(s)}}function S4(t,s,o={}){const[r,c,d]=d1(t,o),u=Eb(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=Eb(b=>{g(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function Ab(t,s,o){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",o==="Start");const c="onHover"+o,d=r[c];d&&_t.postRender(()=>d(s,hl(s)))}class T4 extends qa{mount(){const{current:s}=this.node;s&&(this.unmount=S4(s,o=>(Ab(this.node,o,"Start"),r=>Ab(this.node,r,"End"))))}unmount(){}}class w4 extends qa{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=ml(rl(this.node.current,"focus",()=>this.onFocus()),rl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const u1=(t,s)=>s?t===s?!0:u1(t,s.parentElement):!1,j4=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function N4(t){return j4.has(t.tagName)||t.tabIndex!==-1}const Gr=new WeakSet;function Db(t){return s=>{s.key==="Enter"&&t(s)}}function gp(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const C4=(t,s)=>{const o=t.currentTarget;if(!o)return;const r=Db(()=>{if(Gr.has(o))return;gp(o,"down");const c=Db(()=>{gp(o,"up")}),d=()=>gp(o,"cancel");o.addEventListener("keyup",c,s),o.addEventListener("blur",d,s)});o.addEventListener("keydown",r,s),o.addEventListener("blur",()=>o.removeEventListener("keydown",r),s)};function Rb(t){return Ym(t)&&!G_()}function E4(t,s,o={}){const[r,c,d]=d1(t,o),u=p=>{const m=p.currentTarget;if(!Rb(p)||Gr.has(m))return;Gr.add(m);const g=s(p),v=(S,k)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",x),!(!Rb(S)||!Gr.has(m))&&(Gr.delete(m),typeof g=="function"&&g(S,{success:k}))},b=S=>{v(S,o.useGlobalTarget||u1(m,S.target))},x=S=>{v(S,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",x,c)};return r.forEach(p=>{!N4(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(o.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>C4(g,c),c)}),d}function Mb(t,s,o){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",o==="Start");const c="onTap"+(o==="End"?"":o),d=r[c];d&&_t.postRender(()=>d(s,hl(s)))}class A4 extends qa{mount(){const{current:s}=this.node;s&&(this.unmount=E4(s,o=>(Mb(this.node,o,"Start"),(r,{success:c})=>Mb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Jp=new WeakMap,vp=new WeakMap,D4=t=>{const s=Jp.get(t.target);s&&s(t)},R4=t=>{t.forEach(D4)};function M4({root:t,...s}){const o=t||document;vp.has(o)||vp.set(o,{});const r=vp.get(o),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(R4,{root:t,...s})),r[c]}function I4(t,s,o){const r=M4(s);return Jp.set(t,o),r.observe(t),()=>{Jp.delete(t),r.unobserve(t)}}const O4={some:0,all:1};class B4 extends qa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:o,margin:r,amount:c="some",once:d}=s,u={root:o?o.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:O4[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(),x=g?v:b;x&&x(m)};return I4(this.node.current,u,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:o}=this.node;["amount","margin","root"].some(L4(s,o))&&this.startObserver()}unmount(){}}function L4({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const z4={inView:{Feature:B4},tap:{Feature:A4},focus:{Feature:w4},hover:{Feature:T4}},$4={layout:{ProjectionNode:c1,MeasureLayout:t1}},ld={current:null},Jm={current:!1};function f1(){if(Jm.current=!0,!!bm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>ld.current=t.matches;t.addListener(s),s()}else ld.current=!1}const U4=[...M_,cn,Pa],P4=t=>U4.find(R_(t)),Ib=new WeakMap;function H4(t,s,o){for(const r in s){const c=s[r],d=o[r];if(dn(c))t.addValue(r,c);else if(dn(d))t.addValue(r,il(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,il(u!==void 0?u:c,{owner:t}))}}for(const r in o)s[r]===void 0&&t.removeValue(r);return s}const Ob=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class V4{scrapeMotionValuesFromProps(s,o,r){return{}}constructor({parent:s,props:o,presenceContext:r,reducedMotionConfig:c,blockInitialAnimation:d,visualState:u},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Gm,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=js.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=o.initial?{...m}:{},this.renderState=g,this.parent=s,this.props=o,this.presenceContext=r,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=wd(o),this.isVariantNode=Gx(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,...x}=this.scrapeMotionValuesFromProps(o,{},this);for(const S in x){const k=x[S];m[S]!==void 0&&dn(k)&&k.set(m[S],!1)}}mount(s){this.current=s,Ib.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,r)=>this.bindToMotionValue(r,o)),Jm.current||f1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:ld.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Ib.delete(this.current),this.projection&&this.projection.unmount(),Ua(this.notifyUpdate),Ua(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const o=this.features[s];o&&(o.unmount(),o.isMounted=!1)}this.current=null}bindToMotionValue(s,o){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const r=Mi.has(s),c=o.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&_t.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,s,o)),this.valueSubscriptions.set(s,()=>{c(),d(),u&&u(),o.owner&&o.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in Oo){const o=Oo[s];if(!o)continue;const{isEnabled:r,Feature:c}=o;if(!this.features[s]&&c&&r(this.props)&&(this.features[s]=new c(this)),this.features[s]){const d=this.features[s];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Lt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,o){this.latestValues[s]=o}update(s,o){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let r=0;r<Ob.length;r++){const c=Ob[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=H4(this,this.scrapeMotionValuesFromProps(s,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const o=this.getClosestVariantNode();if(o)return o.variantChildren&&o.variantChildren.add(s),()=>o.variantChildren.delete(s)}addValue(s,o){const r=this.values.get(s);o!==r&&(r&&this.removeValue(s),this.bindToMotionValue(s,o),this.values.set(s,o),this.latestValues[s]=o.get())}removeValue(s){this.values.delete(s);const o=this.valueSubscriptions.get(s);o&&(o(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,o){if(this.props.values&&this.props.values[s])return this.props.values[s];let r=this.values.get(s);return r===void 0&&o!==void 0&&(r=il(o===null?void 0:o,{owner:this}),this.addValue(s,r)),r}readValue(s,o){var r;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(r=this.getBaseTargetFromProps(this.props,s))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(A_(c)||__(c))?c=parseFloat(c):!P4(c)&&Pa.test(o)&&(c=N_(s,o)),this.setBaseTarget(s,dn(c)?c.get():c)),dn(c)?c.get():c}setBaseTarget(s,o){this.baseTarget[s]=o}getBaseTarget(s){var o;const{initial:r}=this.props;let c;if(typeof r=="string"||typeof r=="object"){const u=wm(this.props,r,(o=this.presenceContext)===null||o===void 0?void 0:o.custom);u&&(c=u[s])}if(r&&c!==void 0)return c;const d=this.getBaseTargetFromProps(this.props,s);return d!==void 0&&!dn(d)?d:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,o){return this.events[s]||(this.events[s]=new Bm),this.events[s].add(o)}notify(s,...o){this.events[s]&&this.events[s].notify(...o)}}class p1 extends V4{constructor(){super(...arguments),this.KeyframeResolver=I_}sortInstanceNodePosition(s,o){return s.compareDocumentPosition(o)&2?1:-1}getBaseTargetFromProps(s,o){return s.style?s.style[o]:void 0}removeValueFromRenderState(s,{vars:o,style:r}){delete o[s],delete r[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;dn(s)&&(this.childSubscription=s.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}}function q4(t){return window.getComputedStyle(t)}class G4 extends p1{constructor(){super(...arguments),this.type="html",this.renderInstance=e_}readValueFromInstance(s,o){if(Mi.has(o)){const r=qm(o);return r&&r.default||0}else{const r=q4(s),c=(Wx(o)?r.getPropertyValue(o):r[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:o}){return Q_(s,o)}build(s,o,r){Cm(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return Rm(s,o,r)}}class F4 extends p1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Lt}getBaseTargetFromProps(s,o){return s[o]}readValueFromInstance(s,o){if(Mi.has(o)){const r=qm(o);return r&&r.default||0}return o=t_.has(o)?o:km(o),s.getAttribute(o)}scrapeMotionValuesFromProps(s,o,r){return a_(s,o,r)}build(s,o,r){Em(s,o,this.isSVGTag,r.transformTemplate)}renderInstance(s,o,r,c){n_(s,o,r,c)}mount(s){this.isSVGTag=Dm(s.tagName),super.mount(s)}}const Z4=(t,s)=>Tm(t)?new F4(s):new G4(s,{allowProjection:t!==y.Fragment}),K4=xD({...uM,...z4,..._4,...$4},Z4),Rt=OA(K4);function Y4(){!Jm.current&&f1();const[t]=y.useState(ld.current);return t}const J4="_overlay_cmicx_1",W4="_dialog_cmicx_11",X4="_title_cmicx_30",Q4="_description_cmicx_38",e3="_actions_cmicx_45",t3="_cancelButton_cmicx_52",n3="_confirmButton_cmicx_79",yi={overlay:J4,dialog:W4,title:X4,description:Q4,actions:e3,cancelButton:t3,confirmButton:n3};function Ei({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return i.jsx(us,{children:t&&i.jsx(Rt.div,{className:yi.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:m=>{m.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":o?p:void 0,children:i.jsxs(Rt.div,{className:yi.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:m=>m.stopPropagation(),children:[i.jsx("h3",{id:u,className:yi.title,children:s}),o&&i.jsx("p",{id:p,className:yi.description,children:o}),i.jsxs("div",{className:yi.actions,children:[i.jsx("button",{type:"button",className:yi.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),i.jsx("button",{type:"button",className:yi.confirmButton,onClick:c,children:r})]})]})})})}const s3="_skeleton_1gqp4_9",a3="_circular_1gqp4_17",i3="_textContainer_1gqp4_26",o3="_card_1gqp4_31",cd={skeleton:s3,circular:a3,textContainer:i3,card:o3};function we({width:t="100%",height:s="1rem",borderRadius:o,variant:r="rectangular",className:c}){const d=[cd.skeleton,r==="circular"?cd.circular:"",c??""].filter(Boolean).join(" ");return i.jsx("div",{className:d,style:{width:t,height:s,...o&&r!=="circular"?{borderRadius:o}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function Wp({lines:t=3,lastLineWidth:s="60%",lineHeight:o="0.75rem",gap:r="var(--space-sm)",className:c}){return i.jsx("div",{className:`${cd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>i.jsx(we,{width:u===t-1&&t>1?s:"100%",height:o},u))})}function dd({lines:t=2,className:s}){return i.jsxs("div",{className:`${cd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[i.jsx(we,{width:"40%",height:"1.25rem"}),i.jsx(Wp,{lines:t})]})}const r3="_spinner_1uyt1_1",l3="_spin_1uyt1_1",c3="_sm_1uyt1_14",d3="_md_1uyt1_20",u3="_lg_1uyt1_26",f3="_xl_1uyt1_32",Bb={spinner:r3,spin:l3,sm:c3,md:d3,lg:u3,xl:f3};function m1({size:t="md",className:s,label:o="Loading",liveRegion:r=!1}){return i.jsx("span",{className:`${Bb.spinner} ${Bb[t]} ${s??""}`,role:r?"status":void 0,"aria-label":o,"aria-hidden":r?void 0:!0})}const p3="_splash_1bn1g_1",m3="_logo_1bn1g_11",Lb={splash:p3,logo:m3};function h1(){return i.jsxs("div",{className:Lb.splash,"data-testid":"splash-screen",children:[i.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Lb.logo}),i.jsx(m1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const h3="_wrapper_4e5yt_1",g3="_wrapperBlock_4e5yt_6",v3="_tooltip_4e5yt_11",y3="_visible_4e5yt_31",b3="_top_4e5yt_41",x3="_bottom_4e5yt_48",_3="_left_4e5yt_55",k3="_right_4e5yt_62",Lr={wrapper:h3,wrapperBlock:g3,tooltip:v3,visible:y3,top:b3,bottom:x3,left:_3,right:k3},S3=300,Lc=6;function zo({text:t,placement:s="top",delayMs:o=S3,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),x=y.useRef(null),S=y.useRef(void 0),k=y.useId(),w=typeof document<"u",N=y.useCallback(()=>{if(!b.current||!x.current)return;const U=b.current.getBoundingClientRect(),Q=x.current.getBoundingClientRect();let $=0,H=0;switch(s){case"top":$=U.top-Q.height-Lc,H=U.left+U.width/2-Q.width/2;break;case"bottom":$=U.bottom+Lc,H=U.left+U.width/2-Q.width/2;break;case"left":$=U.top+U.height/2-Q.height/2,H=U.left-Q.width-Lc;break;case"right":$=U.top+U.height/2-Q.height/2,H=U.right+Lc;break}v({top:$,left:H})},[s]),T=y.useCallback(U=>{S.current!==void 0&&clearTimeout(S.current),S.current=setTimeout(()=>{N(),m(!0),S.current=void 0},U)},[N]),C=y.useCallback(()=>{T(o)},[o,T]),D=y.useCallback(()=>{T(0)},[T]),O=y.useCallback(()=>{S.current!==void 0&&(clearTimeout(S.current),S.current=void 0),m(!1)},[]);y.useEffect(()=>{if(!p)return;const U=Q=>{Q.key==="Escape"&&O()};return document.addEventListener("keydown",U),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{document.removeEventListener("keydown",U),window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[p,O,N]),y.useEffect(()=>()=>{S.current!==void 0&&clearTimeout(S.current)},[]);const E=r?"span":"div",A=[r?Lr.wrapper:Lr.wrapperBlock,d].filter(Boolean).join(" ");let P=c;if(y.isValidElement(c)){const U=c,Q=U.props["aria-describedby"],$=p?Q?`${Q} ${k}`:k:Q;P=y.cloneElement(U,{"aria-describedby":$})}const I=i.jsx("div",{ref:x,id:k,role:"tooltip",className:`${Lr.tooltip} ${Lr[s]} ${p?Lr.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return i.jsxs(E,{ref:b,className:A,onMouseEnter:C,onMouseLeave:O,onFocus:D,onBlur:O,children:[P,w?lT.createPortal(I,document.body):null]})}const T3="_attemptSelector_ggigl_1",w3="_attemptLabel_ggigl_17",j3="_attemptButton_ggigl_21",N3="_attemptActive_ggigl_38",C3="_attemptStatus_ggigl_44",zr={attemptSelector:T3,attemptLabel:w3,attemptButton:j3,attemptActive:N3,attemptStatus:C3};function E3({taskSessions:t,selectedSessionId:s,onSelect:o}){if(!(t.length<2))return i.jsxs("div",{className:zr.attemptSelector,"data-testid":"attempt-selector",children:[i.jsx("span",{className:zr.attemptLabel,children:"Attempts:"}),t.map((r,c)=>{const d=r.id===s,u=r.status==="stopped"&&r.endReason==="completed"?"✓":r.status==="stopped"?"✗":r.status==="running"||r.status==="idle"?"●":"";return i.jsxs("button",{className:`${zr.attemptButton} ${d?zr.attemptActive:""}`,onClick:()=>o(r.id),title:`Attempt #${c+1} — ${r.status}`,"aria-label":`Attempt #${c+1}, ${r.status}`,"aria-pressed":d,"data-testid":`attempt-${c+1}`,children:["#",c+1,u&&i.jsx("span",{className:zr.attemptStatus,children:u})]},r.id)})]})}const A3="_row_ldkru_1",D3="_hoverActions_ldkru_5",R3="_hoverButton_ldkru_31",M3="_selectingRow_ldkru_72",I3="_selected_ldkru_83",O3="_checkboxArea_ldkru_90",B3="_checkbox_ldkru_90",L3="_contentArea_ldkru_106",os={row:A3,hoverActions:D3,hoverButton:R3,selectingRow:M3,selected:I3,checkboxArea:O3,checkbox:B3,contentArea:L3};function z3({copyText:t,isContentBearing:s,isSelecting:o,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 x=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=>{!o||k.target.closest("a, button, input, textarea, select, [role=button]")||(k.preventDefault(),u(k.shiftKey))},[o,u]);return s?o?i.jsxs("div",{className:`${os.row} ${os.selectingRow} ${r?os.selected:""}`,onClick:S,"data-testid":"event-selectable-row",children:[i.jsx("div",{className:os.checkboxArea,children:i.jsx("input",{type:"checkbox",checked:r,onChange:k=>{u(k.nativeEvent.shiftKey)},onClick:k=>{k.stopPropagation()},className:os.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),i.jsx("div",{className:os.contentArea,children:m})]}):i.jsxs("div",{className:os.row,"data-testid":"event-hover-row",children:[i.jsxs("div",{className:os.hoverActions,"data-testid":"event-hover-actions",children:[i.jsx("button",{type:"button",className:os.hoverButton,onClick:()=>{x().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?i.jsx(Ai,{size:lt,"aria-hidden":"true"}):i.jsx(mx,{size:lt,"aria-hidden":"true"})}),i.jsx("button",{type:"button",className:os.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:i.jsx(Y2,{size:lt,"aria-hidden":"true"})})]}),m]}):i.jsx("div",{className:os.row,children:m})}const $3="_bar_1vah7_1",U3="_left_1vah7_21",P3="_right_1vah7_27",H3="_count_1vah7_33",V3="_toggleButton_1vah7_40",q3="_copyButton_1vah7_68",G3="_cancelButton_1vah7_108",bi={bar:$3,left:U3,right:P3,count:H3,toggleButton:V3,copyButton:q3,cancelButton:G3};function F3({selectedCount:t,totalSelectable:s,onSelectAll:o,onDeselectAll:r,onCopy:c,onCancel:d}){const u=t>0&&t>=s;return i.jsxs(Rt.div,{className:bi.bar,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.15},"data-testid":"floating-action-bar",children:[i.jsxs("div",{className:bi.left,children:[i.jsxs("span",{className:bi.count,"data-testid":"floating-bar-count",children:[t," selected"]}),i.jsx("button",{type:"button",className:bi.toggleButton,onClick:u?r:o,"data-testid":"floating-bar-select-all",children:u?"Deselect all":"Select all"})]}),i.jsxs("div",{className:bi.right,children:[i.jsxs("button",{type:"button",className:bi.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[i.jsx(p2,{size:lt,"aria-hidden":"true"}),"Copy"]}),i.jsx("button",{type:"button",className:bi.cancelButton,onClick:d,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:i.jsx(Ha,{size:lt,"aria-hidden":"true"})})]})]})}const g1=50;function Z3(t,s,o,r,c=g1){return r?t<c:s-t-o<c}function K3(t,s){const o=s-t;return o>0?o:0}function Y3({scrollRef:t,contentLength:s,isReversed:o,paused:r}){const[c,d]=y.useState(!0),u=y.useRef(0),p=y.useRef(!1),m=y.useRef(0);y.useEffect(()=>{const v=t.current;if(!v)return;let b=!0;const x=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const S=Z3(v.scrollTop,v.scrollHeight,v.clientHeight,o,g1);S!==b&&(b=S,d(S))}))};return v.addEventListener("scroll",x,{passive:!0}),()=>{v.removeEventListener("scroll",x),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[t,o]),y.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,o?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,o]),y.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(o&&!c){const b=K3(u.current,v.scrollHeight);b>0&&(v.scrollTop+=b)}c&&(o?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),u.current=v.scrollHeight}},[s,c,o,r,t]);const g=y.useCallback(()=>{const v=t.current;if(!v)return;const b=o?0:v.scrollHeight;v.scrollTo({top:b,behavior:"smooth"}),d(!0)},[t,o]);return{isAtAnchor:c,scrollToAnchor:g}}const J3=new Set(["text","output","user_input","tool_use","tool_result","error"]);function ll(t){return J3.has(t.eventType)}function W3(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let o=t.content;if(t.content.trimStart().startsWith("{"))try{const r=JSON.parse(t.content);typeof r.content=="string"&&(o=r.content)}catch{}return o}case"tool_use":try{const o=JSON.parse(t.content),r=o.tool??"tool",c=o.args!==void 0?JSON.stringify(o.args,void 0,2):"";return`${r}
|
|
264
|
+
${c}`}catch{return t.content}default:return t.content}}function zb(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 X3(t){var o;const s=[];for(const r of t){if(!ll(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=((o=r.toolUseCtx)==null?void 0:o.detailedResult)??void 0;if(!d&&(d=r.content,r.content.trimStart().startsWith("{")))try{const u=JSON.parse(r.content);typeof u.content=="string"&&(d=u.content)}catch{}if(r.toolUseCtx){const u=zb(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=zb(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 Q3({events:t,formatForClipboard:s}){const[o,r]=y.useState(!1),[c,d]=y.useState(new Set),u=y.useRef(void 0),p=y.useMemo(()=>c.size,[c]),m=y.useCallback(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 D=new Set(C);for(let O=N;O<=T;O++)O<t.length&&ll(t[O])&&D.add(O);return D})}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++)ll(t[w])&&k.add(w);d(k)},[t]),x=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:o,selectedIndices:c,selectedCount:p,enterSelectionMode:m,cancelSelection:g,toggleEvent:v,selectAll:b,deselectAll:x,copySelected:S}}const e6="_wrapper_1cdza_1",t6="_scrollContainer_1cdza_9",n6="_selectingPadding_1cdza_16",s6="_toolbar_1cdza_20",a6="_directionToggle_1cdza_27",i6="_scrollToAnchor_1cdza_65",o6="_scrollToAnchorBottom_1cdza_89",r6="_scrollToAnchorTop_1cdza_93",l6="_eventOverflowWarning_1cdza_97",Ys={wrapper:e6,scrollContainer:t6,selectingPadding:n6,toolbar:s6,directionToggle:a6,scrollToAnchor:i6,scrollToAnchorBottom:o6,scrollToAnchorTop:r6,eventOverflowWarning:l6};function c6(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 v1="grackle-stream-direction";function d6(){try{return localStorage.getItem(v1)==="reversed"}catch{return!1}}function u6({eventsDropped:t}){return t<=0?i.jsx(i.Fragment,{}):i.jsxs("div",{className:Ys.eventOverflowWarning,role:"alert",children:[i.jsx(im,{size:tn,"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 Wm({events:t,eventsDropped:s,emptyState:o,onShowToast:r}){const c=y.useRef(null),[d,u]=y.useState(d6),p=Y4(),m=Q3({events:t,formatForClipboard:X3}),g=y.useMemo(()=>t.filter(ll).length,[t]),v=y.useMemo(()=>d?[...t].reverse():t,[t,d]),{isAtAnchor:b,scrollToAnchor:x}=Y3({scrollRef:c,contentLength:t.length,isReversed:d,paused:m.isSelecting}),S=()=>{const T=!d;u(T);try{localStorage.setItem(v1,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 i.jsxs("div",{className:Ys.wrapper,children:[i.jsx("div",{className:Ys.toolbar,children:i.jsx(zo,{text:d?"Showing newest first":"Showing oldest first",children:i.jsx("button",{className:Ys.directionToggle,onClick:S,"aria-label":d?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:d?i.jsx(iy,{size:tn,"aria-hidden":"true"}):i.jsx(oy,{size:tn,"aria-hidden":"true"})})})}),i.jsxs("div",{ref:c,className:`${Ys.scrollContainer} ${m.isSelecting?Ys.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,i.jsx(u6,{eventsDropped:s}),i.jsx(us,{initial:!1,children:v.map((T,C)=>{const D=d?t.length-1-C:C;return i.jsx(Rt.div,{initial:{opacity:0,y:N},animate:{opacity:1,y:0},transition:{duration:w,ease:"easeOut"},children:i.jsx(z3,{copyText:W3(T),isContentBearing:ll(T),isSelecting:m.isSelecting,isSelected:m.selectedIndices.has(D),checkboxLabel:c6(T),onSelect:()=>{m.enterSelectionMode(D)},onToggle:O=>{m.toggleEvent(D,O)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:i.jsx(SA,{event:T,toolUseCtx:T.toolUseCtx,settled:T.settled})})},`${T.sessionId}-${T.timestamp}-${D}`)})})]}),i.jsx(us,{children:m.isSelecting&&i.jsx(F3,{selectedCount:m.selectedCount,totalSelectable:g,onSelectAll:m.selectAll,onDeselectAll:m.deselectAll,onCopy:()=>{k().catch(()=>{})},onCancel:m.cancelSelection})}),i.jsx(us,{children:!b&&i.jsxs(Rt.button,{className:`${Ys.scrollToAnchor} ${d?Ys.scrollToAnchorTop:Ys.scrollToAnchorBottom}`,onClick:x,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[d?i.jsx(oy,{size:tn,"aria-hidden":"true"}):i.jsx(iy,{size:tn,"aria-hidden":"true"})," New events"]})})]})}function Xm(t){const{value:s,onSave:o,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:p=!0,trimOnSave:m=!0}=t,[g,v]=y.useState(""),[b,x]=y.useState(""),S=y.useRef(!1),k=d===c,w=y.useCallback(P=>{v(P),x("")},[]),N=y.useCallback(()=>{x("")},[]),T=y.useCallback(()=>{S.current=!1,u==null||u(null),v(""),x("")},[u]),C=y.useCallback(()=>{const P=m?g.trim():g;if(r){const U=r(g);if(U){x(U);return}}const I=m?s.trim():s;if(P===I){T();return}o(P),T()},[g,s,m,r,o,T]),D=y.useCallback(()=>{S.current=!0,u==null||u(c),v(s),x("")},[c,s,u]),O=y.useCallback(P=>{if(S.current){S.current=!1;return}P.relatedTarget instanceof HTMLElement&&P.relatedTarget.dataset.editAction===c||C()},[c,C]),E=y.useCallback(P=>{P.key==="Escape"?T():P.key==="Enter"&&p&&C()},[T,p,C]),A=(()=>{if(!k)return!1;const P=m?s.trim():s;return(m?g.trim():g)!==P})();return y.useEffect(()=>{!k&&(g!==""||b!=="")&&(v(""),x(""))},[k,g,b]),{isEditing:k,draft:g,error:b,isDirty:A,startEdit:D,cancelEdit:T,save:C,setDraft:w,clearError:N,handleBlur:O,handleKeyDown:E,ignoreInitialBlurRef:S}}const f6="_editFieldWrapper_yuzty_1",p6="_editInput_yuzty_10",m6="_editTextarea_yuzty_42",h6="_editSelect_yuzty_78",g6="_editError_yuzty_111",v6="_editInputInvalid_yuzty_118",y6="_editHint_yuzty_123",b6="_unsavedDot_yuzty_132",x6="_metaValueClickable_yuzty_140",_6="_editButton_yuzty_159",k6="_metaPlaceholder_yuzty_175",S6="_worktreeToggle_yuzty_180",nt={editFieldWrapper:f6,editInput:p6,editTextarea:m6,editSelect:h6,editError:g6,editInputInvalid:v6,editHint:y6,unsavedDot:b6,metaValueClickable:x6,editButton:_6,metaPlaceholder:k6,worktreeToggle:S6};function ln(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:x,"data-testid":S}=t,k=y.useRef(null),w=Xm({value:s,onSave:o,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=D=>{m==null||m(D.target.value)},C=r==null?void 0:r(s);return i.jsxs("div",{className:nt.editFieldWrapper,children:[i.jsx("input",{className:`${nt.editInput} ${C?nt.editInputInvalid:""}`,value:s,onChange:T,maxLength:b,placeholder:v,"aria-label":x,"data-testid":S?`${S}-input`:void 0}),C&&i.jsx("span",{className:nt.editError,"data-testid":"edit-error",children:C})]})}if(w.isEditing)return i.jsxs("div",{className:nt.editFieldWrapper,children:[i.jsx("input",{ref:k,className:`${nt.editInput} ${w.error?nt.editInputInvalid:""}`,value:w.draft,onChange:T=>w.setDraft(T.target.value),onBlur:w.handleBlur,onKeyDown:w.handleKeyDown,maxLength:b,placeholder:v,"aria-label":x,"data-testid":S?`${S}-input`:void 0}),w.isDirty&&i.jsx("span",{className:nt.unsavedDot,title:"Unsaved changes"}),w.error&&i.jsx("span",{className:nt.editError,"data-testid":"edit-error",children:w.error}),i.jsx("span",{className:nt.editHint,children:"Enter to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:nt.metaValueClickable,onClick:()=>w.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),w.startEdit())},title:"Click to edit","aria-label":x,"data-testid":S?`${S}-button`:void 0,children:[N!==void 0?N:s?i.jsx("span",{children:s}):i.jsx("span",{className:nt.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:nt.editButton,"aria-hidden":"true",children:"✏️"})]})}function Xp(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":x}=t,S=y.useRef(null),k=Xm({value:s,onSave:o,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 i.jsxs("div",{className:nt.editFieldWrapper,children:[i.jsx("textarea",{className:`${nt.editTextarea} ${T?nt.editInputInvalid:""}`,value:s,onChange:N,placeholder:v,"aria-label":b,"data-testid":x?`${x}-input`:void 0}),T&&i.jsx("span",{className:nt.editError,"data-testid":"edit-error",children:T})]})}if(k.isEditing)return i.jsxs("div",{className:nt.editFieldWrapper,children:[i.jsx("textarea",{ref:S,className:`${nt.editTextarea} ${k.error?nt.editInputInvalid:""}`,value:k.draft,onChange:N=>k.setDraft(N.target.value),onBlur:k.handleBlur,onKeyDown:k.handleKeyDown,title:b,"aria-label":b,"data-testid":x?`${x}-input`:void 0}),k.isDirty&&i.jsx("span",{className:nt.unsavedDot,title:"Unsaved changes"}),k.error&&i.jsx("span",{className:nt.editError,"data-testid":"edit-error",children:k.error}),i.jsx("span",{className:nt.editHint,children:"Tab to save · Esc to cancel"})]});const w=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:nt.metaValueClickable,onClick:()=>k.startEdit(),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),k.startEdit())},title:"Click to edit","aria-label":b,"data-testid":x?`${x}-button`:void 0,children:[w!==void 0?w:s?i.jsx("span",{children:s}):i.jsx("span",{className:nt.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:nt.editButton,"aria-hidden":"true",children:"✏️"})]})}function ud(t){var D;const{value:s,onSave:o,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":x}=t,S=y.useRef(null),k=Xm({value:s,onSave:o,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(k.isEditing){const O=window.setTimeout(()=>{var E;(E=S.current)==null||E.focus()},0);return()=>window.clearTimeout(O)}},[k.isEditing]);const w=y.useCallback(O=>{const E=O.target.value;k.ignoreInitialBlurRef.current=!1,E!==s&&o(E),k.cancelEdit()},[s,o,k]),N=y.useCallback(O=>{if(k.ignoreInitialBlurRef.current){k.ignoreInitialBlurRef.current=!1;return}O.relatedTarget instanceof HTMLElement&&O.relatedTarget.dataset.editAction===d||k.cancelEdit()},[d,k]);if(r==="create")return i.jsx("select",{className:nt.editSelect,value:s,onChange:O=>m==null?void 0:m(O.target.value),"aria-label":b,"data-testid":x?`${x}-select`:void 0,children:c.map(O=>i.jsx("option",{value:O.value,children:O.label},O.value))});if(k.isEditing)return i.jsx("select",{ref:S,className:nt.editSelect,value:k.draft,onChange:w,onBlur:N,title:b,"aria-label":b,"data-testid":x?`${x}-select`:void 0,children:c.map(O=>i.jsx("option",{value:O.value,children:O.label},O.value))});const T=g==null?void 0:g(s),C=(D=c.find(O=>O.value===s))==null?void 0:D.label;return i.jsxs("button",{type:"button",className:nt.metaValueClickable,onClick:()=>k.startEdit(),title:"Click to change","aria-label":b,"data-testid":x?`${x}-button`:void 0,children:[T!==void 0?T:C?i.jsx("span",{children:C}):i.jsx("span",{className:nt.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:nt.editButton,"aria-hidden":"true",children:"✏️"})]})}function T6(t){const{checked:s,onChange:o,label:r,ariaLabel:c,"data-testid":d}=t;return i.jsxs("label",{className:nt.worktreeToggle,"data-testid":d,children:[i.jsx("input",{type:"checkbox",checked:s,onChange:u=>o(u.target.checked),"aria-label":c}),i.jsx("span",{children:r})]})}const w6="_envRow_1e1r5_1",j6="_envDot_1e1r5_7",N6="_envDotGreen_1e1r5_14",C6="_envDotYellow_1e1r5_18",E6="_envDotRed_1e1r5_22",A6="_envDotGray_1e1r5_26",Do={envRow:w6,envDot:j6,envDotGreen:N6,envDotYellow:C6,envDotRed:E6,envDotGray:A6};function D6(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?Do.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?Do.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?Do.envDotRed:Do.envDotGray}function R6(t){const{value:s,onSave:o,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),x=[...c?[{value:"",label:"None"}]:[],...r.map(k=>({value:k.id,label:k.displayName}))],S=()=>{if(b)return i.jsxs("span",{className:Do.envRow,children:[i.jsx("span",{className:`${Do.envDot} ${D6(b.status)}`}),b.displayName]})};return i.jsx(ud,{value:s,onSave:o,options:x,fieldId:d,activeFieldId:u,onActivate:p,renderDisplay:S,placeholder:m,ariaLabel:g,"data-testid":v})}const M6="_nav_1snmp_1",I6="_searchForm_1snmp_8",O6="_searchInput_1snmp_15",B6="_searchButton_1snmp_33",L6="_clearButton_1snmp_68",z6="_workspaceSelect_1snmp_85",$6="_listHeader_1snmp_99",U6="_nodeList_1snmp_108",P6="_nodeItem_1snmp_116",H6="_indicator_1snmp_129",V6="_label_1snmp_136",q6="_badge_1snmp_145",Yn={nav:M6,searchForm:I6,searchInput:O6,searchButton:B6,clearButton:L6,workspaceSelect:z6,listHeader:$6,nodeList:U6,nodeItem:P6,indicator:H6,label:V6,badge:q6};function G6({nodes:t,workspaces:s,loading:o,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]),x=y.useCallback(k=>{u(k)},[u]),S=y.useCallback(k=>{g(""),p(k)},[p]);return i.jsxs("div",{className:Yn.nav,"data-testid":"knowledge-nav",children:[i.jsxs("form",{className:Yn.searchForm,onSubmit:v,children:[i.jsx("input",{className:Yn.searchInput,type:"text",placeholder:"Search...",value:m,onChange:k=>{g(k.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),i.jsx("button",{type:"submit",className:Yn.searchButton,disabled:o,children:"Go"})]}),r&&i.jsx("button",{type:"button",className:Yn.clearButton,onClick:b,children:"Clear search"}),i.jsxs("select",{className:Yn.workspaceSelect,onChange:k=>{S(k.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[i.jsx("option",{value:"",children:"All workspaces"}),s.map(k=>i.jsx("option",{value:k.id,children:k.name},k.id))]}),i.jsxs("div",{className:Yn.listHeader,children:["Nodes (",t.length,")"]}),i.jsx("ul",{className:Yn.nodeList,children:t.map(k=>i.jsxs("li",{className:Yn.nodeItem,onClick:()=>{x(k.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),x(k.id))},role:"button",tabIndex:0,children:[i.jsx("span",{className:Yn.indicator,style:{backgroundColor:k.kind==="reference"?"#4A9EFF":k.category==="decision"?"#22C55E":k.category==="concept"?"#A855F7":k.category==="snippet"?"#6B7280":"#EAB308"}}),i.jsx("span",{className:Yn.label,children:k.label}),i.jsx("span",{className:Yn.badge,children:k.kind==="reference"?k.sourceType:k.category})]},k.id))})]})}const F6="_container_1mq5u_1",Z6="_hamburger_1mq5u_33",K6="_brand_1mq5u_49",Y6="_brandLogo_1mq5u_68",J6="_info_1mq5u_75",W6="_connectionLabel_1mq5u_90",X6="_connectionDot_1mq5u_103",Q6="_connected_1mq5u_106",e5="_disconnected_1mq5u_110",Zs={container:F6,hamburger:Z6,brand:K6,brandLogo:Y6,info:J6,connectionLabel:W6,connectionDot:X6,connected:Q6,disconnected:e5};function t5({connected:t,environments:s,sessions:o,onToggleSidebar:r,sidebarOpen:c}){const d=kt(),u=s.length,p=s.filter(g=>g.status==="connected").length,m=o.filter(g=>["running","idle"].includes(g.status)).length;return i.jsxs("div",{className:Zs.container,children:[r&&i.jsx("button",{type:"button",className:Zs.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:i.jsx(I2,{size:zt,"aria-hidden":"true"})}),i.jsx(zo,{text:"Home",placement:"bottom",children:i.jsxs("button",{type:"button",className:Zs.brand,onClick:()=>d(Ci),"data-testid":"statusbar-brand",children:[i.jsx("img",{src:"/icon-192x192.png",alt:"",className:Zs.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),i.jsxs("div",{className:Zs.info,children:[i.jsxs("span",{"aria-label":t?"Connected":"Disconnected",children:[i.jsx("span",{className:`${Zs.connectionDot} ${t?Zs.connected:Zs.disconnected}`,"aria-hidden":"true",children:i.jsx(La,{size:om,fill:"currentColor"})})," ",i.jsx("span",{className:Zs.connectionLabel,"aria-hidden":"true",children:t?"Connected":"Disconnected"})]}),i.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),i.jsxs("span",{children:[m," active"]})]})]})}const n5="_nav_13gkc_1",s5="_tab_13gkc_35",a5="_tabIcon_13gkc_68",i5="_tabLabel_13gkc_79",o5="_tabActive_13gkc_84",$r={nav:n5,tab:s5,tabIcon:a5,tabLabel:i5,tabActive:o5},xi=[{view:"dashboard",label:"Dashboard",icon:i.jsx(_2,{size:zt}),route:Ci,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:i.jsx(B2,{size:zt}),route:aN,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:i.jsx(l2,{size:zt}),route:iN,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:i.jsx(z2,{size:zt}),route:Mo,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:i.jsx(n2,{size:zt}),route:Lx,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:i.jsx(hx,{size:zt}),route:_d,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:i.jsx(Z2,{size:zt}),route:eN,testId:"sidebar-tab-settings"}];function r5(t){return t===Ci||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(Lx)?"knowledge":t.startsWith(_d)?"findings":t.startsWith(Ro)?"settings":"tasks"}function l5(){const t=Zt(),s=kt(),o=y.useRef(null),r=r5(t.pathname),c=y.useCallback(u=>{s(u.route)},[s]),d=y.useCallback(u=>{var b,x;const p=(b=o.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:xi.findIndex(S=>S.view===r);let v=g;if(u.key==="ArrowRight"||u.key==="j"||u.key==="J")u.preventDefault(),v=(g+1)%xi.length;else if(u.key==="ArrowLeft"||u.key==="k"||u.key==="K")u.preventDefault(),v=(g-1+xi.length)%xi.length;else if(u.key==="Home")u.preventDefault(),v=0;else if(u.key==="End")u.preventDefault(),v=xi.length-1;else return;s(xi[v].route),(x=p[v])==null||x.focus()},[r,s]);return i.jsx("nav",{className:$r.nav,ref:o,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:d,"data-testid":"sidebar-nav",children:xi.map(u=>{const p=u.view===r;return i.jsx(zo,{text:u.label,placement:"bottom",children:i.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${$r.tab} ${p?$r.tabActive:""}`,onClick:()=>c(u),"data-testid":u.testId,"aria-label":u.label,children:[i.jsx("span",{className:$r.tabIcon,"aria-hidden":"true",children:u.icon}),i.jsx("span",{className:$r.tabLabel,children:u.label})]})},u.view)})})}const c5="_container_pi6ii_1",d5="_content_pi6ii_66",$b={container:c5,content:d5},u5=320,y1=220,b1=600,x1="grackle-sidebar-width";function f5(){try{const t=localStorage.getItem(x1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=y1&&s<=b1)return s}}catch{}return u5}function p5(t){try{localStorage.setItem(x1,String(t))}catch{}}function m5({content:t}){const[s]=y.useState(f5),o=y.useRef(null);if(y.useEffect(()=>{const r=o.current;if(!r)return;const c=new ResizeObserver(d=>{for(const u of d){const p=u.borderBoxSize[0];if(p){const m=Math.round(p.inlineSize);m>=y1&&m<=b1&&p5(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return i.jsx("div",{className:$b.container,ref:o,"data-testid":"sidebar",style:{width:s},children:i.jsx("div",{className:$b.content,children:t})})}const h5="_bar_tnfsh_1",g5="_btnPrimary_tnfsh_32",v5="_statusText_tnfsh_85",y5="_statusCompleted_tnfsh_90",b5="_statusFailed_tnfsh_94",x5="_statusBlocked_tnfsh_98",_5="_hintText_tnfsh_103",wt={bar:h5,btnPrimary:g5,statusText:v5,statusCompleted:y5,statusFailed:b5,statusBlocked:x5,hintText:_5};function k5({sessions:t,tasks:s,environments:o}){const r=kt(),c=Zt(),d=At("/sessions/:sessionId"),u=At("/tasks/:taskId"),p=At("/tasks/:taskId/stream"),m=At("/tasks/:taskId/findings"),g=At("/tasks/:taskId/edit"),v=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),x=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),S=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),k=At("/sessions/new"),w=At("/environments/:environmentId/workspaces/:workspaceId"),N=At("/tasks/new"),T=At("/chat"),C=At("/"),D=At("/settings/*"),O=d==null?void 0:d.params.sessionId,E=(u==null?void 0:u.params.taskId)??(p==null?void 0:p.params.taskId)??(m==null?void 0:m.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId)??(x==null?void 0:x.params.taskId)??(S==null?void 0:S.params.taskId),A=v??b??x??S,P=(A==null?void 0:A.params.environmentId)??(w==null?void 0:w.params.environmentId),I=c.pathname.startsWith("/environments")&&!w&&!A,U=!!T,Q=!!k,$=!!w&&!v&&!b&&!x&&!S,H=!!N;if(!!C&&!Q&&!$&&!H||!!D||(!!g||!!S)||H||I||Q)return i.jsx(i.Fragment,{});if(U)return o.find(Z=>Z.adapterType==="local"&&Z.status==="connected")?i.jsx(i.Fragment,{}):i.jsx("div",{className:wt.bar,children:i.jsx("span",{className:wt.hintText,children:"Add a local environment to start chatting"})});if($)return i.jsx("div",{className:wt.bar,children:i.jsx("span",{className:wt.hintText,children:"Select a task or click + to create one"})});if(E){const L=s.find(ce=>ce.id===E);if(!L)return i.jsx("div",{className:wt.bar,children:i.jsx("span",{className:wt.hintText,children:"Loading..."})});const Z=new Map(s.map(ce=>[ce.id,ce])),J=L.dependsOn.some(ce=>{const X=Z.get(ce);return X!==void 0&&X.status!=="complete"});if(L.status==="not_started"){const ce=J?L.dependsOn.map(X=>Z.get(X)).filter(X=>X&&X.status!=="complete").map(X=>X.title):[];return i.jsx("div",{className:wt.bar,children:J?i.jsxs("span",{className:wt.statusBlocked,children:["Blocked by: ",ce.join(", ")]}):i.jsx("span",{className:wt.hintText,children:"Use the buttons above to start or manage this task"})})}if(L.status==="working"||L.status==="paused"){const ce=L.latestSessionId||void 0,X=ce?t.find(pe=>pe.id===ce):void 0;return X&&X.status!=="stopped"?i.jsx(i.Fragment,{}):i.jsx("div",{className:wt.bar,children:i.jsx("span",{className:wt.hintText,children:"Waiting for agent..."})})}if(L.status==="complete")return i.jsxs("div",{className:wt.bar,children:[i.jsx("span",{className:`${wt.statusText} ${wt.statusCompleted}`,children:"Task completed"}),i.jsx("button",{onClick:()=>r(Ri(L.workspaceId,void 0,P)),className:wt.btnPrimary,children:"+ New Task"})]});if(L.status==="failed")return i.jsx("div",{className:wt.bar,children:i.jsx("span",{className:`${wt.statusText} ${wt.statusFailed}`,children:"Task failed"})})}if(O){const L=t.find(ce=>ce.id===O),Z=(L==null?void 0:L.status)==="stopped";if(L!==void 0&&!Z)return i.jsx(i.Fragment,{});if(Z)return i.jsxs("div",{className:wt.bar,children:[i.jsxs("span",{className:`${wt.statusText} ${wt.hintText}`,children:["Session ",L.endReason||L.status]}),i.jsx("button",{onClick:()=>r(Ix(L.environmentId)),className:wt.btnPrimary,children:"+ New Chat"})]})}return i.jsx("div",{className:wt.bar,children:i.jsx("span",{className:wt.hintText,children:"Loading..."})})}const S5="_nav_14i94_1",T5="_tab_14i94_24",w5="_tabActive_14i94_62",j5="_tabLabel_14i94_75",N5="_statusDot_14i94_81",C5="_pulse_14i94_87",E5="_addButton_14i94_99",A5="_empty_14i94_132",Aa={nav:S5,tab:T5,tabActive:w5,tabLabel:j5,statusDot:N5,pulse:C5,addButton:E5,empty:A5},D5={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function R5({environments:t}){const s=kt(),o=y.useRef(null),r=At("/environments/:environmentId"),c=At("/environments/:environmentId/edit"),d=At("/environments/:environmentId/workspaces/:workspaceId"),u=At("/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(x=>{s(Ni(x))},[s]),v=y.useCallback(x=>{var T;const S=(T=o.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(x.key==="ArrowDown"||x.key==="j"||x.key==="J")x.preventDefault(),N=(w+1)%S.length;else if(x.key==="ArrowUp"||x.key==="k"||x.key==="K")x.preventDefault(),N=(w-1+S.length)%S.length;else if(x.key==="Home")x.preventDefault(),N=0;else if(x.key==="End")x.preventDefault(),N=S.length-1;else return;N<t.length&&s(Ni(t[N].id)),S[N].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return i.jsxs("div",{className:Aa.nav,"data-testid":"environment-nav",children:[i.jsx("nav",{ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(x=>{const S=x.id===m,k=x.id===b,w=D5[x.status]||"var(--text-tertiary)",N=x.status==="connected";return i.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:k?0:-1,className:`${Aa.tab} ${S?Aa.tabActive:""}`,onClick:()=>g(x.id),"data-testid":"env-nav-item",children:[i.jsx("span",{className:`${Aa.statusDot} ${N?Aa.pulse:""}`,style:{color:w},"aria-hidden":"true",children:i.jsx(La,{size:om,fill:"currentColor"})}),i.jsx("span",{className:Aa.tabLabel,title:x.displayName||x.id,children:x.displayName||x.id})]},x.id)})}),i.jsx("button",{type:"button",className:Aa.addButton,onClick:()=>s(Xj),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&i.jsx("div",{className:Aa.empty,children:"No environments yet."})]})}function Qm(t){const s=new Date(t),o=new Date,r=o.getTime()-s.getTime(),c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return"just now";if(d<60)return`${d}m ago`;if(u<24)return`${u}h ago`;if(p===1)return"yesterday";if(p<7)return`${p} days ago`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Ub={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 fd(t){return Ub[t]||Ub.general}const M5="_nav_dlm8m_1",I5="_categoryPills_dlm8m_24",O5="_categoryPill_dlm8m_24",B5="_tab_dlm8m_42",L5="_tabActive_dlm8m_80",z5="_tabContent_dlm8m_93",$5="_tabLabel_dlm8m_100",U5="_tabMeta_dlm8m_106",P5="_categoryDot_dlm8m_111",H5="_empty_dlm8m_118",xs={nav:M5,categoryPills:I5,categoryPill:O5,tab:B5,tabActive:L5,tabContent:z5,tabLabel:$5,tabMeta:U5,categoryDot:P5,empty:H5};function V5({findings:t,workspaceId:s,environmentId:o}){const r=kt(),c=y.useRef(null),d=At("/findings/:findingId"),u=At("/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 x=new Set(t.map(S=>S.category).filter(Boolean));return Array.from(x).sort()},[t]),g=y.useCallback(x=>{r(Mp(x,s,o))},[r,s,o]),v=y.useCallback(x=>{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(x.key==="ArrowDown"||x.key==="j"||x.key==="J")x.preventDefault(),N=(w+1)%S.length;else if(x.key==="ArrowUp"||x.key==="k"||x.key==="K")x.preventDefault(),N=(w-1+S.length)%S.length;else if(x.key==="Home")x.preventDefault(),N=0;else if(x.key==="End")x.preventDefault(),N=S.length-1;else return;N<t.length&&r(Mp(t[N].id,s,o)),S[N].focus()},[p,t,r,s,o]),b=p??(t.length>0?t[0].id:void 0);return i.jsxs("div",{className:xs.nav,"data-testid":"findings-nav",children:[m.length>1&&i.jsx("div",{className:xs.categoryPills,"data-testid":"findings-nav-categories",children:m.map(x=>i.jsx("span",{className:xs.categoryPill,style:{color:fd(x).text},children:x},x))}),i.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(x=>{const S=x.id===p,k=x.id===b;return i.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:k?0:-1,className:`${xs.tab} ${S?xs.tabActive:""}`,onClick:()=>g(x.id),"data-testid":"finding-nav-item",children:[i.jsx("span",{className:xs.categoryDot,style:{color:fd(x.category).text},"aria-hidden":"true",children:i.jsx(La,{size:om,fill:"currentColor"})}),i.jsxs("span",{className:xs.tabContent,children:[i.jsx("span",{className:xs.tabLabel,title:x.title,children:x.title}),i.jsx("span",{className:xs.tabMeta,title:x.createdAt,children:Qm(x.createdAt)})]})]},x.id)})}),t.length===0&&i.jsx("div",{className:xs.empty,children:"No findings yet. Agents will post discoveries here."})]})}function q5(t){if(t.length===0)return[];const s=[...t].sort((r,c)=>r[0]-c[0]),o=[[s[0][0],s[0][1]]];for(let r=1;r<s.length;r++){const c=o[o.length-1],[d,u]=s[r];d<=c[1]+1?c[1]=Math.max(c[1],u):o.push([d,u])}return o}function _1({text:t,indices:s,highlightClass:o}){if(!s||s.length===0)return i.jsx(i.Fragment,{children:t});const r=q5(s),c=[];let d=0;for(const[u,p]of r)u>d&&c.push(i.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(i.jsx("mark",{className:o,children:t.slice(u,p+1)},`m${u}`)),d=p+1;return d<t.length&&c.push(i.jsx("span",{children:t.slice(d)},`p${d}`)),i.jsx(i.Fragment,{children:c})}function G5(t){const s=new Map(t.map(r=>[r.id,{...r,children:[]}])),o=[];for(const r of s.values())r.parentTaskId&&s.has(r.parentTaskId)?s.get(r.parentTaskId).children.push(r):o.push(r);for(const r of s.values())r.children.sort((c,d)=>c.sortOrder-d.sortOrder);return o.sort((r,c)=>r.sortOrder-c.sortOrder)}function F5(t,s){const o=new Map;for(const d of t){const p=d.dependsOn.length>0&&d.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":d.status,m=o.get(p);m?m.push(d):o.set(p,[d])}const r=[],c=new Set;for(const d of nw){c.add(d);const u=o.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=za(d);r.push({status:d,label:p.label,style:p,tasks:u})}}for(const[d,u]of o)if(!c.has(d)&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=za(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const Z5="_container_z4i38_1",K5="_header_z4i38_5",Y5="_headerActions_z4i38_17",J5="_searchInput_z4i38_23",W5="_searchHighlight_z4i38_56",X5="_groupToggle_z4i38_62",Q5="_groupToggleActive_z4i38_89",eI="_addButton_z4i38_93",tI="_taskRow_z4i38_120",nI="_selected_z4i38_140",sI="_expandArrow_z4i38_150",aI="_expanded_z4i38_157",iI="_leafSpacer_z4i38_161",oI="_taskStatusIcon_z4i38_166",rI="_taskTitle_z4i38_170",lI="_workspaceBadge_z4i38_177",cI="_childCountBadge_z4i38_195",dI="_dependencyBadge_z4i38_208",uI="_blockedBadge_z4i38_220",fI="_addChildButton_z4i38_225",pI="_emptyState_z4i38_268",mI="_statusGroupHeader_z4i38_275",hI="_statusGroupIcon_z4i38_294",gI="_statusGroupLabel_z4i38_298",vI="_statusGroupCount_z4i38_303",Ge={container:Z5,header:K5,headerActions:Y5,searchInput:J5,searchHighlight:W5,groupToggle:X5,groupToggleActive:Q5,addButton:eI,taskRow:tI,selected:nI,expandArrow:sI,expanded:aI,leafSpacer:iI,taskStatusIcon:oI,taskTitle:rI,workspaceBadge:lI,childCountBadge:cI,dependencyBadge:dI,blockedBadge:uI,addChildButton:fI,emptyState:pI,statusGroupHeader:mI,statusGroupIcon:hI,statusGroupLabel:gI,statusGroupCount:vI},yI=[{name:"title",weight:2},{name:"description",weight:1}],k1=16,bI=16,S1="grackle-task-group-by-status";function Pb(){try{return localStorage.getItem(S1)==="true"}catch{return!1}}function xI(t){try{localStorage.setItem(S1,String(t))}catch{}}function _I({group:t,isExpanded:s,onToggle:o,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return i.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[i.jsxs("div",{className:Ge.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:o,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o())},children:[i.jsx("span",{className:`${Ge.expandArrow} ${s?Ge.expanded:""}`,"aria-hidden":"true",children:i.jsx(sa,{size:lt})}),i.jsx("span",{className:Ge.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),i.jsx("span",{className:Ge.statusGroupLabel,children:t.label}),i.jsx("span",{className:Ge.statusGroupCount,children:t.tasks.length})]}),i.jsx(us,{children:s&&i.jsx(Rt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:t.tasks.map(p=>{const m=za(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return i.jsxs("div",{onClick:()=>c(On(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(On(p.id)))},className:`${Ge.taskRow} ${g?Ge.selected:""}`,style:{"--task-indent":`${k1}px`},"data-task-id":p.id,children:[i.jsx("span",{className:Ge.leafSpacer}),i.jsx("span",{className:Ge.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${cl(p.status)}`,children:m.icon}),i.jsx("span",{className:Ge.taskTitle,title:p.title,children:i.jsx(_1,{text:p.title,indices:d.get(p.id),highlightClass:Ge.searchHighlight})}),v&&i.jsx("span",{className:Ge.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function T1({node:t,depth:s,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=za(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(T=>u.get(T)!=="complete"),b=o.has(t.id),x=t.children.length>0,S=c===t.id,k=k1+s*bI,N=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{onClick:()=>d(On(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:T=>{T.currentTarget===T.target&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),d(On(t.id)))},className:`${Ge.taskRow} ${S?Ge.selected:""}`,style:{"--task-indent":`${k}px`},"data-task-id":t.id,children:[x&&i.jsx("span",{className:`${Ge.expandArrow} ${b?Ge.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:i.jsx(sa,{size:lt,"aria-hidden":"true"})}),!x&&i.jsx("span",{className:Ge.leafSpacer}),i.jsx("span",{className:Ge.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${cl(t.status)}`,children:g.icon}),i.jsx("span",{className:Ge.taskTitle,title:t.title,children:i.jsx(_1,{text:t.title,indices:p.get(t.id),highlightClass:Ge.searchHighlight})}),N&&i.jsx("span",{className:Ge.workspaceBadge,title:N,children:N}),x&&i.jsxs("span",{className:Ge.childCountBadge,children:[t.children.filter(T=>T.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&i.jsx("span",{className:`${Ge.dependencyBadge} ${v?Ge.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<pT&&i.jsx(zo,{text:"Add child task",children:i.jsx("button",{onClick:T=>{T.stopPropagation(),d(Ri(t.workspaceId,t.id))},"aria-label":"Add child task",className:Ge.addChildButton,children:"+"})})]}),i.jsx(us,{children:x&&b&&i.jsx(Rt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:t.children.map(T=>i.jsx(T1,{node:T,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},T.id))})})]})}function kI({workspaces:t,tasks:s}){const o=kt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,m]=y.useState(Pb),[g,v]=y.useState(Pb),[b,x]=y.useState(new Map),S=At("/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(W=>[W.id,W.status])),[s]),N=y.useMemo(()=>new Map(t.map(W=>[W.id,W.name])),[t]),T=()=>{const W=!p;xI(W),m(W),W&&(v(!0),x(new Map))},C=W=>{x(oe=>{const L=new Map(oe),Z=L.has(W)?L.get(W):g;return L.set(W,!Z),L})},D=W=>b.has(W)?b.get(W):g,O=W=>{c(oe=>{const L=new Set(oe);return L.has(W)?(L.delete(W),u(Z=>new Set(Z).add(W))):(L.add(W),u(Z=>{const J=new Set(Z);return J.delete(W),J})),L})};y.useEffect(()=>{const W=new Set(s.filter(oe=>oe.parentTaskId).map(oe=>oe.parentTaskId));W.size>0&&c(oe=>{const L=new Set(oe);for(const Z of W)d.has(Z)||L.add(Z);return L})},[s,d]);const[E,A]=y.useState(""),{directMatchTaskIds:P,treeMatchTaskIds:I,titleHighlights:U}=y.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const W=fT(s,E,yI),oe=new Set(W.map(ce=>ce.item.id)),L=new Map;for(const ce of W){const X=ce.matches.find(ge=>ge.key==="title");X&&L.set(ce.item.id,X.indices)}const Z=new Set(oe),J=new Map(s.map(ce=>[ce.id,ce]));for(const ce of[...oe]){let X=J.get(ce);for(;X!=null&&X.parentTaskId;)Z.add(X.parentTaskId),X=J.get(X.parentTaskId)}return{directMatchTaskIds:oe,treeMatchTaskIds:Z,titleHighlights:L}},[E,s]),Q=P!==null,$=Q?p?P:I:null,H=$?s.filter(W=>$.has(W.id)):s,ue=p?[]:G5(H);return i.jsxs("div",{className:Ge.container,children:[i.jsxs("div",{className:Ge.header,children:[i.jsx("span",{children:"Tasks"}),i.jsxs("div",{className:Ge.headerActions,children:[i.jsx(zo,{text:p?"Switch to tree view":"Group tasks by status",children:i.jsx("button",{className:`${Ge.groupToggle} ${p?Ge.groupToggleActive:""}`,onClick:T,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,"data-testid":"task-group-by-status-toggle",children:i.jsx(A2,{size:tn})})}),i.jsx(zo,{text:"New task",children:i.jsx("button",{className:Ge.addButton,onClick:()=>o(Ri()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&i.jsx("input",{type:"text",value:E,onChange:W=>A(W.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Ge.searchInput,"data-testid":"sidebar-search"}),p?F5(H,w).map(W=>i.jsx(_I,{group:W,isExpanded:D(W.status),onToggle:()=>C(W.status),selectedTaskId:k,navigate:o,titleHighlights:U,workspaceNames:N},W.status)):ue.map(W=>i.jsx(T1,{node:W,depth:0,expandedTasks:r,toggleTask:O,selectedTaskId:k,navigate:o,taskStatusById:w,titleHighlights:U,workspaceNames:N},W.id)),H.length===0&&!Q&&i.jsx("div",{className:Ge.emptyState,children:"No tasks yet. Click + to create one."}),H.length===0&&Q&&i.jsx("div",{className:Ge.emptyState,children:"No matching tasks"})]})}const SI="_toast_ed2dk_1",TI="_success_ed2dk_18",wI="_icon_ed2dk_22",jI="_error_ed2dk_25",NI="_warning_ed2dk_32",CI="_info_ed2dk_38",EI="_message_ed2dk_53",AI="_close_ed2dk_60",Ur={toast:SI,success:TI,icon:wI,error:jI,warning:NI,info:CI,message:EI,close:AI},DI={success:i.jsx(Ai,{size:zt}),error:i.jsx(Ha,{size:zt}),warning:i.jsx(im,{size:zt}),info:i.jsx(am,{size:zt})};function RI({toast:t,onDismiss:s}){return y.useEffect(()=>{const o=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(o)},[t.id,t.duration,s]),i.jsxs(Rt.div,{className:`${Ur.toast} ${Ur[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[i.jsx("span",{className:Ur.icon,"aria-hidden":"true",children:DI[t.variant]}),i.jsx("span",{className:Ur.message,children:t.message}),i.jsx("button",{type:"button",className:Ur.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:i.jsx(Ha,{size:tn,"aria-hidden":"true"})})]})}const MI="_container_qqse2_1",II={container:MI};function OI({toasts:t,onDismiss:s}){return i.jsx("div",{className:II.container,"data-testid":"toast-container",children:i.jsx(us,{children:t.map(o=>i.jsx(RI,{toast:o,onDismiss:s},o.id))})})}const BI="_callout_e5awm_1",LI="_success_e5awm_11",zI="_icon_e5awm_15",$I="_error_e5awm_18",UI="_warning_e5awm_25",PI="_info_e5awm_32",HI="_content_e5awm_48",VI="_close_e5awm_53",Pr={callout:BI,success:LI,icon:zI,error:$I,warning:UI,info:PI,content:HI,close:VI},qI={success:i.jsx(Ai,{size:zt}),error:i.jsx(Ha,{size:zt}),warning:i.jsx(im,{size:zt}),info:i.jsx(am,{size:zt})};function GI({variant:t="info",children:s,dismissible:o=!1,className:r}){const[c,d]=y.useState(!1);return i.jsx(i.Fragment,{children:!c&&i.jsxs("div",{className:[Pr.callout,Pr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[i.jsx("span",{className:Pr.icon,"aria-hidden":"true",children:qI[t]}),i.jsx("span",{className:Pr.content,children:s}),o&&i.jsx("button",{type:"button",className:Pr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:i.jsx(Ha,{size:tn,"aria-hidden":"true"})})]})})}function FI({currentVersion:t,latestVersion:s,updateAvailable:o,isDocker:r}){if(!o)return i.jsx(i.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return i.jsx("div",{"data-testid":"update-banner",children:i.jsxs(GI,{variant:"info",dismissible:!0,children:[i.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",i.jsx("code",{children:c})]})})}const ZI="_container_de44x_1",KI="_emptyState_de44x_8",YI="_card_de44x_14",JI="_cardClickable_de44x_34",WI="_cardHeader_de44x_42",XI="_categoryBadge_de44x_54",QI="_findingTitle_de44x_62",eO="_findingDate_de44x_68",tO="_findingContent_de44x_80",nO="_tags_de44x_86",sO="_tag_de44x_86",rs={container:ZI,emptyState:KI,card:YI,cardClickable:JI,cardHeader:WI,categoryBadge:XI,findingTitle:QI,findingDate:eO,findingContent:tO,tags:nO,tag:sO};function w1({findings:t,onFindingClick:s}){return t.length===0?i.jsx("div",{className:rs.emptyState,children:"No findings yet. Agents will post discoveries here."}):i.jsx("div",{className:rs.container,children:t.map((o,r)=>{const c=fd(o.category),d=s?Rt.button:Rt.div;return i.jsxs(d,{type:s?"button":void 0,className:`${rs.card} ${s?rs.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},onClick:s?()=>{s(o.id)}:void 0,children:[i.jsxs("div",{className:rs.cardHeader,children:[i.jsx("span",{className:rs.categoryBadge,style:{background:c.bg,color:c.text},children:o.category}),i.jsx("span",{className:rs.findingTitle,children:o.title}),i.jsx("span",{className:rs.findingDate,title:o.createdAt,children:Qm(o.createdAt)})]}),i.jsx("div",{className:rs.findingContent,children:o.content.length>300?o.content.slice(0,300)+"...":o.content}),o.tags.length>0&&i.jsx("div",{className:rs.tags,children:o.tags.map(u=>i.jsx("span",{className:rs.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:u},u))})]},o.id)})})}const aO="_section_1ingb_14",iO="_sectionTitle_1ingb_26",oO="_sectionDescription_1ingb_35",rO="_tokenList_1ingb_48",lO="_tokenRow_1ingb_55",cO="_tokenBadge_1ingb_68",dO="_tokenName_1ingb_83",uO="_tokenTarget_1ingb_90",fO="_deleteButton_1ingb_99",pO="_addForm_1ingb_113",mO="_formRow_1ingb_119",hO="_input_1ingb_125",gO="_select_1ingb_155",vO="_addButton_1ingb_187",yO="_emptyStateInfo_1ingb_221",bO="_themeOptions_1ingb_229",xO="_themeOption_1ingb_229",_O="_themeOptionSelected_1ingb_254",kO="_themeOptionHeader_1ingb_259",SO="_themeOptionLabel_1ingb_266",TO="_themeOptionDesc_1ingb_273",wO="_variantToggle_1ingb_279",jO="_variantButton_1ingb_286",NO="_variantActive_1ingb_305",CO="_themeSwatches_1ingb_311",EO="_themeSwatch_1ingb_311",AO="_systemToggle_1ingb_325",DO="_systemToggleHint_1ingb_341",RO="_themeActive_1ingb_348",MO="_aboutGrid_1ingb_354",IO="_aboutItem_1ingb_360",OO="_aboutLabel_1ingb_373",BO="_aboutValue_1ingb_379",LO="_aboutDot_1ingb_387",zO="_aboutDotConnected_1ingb_394",$O="_aboutDotDisconnected_1ingb_398",be={section:aO,sectionTitle:iO,sectionDescription:oO,tokenList:rO,tokenRow:lO,tokenBadge:cO,tokenName:dO,tokenTarget:uO,deleteButton:fO,addForm:pO,formRow:mO,input:hO,select:gO,addButton:vO,emptyStateInfo:yO,themeOptions:bO,themeOption:xO,themeOptionSelected:_O,themeOptionHeader:kO,themeOptionLabel:SO,themeOptionDesc:TO,variantToggle:wO,variantButton:jO,variantActive:NO,themeSwatches:CO,themeSwatch:EO,systemToggle:AO,systemToggleHint:DO,themeActive:RO,aboutGrid:MO,aboutItem:IO,aboutLabel:OO,aboutValue:BO,aboutDot:LO,aboutDotConnected:zO,aboutDotDisconnected:$O},UO=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function PO({tokens:t,onSetToken:s,onDeleteToken:o,onShowToast:r}){const[c,d]=y.useState(""),[u,p]=y.useState(""),[m,g]=y.useState("env_var"),[v,b]=y.useState(""),[x,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=()=>{x&&(o(x),r==null||r("Token deleted","info")),S(null)};return i.jsxs(i.Fragment,{children:[i.jsx(Ei,{isOpen:x!==null,title:"Delete Token?",description:x?`"${x}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>S(null)}),i.jsxs("section",{className:be.section,children:[i.jsx("h3",{className:be.sectionTitle,children:"Tokens"}),i.jsx("p",{className:be.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?i.jsx("div",{className:be.emptyStateInfo,children:"Add your first API token to enable service integrations."}):i.jsx("div",{className:be.tokenList,children:t.map(T=>i.jsxs("div",{className:be.tokenRow,children:[i.jsx("span",{className:be.tokenBadge,children:T.tokenType}),i.jsx("span",{className:be.tokenName,children:T.name}),i.jsx("span",{className:be.tokenTarget,children:T.tokenType==="env_var"?T.envVar:T.filePath}),i.jsx("button",{className:be.deleteButton,onClick:()=>w(T.name),title:`Delete ${T.name}`,"aria-label":`Delete ${T.name}`,children:i.jsx(Ha,{size:tn,"aria-hidden":"true"})})]},T.name))}),i.jsxs("form",{className:be.addForm,onSubmit:k,children:[i.jsxs("div",{className:be.formRow,children:[i.jsx("input",{className:be.input,type:"text",placeholder:"Token name",value:c,onChange:T=>d(T.target.value)}),i.jsx("input",{className:be.input,type:"password",placeholder:"Value",value:u,onChange:T=>p(T.target.value)})]}),i.jsxs("div",{className:be.formRow,children:[i.jsx("select",{className:be.select,value:m,onChange:T=>g(T.target.value),children:UO.map(T=>i.jsx("option",{value:T.value,children:T.label},T.value))}),i.jsx("input",{className:be.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)}),i.jsx("button",{className:be.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const Cd=[{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"]}],j1=new Set(Cd.map(t=>t.id)),Hb="grackle";function Qp(t){return Cd.find(s=>s.id===t)}function HO({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return i.jsxs("section",{className:be.section,children:[i.jsx("h3",{className:be.sectionTitle,children:"Appearance"}),i.jsx("p",{className:be.sectionDescription,children:"Choose how Grackle looks across the app."}),i.jsx("div",{className:be.themeOptions,children:Cd.filter(d=>!d.hidden).map(d=>{const u=!!(d.variantLightId&&d.variantDarkId),p=u?t===d.id||t===d.variantLightId||t===d.variantDarkId:t===d.id,m=u&&s===d.variantLightId;return i.jsxs("button",{type:"button",className:`${be.themeOption} ${p?be.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>o(d.id),children:[i.jsxs("span",{className:be.themeOptionHeader,children:[i.jsxs("span",{children:[i.jsx("span",{className:be.themeOptionLabel,children:d.label}),i.jsx("span",{className:be.themeOptionDesc,children:d.description})]}),u&&i.jsxs("span",{className:be.variantToggle,children:[i.jsx("span",{role:"button",tabIndex:0,className:`${be.variantButton} ${p&&m?be.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&m,children:"☼"}),i.jsx("span",{role:"button",tabIndex:0,className:`${be.variantButton} ${p&&!m?be.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!m,children:"☾"})]})]}),d.swatches&&i.jsx("span",{className:be.themeSwatches,children:d.swatches.map((g,v)=>i.jsx("span",{className:be.themeSwatch,style:{background:g}},v))})]},d.id)})}),i.jsxs("label",{className:be.systemToggle,children:[i.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),i.jsx("span",{children:"Match system light/dark preference"})]}),i.jsx("p",{className:be.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),i.jsxs("p",{className:be.themeActive,children:["Active theme: ",i.jsx("strong",{children:s})]})]})}function VO({connected:t,environments:s,sessions:o}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=o.filter(u=>["running","idle"].includes(u.status)).length;return i.jsxs("section",{className:be.section,"data-testid":"about-panel",children:[i.jsx("h3",{className:be.sectionTitle,children:"About"}),i.jsx("p",{className:be.sectionDescription,children:"Connection status and application information."}),i.jsxs("div",{className:be.aboutGrid,children:[i.jsxs("div",{className:be.aboutItem,children:[i.jsx("span",{className:be.aboutLabel,children:"Connection"}),i.jsxs("span",{className:be.aboutValue,children:[i.jsx("span",{className:`${be.aboutDot} ${t?be.aboutDotConnected:be.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),i.jsxs("div",{className:be.aboutItem,children:[i.jsx("span",{className:be.aboutLabel,children:"Environments"}),i.jsxs("span",{className:be.aboutValue,children:[r,"/",c," connected"]})]}),i.jsxs("div",{className:be.aboutItem,children:[i.jsx("span",{className:be.aboutLabel,children:"Active Sessions"}),i.jsx("span",{className:be.aboutValue,children:d})]}),i.jsxs("div",{className:be.aboutItem,children:[i.jsx("span",{className:be.aboutLabel,children:"Version"}),i.jsx("span",{className:be.aboutValue,children:"0.96.1"})]})]})]})}const qO="_container_cddyd_1",GO="_header_cddyd_8",FO="_headerTitle_cddyd_35",ZO="_badge_cddyd_44",KO="_headerActions_cddyd_54",YO="_body_cddyd_61",JO="_formContent_cddyd_73",WO="_section_cddyd_85",XO="_label_cddyd_91",QO="_titleInput_cddyd_98",eB="_descriptionTextarea_cddyd_131",tB="_parentContext_cddyd_167",nB="_parentLabel_cddyd_175",sB="_parentName_cddyd_182",aB="_personaSelect_cddyd_186",iB="_depList_cddyd_220",oB="_depItem_cddyd_226",rB="_depItemSelected_cddyd_248",lB="_noDeps_cddyd_252",cB="_btnPrimary_cddyd_258",dB="_btnGhost_cddyd_289",tt={container:qO,header:GO,headerTitle:FO,badge:ZO,headerActions:KO,body:YO,formContent:JO,section:WO,label:XO,titleInput:QO,descriptionTextarea:eB,parentContext:tB,parentLabel:nB,parentName:sB,personaSelect:aB,depList:iB,depItem:oB,depItemSelected:rB,noDeps:lB,btnPrimary:cB,btnGhost:dB};function N1({mode:t,taskId:s,workspaceId:o,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:p,onCreateTask:m,onUpdateTask:g,onEditDone:v,onShowToast:b}){const x=kt(),S=t==="edit",k=S&&s?d.find(ve=>ve.id===s):void 0,w=S?(k==null?void 0:k.workspaceId)??"":o??"",[N,T]=y.useState(w),C=w||N,D=u.find(ve=>ve.id===C),O=c??(D==null?void 0:D.environmentId),E=!S&&!o,A=S?(k==null?void 0:k.parentTaskId)??"":r??"",P=A?d.find(ve=>ve.id===A):void 0,[I,U]=y.useState((k==null?void 0:k.title)??""),[Q,$]=y.useState((k==null?void 0:k.description)??""),[H,ue]=y.useState((k==null?void 0:k.dependsOn)??[]),[W,oe]=y.useState((k==null?void 0:k.defaultPersonaId)??""),[L,Z]=y.useState((k==null?void 0:k.canDecompose)??!1),[J,ce]=y.useState(!1),X=y.useRef(!1);y.useEffect(()=>{S&&k&&!X.current&&(X.current=!0,U(k.title),$(k.description),ue(k.dependsOn),oe(k.defaultPersonaId),Z(k.canDecompose))},[S,k]);const ge=d.filter(ve=>ve.workspaceId===C&&(!S||ve.id!==s)&&ve.id!==A),pe=I.trim().length>0&&(!S||k!==void 0)&&C.length>0,Ce=ve=>{ue(Le=>Le.includes(ve)?Le.filter(Mt=>Mt!==ve):[...Le,ve])},Ze=()=>{!pe||J||S&&k===void 0||(S&&s?(g(s,I.trim(),Q,H,W),b==null||b("Task updated","success"),v?v():x(On(s,void 0,C,O),{replace:!0})):(ce(!0),m(C,I.trim(),Q,H.length>0?H:void 0,A||void 0,W,L,()=>{b==null||b("Task created","success"),x(o?$a(o,O):"/tasks",{replace:!0})},ve=>{b==null||b(ve,"error"),ce(!1)})))},me=()=>{if(v){v();return}x(S&&s?On(s,void 0,C,O):o?$a(o,O):"/tasks")},_e=S?"edit task":A?"child task":"new task";return i.jsxs("div",{className:tt.container,children:[i.jsxs("div",{className:tt.header,children:[i.jsxs("div",{className:tt.headerTitle,children:[i.jsx("span",{className:tt.badge,children:_e}),P&&i.jsxs("span",{className:tt.parentContext,children:[i.jsx("span",{className:tt.parentLabel,children:"Child of"}),i.jsx("span",{className:tt.parentName,children:P.title})]})]}),i.jsxs("div",{className:tt.headerActions,children:[i.jsx("button",{onClick:Ze,disabled:!pe||J,className:tt.btnPrimary,"data-testid":"task-edit-save",children:J?"Creating…":S?"Save Changes":"Create"}),i.jsx("button",{onClick:me,className:tt.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:tt.body,children:i.jsxs("div",{className:tt.formContent,children:[E&&i.jsxs("div",{className:tt.section,children:[i.jsx("label",{className:tt.label,htmlFor:"task-edit-workspace",children:"Workspace"}),i.jsxs("select",{id:"task-edit-workspace",value:N,onChange:ve=>T(ve.target.value),className:tt.personaSelect,"data-testid":"task-edit-workspace",children:[i.jsx("option",{value:"",children:"Select a workspace..."}),u.map(ve=>i.jsx("option",{value:ve.id,children:ve.name},ve.id))]})]}),i.jsxs("div",{className:tt.section,children:[i.jsx("label",{className:tt.label,htmlFor:"task-edit-title",children:"Title"}),i.jsx("input",{id:"task-edit-title",type:"text",value:I,onChange:ve=>U(ve.target.value),placeholder:"Task title...",autoFocus:!0,className:tt.titleInput,"data-testid":"task-edit-title",onKeyDown:ve=>{ve.key==="Enter"&&pe&&Ze()}})]}),i.jsxs("div",{className:tt.section,children:[i.jsx("label",{className:tt.label,htmlFor:"task-edit-description",children:"Description"}),i.jsx("textarea",{id:"task-edit-description",value:Q,onChange:ve=>$(ve.target.value),placeholder:"Describe the task... (markdown supported)",className:tt.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),i.jsxs("div",{className:tt.section,children:[i.jsx("label",{className:tt.label,htmlFor:"task-edit-persona",children:"Default Persona"}),i.jsxs("select",{id:"task-edit-persona",value:W,onChange:ve=>oe(ve.target.value),className:tt.personaSelect,"data-testid":"task-edit-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),p.map(ve=>i.jsx("option",{value:ve.id,children:ve.name},ve.id))]})]}),!S&&i.jsx("div",{className:tt.section,children:i.jsxs("label",{className:tt.depItem,"data-testid":"task-edit-can-decompose",children:[i.jsx("input",{type:"checkbox",checked:L,onChange:ve=>Z(ve.target.checked)}),"Can spawn subtasks"]})}),i.jsxs("div",{className:tt.section,children:[i.jsx("div",{className:tt.label,children:"Dependencies"}),ge.length===0?i.jsx("div",{className:tt.noDeps,children:"No other tasks in this workspace"}):i.jsx("div",{className:tt.depList,children:ge.map(ve=>{const Le=H.includes(ve.id);return i.jsxs("label",{className:`${tt.depItem} ${Le?tt.depItemSelected:""}`,"data-testid":`dep-option-${ve.id}`,children:[i.jsx("input",{type:"checkbox",checked:Le,onChange:()=>Ce(ve.id)}),ve.title,i.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",ve.status,")"]})]},ve.id)})})]})]})})]})}const uB="_actionButtons_1rjka_1",fB="_btnPrimary_1rjka_8",pB="_btnDanger_1rjka_39",mB="_btnGhost_1rjka_78",Ft={actionButtons:uB,btnPrimary:fB,btnDanger:pB,btnGhost:mB};function hB({task:t,sessionId:s,isBlocked:o,onStart:r,onResume:c,onStop:d,onPause:u,onDelete:p,onEdit:m}){if(t.status==="not_started")return o?i.jsxs("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:m,className:Ft.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Ft.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):i.jsxs("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{"data-testid":"task-header-start",onClick:r,className:Ft.btnPrimary,children:"Start"}),i.jsx("button",{onClick:m,className:Ft.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Ft.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return i.jsxs("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Ft.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:u,disabled:!s,className:Ft.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused")return i.jsxs("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Ft.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:c,className:Ft.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),i.jsx("button",{onClick:p,className:Ft.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="complete")return i.jsx("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:i.jsx("button",{onClick:p,className:Ft.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return i.jsxs("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:r,className:Ft.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),i.jsx("button",{onClick:p,className:Ft.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const gB="_workpadSection_y8nj9_1",vB="_workpadLabel_y8nj9_9",yB="_workpadStatus_y8nj9_17",bB="_workpadSummary_y8nj9_23",xB="_workpadExtra_y8nj9_29",Da={workpadSection:gB,workpadLabel:vB,workpadStatus:yB,workpadSummary:bB,workpadExtra:xB};function _B({workpad:t}){if(!t)return;let s;try{const o=JSON.parse(t);if(o==null||typeof o!="object"||Array.isArray(o))return;s=o}catch{return i.jsxs("div",{className:Da.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:Da.workpadLabel,children:"Workpad"}),i.jsx("div",{className:Da.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return i.jsxs("div",{className:Da.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:Da.workpadLabel,children:"Workpad"}),s.status&&i.jsx("div",{className:Da.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&i.jsx("div",{className:Da.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&i.jsx("div",{className:Da.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const kB="_overviewDashboard_r05qm_1",SB="_overviewHero_r05qm_7",TB="_statusBadge_r05qm_14",wB="_statusPending_r05qm_26",jB="_statusAssigned_r05qm_31",NB="_statusInProgress_r05qm_36",CB="_statusReview_r05qm_41",EB="_statusDone_r05qm_46",AB="_statusFailed_r05qm_51",DB="_statusWaitingInput_r05qm_56",RB="_overviewBranchPill_r05qm_61",MB="_branchLink_r05qm_76",IB="_overviewSection_r05qm_87",OB="_overviewLabel_r05qm_93",BB="_overviewValue_r05qm_100",LB="_overviewMuted_r05qm_105",zB="_overviewMarkdown_r05qm_111",$B="_envRow_r05qm_180",UB="_envDot_r05qm_186",PB="_envDotGreen_r05qm_193",HB="_envDotYellow_r05qm_197",VB="_envDotRed_r05qm_201",qB="_envDotGray_r05qm_205",GB="_depList_r05qm_209",FB="_depItem_r05qm_215",ZB="_depBlocked_r05qm_222",KB="_depDone_r05qm_226",YB="_timeline_r05qm_230",JB="_timelineRow_r05qm_236",WB="_timelineKey_r05qm_243",XB="_timelineValue_r05qm_249",QB="_timelineDelta_r05qm_253",eL="_reviewNotes_r05qm_264",he={overviewDashboard:kB,overviewHero:SB,statusBadge:TB,statusPending:wB,statusAssigned:jB,statusInProgress:NB,statusReview:CB,statusDone:EB,statusFailed:AB,statusWaitingInput:DB,overviewBranchPill:RB,branchLink:MB,overviewSection:IB,overviewLabel:OB,overviewValue:BB,overviewMuted:LB,overviewMarkdown:zB,envRow:$B,envDot:UB,envDotGreen:PB,envDotYellow:HB,envDotRed:VB,envDotGray:qB,depList:GB,depItem:FB,depBlocked:ZB,depDone:KB,timeline:YB,timelineRow:JB,timelineKey:WB,timelineValue:XB,timelineDelta:QB,reviewNotes:eL};function zc(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 yp(t,s){if(!t||!s)return;const o=new Date(s).getTime()-new Date(t).getTime();if(isNaN(o)||o<0)return;const r=Math.floor(o/6e4),c=Math.floor(o%6e4/1e3);if(r===0)return`${c}s`;const d=Math.floor(r/60),u=r%60;return d===0?`${r}m ${c}s`:`${d}h ${u}m`}function Vb(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?he.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?he.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?he.envDotRed:he.envDotGray}function tL({status:t}){const s=za(t),o=tw(t);return i.jsx("span",{className:`${he.statusBadge} ${he[o]??he.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function nL({task:t,tasksById:s,environments:o,workspaces:r,taskSessions:c,selectedEnvId:d,taskUsage:u,treeUsage:p}){const m=c.length>0?c[c.length-1]:void 0,g=(m==null?void 0:m.environmentId)??"",v=g?o.find(k=>k.id===g):void 0,b=r.find(k=>k.id===t.workspaceId),x=o.find(k=>k.id===d),S=t.branch&&(b!=null&&b.repoUrl)?`${b.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return i.jsxs("div",{className:he.overviewDashboard,"data-testid":"task-overview-panel",children:[i.jsxs("div",{className:he.overviewHero,children:[i.jsx(tL,{status:t.status}),t.branch&&i.jsx("span",{className:he.overviewBranchPill,"data-testid":"task-overview-branch",children:S?i.jsxs("a",{href:S,target:"_blank",rel:"noreferrer noopener",className:he.branchLink,children:["🔗"," ",t.branch]}):i.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&i.jsxs("div",{className:he.overviewSection,"data-testid":"task-overview-description",children:[i.jsx("div",{className:he.overviewLabel,children:"Description"}),i.jsx("div",{className:he.overviewMarkdown,children:i.jsx(hd,{remarkPlugins:[gd],children:t.description})})]}),t.workpad&&i.jsx(_B,{workpad:t.workpad}),i.jsxs("div",{className:he.overviewSection,children:[i.jsx("div",{className:he.overviewLabel,children:"Environment"}),g&&v?i.jsxs("div",{className:he.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${he.envDot} ${Vb(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),i.jsx("span",{className:he.overviewValue,children:v.displayName})]}):x?i.jsxs("div",{className:he.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${he.envDot} ${Vb(x.status)}`,title:x.status,"aria-label":`Status: ${x.status}`,role:"img"}),i.jsx("span",{className:he.overviewValue,children:x.displayName}),i.jsx("span",{className:he.overviewMuted,children:"(workspace default)"})]}):i.jsx("div",{className:he.overviewMuted,children:"Set in workspace settings"})]}),i.jsxs("div",{className:he.overviewSection,"data-testid":"task-overview-dependencies",children:[i.jsx("div",{className:he.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?i.jsx("div",{className:he.overviewMuted,children:"None"}):i.jsx("div",{className:he.depList,children:t.dependsOn.map(k=>{const w=s.get(k),N=(w==null?void 0:w.status)==="complete";return i.jsxs("div",{className:`${he.depItem} ${N?he.depDone:he.depBlocked}`,children:[i.jsx("span",{children:N?"✓":"○"}),i.jsx("span",{children:(w==null?void 0:w.title)??k})]},k)})})]}),i.jsxs("div",{className:he.overviewSection,"data-testid":"task-overview-timeline",children:[i.jsx("div",{className:he.overviewLabel,children:"Timeline"}),i.jsxs("div",{className:he.timeline,children:[t.createdAt&&i.jsxs("div",{className:he.timelineRow,children:[i.jsx("span",{className:he.timelineKey,children:"Created"}),i.jsx("span",{className:he.timelineValue,children:zc(t.createdAt)})]}),t.assignedAt&&(()=>{const k=yp(t.createdAt,t.assignedAt);return i.jsxs("div",{className:he.timelineRow,children:[i.jsx("span",{className:he.timelineKey,children:"Assigned"}),i.jsx("span",{className:he.timelineValue,children:zc(t.assignedAt)}),k!==void 0&&i.jsx("span",{className:he.timelineDelta,children:k})]})})(),t.startedAt&&(()=>{const k=yp(t.assignedAt??t.createdAt,t.startedAt);return i.jsxs("div",{className:he.timelineRow,children:[i.jsx("span",{className:he.timelineKey,children:"Started"}),i.jsx("span",{className:he.timelineValue,children:zc(t.startedAt)}),k!==void 0&&i.jsx("span",{className:he.timelineDelta,children:k})]})})(),t.completedAt&&(()=>{const k=yp(t.startedAt,t.completedAt);return i.jsxs("div",{className:he.timelineRow,children:[i.jsx("span",{className:he.timelineKey,children:"Completed"}),i.jsx("span",{className:he.timelineValue,children:zc(t.completedAt)}),k!==void 0&&i.jsx("span",{className:he.timelineDelta,children:k})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&i.jsx("div",{className:he.overviewMuted,children:"No timing data"})]})]}),u&&u.costUsd>0&&i.jsxs("div",{className:he.overviewSection,"data-testid":"task-overview-usage",children:[i.jsx("div",{className:he.overviewLabel,children:"Usage"}),i.jsxs("div",{className:he.timeline,children:[i.jsxs("div",{className:he.timelineRow,children:[i.jsx("span",{className:he.timelineKey,children:"Cost"}),i.jsx("span",{className:he.timelineValue,children:Ss(u.costUsd)}),i.jsxs("span",{className:he.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),p&&p.costUsd>u.costUsd&&i.jsxs("div",{className:he.timelineRow,children:[i.jsx("span",{className:he.timelineKey,children:"Total (incl. subtasks)"}),i.jsx("span",{className:he.timelineValue,children:Ss(p.costUsd)}),i.jsxs("span",{className:he.timelineDelta,children:[p.sessionCount," session",p.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&i.jsxs("div",{className:he.overviewSection,"data-testid":"task-overview-budget",children:[i.jsx("div",{className:he.overviewLabel,children:"Budget"}),i.jsxs("div",{className:he.timeline,children:[t.tokenBudget>0&&i.jsxs("div",{className:he.timelineRow,children:[i.jsx("span",{className:he.timelineKey,children:"Tokens"}),i.jsxs("span",{className:he.timelineValue,children:[Io(((u==null?void 0:u.inputTokens)??0)+((u==null?void 0:u.outputTokens)??0))," / ",Io(t.tokenBudget)]})]}),t.costBudgetMillicents>0&&i.jsxs("div",{className:he.timelineRow,children:[i.jsx("span",{className:he.timelineKey,children:"Cost"}),i.jsxs("span",{className:he.timelineValue,children:[Ss((u==null?void 0:u.costUsd)??0)," / ",Ss(t.costBudgetMillicents/1e5)]})]})]})]}),t.reviewNotes&&i.jsxs("div",{className:he.overviewSection,"data-testid":"task-overview-review-notes",children:[i.jsx("div",{className:he.overviewLabel,children:"Review Notes"}),i.jsx("div",{className:he.reviewNotes,children:t.reviewNotes})]})]})}const sL="_container_legrg_1",aL="_header_legrg_8",iL="_headerTitle_legrg_35",oL="_badge_legrg_44",rL="_headerActions_legrg_54",lL="_body_legrg_61",cL="_formContent_legrg_73",dL="_section_legrg_85",uL="_label_legrg_91",fL="_nameInput_legrg_98",pL="_fieldInput_legrg_131",mL="_adapterSelect_legrg_164",hL="_readOnlyValue_legrg_198",gL="_codespaceSection_legrg_204",vL="_codespaceActions_legrg_210",yL="_creatingHint_legrg_216",bL="_errorHint_legrg_222",xL="_btnPrimary_legrg_235",_L="_btnGhost_legrg_266",re={container:sL,header:aL,headerTitle:iL,badge:oL,headerActions:rL,body:lL,formContent:cL,section:dL,label:uL,nameInput:fL,fieldInput:pL,adapterSelect:mL,readOnlyValue:hL,codespaceSection:gL,codespaceActions:vL,creatingHint:yL,errorHint:bL,btnPrimary:xL,btnGhost:_L},Wc=1,Xc=65535;function bp(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=Wc&&s<=Xc}function xp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function kL({codespaceName:t,onCodespaceNameChange:s,envName:o,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:m}){const[g,v]=y.useState("pick"),[b,x]=y.useState(""),[S,k]=y.useState("");return g==="create"?i.jsxs("div",{className:re.codespaceSection,children:[i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Repository"}),i.jsx("input",{type:"text",value:b,onChange:w=>x(w.target.value),placeholder:"owner/repo",className:re.fieldInput,"data-testid":"env-codespace-repo"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Machine Type"}),i.jsx("input",{type:"text",value:S,onChange:w=>k(w.target.value),placeholder:"Machine type (optional)...",className:re.fieldInput,"data-testid":"env-codespace-machine"})]}),i.jsxs("div",{className:re.codespaceActions,children:[i.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),S.trim()||void 0),v("pick"),x(""),k(""))},disabled:!b.trim(),className:re.btnPrimary,children:"Create"}),i.jsx("button",{onClick:()=>{v("pick"),x(""),k("")},className:re.btnGhost,children:"Cancel"})]})]}):i.jsx("div",{className:re.codespaceSection,children:i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Codespace"}),!u&&i.jsxs("select",{value:t,onChange:w=>{w.target.value==="__create__"?(v("create"),s("")):(s(w.target.value),w.target.value&&!o.trim()&&r(w.target.value))},disabled:p,className:re.adapterSelect,"data-testid":"env-codespace-select",children:[i.jsx("option",{value:"",children:"Select a codespace..."}),c.map(w=>i.jsxs("option",{value:w.name,children:[w.name," (",w.repository,") — ",w.state]},w.name)),i.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&i.jsx("span",{className:re.creatingHint,children:"Creating codespace..."}),u&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:re.errorHint,children:u}),i.jsx("input",{type:"text",value:t,onChange:w=>s(w.target.value),placeholder:"Or enter codespace name manually...",className:re.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&i.jsx("span",{className:re.errorHint,children:d})]})})}function C1({mode:t,environmentId:s,environments:o,onAddEnvironment:r,onUpdateEnvironment:c,onListCodespaces:d,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v,onShowToast:b}){const x=kt(),S=t==="edit",k=S&&s?o.find(me=>me.id===s):void 0,[w,N]=y.useState(""),[T,C]=y.useState("local"),[D,O]=y.useState(""),[E,A]=y.useState(""),[P,I]=y.useState(""),[U,Q]=y.useState(""),[$,H]=y.useState(""),[ue,W]=y.useState(""),[oe,L]=y.useState(""),[Z,J]=y.useState(null),ce=y.useCallback(()=>{const me={};if(T==="local"){if(D.trim()&&(me.host=D.trim()),E.trim()){const _e=Number(E);Number.isInteger(_e)&&(me.port=_e)}}else if(T==="ssh"){if(me.host=D.trim(),P.trim()&&(me.user=P.trim()),E.trim()){const _e=Number(E);Number.isInteger(_e)&&(me.sshPort=_e)}U.trim()&&(me.identityFile=U.trim())}else T==="docker"?($.trim()&&(me.image=$.trim()),ue.trim()&&(me.repo=ue.trim())):T==="codespace"&&(me.codespaceName=oe.trim());return me},[T,D,E,P,U,$,ue,oe]),X=()=>!(!w.trim()||T==="ssh"&&!D.trim()||T==="codespace"&&!oe.trim()||(T==="local"||T==="ssh")&&!bp(E)),ge=()=>{X()&&(r(w.trim(),T,ce()),b==null||b("Environment added successfully","success"),x(Mo,{replace:!0}))},pe=()=>{x(s?Ni(s):Mo)},Ce=y.useCallback((me,_e)=>{if(!k||!s)return;const ve=xp(k.adapterConfig),Le=_e.trim();Le?ve[me]=Le:delete ve[me],c(s,{adapterConfig:ve})},[k,s,c]),Ze=y.useCallback((me,_e)=>{if(!k||!s)return;const ve=xp(k.adapterConfig);if(_e.trim()){const Le=Number(_e);Number.isInteger(Le)&&Le>=Wc&&Le<=Xc&&(ve[me]=Le)}else delete ve[me];c(s,{adapterConfig:ve})},[k,s,c]);if(S){if(!k)return i.jsxs("div",{className:re.container,children:[i.jsxs("div",{className:re.header,children:[i.jsx("div",{className:re.headerTitle,children:i.jsx("span",{className:re.badge,children:"edit environment"})}),i.jsx("div",{className:re.headerActions,children:i.jsx("button",{onClick:pe,className:re.btnGhost,children:"Back"})})]}),i.jsx("div",{className:re.body,children:i.jsx("div",{className:re.formContent,children:i.jsx("span",{className:re.readOnlyValue,children:"Environment not found"})})})]});const me=xp(k.adapterConfig);return i.jsxs("div",{className:re.container,"data-testid":"env-edit-panel",children:[i.jsxs("div",{className:re.header,children:[i.jsx("div",{className:re.headerTitle,children:i.jsx("span",{className:re.badge,children:"edit environment"})}),i.jsx("div",{className:re.headerActions,children:i.jsx("button",{onClick:pe,className:re.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),i.jsx("div",{className:re.body,children:i.jsxs("div",{className:re.formContent,children:[i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Name"}),i.jsx(ln,{value:k.displayName,onSave:_e=>{s&&c(s,{displayName:_e})},validate:_e=>_e.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:Z,onActivate:J,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Adapter Type"}),i.jsx("span",{className:re.readOnlyValue,"data-testid":"env-edit-adapter-type",children:k.adapterType})]}),k.adapterType==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Host"}),i.jsx(ln,{value:String(me.host??""),onSave:_e=>Ce("host",_e),mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:J,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Port"}),i.jsx(ln,{value:String(me.port??""),onSave:_e=>Ze("port",_e),validate:_e=>bp(_e)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:Z,onActivate:J,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),k.adapterType==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Host"}),i.jsx(ln,{value:String(me.host??""),onSave:_e=>Ce("host",_e),validate:_e=>_e.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:J,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"User"}),i.jsx(ln,{value:String(me.user??""),onSave:_e=>Ce("user",_e),mode:"edit",fieldId:"user",activeFieldId:Z,onActivate:J,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"SSH Port"}),i.jsx(ln,{value:String(me.sshPort??""),onSave:_e=>Ze("sshPort",_e),validate:_e=>bp(_e)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:Z,onActivate:J,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Identity File"}),i.jsx(ln,{value:String(me.identityFile??""),onSave:_e=>Ce("identityFile",_e),mode:"edit",fieldId:"identityFile",activeFieldId:Z,onActivate:J,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),k.adapterType==="docker"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Image"}),i.jsx(ln,{value:String(me.image??""),onSave:_e=>Ce("image",_e),mode:"edit",fieldId:"image",activeFieldId:Z,onActivate:J,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Repo"}),i.jsx(ln,{value:String(me.repo??""),onSave:_e=>Ce("repo",_e),mode:"edit",fieldId:"repo",activeFieldId:Z,onActivate:J,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),k.adapterType==="codespace"&&i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,children:"Codespace Name"}),i.jsx(ln,{value:String(me.codespaceName??""),onSave:_e=>Ce("codespaceName",_e),validate:_e=>_e.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:Z,onActivate:J,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return i.jsxs("div",{className:re.container,"data-testid":"env-create-panel",children:[i.jsxs("div",{className:re.header,children:[i.jsx("div",{className:re.headerTitle,children:i.jsx("span",{className:re.badge,children:"new environment"})}),i.jsxs("div",{className:re.headerActions,children:[i.jsx("button",{onClick:ge,disabled:!X(),className:re.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),i.jsx("button",{onClick:pe,className:re.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:re.body,children:i.jsxs("div",{className:re.formContent,children:[i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,htmlFor:"env-create-name",children:"Name"}),i.jsx("input",{id:"env-create-name",type:"text",value:w,onChange:me=>N(me.target.value),placeholder:"Environment name...",autoFocus:!0,className:re.nameInput,"data-testid":"env-create-name",onKeyDown:me=>{me.key==="Enter"&&X()&&ge()}})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),i.jsxs("select",{id:"env-create-adapter",value:T,onChange:me=>{C(me.target.value),me.target.value==="codespace"&&d()},className:re.adapterSelect,"data-testid":"env-create-adapter",children:[i.jsx("option",{value:"local",children:"local"}),i.jsx("option",{value:"ssh",children:"ssh"}),i.jsx("option",{value:"docker",children:"docker"}),i.jsx("option",{value:"codespace",children:"codespace"})]})]}),T==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:D,onChange:me=>O(me.target.value),placeholder:"Host (optional)...",className:re.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,htmlFor:"env-create-port",children:"Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:Wc,max:Xc,value:E,onChange:me=>A(me.target.value),placeholder:"Port (optional)...",className:re.fieldInput,"data-testid":"env-create-port"})]})]}),T==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:D,onChange:me=>O(me.target.value),placeholder:"Host (required)...",className:re.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,htmlFor:"env-create-user",children:"User"}),i.jsx("input",{id:"env-create-user",type:"text",value:P,onChange:me=>I(me.target.value),placeholder:"User (optional)...",className:re.fieldInput,"data-testid":"env-create-user"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,htmlFor:"env-create-port",children:"SSH Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:Wc,max:Xc,value:E,onChange:me=>A(me.target.value),placeholder:"SSH port (optional)...",className:re.fieldInput,"data-testid":"env-create-port"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,htmlFor:"env-create-identity",children:"Identity File"}),i.jsx("input",{id:"env-create-identity",type:"text",value:U,onChange:me=>Q(me.target.value),placeholder:"Identity file (optional)...",className:re.fieldInput,"data-testid":"env-create-identity"})]})]}),T==="docker"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,htmlFor:"env-create-image",children:"Image"}),i.jsx("input",{id:"env-create-image",type:"text",value:$,onChange:me=>H(me.target.value),placeholder:"Image (optional)...",className:re.fieldInput,"data-testid":"env-create-image"})]}),i.jsxs("div",{className:re.section,children:[i.jsx("label",{className:re.label,htmlFor:"env-create-repo",children:"Repo"}),i.jsx("input",{id:"env-create-repo",type:"text",value:ue,onChange:me=>W(me.target.value),placeholder:"Repo (optional)...",className:re.fieldInput,"data-testid":"env-create-repo"})]})]}),T==="codespace"&&i.jsx(kL,{codespaceName:oe,onCodespaceNameChange:L,envName:w,onEnvNameChange:N,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v})]})})]})}const SL="_group_1iprv_1",TL="_groupTitle_1iprv_8",wL="_shortcutList_1iprv_17",jL="_shortcutRow_1iprv_23",NL="_keys_1iprv_36",CL="_kbd_1iprv_43",EL="_description_1iprv_60",_i={group:SL,groupTitle:TL,shortcutList:wL,shortcutRow:jL,keys:NL,kbd:CL,description:EL},AL=[{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 DL(){return i.jsxs("section",{className:be.section,"data-testid":"keyboard-shortcuts-panel",children:[i.jsx("h3",{className:be.sectionTitle,children:"Keyboard Shortcuts"}),i.jsx("p",{className:be.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),AL.map(t=>i.jsxs("div",{className:_i.group,children:[i.jsx("h4",{className:_i.groupTitle,children:t.title}),i.jsx("div",{className:_i.shortcutList,children:t.shortcuts.map(s=>i.jsxs("div",{className:_i.shortcutRow,children:[i.jsx("span",{className:_i.keys,children:s.keys.map(o=>i.jsx("kbd",{className:_i.kbd,children:o},o))}),i.jsx("span",{className:_i.description,children:s.description})]},s.description))})]},t.title))]})}const RL=[{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 ML({credentialProviders:t,onUpdateCredentialProviders:s}){const o=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return i.jsxs("section",{className:be.section,children:[i.jsx("h3",{className:be.sectionTitle,children:"Credential Providers"}),i.jsx("p",{className:be.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),i.jsx("div",{className:be.tokenList,children:RL.map(r=>i.jsxs("div",{className:be.tokenRow,children:[i.jsx("span",{className:be.tokenName,children:r.label}),i.jsx("span",{className:be.tokenTarget,children:r.description}),i.jsx("select",{className:be.select,value:t[r.key],onChange:c=>o(r.key,c.target.value),children:r.options.map(c=>i.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const IL="_container_10efq_1",OL="_header_10efq_7",BL="_list_10efq_105",LL="_card_10efq_111",zL="_cardHeader_10efq_125",$L="_cardTitle_10efq_135",UL="_defaultBadge_10efq_141",PL="_cardActions_10efq_155",HL="_description_10efq_160",VL="_meta_10efq_166",qL="_empty_10efq_212",GL="_typeBadge_10efq_362",Jn={container:IL,header:OL,list:BL,card:LL,cardHeader:zL,cardTitle:$L,defaultBadge:UL,cardActions:PL,description:HL,meta:VL,empty:qL,typeBadge:GL};function FL({personas:t,appDefaultPersonaId:s,onDeletePersona:o,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,p]=y.useState(null),m=u?t.find(v=>v.id===u):void 0,g=async v=>{await o(v),p(null)};return i.jsxs("div",{className:Jn.container,children:[i.jsxs("div",{className:Jn.header,children:[i.jsx("h2",{children:"Personas"}),i.jsx(Js,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?i.jsx("p",{className:Jn.empty,children:"No personas yet. Create one to get started."}):i.jsx("div",{className:Jn.list,children:t.map(v=>{const b=s===v.id,x=v.type==="script";return i.jsxs("div",{className:Jn.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:[i.jsxs("div",{className:Jn.cardHeader,children:[i.jsxs("span",{className:Jn.cardTitle,children:[i.jsx("strong",{children:v.name}),i.jsx("span",{className:Jn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:x?"Script":"Agent"}),b&&i.jsx("span",{className:Jn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),i.jsxs("div",{className:Jn.cardActions,onClick:S=>S.stopPropagation(),children:[!b&&i.jsx(Js,{variant:"ghost",size:"sm",onClick:()=>{r(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),i.jsx(Js,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),i.jsx(Js,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&i.jsx("p",{className:Jn.description,children:v.description}),i.jsxs("div",{className:Jn.meta,children:[v.runtime&&i.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&i.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&i.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),i.jsx(Ei,{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 ZL="_container_uy08i_1",KL="_header_uy08i_7",YL="_count_uy08i_13",JL="_presets_uy08i_18",WL="_presetButton_uy08i_24",XL="_filterInput_uy08i_41",QL="_groups_uy08i_53",e8="_group_uy08i_53",t8="_groupHeader_uy08i_68",n8="_groupName_uy08i_77",s8="_groupCount_uy08i_81",a8="_toolList_uy08i_87",i8="_toolItem_uy08i_95",o8="_toolName_uy08i_103",pn={container:ZL,header:KL,count:YL,presets:JL,presetButton:WL,filterInput:XL,groups:QL,group:e8,groupHeader:t8,groupName:n8,groupCount:s8,toolList:a8,toolItem:i8,toolName:o8},r8=(()=>{const t=new Map;for(const s of lx){const o=s==="get_version_status"?"version":s.split("_")[0];t.has(o)||t.set(o,[]),t.get(o).push(s)}return[...t.entries()].sort(([s],[o])=>s.localeCompare(o)).map(([s,o])=>({group:s,tools:o.sort()}))})(),l8=[{name:"default",label:"Default",tools:cx},{name:"worker",label:"Worker",tools:mT},{name:"orchestrator",label:"Orchestrator",tools:hT},{name:"admin",label:"Admin",tools:gT}];function qb({selectedTools:t,onChange:s,disabled:o}){const[r,c]=y.useState(""),d=y.useMemo(()=>new Set(t),[t]),u=y.useCallback(v=>{if(o)return;const b=new Set(d);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[d,s,o]),p=y.useCallback((v,b)=>{if(o)return;const x=new Set(d);for(const S of v)b?x.delete(S):x.add(S);s([...x].sort())},[d,s,o]),m=y.useCallback(v=>{o||s([...v].sort())},[s,o]),g=r.toLowerCase();return i.jsxs("div",{className:pn.container,"data-testid":"mcp-tool-selector",children:[i.jsx("div",{className:pn.header,children:i.jsx("span",{className:pn.count,children:t.length===0?`Using default (${cx.length} tools)`:`${t.length} of ${lx.size} tools selected`})}),i.jsxs("div",{className:pn.presets,"data-testid":"mcp-tool-presets",children:[l8.map(v=>i.jsx("button",{type:"button",className:pn.presetButton,disabled:o,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),i.jsx("button",{type:"button",className:pn.presetButton,disabled:o,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),i.jsx("input",{type:"text",className:pn.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:o,"data-testid":"mcp-tool-filter"}),i.jsx("div",{className:pn.groups,children:r8.map(({group:v,tools:b})=>{const x=g?b.filter(k=>k.toLowerCase().includes(g)):b;if(x.length===0)return null;const S=x.every(k=>d.has(k));return i.jsxs("div",{className:pn.group,"data-testid":`tool-group-${v}`,children:[i.jsxs("label",{className:pn.groupHeader,children:[i.jsx("input",{type:"checkbox",checked:S,onChange:()=>p(x,S),disabled:o,"data-testid":`group-toggle-${v}`}),i.jsx("span",{className:pn.groupName,children:v}),i.jsxs("span",{className:pn.groupCount,children:["(",x.filter(k=>d.has(k)).length,"/",x.length,")"]})]}),i.jsx("div",{className:pn.toolList,children:x.map(k=>i.jsxs("label",{className:pn.toolItem,children:[i.jsx("input",{type:"checkbox",checked:d.has(k),onChange:()=>u(k),disabled:o,"data-testid":`tool-${k}`}),i.jsx("span",{className:pn.toolName,children:k})]},k))})]},v)})})]})}const c8="_nav_1bhou_1",d8="_tab_1bhou_24",u8="_tabIcon_1bhou_62",f8="_tabActive_1bhou_68",$c={nav:c8,tab:d8,tabIcon:u8,tabActive:f8},Ks=[{path:"credentials",label:"Credentials",icon:i.jsx(T2,{size:zt})},{path:"personas",label:"Personas",icon:i.jsx(X2,{size:zt})},{path:"appearance",label:"Appearance",icon:i.jsx(U2,{size:zt})},{path:"shortcuts",label:"Shortcuts",icon:i.jsx(j2,{size:zt})},{path:"about",label:"About",icon:i.jsx(am,{size:zt})}];function p8(){var u;const t=Zt(),s=kt(),o=y.useRef(null),r=((u=Ks.find(p=>{const m=`${Ro}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??Ks[0].path,c=y.useCallback(p=>{s(`${Ro}/${p}`)},[s]),d=y.useCallback(p=>{var S,k;const m=(S=o.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:Ks.findIndex(w=>w.path===r);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%Ks.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+Ks.length)%Ks.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=Ks.length-1;else return;const x=Ks[b].path;s(`${Ro}/${x}`),(k=m[b])==null||k.focus()},[r,s]);return i.jsx("nav",{className:$c.nav,ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:Ks.map(p=>{const m=p.path===r;return i.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${$c.tab} ${m?$c.tabActive:""}`,onClick:()=>c(p.path),children:[i.jsx("span",{className:$c.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function m8({tasks:t,taskStatusById:s,sessionStatusByTaskId:o}){const r=new Map;for(const d of t)if(d.parentTaskId){const u=r.get(d.parentTaskId);u?u.push(d):r.set(d.parentTaskId,[d])}const c=new Map(ry.map(d=>[d,[]]));for(const d of t){const u=cl(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"&&o){const k=o.get(d.id);k==="idle"?b="Needs input":k==="completed"&&(b="Ready to complete")}const x={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:b},S=c.get(u);S?S.push(x):c.get("not_started").push(x)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return ry.map(d=>{const u=za(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const h8="_boardContainer_1c4y1_1",g8="_column_1c4y1_17",v8="_columnHeader_1c4y1_34",y8="_columnIcon_1c4y1_47",b8="_columnLabel_1c4y1_52",x8="_columnCount_1c4y1_57",_8="_cardList_1c4y1_67",k8="_emptyPlaceholder_1c4y1_76",S8="_card_1c4y1_67",T8="_cardHeader_1c4y1_107",w8="_cardStatusIcon_1c4y1_113",j8="_cardTitle_1c4y1_119",N8="_cardBadges_1c4y1_127",C8="_badge_1c4y1_134",E8="_blockedBadge_1c4y1_146",A8="_childBadge_1c4y1_151",D8="_depBadge_1c4y1_155",R8="_parentBadge_1c4y1_159",M8="_pausedSubBadge_1c4y1_166",I8="_personaBadge_1c4y1_170",O8="_envBadge_1c4y1_174",B8="_emptyCta_1c4y1_178",L8="_ctaButton_1c4y1_188",z8="_ctaDescription_1c4y1_204",it={boardContainer:h8,column:g8,columnHeader:v8,columnIcon:y8,columnLabel:b8,columnCount:x8,cardList:_8,emptyPlaceholder:k8,card:S8,cardHeader:T8,cardStatusIcon:w8,cardTitle:j8,cardBadges:N8,badge:C8,blockedBadge:E8,childBadge:A8,depBadge:D8,parentBadge:R8,pausedSubBadge:M8,personaBadge:I8,envBadge:O8,emptyCta:B8,ctaButton:L8,ctaDescription:z8};function $8({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=kt(),p=y.useMemo(()=>o.filter(x=>x.workspaceId===t),[o,t]),m=y.useMemo(()=>new Map(o.map(x=>[x.id,x.status])),[o]),g=y.useMemo(()=>new Map(p.map(x=>[x.id,x])),[p]),v=y.useMemo(()=>{const x=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 D=x.get(C.latestSessionId);if(D){if(w.set(C.id,D.endReason||D.status),D.personaId){const O=S.get(D.personaId);O&&N.set(C.id,O.name)}if(D.environmentId){const O=k.get(D.environmentId);O&&T.set(C.id,O.displayName)}}}return{sessionStatusByTaskId:w,personaNameByTaskId:N,environmentNameByTaskId:T}},[p,r,c,d]),b=y.useMemo(()=>m8({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?i.jsxs("div",{className:it.emptyCta,"data-testid":"board-empty-cta",children:[i.jsx("button",{className:it.ctaButton,onClick:()=>u(Ri(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:it.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):i.jsx("div",{className:it.boardContainer,"data-testid":"board-container",children:b.map(x=>i.jsxs("section",{className:it.column,"data-testid":`board-column-${x.status}`,"aria-label":`${x.label}, ${x.tasks.length} ${x.tasks.length===1?"task":"tasks"}`,children:[i.jsxs("div",{className:it.columnHeader,children:[i.jsx("span",{className:it.columnIcon,style:{color:x.style.color},children:x.style.icon}),i.jsx("span",{className:it.columnLabel,children:x.label}),i.jsx("span",{className:it.columnCount,"data-testid":`board-count-${x.status}`,children:x.tasks.length})]}),i.jsx("div",{className:it.cardList,children:x.tasks.length===0?i.jsx("div",{className:it.emptyPlaceholder,children:"No tasks"}):i.jsx(us,{mode:"popLayout",children:x.tasks.map(S=>i.jsx(Rt.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:i.jsx(U8,{boardTask:S,tasksById:g,personaName:v.personaNameByTaskId.get(S.task.id),envName:v.environmentNameByTaskId.get(S.task.id),onClick:()=>u(On(S.task.id,void 0,t,s))})},S.task.id))})})]},x.status))})}function U8({boardTask:t,tasksById:s,personaName:o,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=za(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return i.jsxs("div",{className:it.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),c())},children:[i.jsxs("div",{className:it.cardHeader,children:[i.jsx("span",{className:it.cardStatusIcon,style:{color:v.color},children:v.icon}),i.jsx("span",{className:it.cardTitle,children:d.title})]}),i.jsxs("div",{className:it.cardBadges,children:[b&&i.jsx("span",{className:`${it.badge} ${it.parentBadge}`,title:b.title,children:b.title}),p>0&&i.jsxs("span",{className:`${it.badge} ${it.childBadge}`,children:[m,"/",p]}),u&&i.jsx("span",{className:`${it.badge} ${it.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&i.jsx("span",{className:`${it.badge} ${it.depBadge}`,children:"dep"}),g&&i.jsx("span",{className:`${it.badge} ${it.pausedSubBadge}`,children:g}),o&&i.jsx("span",{className:`${it.badge} ${it.personaBadge}`,children:o}),r&&i.jsx("span",{className:`${it.badge} ${it.envBadge}`,children:r})]})]})}const P8="_formContent_ymnez_1",H8="_section_ymnez_13",V8="_label_ymnez_19",q8="_titleInput_ymnez_26",G8="_descriptionTextarea_ymnez_58",F8="_selectField_ymnez_94",Z8="_checkboxRow_ymnez_128",K8="_checkboxLabel_ymnez_141",Y8="_fieldError_ymnez_146",bt={formContent:P8,section:H8,label:V8,titleInput:q8,descriptionTextarea:G8,selectField:F8,checkboxRow:Z8,checkboxLabel:K8,fieldError:Y8};function J8(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 W8=100;function X8({values:t,onChange:s,environments:o,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return i.jsxs("div",{className:bt.formContent,children:[i.jsxs("div",{className:bt.section,children:[i.jsx("label",{className:bt.label,htmlFor:"ws-name",children:"Name"}),i.jsx("input",{id:"ws-name",className:bt.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:W8,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&i.jsx("span",{className:bt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),i.jsxs("div",{className:bt.section,children:[i.jsx("label",{className:bt.label,htmlFor:"ws-description",children:"Description"}),i.jsx("textarea",{id:"ws-description",className:bt.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),i.jsxs("div",{className:bt.section,children:[i.jsx("label",{className:bt.label,htmlFor:"ws-repo",children:"Repository URL"}),i.jsx("input",{id:"ws-repo",className:bt.titleInput,type:"text",value:t.repoUrl,onChange:m=>p("repoUrl",m.target.value),placeholder:"https://github.com/org/repo",disabled:d,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&i.jsx("span",{className:bt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),i.jsxs("div",{className:bt.section,children:[i.jsx("label",{className:bt.label,htmlFor:"ws-environment",children:"Environment"}),i.jsxs("select",{id:"ws-environment",className:bt.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[i.jsx("option",{value:"",children:"Select environment…"}),o.map(m=>i.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&i.jsx("span",{className:bt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),i.jsxs("div",{className:bt.section,children:[i.jsx("label",{className:bt.label,htmlFor:"ws-persona",children:"Default Persona"}),i.jsxs("select",{id:"ws-persona",className:bt.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>i.jsx("option",{value:m.id,children:m.name},m.id))]})]}),i.jsx("div",{className:bt.section,children:i.jsxs("label",{className:bt.checkboxRow,children:[i.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),i.jsx("span",{className:bt.checkboxLabel,children:"Enable worktree isolation"})]})}),i.jsxs("div",{className:bt.section,children:[i.jsx("label",{className:bt.label,htmlFor:"ws-workdir",children:"Working Directory"}),i.jsx("input",{id:"ws-workdir",className:bt.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 E1=y.createContext(void 0),Q8=4e3;function e7({children:t}){const[s,o]=y.useState([]),r=y.useRef(0),c=y.useCallback(u=>{o(p=>p.filter(m=>m.id!==u))},[]),d=y.useCallback((u,p="info",m=Q8)=>{const g=`toast-${++r.current}`;o(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return i.jsx(E1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function Sn(){const t=y.useContext(E1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const em="grackle-theme",A1="grackle-prefer-system",D1="(prefers-color-scheme: dark)";let Fr=[],Qc;function _p(){Qc=void 0;for(const t of Fr)t()}function tm(){return typeof window>"u"?!1:window.matchMedia(D1).matches}function Xr(){if(typeof localStorage>"u")return Hb;try{const t=localStorage.getItem(em);if(t!==null&&j1.has(t))return t}catch{}return Hb}function pd(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(A1)==="true"}catch{return!1}}function nm(t){return Cd.find(s=>s.variantLightId===t||s.variantDarkId===t)}function R1(t,s){const o=Qp(t);if(o!=null&&o.variantDarkId)return s&&o.variantLightId?tm()?o.variantDarkId:o.variantLightId:o.variantDarkId;if(o!=null&&o.hidden&&s){const r=nm(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return tm()?r.variantDarkId:r.variantLightId}return t}function wo(t,s,o=!1){o&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=R1(t,s),o&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&wo(Xr(),pd());function t7(){return Qc===void 0&&(Qc={themeId:Xr(),systemDark:tm(),preferSystem:pd()}),Qc}function n7(t){return Fr=[...Fr,t],()=>{Fr=Fr.filter(s=>s!==t)}}function s7(){const t=y.useSyncExternalStore(n7,t7),{themeId:s,preferSystem:o}=t,r=R1(s,o),c=y.useCallback(u=>{if(j1.has(u)){try{localStorage.setItem(em,u)}catch{}wo(u,pd(),!0),_p()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(A1,u?"true":"false")}catch{}if(u){const p=Xr(),m=Qp(p);if(m!=null&&m.hidden){const g=nm(p);if(g)try{localStorage.setItem(em,g.id)}catch{}}}wo(Xr(),u,!0),_p()},[]);return y.useEffect(()=>{wo(s,o)},[s,o]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(D1),p=()=>{const m=Xr(),g=pd();if(g){const v=Qp(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&wo(m,g),v!=null&&v.hidden){const b=nm(m);b!=null&&b.variantDarkId&&b.variantLightId&&wo(m,g)}}_p()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:o,setPreferSystem:d}}const M1=y.createContext(void 0);function a7({children:t}){const s=s7();return i.jsx(M1.Provider,{value:s,children:t})}function I1(){const t=y.useContext(M1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const O1=y.createContext(void 0),B1=y.createContext(void 0);function i7({children:t}){const[s,o]=y.useState(void 0),r=y.useCallback(c=>{o(c)},[]);return i.jsx(B1.Provider,{value:r,children:i.jsx(O1.Provider,{value:s,children:t})})}function o7(){return y.useContext(O1)}function r7(){const t=y.useContext(B1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const eh=y.createContext(void 0);function mt(){const t=y.useContext(eh);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function L1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function z1(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function l7(t){return L1(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 c7=new Set(["off","subscription","api_key"]),Uc=new Set(["off","on"]);function d7(t){return L1(t)&&c7.has(t.claude)&&Uc.has(t.github)&&Uc.has(t.copilot)&&Uc.has(t.codex)&&Uc.has(t.goose)}function $1(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 U1(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 To=5e3;function u7(t,s){const o=[];let r=t;const c=new Set;for(;r&&s.has(r)&&!c.has(r);){c.add(r);const d=s.get(r);o.unshift(d),r=d.parentTaskId||void 0}return o}const na={label:"Home",url:Ci};function f7(t){return t?[na,{label:"Settings",url:Ro},{label:t,url:void 0}]:[na,{label:"Settings",url:void 0}]}const th={label:"Environments",url:Mo};function p7(){return[na,{label:"Environments",url:void 0}]}function m7(){return[na,{label:"New Chat",url:void 0}]}function h7(t){return[na,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function g7(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[na,th,{label:(d==null?void 0:d.displayName)??"Environment",url:Ni(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function v7(t,s,o,r,c){const d=u7(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,m=p?o.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=[na];v&&g&&(b.push(th),b.push({label:v.displayName,url:Ni(g)})),m&&g&&b.push({label:m.name,url:$a(m.id,g)});for(let S=0;S<d.length-1;S++)b.push({label:d[S].title,url:On(d[S].id,void 0,p,g)});const x=d[d.length-1];return b.push({label:(x==null?void 0:x.title)??t,url:void 0}),b}const y7={label:"Findings",url:_d};function b7(){return[na,{label:"Findings",url:void 0}]}function P1(t,s,o,r,c){const d=[na];if(s&&o){const u=r.find(m=>m.id===s),p=c.find(m=>m.id===o);d.push(th),p&&d.push({label:p.displayName,url:Ni(o)}),u&&d.push({label:u.name,url:$a(s,o)}),d.push({label:"Findings",url:oN(s,o)})}else d.push(y7);return d.push({label:t,url:void 0}),d}function nh(t){const s=[];for(const o of t){const r=s[s.length-1];o.eventType==="text"&&(r==null?void 0:r.eventType)==="text"?s[s.length-1]={...r,content:r.content+o.content}:s.push(o)}return s}function Pc(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const o=t.item;if(o&&typeof o.id=="string")return o.id}function x7(t){if(typeof t.tool_use_id=="string")return t.tool_use_id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const o=t.item;if(o&&typeof o.id=="string")return o.id}function sh(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const o=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const b=s.get(v),x=b?Pc(b):void 0;if(x)try{const S=JSON.parse(v.content);o.set(x,{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 x=s.get(v),S=x?x7(x):void 0;if(!S)return v;const k=o.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]),x=b?Pc(b):void 0;x&&r.has(x)||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 x=d[v],S=d[b];let k;try{const w=JSON.parse(x.content);k={tool:w.tool,args:w.args}}catch{}if(k){let w;const N=S.content.trim();if(N.startsWith("{"))try{const D=JSON.parse(N);typeof D.detailedContent=="string"&&(w=D.detailedContent)}catch{}d[b]={...S,toolUseCtx:{...k,detailedResult:w}},c.add(b);const T=s.get(x),C=T?Pc(T):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(x,{...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 x=Pc(b);if(x&&r.has(x))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 x=v+1;x<g.length;x++)if(g[x].eventType!=="tool_use"){b=!0;break}b&&(g[v]={...g[v],settled:!0})}return g}function _7(t,s,o){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=H1(s),d=s.filter(m=>sm(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||sm(m,c)).length,p=o.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function H1(t){const s=new Map;for(const o of t)s.set(o.id,o.status);return s}function sm(t,s){return t.dependsOn.some(o=>s.get(o)!=="complete")}function k7(t,s){var u;const o=new Map;for(const p of s)o.set(p.id,p);const r=H1(t),c=[];for(const p of t){const m=p.workspaceId?((u=o.get(p.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:m}):sm(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 S7(t,s){const o=new Map;for(const r of s)o.set(r.id,r);return t.filter(r=>r.status==="running"||r.status==="idle"||r.status==="waiting").map(r=>{var c;return{session:r,environmentName:((c=o.get(r.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function T7(t,s,o){const r=new Map;for(const c of s){if(!c.workspaceId)continue;let d=r.get(c.workspaceId);d||(d={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},r.set(c.workspaceId,d)),d.totalTasks+=1,c.status==="complete"?d.completedTasks+=1:c.status==="working"?d.workingTasks+=1:c.status==="failed"&&(d.failedTasks+=1)}return t.map(c=>{const d=r.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:d.totalTasks,completedTasks:d.completedTasks,workingTasks:d.workingTasks,failedTasks:d.failedTasks}})}const ks=[{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}],Ra=[{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"}],w7=new Map(ks.map(t=>[t.id,t]));function kp(t){const s=w7.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const Gb={"kn-auth-flow":{node:kp("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:kp("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:kp("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"}]}},j7=[{id:"env-local-01",displayName:"Local Dev",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0},{id:"env-docker-01",displayName:"Docker Sandbox",adapterType:"docker",adapterConfig:'{"image":"node:20"}',status:"connected",bootstrapped:!0},{id:"env-cs-01",displayName:"GitHub Codespace",adapterType:"codespace",adapterConfig:'{"codespaceName":"my-codespace"}',status:"connected",bootstrapped:!0},{id:"env-remote-01",displayName:"Staging (SSH)",adapterType:"ssh",adapterConfig:'{"host":"192.168.1.10","user":"deploy","sshPort":22}',status:"disconnected",bootstrapped:!1},{id:"error-env",displayName:"Error Test",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0}],N7=[{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}],C7=[{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"}],E7=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",environmentId:"env-local-01",linkedEnvironmentIds:["env-docker-01"],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-01-15T10:00:00Z",updatedAt:"2026-01-15T10:00:00Z"},{id:"proj-beta",name:"Data Pipeline",description:"ETL pipelines for analytics and reporting",repoUrl:"https://github.com/acme/data-pipeline",environmentId:"env-docker-01",linkedEnvironmentIds:[],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-02-01T14:30:00Z",updatedAt:"2026-02-01T14:30:00Z"},{id:"proj-gamma",name:"Mobile App",description:"React Native cross-platform mobile application",repoUrl:"",environmentId:"env-local-01",linkedEnvironmentIds:[],status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],A7=[{id:"task-001",workspaceId:"proj-alpha",title:"Implement JWT authentication",description:"Replace session-based auth with JWT tokens across all protected routes",status:"working",branch:"feat/jwt-auth",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-001a","task-001b","task-001c"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Design and implement JWT-based authentication with access/refresh tokens, replacing session-based auth.",extra:{approach:"Replace express-session with JWT Bearer tokens. Access tokens expire in 24h, refresh tokens stored in DB.",files_changed:["src/middleware/auth.ts","src/routes/login.ts","src/routes/protected.ts"],decisions:["Chose jsonwebtoken over jose for consistency with existing codebase","24h access token expiry — long enough for dev sessions, short enough for security","Refresh tokens are 48-byte random hex stored in DB with user association"],blockers:"Need to verify token rotation strategy with security team before merging"}}),tokenBudget:0,costBudgetMillicents:0},{id:"task-001a",workspaceId:"proj-alpha",title:"Design token schema",description:"Define JWT payload structure, expiry, and refresh token strategy",status:"complete",branch:"feat/jwt-auth/design-token-schema",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:10:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-001b",workspaceId:"proj-alpha",title:"Implement auth middleware",description:"Build Express middleware that verifies JWT Bearer tokens",status:"working",branch:"feat/jwt-auth/implement-auth-middleware",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:15:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-001c",workspaceId:"proj-alpha",title:"Write auth integration tests",description:"End-to-end tests for login flow, token refresh, and protected route access",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-25T10:20:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-002",workspaceId:"proj-alpha",title:"Add rate limiting",description:"Implement token-bucket rate limiting for public API endpoints",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:05:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-003",workspaceId:"proj-alpha",title:"Set up OpenAPI documentation",description:"Generate Swagger docs from route decorators and serve at /api/docs",status:"paused",branch:"feat/openapi-docs",latestSessionId:"sess-002",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-24T16:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-004",workspaceId:"proj-alpha",title:"Database connection pooling",description:"Switch from single connection to a connection pool with health checks",status:"complete",branch:"feat/db-pool",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-23T11:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-005",workspaceId:"proj-alpha",title:"Fix N+1 query in user list",description:"Use a JOIN instead of per-row lookups in GET /api/users",status:"not_started",branch:"fix/user-list-n1",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:5,createdAt:"2026-02-22T09:30:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006",workspaceId:"proj-beta",title:"Add Parquet export support",description:"Allow pipeline outputs to be written as Parquet files for Spark consumption",status:"working",branch:"feat/parquet-export",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-006a","task-006b","task-006c","task-006d"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Plan for adding Parquet export support, including compression options and performance benchmarks.",extra:{approach:"Use apache-arrow npm package for Parquet write support. Map internal column types to Arrow type system.",compression:{supported:["snappy","zstd","gzip"],default:"snappy"},benchmarks:{"1M rows snappy":"2.3s","1M rows zstd":"3.1s","1M rows gzip":"4.8s"}}}),tokenBudget:0,costBudgetMillicents:0},{id:"task-006a",workspaceId:"proj-beta",title:"Define Parquet schema mapping",description:"Map internal column types to Arrow/Parquet type system",status:"complete",branch:"feat/parquet-export/define-parquet-schema-mapping",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:05:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006b",workspaceId:"proj-beta",title:"Implement row-group writer",description:"Write buffered row groups with configurable batch size",status:"complete",branch:"feat/parquet-export/implement-row-group-writer",latestSessionId:"",dependsOn:["task-006a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:10:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006c",workspaceId:"proj-beta",title:"Add compression options",description:"Support Snappy, ZSTD, and GZIP compression for Parquet output",status:"working",branch:"feat/parquet-export/add-compression-options",latestSessionId:"sess-004",dependsOn:["task-006b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T08:15:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006d",workspaceId:"proj-beta",title:"Write Parquet integration tests",description:"Round-trip tests: write Parquet, read back with pyarrow, verify data integrity",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-006c"],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-26T08:20:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007",workspaceId:"proj-beta",title:"Implement incremental loads",description:"Track watermarks so pipelines only process new/changed rows",status:"working",branch:"feat/incremental",latestSessionId:"sess-004",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:30:00Z",parentTaskId:"",depth:0,childTaskIds:["task-007a","task-007b"],canDecompose:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007a",workspaceId:"proj-beta",title:"Design watermark storage",description:"Define schema for per-pipeline high-watermark tracking",status:"complete",branch:"feat/incremental/design-watermark-storage",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:35:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007b",workspaceId:"proj-beta",title:"Implement change detection query",description:"Generate WHERE clauses from watermarks to fetch only changed rows",status:"failed",branch:"feat/incremental/implement-change-detection-query",latestSessionId:"",dependsOn:["task-007a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:40:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-008",workspaceId:"proj-beta",title:"Add pipeline monitoring dashboard",description:"Real-time metrics for pipeline throughput, latency, and error rates",status:"paused",branch:"feat/monitoring",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T09:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0}],Hc=[{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"}],D7=[{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:""}],R7=[{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:[]}],M7={"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 Me(t){return new Date(Date.now()+t).toISOString()}const Fb=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Me(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Me(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Me(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:Me(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:Me(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:Me(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:Me(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:Me(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_usd:.15})}},{delayMs:5e3,event:{eventType:"text",timestamp:Me(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Me(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Me(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Me(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Me(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:Me(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:Me(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:Me(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Me(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:Me(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:Me(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Me(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Me(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Me(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Me(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:Me(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:Me(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Me(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:Me(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:Me(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:Me(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Me(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Me(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Me(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:Me(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:Me(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:Me(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:Me(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Me(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:Me(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:Me(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:Me(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:Me(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:Me(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_usd:.12})}},{delayMs:8800,event:{eventType:"status",timestamp:Me(8800),content:"completed"}}]}],_s={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1},Zb=400;function I7({children:t}){const[s,o]=y.useState(j7),[r,c]=y.useState(N7),[d,u]=y.useState(C7),[p,m]=y.useState(void 0),[g,v]=y.useState(E7),[b,x]=y.useState(""),[S,k]=y.useState(A7),[w,N]=y.useState(Hc),[T,C]=y.useState(void 0),D=!1,[O,E]=y.useState(D7),[A,P]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[I,U]=y.useState(R7),[Q]=y.useState(M7),[$,H]=y.useState(""),[ue,W]=y.useState(ks),[oe,L]=y.useState(Ra),[Z,J]=y.useState(void 0),[ce,X]=y.useState(void 0),[ge,pe]=y.useState(""),Ce=y.useRef(void 0),Ze=y.useRef(0),me=y.useRef(0),_e=y.useRef(new Set),ve=y.useRef(new Map),Le=y.useRef(S);Le.current=S;const Mt=y.useRef(new Map),Tn=y.useRef(new Map),ie=y.useCallback(V=>(Ze.current+=1,`mock-${V}-${String(Ze.current).padStart(3,"0")}`),[]),Ve=y.useCallback(()=>{const V=Fb[me.current%Fb.length];return me.current+=1,V},[]),qt=y.useCallback((V,ae,le)=>{const de=setTimeout(()=>{var ye;_e.current.delete(de),le&&((ye=ve.current.get(le))==null||ye.delete(de)),V()},ae);_e.current.add(de),le&&(ve.current.has(le)||ve.current.set(le,new Set),ve.current.get(le).add(de))},[]),te=y.useCallback(V=>{const ae=ve.current.get(V);ae&&(ae.forEach(le=>{clearTimeout(le),_e.current.delete(le)}),ve.current.delete(V))},[]),ht=y.useCallback((V,ae,le)=>{c(de=>de.map(ye=>ye.id===V?{...ye,status:ae,...le!==void 0?{endReason:le}:{}}:ye))},[]),at=y.useCallback(V=>{u(ae=>[...ae,V])},[]),Kt=y.useCallback((V,ae,le)=>{ae.forEach((de,ye)=>{qt(()=>{const We={sessionId:V,...de.event,timestamp:new Date().toISOString()};if(at(We),de.event.eventType==="status"){const Te=$1(de.event.content),Ie=U1(de.event.content);ht(V,Te,Ie)}ye===ae.length-1&&le&&le()},de.delayMs,V)})},[qt,at,ht]),gt=y.useCallback(async(V,ae,le,de)=>{console.log("[MockGrackle] spawn",{environmentId:V,prompt:ae,runtime:de});const ye=ie("sess"),We={id:ye,environmentId:V,runtime:de||"claude-code",status:"running",prompt:ae,startedAt:new Date().toISOString()};c(Ie=>[...Ie,We]),m(ye);const Te=Ve();if(console.log(`[MockGrackle] Playing scenario: ${Te.label}`),Te.pauseForInput){const Ie=Te.pauseAfterStep??Te.steps.length-1,Ke=Te.steps.slice(0,Ie+1),ct=Ke.length>0?Ke[Ke.length-1].delayMs:0;Kt(ye,Ke),qt(()=>{ht(ye,"idle"),at({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ct+Zb,ye),Te.resumeSteps&&Mt.current.set(ye,Te.resumeSteps)}else Kt(ye,Te.steps)},[ie,Ve,Kt,qt,ht,at]),ps=y.useCallback(async V=>{console.log("[MockGrackle] kill",V),te(V),Mt.current.delete(V),ht(V,"stopped","killed"),at({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),k(ae=>ae.map(le=>le.latestSessionId===V&&le.status==="working"?{...le,status:"not_started"}:le))},[te,ht,at]),aa=y.useCallback(async V=>{console.log("[MockGrackle] stopGraceful",V),te(V),Mt.current.delete(V),ht(V,"stopped","terminated"),at({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),k(ae=>ae.map(le=>le.latestSessionId===V&&le.status==="working"?{...le,status:"not_started"}:le))},[te,ht,at]),es=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Fa=y.useCallback(async V=>{console.log("[MockGrackle] loadSessionEvents",V)},[]),ia=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),u([])},[]),Yt=y.useCallback(async(V,ae,le,de,ye,We,Te,Ie,Ke)=>{console.log("[MockGrackle] createWorkspace",{name:V,description:ae});const ct={id:ie("proj"),name:V,description:ae||"",repoUrl:le||"",environmentId:de||"",linkedEnvironmentIds:[],status:"active",workingDirectory:Te||"",useWorktrees:We??!0,defaultPersonaId:ye||"",tokenBudget:0,costBudgetMillicents:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Xe=>[...Xe,ct]),Ie&&Ie()},[ie]),Ii=y.useCallback(async V=>{console.log("[MockGrackle] archiveWorkspace",V),v(ae=>ae.map(le=>le.id===V?{...le,status:"archived"}:le))},[]),oa=y.useCallback(async V=>{console.log("[MockGrackle] loadTasks",V)},[]),Za=y.useCallback(async(V,ae,le,de,ye,We,Te,Ie,Ke)=>{console.log("[MockGrackle] createTask",{workspaceId:V,title:ae,parentTaskId:ye}),k(ct=>{const Xt=ct.filter(gn=>gn.workspaceId===V).reduce((gn,Qa)=>Math.max(gn,Qa.sortOrder),0),jt=ye?ct.find(gn=>gn.id===ye):void 0;if(ye&&!jt)return console.warn("[MockGrackle] Parent task not found:",ye),ct;if(jt&&!jt.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ye),ct;const Ue=jt?jt.depth+1:0,It={id:ie("task"),workspaceId:V,title:ae,description:le||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:de||[],reviewNotes:void 0,sortOrder:Xt+1,createdAt:new Date().toISOString(),parentTaskId:ye||"",depth:Ue,childTaskIds:[],canDecompose:Te??!ye,defaultPersonaId:We||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[...ct,It]}),Ie&&Ie()},[ie]),ms=y.useCallback(async(V,ae,le,de)=>{var ct;console.log("[MockGrackle] startTask",{taskId:V});const ye=Le.current.find(Xe=>Xe.id===V),We=(ye==null?void 0:ye.title)??"",Te=ie("sess"),Ie={id:Te,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:We||V,startedAt:new Date().toISOString()};c(Xe=>[...Xe,Ie]),k(Xe=>Xe.map(Xt=>Xt.id===V?{...Xt,status:"working",latestSessionId:Te,branch:`mock/${V.slice(0,8)}`}:Xt));const Ke=Ve();if(console.log(`[MockGrackle] Playing task scenario: ${Ke.label}`),Ke.pauseForInput){const Xe=Ke.pauseAfterStep??Ke.steps.length-1,Xt=Ke.steps.slice(0,Xe+1),jt=Xt.length>0?Xt[Xt.length-1].delayMs:0;if(Kt(Te,Xt),qt(()=>{ht(Te,"idle"),at({sessionId:Te,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},jt+Zb,Te),Ke.resumeSteps){const Ue=[...Ke.resumeSteps];Mt.current.set(Te,Ue);const It=Ue.reduce((gn,Qa)=>Math.max(gn,Qa.delayMs),0);Tn.current.set(Te,{taskId:V,delayAfterResume:It+200})}}else{const Xe=Ke.steps.length>0?Ke.steps[Ke.steps.length-1].delayMs:0;Kt(Te,Ke.steps);const Xt=(ct=Ke.steps[Ke.steps.length-1])==null?void 0:ct.event.content;qt(()=>{Xt==="completed"?k(jt=>jt.map(Ue=>Ue.id===V&&Ue.status==="working"?{...Ue,status:"paused"}:Ue)):Xt==="failed"&&k(jt=>jt.map(Ue=>Ue.id===V&&Ue.status==="working"?{...Ue,status:"failed"}:Ue))},Xe+100,Te)}},[ie,Ve,Kt,qt,ht,at]),Oi=y.useCallback(async(V,ae)=>{console.log("[MockGrackle] sendInput",{sessionId:V,text:ae}),at({sessionId:V,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ae}`}),ht(V,"running"),at({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const le=Mt.current.get(V);if(le)Mt.current.delete(V),Kt(V,le);else{const ye=[{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"}}];Kt(V,ye)}const de=Tn.current.get(V);de&&(Tn.current.delete(V),qt(()=>{k(ye=>ye.map(We=>We.id===de.taskId&&We.status==="working"?{...We,status:"paused"}:We))},de.delayAfterResume,V))},[at,ht,Kt,qt]),wn=y.useCallback(async V=>{console.log("[MockGrackle] completeTask",V),k(ae=>ae.map(le=>le.id===V?{...le,status:"complete"}:le))},[]),Re=y.useCallback(async V=>{console.log("[MockGrackle] resumeTask",V)},[]),Je=y.useCallback(async(V,ae,le,de,ye)=>{console.log("[MockGrackle] updateTask",{taskId:V,title:ae}),k(We=>We.map(Te=>Te.id===V?{...Te,title:ae.trim()||Te.title,description:le,dependsOn:de,...ye!==void 0?{defaultPersonaId:ye}:{}}:Te))},[]),Jt=y.useCallback(async V=>{console.log("[MockGrackle] deleteTask",V),k(ae=>ae.filter(le=>le.id!==V))},[]),St=y.useCallback(async V=>{console.log("[MockGrackle] loadFindings",V),N(Hc.filter(ae=>ae.workspaceId===V))},[]),un=y.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),N([...Hc])},[]),Wt=y.useCallback(async V=>{console.log("[MockGrackle] loadFinding",V);const ae=Hc.find(le=>le.id===V);C(ae)},[]),Bi=y.useCallback(async(V,ae,le,de,ye)=>{console.log("[MockGrackle] postFinding",{workspaceId:V,title:ae});const We={id:ie("find"),workspaceId:V,taskId:"",sessionId:"",category:de||"general",title:ae,content:le,tags:ye||[],createdAt:new Date().toISOString()};N(Te=>[...Te,We])},[ie]),Li=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),zi=y.useCallback(async(V,ae,le)=>{console.log("[MockGrackle] addEnvironment",{displayName:V,adapterType:ae,adapterConfig:le})},[]),Ka=y.useCallback(async(V,ae)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:V,...ae}),o(le=>le.map(de=>de.id!==V?de:{...de,...ae.displayName!==void 0?{displayName:ae.displayName}:{},...ae.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ae.adapterConfig)}:{}}))},[]),Ya=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Ja=y.useCallback(async(V,ae,le,de,ye)=>{console.log("[MockGrackle] setToken",{name:V,tokenType:le}),E(We=>[...We.filter(Ie=>Ie.name!==V),{name:V,tokenType:le,envVar:de,filePath:ye,expiresAt:""}])},[]),hs=y.useCallback(async V=>{console.log("[MockGrackle] deleteToken",V),E(ae=>ae.filter(le=>le.name!==V))},[]),Wa=y.useCallback(async V=>{console.log("[MockGrackle] updateCredentialProviders",V),P(V)},[]);y.useEffect(()=>()=>{_e.current.forEach(clearTimeout),_e.current.clear()},[]);const Xa=y.useMemo(()=>({connected:!0,environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:Li,addEnvironment:zi,updateEnvironment:Ka,provisionEnvironment:async(V,ae)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:_s},sessions:{sessions:r,sessionsLoading:!1,events:d,eventsDropped:0,lastSpawnedId:p,taskSessions:Q,spawn:gt,sendInput:Oi,kill:ps,stopGraceful:aa,loadSessionEvents:Fa,clearEvents:ia,loadTaskSessions:async V=>{console.log("[MockGrackle] loadTaskSessions",V)},domainHook:_s},workspaces:{workspaces:g,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Yt,archiveWorkspace:Ii,updateWorkspace:async(V,ae)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:V,...ae}),v(le=>le.map(de=>de.id!==V?de:{...de,...ae.name!==void 0?{name:ae.name}:{},...ae.description!==void 0?{description:ae.description}:{},...ae.repoUrl!==void 0?{repoUrl:ae.repoUrl}:{},...ae.environmentId!==void 0?{environmentId:ae.environmentId}:{},...ae.workingDirectory!==void 0?{workingDirectory:ae.workingDirectory}:{},...ae.useWorktrees!==void 0?{useWorktrees:ae.useWorktrees}:{},...ae.defaultPersonaId!==void 0?{defaultPersonaId:ae.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},linkEnvironment:async(V,ae)=>{if(console.log("[MockGrackle] linkEnvironment",{workspaceId:V,environmentId:ae}),ae==="error-env"){x("Failed to link environment");return}x(""),v(le=>le.map(de=>de.id!==V||de.linkedEnvironmentIds.includes(ae)?de:{...de,linkedEnvironmentIds:[...de.linkedEnvironmentIds,ae]}))},unlinkEnvironment:async(V,ae)=>{if(console.log("[MockGrackle] unlinkEnvironment",{workspaceId:V,environmentId:ae}),ae==="error-env"){x("Failed to unlink environment");return}x(""),v(le=>le.map(de=>de.id!==V?de:{...de,linkedEnvironmentIds:de.linkedEnvironmentIds.filter(ye=>ye!==ae)}))},linkOperationError:b,clearLinkOperationError:()=>{x("")},domainHook:_s},tasks:{tasks:S,tasksLoading:!1,taskStartingId:void 0,loadTasks:oa,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Za,startTask:ms,stopTask:async V=>{console.log("[MockGrackle] stopTask",{taskId:V}),await wn(V)},completeTask:wn,resumeTask:Re,updateTask:Je,deleteTask:Jt,domainHook:_s},findings:{findings:w,selectedFinding:T,findingLoading:D,findingsLoading:!1,loadFindings:St,loadAllFindings:un,loadFinding:Wt,postFinding:Bi,domainHook:_s},tokens:{tokens:O,tokensLoading:!1,loadTokens:Ya,setToken:Ja,deleteToken:hs,domainHook:_s},credentials:{credentialProviders:A,credentialsLoading:!1,updateCredentialProviders:Wa,domainHook:_s},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:_s},personas:{personas:I,personasLoading:!1,createPersona:async(V,ae,le,de,ye,We,Te,Ie,Ke)=>{console.log("[MockGrackle] createPersona",{name:V});const ct={id:`mock-persona-${Date.now()}`,name:V,description:ae,systemPrompt:le,toolConfig:"{}",runtime:de??"claude-code",model:ye||"",maxTurns:We||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:Te||"agent",script:Ie||"",allowedMcpTools:Ke||[]};return U(Xe=>[...Xe,ct]),ct},updatePersona:async(V,ae,le,de,ye,We,Te,Ie,Ke,ct)=>{console.log("[MockGrackle] updatePersona",{personaId:V,name:ae});const Xe=I.find(Ue=>Ue.id===V);if(!Xe)throw new Error(`Persona not found: ${V}`);const Xt=new Date().toISOString(),jt={...Xe,...ae!==void 0?{name:ae}:{},...le!==void 0?{description:le}:{},...de!==void 0?{systemPrompt:de}:{},...ye!==void 0?{runtime:ye}:{},...We!==void 0?{model:We}:{},...Te!==void 0?{maxTurns:Te}:{},...Ie!==void 0?{type:Ie}:{},...Ke!==void 0?{script:Ke}:{},...ct!==void 0?{allowedMcpTools:ct}:{},updatedAt:Xt};return U(Ue=>Ue.map(It=>It.id===V?jt:It)),jt},deletePersona:async V=>{console.log("[MockGrackle] deletePersona",V),U(ae=>ae.filter(le=>le.id!==V))},domainHook:_s},knowledge:{graphData:{nodes:ue,links:oe},selectedNode:Z,loading:!1,selectedId:ce,searchQuery:ge,search:async V=>{if(console.log("[MockGrackle] knowledge.search",V),!V.trim()){pe(V);return}pe(V);const ae=Ce.current,le=ae?ks.filter(Te=>!Te.workspaceId||Te.workspaceId===ae):ks,de=V.toLowerCase(),ye=le.filter(Te=>{var Ie,Ke,ct;return Te.label.toLowerCase().includes(de)||((Ie=Te.content)==null?void 0:Ie.toLowerCase().includes(de))||((Ke=Te.tags)==null?void 0:Ke.some(Xe=>Xe.toLowerCase().includes(de)))||((ct=Te.category)==null?void 0:ct.toLowerCase().includes(de))});W(ye);const We=new Set(ye.map(Te=>Te.id));L(Ra.filter(Te=>We.has(Te.source)&&We.has(Te.target))),X(void 0),J(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),pe("");const V=Ce.current,ae=V?ks.filter(de=>!de.workspaceId||de.workspaceId===V):ks;W(ae);const le=new Set(ae.map(de=>de.id));L(Ra.filter(de=>le.has(de.source)&&le.has(de.target)))},selectNode:async V=>{console.log("[MockGrackle] knowledge.selectNode",V),X(V);const ae=V in Gb?Gb[V]:void 0;if(ae)J(ae);else{const le=ks.find(de=>de.id===V);if(le){const de=Ra.filter(ye=>ye.source===V||ye.target===V).map(ye=>({fromId:ye.source,toId:ye.target,type:ye.type}));J({node:le,edges:de})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),X(void 0),J(void 0)},expandNode:async V=>{console.log("[MockGrackle] knowledge.expandNode",V),W(ae=>{const le=new Set(ae.map(Ie=>Ie.id)),de=Ra.filter(Ie=>Ie.source===V||Ie.target===V),ye=new Set;for(const Ie of de)le.has(Ie.source)||ye.add(Ie.source),le.has(Ie.target)||ye.add(Ie.target);if(ye.size===0)return ae;const We=ks.filter(Ie=>ye.has(Ie.id)),Te=new Set([...le,...ye]);return L(Ie=>{const Ke=new Set(Ie.map(Xe=>`${Xe.source}|${Xe.target}|${Xe.type}`)),ct=Ra.filter(Xe=>Te.has(Xe.source)&&Te.has(Xe.target)&&!Ke.has(`${Xe.source}|${Xe.target}|${Xe.type}`));return ct.length>0?[...Ie,...ct]:Ie}),[...ae,...We]})},loadRecent:async V=>{if(console.log("[MockGrackle] knowledge.loadRecent",V),Ce.current=V,V){const ae=ks.filter(de=>!de.workspaceId||de.workspaceId===V);W(ae);const le=new Set(ae.map(de=>de.id));L(Ra.filter(de=>le.has(de.source)&&le.has(de.target)))}else W(ks),L(Ra);pe("")},handleEvent:()=>!1,domainHook:_s},appDefaultPersonaId:$,setAppDefaultPersonaId:async V=>{console.log("[MockGrackle] setAppDefaultPersonaId",V),H(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,ae)=>{console.log(`[MockGrackle] loadUsage(${V}, ${ae})`)},refresh:es}),[s,r,d,p,Q,g,b,S,w,T,O,A,I,$,ue,oe,Z,ce,ge,gt,Oi,ps,aa,Fa,ia,Yt,Ii,oa,Za,ms,wn,Re,Je,Jt,St,un,Wt,Bi,Li,zi,Ka,Ya,Ja,hs,Wa,es]);return i.jsx(eh.Provider,{value:Xa,children:t})}const O7=3e3;function B7(t){const[s,o]=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 x=Ne.streamEvents({});o(!0),Promise.resolve((v=d.current)==null?void 0:v.call(d)).catch(()=>{});for await(const S of x){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(x){if(x instanceof ji&&x.code===dx.Unauthenticated){window.location.href=sN;return}}p||(o(!1),(b=u.current)==null||b.call(u),m=setTimeout(()=>{g().catch(()=>{})},O7))}}return g().catch(()=>{}),()=>{p=!0,clearTimeout(m),o(!1)}},[]),{connected:s}}function L7(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped}}function Kb(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 z7(t){return{sessionId:t.sessionId,eventType:ux(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function $7(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,environmentId:t.environmentId,linkedEnvironmentIds:[...t.linkedEnvironmentIds],status:vT(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents,createdAt:t.createdAt,updatedAt:t.updatedAt}}function Yb(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:yT(t.status),branch:t.branch,latestSessionId:t.latestSessionId,dependsOn:[...t.dependsOn],sortOrder:t.sortOrder,createdAt:t.createdAt,startedAt:t.startedAt||void 0,completedAt:t.completedAt||void 0,parentTaskId:t.parentTaskId,depth:t.depth,childTaskIds:[...t.childTaskIds],canDecompose:t.canDecompose,defaultPersonaId:t.defaultPersonaId,workpad:t.workpad,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents}}function Sp(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 U7(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function P7(t){return{claude:bT(t.claude),github:Ec(t.github),copilot:Ec(t.copilot),codex:Ec(t.codex),goose:Ec(t.goose)}}function H7(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function Tp(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 V7(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd,sessionCount:t.sessionCount}}function Vc(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 wp(t){return{source:t.fromId,target:t.toId,type:t.type}}function Ga(){const[t,s]=y.useState(!1),o=y.useRef(0),r=y.useCallback(c=>(o.current++,o.current===1&&s(!0),c.finally(()=>{o.current--,o.current===0&&s(!1)})),[]);return{loading:t,track:r}}const Jb=5e3;function Hr(t){return t instanceof ji?t.message:"Operation failed"}function q7(){const[t,s]=y.useState([]),{loading:o,track:r}=Ga(),[c,d]=y.useState({}),[u,p]=y.useState(""),m=y.useCallback(()=>{p("")},[]),g=y.useCallback(async()=>{try{const C=await r(Ne.listEnvironments({}));s(C.environments.map(L7))}catch{}},[r]),v=y.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const D=C.payload.environmentId;return D&&(s(O=>O.filter(E=>E.id!==D)),d(O=>{const E={...O};return delete E[D],E})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const D=C.payload;if(typeof D.environmentId!="string"||typeof D.stage!="string"||typeof D.message!="string"||typeof D.progress!="number")return z1("environment.provision_progress","invalid payload"),!0;if(d(O=>({...O,[D.environmentId]:{stage:D.stage,message:D.message,progress:D.progress}})),D.stage==="ready"){const O=D.environmentId;setTimeout(()=>{d(E=>{const A={...E};return delete A[O],A})},Jb)}return!0}default:return!1}},[g]),b=y.useCallback(C=>{var D;if(C.type==="environments"){const O=Array.isArray((D=C.payload)==null?void 0:D.environments)?C.payload.environments:[];return s(O),!0}return!1},[]),x=y.useCallback(async(C,D,O)=>{p("");try{await Ne.addEnvironment({displayName:C,adapterType:D,adapterConfig:JSON.stringify(O??{})})}catch(E){p(Hr(E))}},[]),S=y.useCallback(async(C,D)=>{p("");try{await Ne.updateEnvironment({id:C,displayName:D.displayName,adapterConfig:D.adapterConfig?JSON.stringify(D.adapterConfig):void 0})}catch(O){p(Hr(O))}},[]),k=y.useCallback(async(C,D)=>{p("");try{const O=Ne.provisionEnvironment({id:C,force:D??!1});for await(const E of O)d(A=>({...A,[C]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"&&setTimeout(()=>{d(A=>{const P={...A};return delete P[C],P})},Jb)}catch(O){d(E=>{const A={...E};return delete A[C],A}),p(Hr(O))}},[]),w=y.useCallback(async C=>{p("");try{await Ne.stopEnvironment({id:C})}catch(D){p(Hr(D))}},[]),N=y.useCallback(async C=>{p("");try{await Ne.removeEnvironment({id:C})}catch(D){p(Hr(D))}},[]);return{environments:t,environmentsLoading:o,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:g,addEnvironment:x,updateEnvironment:S,provisionEnvironment:k,stopEnvironment:w,removeEnvironment:N,handleEvent:v,handleLegacyMessage:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const jp=new Set(["pending","running","idle"]),G7=new Set(["completed","failed","interrupted","hibernating","suspended"]),Wb=["pending","running","idle"];function F7(){const[t,s]=y.useState([]),{loading:o,track:r}=Ga(),[c,d]=y.useState([]),[u,p]=y.useState(0),[m,g]=y.useState(void 0),[v,b]=y.useState({}),x=y.useCallback(async()=>{try{const U=(await r(Ne.listSessions({}))).sessions.map(Kb);s(Q=>{const $=new Map(Q.map(H=>[H.id,H]));return U.map(H=>{const ue=$.get(H.id),W=ue==null?void 0:ue.status;return!W||W===H.status?H:G7.has(W)&&jp.has(H.status)?{...H,status:W,...ue.endReason!==void 0?{endReason:ue.endReason}:{}}:jp.has(W)&&jp.has(H.status)&&Wb.indexOf(W)>Wb.indexOf(H.status)?{...H,status:W}:H})})}catch{}},[r]),S=y.useCallback(I=>{if(I.type!=="session_event")return!1;if(!l7(I.payload))return z1("session_event","payload is not a valid SessionEvent"),!0;const U=I.payload;let Q=0;if(d($=>{const H=[...$,U];return H.length>To?(Q=H.length-To,H.slice(-To)):H}),Q>0&&p($=>$+Q),U.eventType==="usage")try{const $=JSON.parse(U.content),H=Number($.input_tokens)||0,ue=Number($.output_tokens)||0,W=Number($.cost_usd)||0;(H>0||ue>0||W>0)&&s(oe=>oe.map(L=>L.id===U.sessionId?{...L,inputTokens:(L.inputTokens??0)+H,outputTokens:(L.outputTokens??0)+ue,costUsd:(L.costUsd??0)+W}:L))}catch{}if(U.eventType==="status"){const $=$1(U.content),H=U1(U.content);s(ue=>ue.some(oe=>oe.id===U.sessionId)?ue.map(oe=>oe.id===U.sessionId?{...oe,status:$,...H!==void 0?{endReason:H}:{}}:oe):[...ue,{id:U.sessionId,environmentId:"",runtime:"",status:$,prompt:"",startedAt:U.timestamp,...H!==void 0?{endReason:H}:{}}])}return!0},[]),k=y.useCallback(I=>{S({type:"session_event",payload:I})},[S]),w=y.useCallback(I=>{var U,Q,$,H,ue;switch(I.type){case"sessions":{const W=Array.isArray((U=I.payload)==null?void 0:U.sessions)?I.payload.sessions:[];return s(W),!0}case"spawned":{const W=(Q=I.payload)==null?void 0:Q.sessionId;return typeof W=="string"&&W&&g(W),x().catch(()=>{}),!0}case"session_events":{const W=Array.isArray(($=I.payload)==null?void 0:$.events)?I.payload.events:[];return W.length>0&&d(W),!0}case"task_sessions":{const W=(H=I.payload)==null?void 0:H.taskId;if(typeof W=="string"&&W){const oe=Array.isArray((ue=I.payload)==null?void 0:ue.sessions)?I.payload.sessions:[];b(L=>({...L,[W]:oe}))}return!0}default:return!1}},[x]),N=y.useCallback(async(I,U,Q,$)=>{try{const H=await Ne.spawnAgent({environmentId:I,prompt:U,personaId:Q||"",workingDirectory:$||""});g(H.id),await x()}catch{}},[x]),T=y.useCallback(async(I,U)=>{try{await Ne.sendInput({sessionId:I,text:U})}catch{}},[]),C=y.useCallback(async I=>{try{await Ne.killAgent({id:I,graceful:!1})}catch{}},[]),D=y.useCallback(async I=>{try{await Ne.killAgent({id:I,graceful:!0})}catch{}},[]),O=y.useCallback(async I=>{try{const Q=(await Ne.getSessionEvents({id:I})).events.map(z7);if(Q.length>0){let $=0;d(H=>{const ue=new Set;for(const L of H)L.sessionId===I&&ue.add(`${L.timestamp}|${L.eventType}`);const W=Q.filter(L=>!ue.has(`${L.timestamp}|${L.eventType}`)),oe=[...H,...W].sort((L,Z)=>L.sessionId!==Z.sessionId?0:L.timestamp.localeCompare(Z.timestamp));return oe.length>To?($=oe.length-To,oe.slice(-To)):oe}),$>0&&p(H=>H+$)}}catch{}},[]),E=y.useCallback(()=>{d([]),p(0)},[]),A=y.useCallback(async I=>{try{const Q=(await Ne.getTaskSessions({id:I})).sessions.map(Kb);b($=>({...$,[I]:Q}))}catch{}},[]);return{sessions:t,sessionsLoading:o,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:x,spawn:N,sendInput:T,kill:C,stopGraceful:D,loadSessionEvents:O,clearEvents:E,loadTaskSessions:A,handleMessage:S,handleSessionEvent:k,handleLegacyMessage:w,domainHook:{onConnect:()=>x(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function Xb(t){return t instanceof ji?t.message:"Operation failed"}function Z7(){const[t,s]=y.useState([]),{loading:o,track:r}=Ga(),[c,d]=y.useState(!1),[u,p]=y.useState(""),m=y.useCallback(async()=>{try{const C=await r(Ne.listWorkspaces({}));s(C.workspaces.map($7))}catch{}},[r]),g=y.useCallback(C=>{switch(C.type){case"workspace.created":return d(!1),m().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return m().catch(()=>{}),!0;default:return!1}},[m]),v=y.useCallback(()=>{d(!1)},[]),b=y.useCallback(async(C,D,O,E,A,P,I,U,Q)=>{d(!0);try{await Ne.createWorkspace({name:C,description:D||"",repoUrl:O||"",environmentId:E||"",defaultPersonaId:A||void 0,useWorktrees:P??!0,workingDirectory:I||void 0}),d(!1),U==null||U()}catch($){d(!1);const H=$ instanceof ji?$.message:"Failed to create workspace";Q==null||Q(H)}},[]),x=y.useCallback(async C=>{try{await Ne.archiveWorkspace({id:C})}catch{}},[]),S=y.useCallback(async(C,D)=>{try{await Ne.updateWorkspace({id:C,...D})}catch{}},[]),k=y.useCallback(()=>{p("")},[]),w=y.useCallback(async(C,D)=>{try{p(""),await Ne.linkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(O){p(Xb(O))}},[m]),N=y.useCallback(async(C,D)=>{try{p(""),await Ne.unlinkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(O){p(Xb(O))}},[m]);return{workspaces:t,workspacesLoading:o,workspaceCreating:c,loadWorkspaces:m,createWorkspace:b,archiveWorkspace:x,updateWorkspace:S,linkEnvironment:w,unlinkEnvironment:N,linkOperationError:u,clearLinkOperationError:k,handleEvent:g,onDisconnect:v,domainHook:{onConnect:()=>m(),onDisconnect:v,handleEvent:g}}}function K7(){const[t,s]=y.useState([]),{loading:o,track:r}=Ga(),[c,d]=y.useState(void 0),u=y.useRef({}),p=y.useCallback(async E=>{try{const P=(await Ne.listTasks({workspaceId:E})).tasks.map(Yb);s(I=>[...I.filter(U=>U.workspaceId!==E),...P])}catch{}},[]),m=y.useCallback(async()=>{try{const A=(await r(Ne.listTasks({}))).tasks.map(Yb);s(P=>{const I=new Set(A.map(U=>U.id));return[...P.filter(U=>!I.has(U.id)),...A]})}catch{}},[r]),g=y.useCallback((E,A)=>{const P=I=>{clearTimeout(u.current[I]),u.current[I]=setTimeout(()=>{delete u.current[I],p(I).catch(()=>{})},200)};E?P(E):A&&s(I=>{const U=I.find(Q=>Q.id===A);return U!=null&&U.workspaceId?P(U.workspaceId):m().catch(()=>{}),I})},[p,m]),v=y.useCallback(E=>{const A=E.payload;switch(E.type){case"task.created":{const P=typeof A.workspaceId=="string"?A.workspaceId:"";return P&&p(P).catch(()=>{}),!0}case"task.started":{const P=typeof A.taskId=="string"?A.taskId:"",I=typeof A.sessionId=="string"?A.sessionId:"",U=typeof A.workspaceId=="string"?A.workspaceId:"";return d(Q=>P&&Q===P?void 0:Q),I&&P&&s(Q=>Q.map($=>$.id===P?{...$,latestSessionId:I}:$)),g(U,P),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const P=typeof A.workspaceId=="string"?A.workspaceId:"",I=typeof A.taskId=="string"?A.taskId:"";return d(U=>I&&U===I?void 0:U),g(P,I),!0}default:return!1}},[p,g]),b=y.useCallback(()=>{d(void 0)},[]),x=y.useCallback(E=>{var A,P;if(E.type==="tasks"){const I=Array.isArray((A=E.payload)==null?void 0:A.tasks)?E.payload.tasks:[],U=typeof((P=E.payload)==null?void 0:P.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s(U?Q=>[...Q.filter($=>$.workspaceId!==U),...I]:Q=>{const $=new Set(I.map(H=>H.id));return[...Q.filter(H=>!$.has(H.id)),...I]}),!0}return!1},[]),S=y.useCallback(async(E,A,P,I,U,Q,$,H,ue)=>{try{await Ne.createTask({workspaceId:E,title:A,description:P||"",dependsOn:I||[],parentTaskId:U||"",defaultPersonaId:Q||void 0,canDecompose:$??void 0}),H==null||H()}catch(W){const oe=W instanceof ji?W.message:"Failed to create task";ue==null||ue(oe)}},[]),k=y.useCallback(async(E,A,P,I)=>{d(E);try{await Ne.startTask({taskId:E,personaId:A||"",environmentId:P||"",notes:I||""})}catch(U){if(U instanceof ji&&U.code===dx.ResourceExhausted)return;d(void 0)}},[]),w=y.useCallback(async E=>{try{await Ne.stopTask({id:E})}catch{}},[]),N=y.useCallback(async E=>{try{await Ne.completeTask({id:E})}catch{}},[]),T=y.useCallback(async E=>{try{await Ne.resumeTask({id:E})}catch{}},[]),C=y.useCallback(async(E,A,P,I,U)=>{try{await Ne.updateTask({id:E,title:A,description:P,dependsOn:I,...U!==void 0?{defaultPersonaId:U}:{}})}catch{}},[]),D=y.useCallback(async E=>{try{await Ne.deleteTask({id:E})}catch{}},[]);return{tasks:t,tasksLoading:o,taskStartingId:c,loadTasks:p,loadAllTasks:m,createTask:S,startTask:k,stopTask:w,completeTask:N,resumeTask:T,updateTask:C,deleteTask:D,handleEvent:v,onDisconnect:b,handleLegacyMessage:x,domainHook:{onConnect:()=>m(),onDisconnect:b,handleEvent:v}}}function Y7(){const[t,s]=y.useState([]),[o,r]=y.useState(void 0),[c,d]=y.useState(!1),{loading:u,track:p}=Ga(),m=y.useCallback(async k=>{try{const w=await p(Ne.queryFindings({workspaceId:k}));s(w.findings.map(Sp))}catch{}},[p]),g=y.useCallback(async()=>{try{const k=await p(Ne.queryFindings({workspaceId:""}));s(k.findings.map(Sp))}catch{}},[p]),v=y.useCallback(async k=>{r(void 0),d(!0);try{const w=await Ne.getFinding({id:k});r(Sp(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]),x=y.useCallback(async(k,w,N,T,C)=>{try{await Ne.postFinding({workspaceId:k,title:w,content:N,category:T??"general",tags:C??[]})}catch{}},[]);return{findings:t,selectedFinding:o,findingLoading:c,findingsLoading:u,loadFindings:m,loadAllFindings:g,loadFinding:v,postFinding:x,handleEvent:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:b}}}function J7(){const[t,s]=y.useState([]),{loading:o,track:r}=Ga(),c=y.useCallback(async()=>{try{const g=await r(Ne.listTokens({}));s(g.tokens.map(U7))}catch{}},[r]),d=y.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(g,v,b,x,S)=>{try{await Ne.setToken({name:g,value:v,type:b,envVar:x,filePath:S})}catch{}},[]),p=y.useCallback(async g=>{try{await Ne.deleteToken({name:g})}catch{}},[]);return{tokens:t,tokensLoading:o,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function W7(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=Ga(),c=y.useCallback(async()=>{try{const m=await r(Ne.getCredentialProviders({}));s(P7(m))}catch{}},[r]),d=y.useCallback(m=>m.type==="credential.providers_changed"?(d7(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})=>Ne.setCredentialProvider({provider:v,value:b})))},[]);return{credentialProviders:t,credentialsLoading:o,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function X7(){const[t,s]=y.useState([]),[o,r]=y.useState(""),[c,d]=y.useState(""),[u,p]=y.useState(!1),m=y.useCallback(async()=>{try{const b=await Ne.listCodespaces({});s(b.codespaces.map(H7)),d(b.error)}catch{}},[]),g=y.useCallback(async(b,x)=>{p(!0),r("");try{await Ne.createCodespace({repo:b,machine:x??""}),p(!1),await m()}catch(S){p(!1);const k=S instanceof ji?S.message:"Failed to create codespace";r(k)}},[m]);return{codespaces:t,codespaceError:o,codespaceListError:c,codespaceCreating:u,listCodespaces:m,createCodespace:g,domainHook:{onConnect:()=>m(),onDisconnect:()=>{},handleEvent:()=>!1}}}function Q7(){const[t,s]=y.useState([]),{loading:o,track:r}=Ga(),c=y.useCallback(async()=>{try{const v=await r(Ne.listPersonas({}));s(v.personas.map(Tp))}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,x,S,k,w,N,T,C)=>{const D=await Ne.createPersona({name:v,description:b,systemPrompt:x,runtime:S||"",model:k||"",maxTurns:w||0,type:N||"agent",script:T||"",allowedMcpTools:C||[]}),O=Tp(D);return s(E=>[...E.filter(A=>A.id!==O.id),O]),O},[]),p=y.useCallback(async(v,b,x,S,k,w,N,T,C,D)=>{const O={id:v};b!==void 0&&(O.name=b),x!==void 0&&(O.description=x),S!==void 0&&(O.systemPrompt=S),k!==void 0&&(O.runtime=k),w!==void 0&&(O.model=w),N!==void 0&&(O.maxTurns=N),T!==void 0&&(O.type=T),C!==void 0&&(O.script=C),D!==void 0&&(O.allowedMcpTools={tools:D});const E=await Ne.updatePersona(O),A=Tp(E);return s(P=>P.map(I=>I.id===A.id?A:I)),A},[]),m=y.useCallback(async v=>{await Ne.deletePersona({id:v}),s(b=>b.filter(x=>x.id!==v))},[]);return{personas:t,personasLoading:o,loadPersonas:c,createPersona:u,updatePersona:p,deletePersona:m,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function ez(t){if(t)try{return JSON.parse(t)}catch{return}}function tz(){const[t,s]=y.useState(new Map),[o,r]=y.useState([]),[c,d]=y.useState(void 0),[u,p]=y.useState(void 0),[m,g]=y.useState(!1),[v,b]=y.useState(""),x=y.useRef(""),S=y.useCallback(async E=>{const A=E??"";x.current=A,b(""),g(!0);try{const P=await Ne.listRecentKnowledgeNodes({limit:30,workspaceId:A}),I=new Map,U=[];for(const Q of P.nodes)I.set(Q.id,Vc(Q));for(const Q of P.edges)U.push(wp(Q));for(const Q of U){const $=I.get(Q.source);$&&($.val+=1);const H=I.get(Q.target);H&&(H.val+=1)}s(I),r(U)}catch{}finally{g(!1)}},[]),k=y.useCallback(async E=>{if(E.trim()){b(E),p(void 0),d(void 0),g(!0);try{const A=await Ne.searchKnowledge({query:E,limit:20,workspaceId:x.current}),P=new Map,I=[];for(const U of A.results){U.node&&P.set(U.node.id,Vc(U.node,U.edges.length));for(const Q of U.edges)I.push(wp(Q))}s(P),r(I)}catch{}finally{g(!1)}}},[]),w=y.useCallback(()=>{S(x.current).catch(()=>{})},[S]),N=y.useCallback(async E=>{p(E);try{const A=await Ne.getKnowledgeNode({id:E});if(!A.node){d(void 0);return}d({node:Vc(A.node,A.edges.length),edges:A.edges.map(P=>({fromId:P.fromId,toId:P.toId,type:P.type,metadata:ez(P.metadataJson)}))})}catch{d(void 0)}},[]),T=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async E=>{try{const A=await Ne.expandKnowledgeNode({id:E,depth:1});s(P=>{const I=new Map(P);for(const U of A.nodes)I.has(U.id)||I.set(U.id,Vc(U));return I}),r(P=>{const I=new Set(P.map(Q=>`${Q.source}:${Q.target}:${Q.type}`)),U=[];for(const Q of A.edges){const $=wp(Q),H=`${$.source}:${$.target}:${$.type}`;I.has(H)||U.push($)}return[...P,...U]})}catch{}},[]),D=y.useCallback(E=>!1,[]),O={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:D};return{graphData:{nodes:[...t.values()],links:o},selectedNode:c,selectedId:u,loading:m,searchQuery:v,search:k,clearSearch:w,selectNode:N,clearSelection:T,expandNode:C,loadRecent:S,handleEvent:D,domainHook:O}}function nz(){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 sz(){const[t,s]=y.useState(""),[o,r]=y.useState(void 0),[c,d]=y.useState({}),u=q7(),p=F7(),m=Z7(),g=K7(),v=Y7(),b=J7(),x=W7(),S=X7(),k=Q7(),w=tz(),N=nz(),T=[u.domainHook,p.domainHook,m.domainHook,g.domainHook,v.domainHook,b.domainHook,x.domainHook,S.domainHook,k.domainHook,w.domainHook,N.domainHook],{connected:C}=B7({onSessionEvent:H=>{p.handleSessionEvent({sessionId:H.sessionId,eventType:ux(H.type),timestamp:H.timestamp,content:H.content,raw:H.raw||void 0})},onDomainEvent:H=>{try{const ue=JSON.parse(H.payloadJson);I({id:H.id,type:H.type,timestamp:H.timestamp,payload:ue})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",H.payloadJson)}},onConnect:U,onDisconnect:Q}),D="default_persona_id",O="onboarding_completed",E=y.useCallback(async H=>{const ue=await Ne.setSetting({key:D,value:H});s(ue.value)},[]),A=y.useCallback(async()=>{r(!0);try{await Ne.setSetting({key:O,value:"true"})}catch{}},[]),P=y.useCallback(async(H,ue)=>{try{const W=await Ne.getUsage({scope:H,id:ue}),oe=`${H}:${ue}`;d(L=>({...L,[oe]:V7(W)}))}catch{}},[]);function I(H){const ue=H.payload.key,W=H.payload.value;if(H.type==="setting.changed"){ue===D&&s(W??""),ue===O&&r(W==="true");return}for(const oe of T)if(oe.handleEvent(H))break;(H.type==="environment.removed"||H.type==="environment.changed"||H.type==="task.started")&&p.loadSessions().catch(()=>{})}async function U(){for(const H of T)H.onConnect().catch(()=>{});try{const H=await Ne.getSetting({key:D});s(H.value)}catch{}try{const H=await Ne.getSetting({key:O});r(H.value==="true")}catch{}}function Q(){T.forEach(H=>H.onDisconnect())}const $=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,linkEnvironment:m.linkEnvironment,unlinkEnvironment:m.unlinkEnvironment,linkOperationError:m.linkOperationError,clearLinkOperationError:m.clearLinkOperationError,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:x.credentialProviders,credentialsLoading:x.credentialsLoading,updateCredentialProviders:x.updateCredentialProviders,domainHook:x.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:E,onboardingCompleted:o,completeOnboarding:A,usageCache:c,loadUsage:P,refresh:$}}function az({children:t}){const s=sz();return i.jsx(eh.Provider,{value:s,children:t})}function iz(t,s){const o=y.useRef(null);y.useEffect(()=>{const r=o.current;if(o.current=t,r===null)return;const c=new Map;for(const u of r)c.set(u.id,u);const d=new Set;for(const u of t){d.add(u.id);const p=c.get(u.id);if(p&&p.status!==u.status&&u.status!=="sleeping"){if(u.status==="connecting"){s("Provisioning environment…","info");continue}u.status==="connected"?s("Environment connected","success"):u.status==="error"?s("Environment provision failed","error"):u.status==="disconnected"&&(p.status==="connected"?s("Environment disconnected","warning"):s("Environment stopped","info"))}}for(const u of r)d.has(u.id)||s("Environment removed","info")},[t,s])}function oz(t,s,o){const r=y.useRef(t);y.useEffect(()=>{t&&t!==r.current&&(o(t,"error"),s()),r.current=t},[t,s,o])}const rz={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 lz(t){return rz[t]}function cz(t,s){if(t===void 0)return[];const o=[],r=new Map;for(const d of t)r.set(d.id,d);const c=new Set;for(const d of s){c.add(d.id);const u=r.get(d.id);if(!u||u.status===d.status)continue;const p=lz(d.status);p&&o.push(p)}for(const d of t)c.has(d.id)||o.push({message:"Task deleted",variant:"info"});return o}function dz(t,s){const o=y.useRef(void 0);y.useEffect(()=>{const r=o.current;o.current=t;const c=cz(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const uz="_dashboard_16pzm_1",fz="_kpiStrip_16pzm_11",pz="_kpiCard_16pzm_23",mz="_kpiValue_16pzm_68",hz="_kpiLabel_16pzm_76",gz="_bodyGrid_16pzm_84",vz="_section_16pzm_96",yz="_sectionHeader_16pzm_109",bz="_sectionIcon_16pzm_118",xz="_sectionTitle_16pzm_123",_z="_sectionCount_16pzm_131",kz="_sectionBody_16pzm_138",Sz="_emptyHint_16pzm_143",Tz="_sessionRow_16pzm_150",wz="_sessionPrompt_16pzm_177",jz="_sessionEnv_16pzm_186",Nz="_sessionRuntime_16pzm_192",Cz="_sessionStatus_16pzm_198",Ez="_statusDot_16pzm_207",Az="_attentionRow_16pzm_233",Dz="_attentionTitle_16pzm_259",Rz="_attentionMeta_16pzm_267",Mz="_reasonBadge_16pzm_274",Iz="_bottomGrid_16pzm_301",Oz="_envRow_16pzm_312",Bz="_envName_16pzm_323",Lz="_envStatusBadge_16pzm_333",zz="_workspaceRow_16pzm_369",$z="_workspaceTop_16pzm_395",Uz="_workspaceName_16pzm_401",Pz="_workspaceCounts_16pzm_407",Hz="_progressBar_16pzm_415",Vz="_progressFill_16pzm_422",fe={dashboard:uz,kpiStrip:fz,kpiCard:pz,kpiValue:mz,kpiLabel:hz,bodyGrid:gz,section:vz,sectionHeader:yz,sectionIcon:bz,sectionTitle:xz,sectionCount:_z,sectionBody:kz,emptyHint:Sz,sessionRow:Tz,sessionPrompt:wz,sessionEnv:jz,sessionRuntime:Nz,sessionStatus:Cz,statusDot:Ez,attentionRow:Az,attentionTitle:Dz,attentionMeta:Rz,reasonBadge:Mz,bottomGrid:Iz,envRow:Oz,envName:Bz,envStatusBadge:Lz,workspaceRow:zz,workspaceTop:$z,workspaceName:Uz,workspaceCounts:Pz,progressBar:Hz,progressFill:Vz};function qz(){return i.jsxs("div",{className:fe.dashboard,"aria-hidden":"true",children:[i.jsx("div",{className:fe.kpiStrip,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:fe.kpiCard,children:[i.jsx(we,{width:"3rem",height:"2rem"}),i.jsx(we,{width:"80%",height:"0.75rem"})]},s))}),i.jsxs("div",{className:fe.bodyGrid,children:[i.jsxs("div",{className:fe.section,children:[i.jsxs("div",{className:fe.sectionHeader,children:[i.jsx(we,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(we,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:fe.sectionCount,children:i.jsx(we,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:fe.sectionBody,children:Array.from({length:3},(t,s)=>i.jsxs("div",{className:fe.sessionRow,style:{cursor:"default"},children:[i.jsx(we,{width:"60%",height:"0.875rem"}),i.jsx(we,{width:"4rem",height:"0.75rem"}),i.jsx(we,{width:"3rem",height:"0.75rem"}),i.jsx(we,{width:"3rem",height:"0.75rem"})]},s))})]}),i.jsxs("div",{className:fe.section,children:[i.jsxs("div",{className:fe.sectionHeader,children:[i.jsx(we,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(we,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:fe.sectionCount,children:i.jsx(we,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:fe.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:fe.attentionRow,style:{cursor:"default"},children:[i.jsxs("div",{className:fe.attentionTitle,children:[i.jsx(we,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"70%",height:"0.875rem"})]}),i.jsx("div",{className:fe.attentionMeta,children:i.jsx(we,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),i.jsxs("div",{className:fe.bottomGrid,children:[i.jsxs("div",{className:fe.section,children:[i.jsxs("div",{className:fe.sectionHeader,children:[i.jsx(we,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(we,{width:"9rem",height:"0.75rem"}),i.jsx("span",{className:fe.sectionCount,children:i.jsx(we,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:fe.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:fe.envRow,children:[i.jsx(we,{width:"60%",height:"0.875rem"}),i.jsx(we,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),i.jsxs("div",{className:fe.section,children:[i.jsxs("div",{className:fe.sectionHeader,children:[i.jsx(we,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(we,{width:"6rem",height:"0.75rem"}),i.jsx("span",{className:fe.sectionCount,children:i.jsx(we,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:fe.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:fe.workspaceRow,style:{cursor:"default"},children:[i.jsxs("div",{className:fe.workspaceTop,children:[i.jsx(we,{width:"50%",height:"0.875rem"}),i.jsx(we,{width:"2rem",height:"0.75rem"})]}),i.jsx("div",{className:fe.progressBar,children:i.jsx("div",{className:fe.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const Gz={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},qc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function Fz(t,s,o,r){const c=[`${t} of ${s} tasks completed`];return o>0&&c.push(`${o} in progress`),r>0&&c.push(`${r} failed`),c.join(", ")}function Gc({value:t,label:s,accent:o,index:r,testId:c}){return i.jsxs(Rt.div,{className:fe.kpiCard,"data-accent":o,"data-testid":c,variants:Gz,initial:"hidden",animate:"visible",custom:r,children:[i.jsx("span",{className:fe.kpiValue,children:t}),i.jsx("span",{className:fe.kpiLabel,children:s})]})}function Zz(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:o,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:p,environmentsLoading:m}}=mt(),g=kt(),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(()=>_7(d,o,p),[d,o,p]),x=y.useMemo(()=>S7(d,p),[d,p]),S=y.useMemo(()=>k7(o,t),[o,t]),k=y.useMemo(()=>T7(t,o),[t,o,p]);return d.length===0&&o.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?i.jsx(qz,{}):i.jsxs("div",{className:fe.dashboard,"data-testid":"dashboard",children:[i.jsxs("div",{className:fe.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[i.jsx(Gc,{value:b.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),i.jsx(Gc,{value:b.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),i.jsx(Gc,{value:b.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),i.jsx(Gc,{value:b.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),i.jsxs("div",{className:fe.bodyGrid,children:[i.jsxs(Rt.div,{className:fe.section,variants:qc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[i.jsxs("div",{className:fe.sectionHeader,children:[i.jsx("span",{className:fe.sectionIcon,"aria-hidden":"true",children:"●"}),i.jsx("span",{className:fe.sectionTitle,children:"Active Sessions"}),i.jsx("span",{className:fe.sectionCount,children:x.length})]}),i.jsx("div",{className:fe.sectionBody,children:x.length===0?i.jsx("div",{className:fe.emptyHint,children:"No active sessions"}):x.map(({session:N,environmentName:T})=>i.jsxs("button",{type:"button",className:fe.sessionRow,onClick:()=>g(hm(N.id)),"data-testid":"session-row",children:[i.jsx("span",{className:fe.sessionPrompt,title:N.prompt,children:N.prompt||"—"}),i.jsx("span",{className:fe.sessionEnv,children:T}),i.jsx("span",{className:fe.sessionRuntime,children:N.runtime}),i.jsxs("span",{className:fe.sessionStatus,children:[i.jsx("span",{className:fe.statusDot,"data-status":N.status}),N.status]})]},N.id))})]}),i.jsxs(Rt.div,{className:fe.section,variants:qc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[i.jsxs("div",{className:fe.sectionHeader,children:[i.jsx("span",{className:fe.sectionIcon,"aria-hidden":"true",children:"⚑"}),i.jsx("span",{className:fe.sectionTitle,children:"Needs Attention"}),i.jsx("span",{className:fe.sectionCount,children:S.length})]}),i.jsx("div",{className:fe.sectionBody,children:S.length===0?i.jsx("div",{className:fe.emptyHint,children:"All clear"}):S.map(({task:N,reason:T,workspaceName:C})=>i.jsxs("button",{type:"button",className:fe.attentionRow,onClick:()=>g(On(N.id)),"data-testid":"attention-row",children:[i.jsxs("div",{className:fe.attentionTitle,children:[i.jsx("span",{className:fe.reasonBadge,"data-reason":T,children:T}),N.title]}),i.jsx("div",{className:fe.attentionMeta,children:i.jsx("span",{children:C})})]},N.id))})]})]}),i.jsxs("div",{className:fe.bottomGrid,children:[i.jsxs(Rt.div,{className:fe.section,variants:qc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[i.jsxs("div",{className:fe.sectionHeader,children:[i.jsx("span",{className:fe.sectionIcon,"aria-hidden":"true",children:"◈"}),i.jsx("span",{className:fe.sectionTitle,children:"Environment Health"}),i.jsx("span",{className:fe.sectionCount,children:p.length})]}),i.jsx("div",{className:fe.sectionBody,children:p.length===0?i.jsx("div",{className:fe.emptyHint,children:"No environments configured"}):p.map(N=>i.jsxs("div",{className:fe.envRow,"data-testid":"dashboard-env-row",children:[i.jsx("span",{className:fe.envName,children:N.displayName}),i.jsx("span",{className:fe.envStatusBadge,"data-status":N.status,children:N.status})]},N.id))})]}),i.jsxs(Rt.div,{className:fe.section,variants:qc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[i.jsxs("div",{className:fe.sectionHeader,children:[i.jsx("span",{className:fe.sectionIcon,"aria-hidden":"true",children:"▦"}),i.jsx("span",{className:fe.sectionTitle,children:"Workspaces"}),i.jsx("span",{className:fe.sectionCount,children:t.length})]}),i.jsx("div",{className:fe.sectionBody,children:k.length===0?i.jsx("div",{className:fe.emptyHint,children:"No workspaces yet"}):k.map(({workspace:N,totalTasks:T,completedTasks:C,workingTasks:D,failedTasks:O})=>{const E=T>0?Math.round(C/T*100):0;return i.jsxs("button",{type:"button",className:fe.workspaceRow,onClick:()=>g($a(N.id,N.environmentId)),"data-testid":"workspace-row",children:[i.jsxs("div",{className:fe.workspaceTop,children:[i.jsx("span",{className:fe.workspaceName,children:N.name}),i.jsxs("span",{className:fe.workspaceCounts,"aria-label":Fz(C,T,D,O),children:[C,"/",T,D>0&&i.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",D]}),O>0&&i.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",O]})]})]}),T>0&&i.jsx("div",{className:fe.progressBar,children:i.jsx("div",{className:fe.progressFill,style:{width:`${E}%`}})})]},N.id)})})]})]})]})}const Kz="_panelContainer_1udy7_1",Yz="_emptyState_1udy7_8",Jz="_workspaceSummary_1udy7_17",Wz="_workspaceSummaryTitle_1udy7_28",Xz="_workspaceSummarySubtitle_1udy7_32",Qz="_header_1udy7_36",e$="_headerInfo_1udy7_71",t$="_headerTitle_1udy7_106",n$="_taskStatusBadge_1udy7_128",s$="_taskBranch_1udy7_137",a$="_taskBlockedBadge_1udy7_143",i$="_tabBar_1udy7_277",o$="_tab_1udy7_277",r$="_active_1udy7_303",l$="_eventScroll_1udy7_308",c$="_tabContent_1udy7_314",d$="_noContext_1udy7_319",u$="_overviewContent_1udy7_325",f$="_overviewDashboard_1udy7_334",p$="_overviewHero_1udy7_340",m$="_overviewSection_1udy7_347",h$="_overviewLabel_1udy7_353",g$="_envRow_1udy7_360",v$="_timeline_1udy7_366",y$="_timelineRow_1udy7_372",b$="_waitingMessage_1udy7_379",x$="_errorMessage_1udy7_383",_$="_emptyCta_1udy7_387",k$="_ctaTitle_1udy7_399",S$="_ctaDescription_1udy7_405",T$="_ctaButton_1udy7_412",w$="_workspaceHeader_1udy7_533",j$="_workspaceName_1udy7_558",N$="_workspaceMeta_1udy7_571",C$="_metaRow_1udy7_579",E$="_metaLabel_1udy7_592",A$="_metaValue_1udy7_607",D$="_archiveButton_1udy7_617",R$="_repoLink_1udy7_647",M$="_metaToggle_1udy7_657",I$="_metaToggleArrow_1udy7_678",O$="_metaToggleArrowOpen_1udy7_683",B$="_progressBarContainer_1udy7_687",L$="_progressBar_1udy7_687",z$="_progressFill_1udy7_703",$$="_progressLabel_1udy7_710",U$="_metaTimestamps_1udy7_717",P$="_metaTimestamp_1udy7_717",H$="_metaPlaceholder_1udy7_739",V$="_linkedEnvList_1udy7_744",q$="_linkedEnvChip_1udy7_750",G$="_chipDismiss_1udy7_762",F$="_linkError_1udy7_777",Z$="_linkEnvSelect_1udy7_782",Y={panelContainer:Kz,emptyState:Yz,workspaceSummary:Jz,workspaceSummaryTitle:Wz,workspaceSummarySubtitle:Xz,header:Qz,headerInfo:e$,headerTitle:t$,taskStatusBadge:n$,taskBranch:s$,taskBlockedBadge:a$,tabBar:i$,tab:o$,active:r$,eventScroll:l$,tabContent:c$,noContext:d$,overviewContent:u$,overviewDashboard:f$,overviewHero:p$,overviewSection:m$,overviewLabel:h$,envRow:g$,timeline:v$,timelineRow:y$,waitingMessage:b$,errorMessage:x$,emptyCta:_$,ctaTitle:k$,ctaDescription:S$,ctaButton:T$,workspaceHeader:w$,workspaceName:j$,workspaceMeta:N$,metaRow:C$,metaLabel:E$,metaValue:A$,archiveButton:D$,repoLink:R$,metaToggle:M$,metaToggleArrow:I$,metaToggleArrowOpen:O$,progressBarContainer:B$,progressBar:L$,progressFill:z$,progressLabel:$$,metaTimestamps:U$,metaTimestamp:P$,metaPlaceholder:H$,linkedEnvList:V$,linkedEnvChip:q$,chipDismiss:G$,linkError:F$,linkEnvSelect:Z$};function K$(){return i.jsx("div",{className:Y.emptyState,children:"Select a task or click + to create one"})}function Y$(){return i.jsx("div",{className:Y.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function J$(){const{workspaces:{workspaces:t},environments:{environments:s}}=mt(),o=kt(),r=s.length>0;return t.length>0?i.jsx(Zz,{}):i.jsxs("div",{className:Y.emptyCta,"data-testid":"welcome-cta",children:[i.jsx("div",{className:Y.ctaTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:Y.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),i.jsx("button",{className:Y.ctaButton,onClick:()=>o(Bx),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&i.jsx("div",{className:Y.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const W$="_panelContainer_19poq_1",X$="_chatHeader_19poq_8",Q$="_chatHeaderInfo_19poq_37",eU="_emptyState_19poq_43",tU="_emptyTitle_19poq_55",nU="_emptyDescription_19poq_61",sU="_emptyHint_19poq_67",Ba={panelContainer:W$,chatHeader:X$,chatHeaderInfo:Q$,emptyState:eU,emptyTitle:tU,emptyDescription:nU,emptyHint:sU};function aU(){return i.jsx("div",{className:Ba.panelContainer,"aria-hidden":"true",children:i.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(we,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function iU({hasLocalEnvironment:t}){return i.jsxs("div",{className:Ba.emptyState,"data-testid":"chat-empty-state",children:[i.jsx("div",{className:Ba.emptyTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:Ba.emptyDescription,children:t?"Type a message below to start chatting with the System agent. It can help you plan work, create tasks, and coordinate agents.":"Add a local environment in Settings to start chatting."}),!t&&i.jsx("div",{className:Ba.emptyHint,children:"Go to Settings → Environments to add one."})]})}function oU(){const{tasks:{tasks:t,tasksLoading:s,startTask:o},sessions:{sessions:r,sessionsLoading:c,events:d,eventsDropped:u,taskSessions:p,loadTaskSessions:m,loadSessionEvents:g,kill:v,stopGraceful:b,sendInput:x,spawn:S},environments:{environments:k,provisionEnvironment:w},personas:{personas:N}}=mt(),{showToast:T}=Sn(),C=y.useRef(void 0),[D,O]=y.useState(),E=t.find(H=>H.id===Mr),A=E!=null&&E.latestSessionId?r.find(H=>H.id===E.latestSessionId)??(p[Mr]??[]).find(H=>H.id===E.latestSessionId):void 0;y.useEffect(()=>{m(Mr).catch(()=>{})},[m]),y.useEffect(()=>{E!=null&&E.latestSessionId&&m(Mr).catch(()=>{})},[E==null?void 0:E.latestSessionId,m]),y.useEffect(()=>{A&&A.id!==C.current&&(C.current=A.id,g(A.id).catch(()=>{}))},[A==null?void 0:A.id,g]);const P=y.useMemo(()=>{if(!A)return[];const H=d.filter(ue=>ue.sessionId===A.id);return sh(nh(H))},[d,A==null?void 0:A.id]),I=k.find(H=>H.adapterType==="local"&&H.status==="connected"),U=A!==void 0&&A.status!=="stopped"&&A.status!=="suspended",Q=(A==null?void 0:A.status)==="idle";y.useEffect(()=>{D&&A&&Q&&(x(A.id,D).catch(()=>{}),O(void 0))},[D,Q,A==null?void 0:A.id,x]);const $=y.useCallback((H,ue,W,oe)=>{oe&&O(oe),o(H,ue,W).catch(()=>{})},[o]);return!E&&(c||s)?i.jsx(aU,{}):i.jsxs("div",{className:Ba.panelContainer,"data-testid":"chat-page",children:[U&&i.jsxs("div",{className:Ba.chatHeader,children:[i.jsxs("span",{className:Ba.chatHeaderInfo,children:["Session: ",A.id.slice(0,8)," | ",A.runtime," | ",A.status]}),i.jsx(zx,{label:"Stop",onClick:()=>{b(A.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{b(A.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{v(A.id).catch(()=>{})}}]})]}),i.jsx(Wm,{events:P,eventsDropped:u,emptyState:i.jsx(iU,{hasLocalEnvironment:!!I}),onShowToast:T}),I&&U&&i.jsx(el,{mode:"send",sessionId:A.id,environmentId:A.environmentId,personas:N,environments:k,onSendInput:(H,ue)=>{x(H,ue).catch(()=>{})},onSpawn:(H,ue,W)=>{S(H,ue,W).catch(()=>{})},onStartTask:(H,ue,W)=>{o(H,ue,W).catch(()=>{})},onProvisionEnvironment:H=>{w(H).catch(()=>{})},onShowToast:T}),I&&!U&&i.jsx(el,{mode:"start",taskId:Mr,environmentId:I.id,personas:N,environments:k,onSendInput:(H,ue)=>{x(H,ue).catch(()=>{})},onSpawn:(H,ue,W)=>{S(H,ue,W).catch(()=>{})},onStartTask:$,onProvisionEnvironment:H=>{w(H).catch(()=>{})},onShowToast:T})]})}function rU(){const t=m7(),[s]=mm(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=mt(),{showToast:g}=Sn();return i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(Ns,{segments:t}),i.jsx("div",{className:Y.emptyState,children:"Enter a prompt below to start a new session"}),i.jsx(el,{mode:"spawn",environmentId:o,showPersonaSelect:!0,personas:u,environments:p,onSendInput:(v,b)=>{r(v,b).catch(()=>{})},onSpawn:(v,b,x)=>{c(v,b,x).catch(()=>{})},onStartTask:(v,b,x)=>{d(v,b,x).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:g})]})}function lU(){return i.jsxs("div",{className:Y.panelContainer,"aria-hidden":"true",children:[i.jsxs("div",{className:Y.header,children:[i.jsx("span",{children:i.jsx(we,{width:"10rem",height:"0.875rem"})}),i.jsx("span",{className:Y.headerInfo,children:i.jsx(we,{width:"16rem",height:"0.875rem"})})]}),i.jsx("div",{className:Y.eventScroll,children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(we,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function cU({sessionId:t,session:s,isActive:o,onStop:r,onKill:c}){return i.jsxs("div",{className:Y.header,children:[i.jsxs("span",{children:["Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costUsd?` | ${Io((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${Ss(s.costUsd??0)}`:""]}),i.jsxs("span",{className:Y.headerInfo,children:[s&&i.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),o&&i.jsx(zx,{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 dU({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),o=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return i.jsx("div",{className:s?Y.errorMessage:Y.waitingMessage,children:o})}function uU(){const{sessionId:t}=fs(),{sessions:{events:s,eventsDropped:o,sessions:r,sessionsLoading:c,kill:d,stopGraceful:u,loadSessionEvents:p,sendInput:m,spawn:g},tasks:{startTask:v},personas:{personas:b},environments:{environments:x,provisionEnvironment:S}}=mt(),{showToast:k}=Sn(),w=y.useRef(void 0),N=h7(t),T=r.find(O=>O.id===t)??void 0,C=y.useMemo(()=>{const O=t?s.filter(E=>E.sessionId===t):[];return sh(nh(O))},[s,t]);if(y.useEffect(()=>{t&&t!==w.current&&(w.current=t,p(t).catch(()=>{}))},[t,p]),!T&&c)return i.jsx(lU,{});if(!t)return i.jsx("div",{className:Y.emptyState,children:"No session selected"});const D=(T==null?void 0:T.status)==="running"||(T==null?void 0:T.status)==="idle";return i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(Ns,{segments:N}),i.jsx(cU,{sessionId:t,session:T,isActive:D,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{d(t).catch(()=>{})}}),i.jsx(Wm,{events:C,eventsDropped:o,emptyState:i.jsx(dU,{session:T}),onShowToast:k}),D&&i.jsx(el,{mode:"send",sessionId:t,environmentId:T.environmentId,personas:b,environments:x,onSendInput:(O,E)=>{m(O,E).catch(()=>{})},onSpawn:(O,E,A)=>{g(O,E,A).catch(()=>{})},onStartTask:(O,E,A)=>{v(O,E,A).catch(()=>{})},onProvisionEnvironment:O=>{S(O).catch(()=>{})},onShowToast:k})]})}function fU(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Qs(t,s){const o=y.useRef(s);o.current=s;const{key:r,ctrl:c=!1,shift:d=!1,suppressInInputs:u=!0,enabled:p=!0}=t;y.useEffect(()=>{if(!p)return;const m=g=>{if(u&&fU(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(d&&!g.shiftKey||g.key===r&&o.current())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[r,c,d,u,p])}function pU(){return i.jsxs("div",{className:Y.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:Y.workspaceHeader,children:i.jsx("span",{className:Y.workspaceName,children:i.jsx(we,{width:"12rem",height:"1.25rem"})})}),i.jsx("div",{className:Y.metaToggle,style:{cursor:"default"},children:i.jsx(we,{width:"4rem",height:"0.625rem"})}),i.jsxs("div",{className:Y.progressBarContainer,children:[i.jsx("div",{className:Y.progressBar,children:i.jsx("div",{className:Y.progressFill,style:{width:"0%"}})}),i.jsx(we,{width:"2rem",height:"0.625rem"})]}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("span",{className:`${Y.tab} ${Y.active}`,children:"Graph"}),i.jsx("span",{className:Y.tab,children:"Board"}),i.jsx("span",{className:Y.tab,children:"Tasks"})]}),i.jsx("div",{className:Y.overviewContent,children:Array.from({length:3},(t,s)=>i.jsx(dd,{lines:2},s))})]})}function Qb(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 Np=100;function mU(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function hU(){const{workspaceId:t,environmentId:s}=fs(),o=kt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:p,updateWorkspace:m,linkEnvironment:g,unlinkEnvironment:v,linkOperationError:b,clearLinkOperationError:x},personas:{personas:S},sessions:{sessions:k},usageCache:w,loadUsage:N}=mt(),{resolvedThemeId:T}=I1(),[C,D]=y.useState("tasks"),[O,E]=y.useState(!1),[A,P]=y.useState(null),[I,U]=y.useState(!1),Q=y.useRef(void 0),$=d.find(X=>X.id===t),H=s??($==null?void 0:$.environmentId)??"",ue=g7(t,H,d,c);Qs({key:"1"},()=>D("graph")),Qs({key:"2"},()=>D("board")),Qs({key:"3"},()=>D("tasks")),y.useEffect(()=>{const X=Q.current;Q.current=t,!(X===void 0||X===t)&&A!==null&&P(null)},[t,A]);const W=k.reduce((X,ge)=>X+(ge.costUsd??0),0);y.useEffect(()=>{t&&N("workspace",t).catch(()=>{})},[t,N,W]);const oe=t?w[`workspace:${t}`]:void 0,L=r.filter(X=>X.workspaceId===t),Z=L.filter(X=>X.status==="complete").length,J=L.length,ce=J>0?Math.round(Z/J*100):0;return!$&&u?i.jsx(pU,{}):i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(Ns,{segments:ue}),i.jsxs("div",{className:Y.workspaceHeader,children:[i.jsx("span",{className:Y.workspaceName,"data-testid":"workspace-name",children:i.jsx(ln,{value:($==null?void 0:$.name)||"",onSave:X=>{$&&m($.id,{name:X}).catch(()=>{})},validate:X=>{const ge=X.trim();if(!ge)return"Name is required";if(ge.length>Np)return`Max ${Np} characters`},maxLength:Np,fieldId:"name",activeFieldId:A,onActivate:P,ariaLabel:"Workspace name",renderDisplay:X=>X||t||void 0,"data-testid":"edit-name"})}),i.jsx("button",{className:Y.archiveButton,onClick:()=>E(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),i.jsxs("button",{className:Y.metaToggle,onClick:()=>U(!I),"aria-expanded":!I,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[i.jsx("span",{className:`${Y.metaToggleArrow} ${I?"":Y.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!I&&i.jsxs("div",{className:Y.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Description"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(Xp,{value:($==null?void 0:$.description)||"",onSave:X=>{$&&m($.id,{description:X}).catch(()=>{})},fieldId:"description",activeFieldId:A,onActivate:P,renderDisplay:X=>X?i.jsx("span",{className:Y.overviewMarkdown,children:i.jsx(hd,{remarkPlugins:[gd],children:X})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Repository"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(ln,{value:($==null?void 0:$.repoUrl)||"",onSave:X=>{$&&m($.id,{repoUrl:X}).catch(()=>{})},validate:X=>{const ge=X.trim();if(ge&&!/^https?:\/\/.+/.test(ge))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:A,onActivate:P,renderDisplay:X=>{const ge=mU(X);return ge?i.jsx("a",{className:Y.repoLink,href:ge,target:"_blank",rel:"noopener noreferrer",onClick:pe=>pe.stopPropagation(),children:X}):X?i.jsx("span",{children:X}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Environment"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(R6,{value:($==null?void 0:$.environmentId)||"",onSave:X=>{$&&X&&m($.id,{environmentId:X}).catch(()=>{})},environments:c,fieldId:"environmentId",activeFieldId:A,onActivate:P,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Linked Envs"}),i.jsx("div",{className:Y.metaValue,"data-testid":"linked-environments",children:$?i.jsxs("span",{className:Y.linkedEnvList,children:[(()=>{const X=[...new Set($.linkedEnvironmentIds.filter(ge=>ge!==$.environmentId))];return X.length===0?i.jsx("span",{className:Y.metaPlaceholder,children:"None"}):X.map(ge=>{const pe=c.find(Ce=>Ce.id===ge);return i.jsxs("span",{className:Y.linkedEnvChip,"data-testid":`linked-env-${ge}`,children:[(pe==null?void 0:pe.displayName)||ge,i.jsx("button",{className:Y.chipDismiss,onClick:()=>{v($.id,ge).catch(()=>{})},title:`Unlink ${(pe==null?void 0:pe.displayName)||ge}`,"aria-label":`Unlink ${(pe==null?void 0:pe.displayName)||ge}`,"data-testid":`unlink-env-${ge}`,children:"x"})]},ge)})})(),(()=>{const X=new Set($.linkedEnvironmentIds),ge=c.filter(pe=>pe.id!==$.environmentId&&!X.has(pe.id));return ge.length===0?null:i.jsxs("select",{className:Y.linkEnvSelect,value:"",onChange:pe=>{pe.target.value&&g($.id,pe.target.value).catch(()=>{})},"aria-label":"Link environment","data-testid":"link-env-select",children:[i.jsx("option",{value:"",children:"+ Link"}),ge.map(pe=>i.jsx("option",{value:pe.id,children:pe.displayName||pe.id},pe.id))]})})(),b&&i.jsxs("span",{className:Y.linkError,"data-testid":"link-operation-error",role:"alert",children:[b,i.jsx("button",{className:Y.chipDismiss,onClick:x,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"x"})]})]}):i.jsx("span",{className:Y.metaPlaceholder,children:"None"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Persona"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(ud,{value:($==null?void 0:$.defaultPersonaId)||"",onSave:X=>{$&&m($.id,{defaultPersonaId:X}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...S.map(X=>({value:X.id,label:X.name}))],fieldId:"defaultPersonaId",activeFieldId:A,onActivate:P,renderDisplay:X=>{const ge=S.find(pe=>pe.id===X);if(ge)return i.jsx("span",{children:ge.name})},placeholder:($==null?void 0:$.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Worktrees"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(T6,{checked:($==null?void 0:$.useWorktrees)??!0,onChange:X=>{$&&m($.id,{useWorktrees:X}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Working Dir"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(ln,{value:($==null?void 0:$.workingDirectory)||"",onSave:X=>{$&&m($.id,{workingDirectory:X}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:A,onActivate:P,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),$&&i.jsxs("div",{className:Y.metaTimestamps,children:[i.jsxs("span",{className:Y.metaTimestamp,children:["Created ",Qb($.createdAt)]}),$.updatedAt&&$.updatedAt!==$.createdAt&&i.jsxs("span",{className:Y.metaTimestamp,children:["· Updated ",Qb($.updatedAt)]})]})]}),J>0&&i.jsxs("div",{className:Y.progressBarContainer,"data-testid":"progress-bar",children:[i.jsx("div",{className:Y.progressBar,children:i.jsx("div",{className:Y.progressFill,style:{width:`${ce}%`}})}),i.jsxs("span",{className:Y.progressLabel,children:[Z,"/",J]})]}),oe&&oe.costUsd>0&&i.jsx("div",{className:Y.progressBarContainer,children:i.jsxs("span",{className:Y.progressLabel,children:["Usage: ",Ss(oe.costUsd)," (",oe.sessionCount," session",oe.sessionCount!==1?"s":"",")"]})}),$&&($.tokenBudget>0||$.costBudgetMillicents>0)&&i.jsx("div",{className:Y.progressBarContainer,children:i.jsxs("span",{className:Y.progressLabel,children:["Budget:"," ",$.tokenBudget>0&&i.jsxs(i.Fragment,{children:["Tokens: ",Io(((oe==null?void 0:oe.inputTokens)??0)+((oe==null?void 0:oe.outputTokens)??0))," / ",Io($.tokenBudget)]}),$.tokenBudget>0&&$.costBudgetMillicents>0&&" | ",$.costBudgetMillicents>0&&i.jsxs(i.Fragment,{children:["Cost: ",Ss((oe==null?void 0:oe.costUsd)??0)," / ",Ss($.costBudgetMillicents/1e5)]})]})}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("button",{role:"tab","aria-selected":C==="graph",className:`${Y.tab} ${C==="graph"?Y.active:""}`,onClick:()=>D("graph"),children:"Graph"}),i.jsx("button",{role:"tab","aria-selected":C==="board",className:`${Y.tab} ${C==="board"?Y.active:""}`,onClick:()=>D("board"),"data-testid":"board-tab",children:"Board"}),i.jsx("button",{role:"tab","aria-selected":C==="tasks",className:`${Y.tab} ${C==="tasks"?Y.active:""}`,onClick:()=>D("tasks"),children:"Tasks"})]}),C==="tasks"&&J>0&&i.jsxs("div",{className:Y.workspaceSummary,children:[i.jsx("span",{className:Y.workspaceSummaryTitle,children:`${Z}/${J} tasks complete`}),i.jsx("span",{className:Y.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),C==="tasks"&&J===0&&i.jsxs("div",{className:Y.emptyCta,children:[i.jsx("button",{className:Y.ctaButton,onClick:()=>o(Ri(t,void 0,H)),children:"Create Task"}),i.jsx("div",{className:Y.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),C==="board"&&i.jsx($8,{workspaceId:t,environmentId:H,tasks:r,sessions:k,personas:S,environments:c}),C==="graph"&&i.jsx(cN,{workspaceId:t,environmentId:H,tasks:r,resolvedThemeId:T}),i.jsx(Ei,{isOpen:O,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{$&&(p($.id).catch(()=>{}),o("/",{replace:!0})),E(!1)},onCancel:()=>E(!1)})]})}const gU="_container_3pgew_1",vU="_header_3pgew_8",yU="_headerTitle_3pgew_35",bU="_headerActions_3pgew_44",xU="_body_3pgew_51",_U="_btnPrimary_3pgew_63",kU="_btnGhost_3pgew_94",SU="_error_3pgew_116",Ma={container:gU,header:vU,headerTitle:yU,headerActions:bU,body:xU,btnPrimary:_U,btnGhost:kU,error:SU};function TU(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 wU=[{label:"Home",url:Ci},{label:"New Workspace",url:void 0}];function jU(){const[t]=mm(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=mt(),{showToast:u}=Sn(),p=kt(),[m,g]=y.useState(()=>{var N;return J8(void 0,s||((N=o[0])==null?void 0:N.id))}),[v,b]=y.useState(),[x,S]=y.useState();y.useEffect(()=>{s||m.environmentId||o.length===0||g(N=>{var T;return N.environmentId?N:{...N,environmentId:((T=o[0])==null?void 0:T.id)??""}})},[o,s,m.environmentId]);const k=()=>{const N=TU(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(Ci,{replace:!0})},T=>{S(T)}).catch(()=>{})},w=()=>{p(s?Ni(s):Ci,{replace:!0})};return i.jsxs("div",{className:Ma.container,children:[i.jsxs("div",{className:Ma.header,children:[i.jsx("div",{className:Ma.headerTitle,children:i.jsx(Ns,{segments:wU})}),i.jsxs("div",{className:Ma.headerActions,children:[i.jsx("button",{className:Ma.btnGhost,onClick:w,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),i.jsx("button",{className:Ma.btnPrimary,onClick:k,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?i.jsx(m1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),i.jsxs("div",{className:Ma.body,children:[i.jsx(X8,{values:m,onChange:N=>{g(N),b(void 0),S(void 0)},environments:o,personas:r,errors:v,disabled:d,autoFocusName:!0}),x&&i.jsx("div",{className:Ma.error,"data-testid":"workspace-create-submit-error",children:x})]})]})}function ex(){const{workspaceId:t,environmentId:s}=fs(),[o]=mm(),r=t??o.get("workspace")??"",c=o.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:p},workspaces:{workspaces:m},personas:{personas:g}}=mt(),{showToast:v}=Sn();return i.jsx(N1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(b,x,S,k,w,N,T,C,D)=>{u(b,x,S,k,w,N,T,C,D).catch(()=>{})},onUpdateTask:(b,x,S,k,w)=>{p(b,x,S,k,w).catch(()=>{})},onShowToast:v})}function NU(){return i.jsxs("div",{className:Y.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:Y.header,children:i.jsxs("span",{className:Y.headerTitle,children:[i.jsx(we,{width:"12rem",height:"1rem"}),i.jsx(we,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("span",{className:`${Y.tab} ${Y.active}`,children:"Overview"}),i.jsx("span",{className:Y.tab,children:"Stream"}),i.jsx("span",{className:Y.tab,children:"Findings"})]}),i.jsx("div",{className:Y.overviewContent,children:i.jsxs("div",{className:Y.overviewDashboard,children:[i.jsx("div",{className:Y.overviewHero,children:i.jsx(we,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Description"}),i.jsx(Wp,{lines:2})]}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Environment"}),i.jsxs("div",{className:Y.envRow,children:[i.jsx(we,{width:"0.5rem",height:"0.5rem",variant:"circular"}),i.jsx(we,{width:"8rem",height:"0.875rem"})]})]}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Dependencies"}),i.jsx(Wp,{lines:2})]}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Timeline"}),i.jsx("div",{className:Y.timeline,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:Y.timelineRow,children:[i.jsx(we,{width:"4rem",height:"0.75rem"}),i.jsx(we,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function Ia(){const{taskId:t,workspaceId:s,environmentId:o}=fs(),r=Zt(),c=kt(),{showToast:d}=Sn(),{sessions:{events:u,eventsDropped:p,sessions:m,loadSessionEvents:g,taskSessions:v,loadTaskSessions:b,sendInput:x,spawn:S,kill:k},tasks:{tasks:w,tasksLoading:N,startTask:T,stopTask:C,resumeTask:D,deleteTask:O,createTask:E,updateTask:A},environments:{environments:P,provisionEnvironment:I},findings:{findings:U,loadFindings:Q},workspaces:{workspaces:$},personas:{personas:H},usageCache:ue,loadUsage:W}=mt(),oe=y.useRef(void 0),L=y.useRef(void 0),Z=y.useRef(void 0),J=y.useRef(void 0),ce=y.useRef(void 0),X=r.pathname.endsWith("/stream")?"stream":r.pathname.endsWith("/findings")?"findings":"overview",ge=r.pathname.endsWith("/edit"),[pe,Ce]=y.useState(X),[Ze,me]=y.useState(!1),[_e,ve]=y.useState(void 0),[Le,Mt]=y.useState(""),[Tn,ie]=y.useState(ge),Ve=y.useRef(X),qt=y.useRef(ge),te=w.find(Re=>Re.id===t),ht=(te==null?void 0:te.workspaceId)||void 0,at=$.find(Re=>Re.id===ht);y.useEffect(()=>{X!==Ve.current&&(Ve.current=X,X!==pe&&Ce(X))},[X,pe]),y.useEffect(()=>{ge!==qt.current&&(qt.current=ge,ge!==Tn&&ie(ge))},[ge,Tn]),y.useEffect(()=>{if(Le===""){if(at!=null&&at.environmentId)Mt(at.environmentId);else if(P.length>0){const Re=P.find(Je=>Je.status==="connected");Mt((Re==null?void 0:Re.id)??P[0].id)}}},[Le,at==null?void 0:at.environmentId,P]);const Kt=te?v[te.id]??[]:[];let gt;_e&&Kt.some(Re=>Re.id===_e)?gt=_e:gt=(te==null?void 0:te.latestSessionId)||void 0;const ps=()=>{me(!0)},aa=()=>{if(!te)return;O(te.id).catch(()=>{}),me(!1);const Re=o??(at==null?void 0:at.environmentId);c(te.workspaceId&&Re?$a(te.workspaceId,Re):"/",{replace:!0})};y.useEffect(()=>{(te==null?void 0:te.id)!==L.current&&(L.current=te==null?void 0:te.id,ve(void 0),Mt(""),ie(ge))},[te==null?void 0:te.id,ge]),y.useEffect(()=>{if(!(te!=null&&te.id))return;const Re=te.id!==J.current,Je=te.latestSessionId!==ce.current;(Re||Je)&&(J.current=te.id,ce.current=te.latestSessionId,b(te.id).catch(()=>{}))},[te==null?void 0:te.id,te==null?void 0:te.latestSessionId,b]),y.useEffect(()=>{if((te==null?void 0:te.status)!==Z.current){const Re=Z.current===void 0;Z.current=te==null?void 0:te.status;const Je=(te==null?void 0:te.status)==="not_started"?"overview":(te==null?void 0:te.status)==="working"||(te==null?void 0:te.status)==="paused"?"stream":(te==null?void 0:te.status)==="complete"?"findings":void 0;Je&&Je!==pe&&!(Re&&X!=="overview")&&Ce(Je)}},[te==null?void 0:te.status,pe,X]);const es=y.useMemo(()=>new Map(w.map(Re=>[Re.id,Re])),[w]),Fa=y.useMemo(()=>{const Re=gt?u.filter(Je=>Je.sessionId===gt):[];return sh(nh(Re))},[u,gt]),ia=te?te.dependsOn.some(Re=>{const Je=es.get(Re);return Je!==void 0&&Je.status!=="complete"}):!1,Yt=y.useMemo(()=>v7(t,o,$,P,es),[t,o,$,P,es]);y.useEffect(()=>{gt&>!==oe.current&&(oe.current=gt,g(gt).catch(()=>{}))},[gt,g]),y.useEffect(()=>{pe==="findings"&&ht&&Q(ht).catch(()=>{})},[pe,ht,Q]);const Ii=Kt.reduce((Re,Je)=>Re+(Je.costUsd??0),0);y.useEffect(()=>{te&&(W("task",te.id).catch(()=>{}),te.childTaskIds.length>0&&W("task_tree",te.id).catch(()=>{}))},[te==null?void 0:te.id,te==null?void 0:te.childTaskIds.length,W,Ii]);const oa=te?`task:${te.id}`:"",Za=oa in ue?ue[oa]:void 0,ms=te?`task_tree:${te.id}`:"",Oi=te&&te.childTaskIds.length>0&&ms in ue?ue[ms]:void 0,wn=Re=>{Ce(Re),c(On(t,Re==="overview"?void 0:Re,s,o))};return Qs({key:"1"},()=>wn("overview")),Qs({key:"2"},()=>wn("stream")),Qs({key:"3"},()=>wn("findings")),!te&&N?i.jsx(NU,{}):i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(Ns,{segments:Yt}),i.jsxs("div",{className:Y.header,children:[i.jsxs("span",{className:Y.headerTitle,children:[i.jsx("span",{"data-testid":"task-title",children:(te==null?void 0:te.title)||t}),te&&i.jsx("span",{className:Y.taskStatusBadge,"data-testid":"task-status",children:te.status}),(te==null?void 0:te.branch)&&i.jsx("span",{className:Y.taskBranch,children:te.branch}),ia&&i.jsx("span",{className:Y.taskBlockedBadge,children:"blocked"})]}),te&&i.jsx(hB,{task:te,sessionId:gt,isBlocked:ia,onStart:()=>{T(te.id,void 0,Le).catch(()=>{})},onResume:()=>{D(te.id).catch(()=>{})},onStop:()=>{C(te.id).catch(()=>{})},onPause:()=>{gt&&k(gt).catch(()=>{})},onDelete:ps,onEdit:()=>ie(!0)})]}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("button",{role:"tab","aria-selected":pe==="overview",className:`${Y.tab} ${pe==="overview"?Y.active:""}`,onClick:()=>wn("overview"),children:"Overview"}),i.jsx("button",{role:"tab","aria-selected":pe==="stream",className:`${Y.tab} ${pe==="stream"?Y.active:""}`,onClick:()=>wn("stream"),children:"Stream"}),i.jsx("button",{role:"tab","aria-selected":pe==="findings",className:`${Y.tab} ${pe==="findings"?Y.active:""}`,onClick:()=>wn("findings"),children:"Findings"})]}),i.jsxs(us,{mode:"wait",children:[pe==="overview"&&i.jsx(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:Y.overviewContent,"data-testid":"task-overview",children:Tn&&te?i.jsx(N1,{mode:"edit",taskId:te.id,workspaceId:ht,environmentId:o,tasks:w,workspaces:$,personas:H,onCreateTask:(Re,Je,Jt,St,un,Wt,Bi,Li,zi)=>{E(Re,Je,Jt,St,un,Wt,Bi,Li,zi).catch(()=>{})},onUpdateTask:(Re,Je,Jt,St,un)=>{A(Re,Je,Jt,St,un).catch(()=>{})},onEditDone:()=>{ge?c(On(te.id,void 0,s,o),{replace:!0}):ie(!1)},onShowToast:d}):te?i.jsx(nL,{task:te,tasksById:es,environments:P,workspaces:$,taskSessions:Kt,selectedEnvId:Le,taskUsage:Za,treeUsage:Oi}):i.jsx("div",{className:Y.waitingMessage,children:"No additional details"})},"overview"),pe==="stream"&&i.jsxs(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[i.jsx(E3,{taskSessions:Kt,selectedSessionId:gt,onSelect:Re=>ve(Re)}),i.jsx(Wm,{events:Fa,eventsDropped:p,emptyState:!gt&&te?ia?i.jsx("div",{className:Y.emptyCta,"data-testid":"stream-blocked-message",children:i.jsx("div",{className:Y.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):i.jsxs("div",{className:Y.emptyCta,children:[i.jsx("button",{"data-testid":"stream-start-cta",className:Y.ctaButton,onClick:()=>{T(te.id,void 0,Le).catch(()=>{})},children:"Start Task"}),i.jsx("div",{className:Y.ctaDescription,children:"Click to begin agent execution"})]}):gt&&Fa.length===0?i.jsx("div",{className:Y.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:d})]},"stream"),pe==="findings"&&i.jsx(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:Y.tabContent,children:ht?i.jsx(w1,{findings:U.filter(Re=>Re.workspaceId===ht)}):i.jsx("div",{className:Y.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!te||te.status!=="working"&&te.status!=="paused")return;const Re=gt?m.find(Je=>Je.id===gt):void 0;if(!(!Re||Re.status==="stopped"))return i.jsx(el,{mode:"send",sessionId:Re.id,environmentId:Re.environmentId,personas:H,environments:P,onSendInput:(Je,Jt)=>{x(Je,Jt).catch(()=>{})},onSpawn:(Je,Jt,St)=>{S(Je,Jt,St).catch(()=>{})},onStartTask:(Je,Jt,St)=>{T(Je,Jt,St).catch(()=>{})},onProvisionEnvironment:Je=>{I(Je).catch(()=>{})},onShowToast:d})})(),te&&i.jsx(Ei,{isOpen:Ze,title:"Delete Task?",description:`"${te.title}" will be permanently removed.`,onConfirm:aa,onCancel:()=>me(!1)})]})}function CU(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:o},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:p,createCodespace:m}}=mt(),{showToast:g}=Sn();return i.jsx(C1,{mode:"new",environments:t,onAddEnvironment:(v,b,x)=>{s(v,b,x).catch(()=>{})},onUpdateEnvironment:(v,b)=>{o(v,b).catch(()=>{})},onListCodespaces:()=>{p().catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(v,b)=>{m(v,b).catch(()=>{})},onShowToast:g})}function EU(){const{environmentId:t}=fs(),{environments:{environments:s,addEnvironment:o,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,listCodespaces:m,createCodespace:g}}=mt(),{showToast:v}=Sn();return i.jsx(C1,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(b,x,S)=>{o(b,x,S).catch(()=>{})},onUpdateEnvironment:(b,x)=>{r(b,x).catch(()=>{})},onListCodespaces:()=>{m().catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(b,x)=>{g(b,x).catch(()=>{})},onShowToast:v})}const AU="_layout_11u79_1",DU="_content_11u79_8",RU="_tabPanel_11u79_14",Qr={layout:AU,content:DU,tabPanel:RU};function MU(){const t=p7();return i.jsxs("div",{className:Qr.layout,children:[i.jsx(Ns,{segments:t}),i.jsx("div",{className:Qr.content,children:i.jsx(Va,{})})]})}const IU="_container_144a4_1",OU="_envHeader_144a4_6",BU="_envTitleRow_144a4_10",LU="_statusDot_144a4_16",zU="_envName_144a4_21",$U="_statusBadge_144a4_27",UU="_envMeta_144a4_33",PU="_metaTag_144a4_39",HU="_actions_144a4_51",VU="_provisionMessage_144a4_59",qU="_errorMessage_144a4_64",GU="_section_144a4_69",FU="_sectionHeader_144a4_73",ZU="_cardList_144a4_121",KU="_card_144a4_121",YU="_cardHeader_144a4_138",JU="_cardName_144a4_144",WU="_cardActions_144a4_149",XU="_cardDescription_144a4_154",QU="_cardMeta_144a4_160",eP="_repoLink_144a4_166",tP="_empty_144a4_174",nP="_errorHint_144a4_180",sP="_btnPrimary_144a4_186",aP="_btnOutline_144a4_220",iP="_btnSmall_144a4_247",oP="_btnDanger_144a4_273",Se={container:IU,envHeader:OU,envTitleRow:BU,statusDot:LU,envName:zU,statusBadge:$U,envMeta:UU,metaTag:PU,actions:HU,provisionMessage:VU,errorMessage:qU,section:GU,sectionHeader:FU,cardList:ZU,card:KU,cardHeader:YU,cardName:JU,cardActions:WU,cardDescription:XU,cardMeta:QU,repoLink:eP,empty:tP,errorHint:nP,btnPrimary:sP,btnOutline:aP,btnSmall:iP,btnDanger:oP};function rP(){return i.jsxs("div",{className:Se.container,"aria-hidden":"true",children:[i.jsxs("div",{className:Se.envHeader,children:[i.jsxs("div",{className:Se.envTitleRow,children:[i.jsx(we,{width:"0.875rem",height:"0.875rem",variant:"circular"}),i.jsx(we,{width:"12rem",height:"1.5rem"}),i.jsx(we,{width:"4rem",height:"0.875rem"})]}),i.jsxs("div",{className:Se.envMeta,children:[i.jsx(we,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),i.jsxs("div",{className:Se.actions,children:[i.jsx(we,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(we,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),i.jsxs("div",{className:Se.section,children:[i.jsx("div",{className:Se.sectionHeader,children:i.jsx("h3",{style:{margin:0},children:"Workspaces"})}),i.jsxs("div",{className:Se.cardList,children:[i.jsx(dd,{lines:2}),i.jsx(dd,{lines:2})]})]})]})}const lP={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function cP(){const{environmentId:t}=fs(),s=kt(),{environments:{environments:o,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:p},workspaces:{workspaces:m,archiveWorkspace:g,linkEnvironment:v,unlinkEnvironment:b,linkOperationError:x,clearLinkOperationError:S},sessions:{sessions:k}}=mt(),[w,N]=y.useState(!1),[T,C]=y.useState(!1),[D,O]=y.useState(void 0),E=o.find(J=>J.id===t);if(!E&&r)return i.jsx(rP,{});if(!t||!E)return i.jsx(ds,{to:Mo,replace:!0});const A=m.filter(J=>J.environmentId===E.id),P=m.filter(J=>J.linkedEnvironmentIds.includes(E.id)&&J.environmentId!==E.id).filter((J,ce,X)=>X.findIndex(ge=>ge.id===J.id)===ce),I=k.filter(J=>J.environmentId===E.id),U=I.reduce((J,ce)=>J+(ce.costUsd??0),0),Q=lP[E.status]||"var(--text-tertiary)",$=E.status==="connected",H=E.status==="connecting",ue=E.status==="disconnected"||E.status==="error"||E.status==="sleeping",W=E.id in c?c[E.id]:void 0,oe=()=>{p(E.id).catch(()=>{}),N(!1),s(Mo,{replace:!0})},L=()=>{C(!1),d(E.id,!0).catch(()=>{})},Z=J=>{g(J).catch(()=>{}),O(void 0)};return i.jsxs("div",{className:Se.container,children:[i.jsx(Ei,{isOpen:w,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:oe,onCancel:()=>N(!1)}),i.jsx(Ei,{isOpen:T,title:"Reprovision Environment?",description:"This will kill any active session and force a fresh provision cycle. The environment will be temporarily disconnected.",confirmLabel:"Reprovision",onConfirm:L,onCancel:()=>C(!1)}),i.jsxs("div",{className:Se.envHeader,children:[i.jsxs("div",{className:Se.envTitleRow,children:[i.jsx("span",{className:Se.statusDot,style:{color:Q},children:"●"}),i.jsx("h2",{className:Se.envName,children:E.displayName||E.id}),i.jsx("span",{className:Se.statusBadge,style:{color:Q},children:E.status})]}),i.jsxs("div",{className:Se.envMeta,children:[i.jsxs("span",{className:Se.metaTag,children:["Adapter: ",E.adapterType]}),I.length>0&&i.jsxs("span",{className:Se.metaTag,children:[I.length," session",I.length!==1?"s":""]}),U>0&&i.jsxs("span",{className:Se.metaTag,children:["Cost: ",Ss(U)]})]})]}),i.jsxs("div",{className:Se.actions,children:[$&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:Se.btnPrimary,onClick:()=>s(Ix(E.id)),children:"New Chat"}),i.jsx("button",{className:Se.btnOutline,onClick:()=>{u(E.id).catch(()=>{})},children:"Stop"}),i.jsx("button",{className:Se.btnOutline,onClick:()=>C(!0),disabled:W!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),ue&&i.jsx("button",{className:Se.btnPrimary,onClick:()=>{d(E.id).catch(()=>{})},children:E.status==="error"?"Retry":E.status==="sleeping"?"Wake":"Connect"}),H&&W!==void 0&&i.jsx("span",{className:Se.provisionMessage,children:W.message}),E.status==="error"&&(W==null?void 0:W.stage)==="error"&&i.jsx("span",{className:Se.errorMessage,children:W.message}),i.jsx("button",{className:Se.btnOutline,onClick:()=>s(Qj(E.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),i.jsx("button",{className:Se.btnDanger,onClick:()=>N(!0),children:"Delete"})]}),i.jsxs("div",{className:Se.section,children:[i.jsxs("div",{className:Se.sectionHeader,children:[i.jsx("h3",{children:"Workspaces"}),i.jsx("button",{className:Se.btnPrimary,onClick:()=>s(`${Bx}?environment=${encodeURIComponent(E.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"})]}),A.length===0&&i.jsx("p",{className:Se.empty,children:"No workspaces yet. Create one to get started."}),i.jsx("div",{className:Se.cardList,children:A.map(J=>i.jsx(dP,{workspace:J,confirmArchiveId:D,onOpen:()=>s($a(J.id,E.id)),onArchive:()=>O(J.id),onConfirmArchive:()=>Z(J.id),onCancelArchive:()=>O(void 0)},J.id))})]}),i.jsxs("div",{className:Se.section,children:[i.jsxs("div",{className:Se.sectionHeader,children:[i.jsx("h3",{children:"Linked Workspaces"}),(()=>{const J=m.filter(ce=>ce.environmentId!==E.id&&!ce.linkedEnvironmentIds.includes(E.id)&&ce.status==="active");return J.length===0?null:i.jsxs("select",{className:Se.btnPrimary,value:"",onChange:ce=>{ce.target.value&&v(ce.target.value,E.id).catch(()=>{})},"aria-label":"Link a workspace","data-testid":"link-workspace-select",children:[i.jsx("option",{value:"",children:"+ Link Workspace"}),J.map(ce=>i.jsx("option",{value:ce.id,children:ce.name},ce.id))]})})()]}),P.length===0&&i.jsx("p",{className:Se.empty,"data-testid":"linked-workspaces-empty",children:"No workspaces are linked to this environment."}),x&&i.jsxs("p",{className:Se.errorHint,"data-testid":"link-operation-error",role:"alert",children:[x,i.jsx("button",{className:Se.btnSmall,onClick:S,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"Dismiss"})]}),i.jsx("div",{className:Se.cardList,"data-testid":"linked-workspaces-list",children:P.map(J=>{var ce;return i.jsxs("div",{className:Se.card,"data-testid":`linked-workspace-card-${J.id}`,children:[i.jsxs("div",{className:Se.cardHeader,children:[i.jsx("strong",{className:Se.cardName,children:J.name}),i.jsxs("div",{className:Se.cardActions,children:[i.jsx("button",{className:Se.btnSmall,onClick:()=>s($a(J.id,J.environmentId)),children:"Open"}),i.jsx("button",{className:Se.btnSmall,onClick:()=>{b(J.id,E.id).catch(()=>{})},"data-testid":`unlink-workspace-${J.id}`,children:"Unlink"})]})]}),J.description&&i.jsx("p",{className:Se.cardDescription,children:J.description}),i.jsxs("div",{className:Se.cardMeta,children:["Primary: ",((ce=o.find(X=>X.id===J.environmentId))==null?void 0:ce.displayName)||J.environmentId]})]},J.id)})})]})]})}function dP({workspace:t,confirmArchiveId:s,onOpen:o,onArchive:r,onConfirmArchive:c,onCancelArchive:d}){const u=s===t.id,p=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return i.jsxs("div",{className:Se.card,"data-testid":"workspace-card",children:[i.jsxs("div",{className:Se.cardHeader,children:[i.jsx("strong",{className:Se.cardName,children:t.name}),i.jsxs("div",{className:Se.cardActions,children:[i.jsx("button",{className:Se.btnSmall,onClick:o,children:"Open"}),u?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:Se.btnDanger,onClick:c,children:"Confirm"}),i.jsx("button",{className:Se.btnSmall,onClick:d,children:"Cancel"})]}):i.jsx("button",{className:Se.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&i.jsx("p",{className:Se.cardDescription,children:t.description}),t.repoUrl&&i.jsx("div",{className:Se.cardMeta,children:p?i.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Se.repoLink,children:t.repoUrl}):i.jsx("span",{children:t.repoUrl})})]})}const uP={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function fP(){const s=Zt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=uP[s],r=f7(o);return i.jsxs("div",{className:Qr.layout,children:[i.jsx(Ns,{segments:r}),i.jsx("div",{className:Qr.content,children:i.jsx("div",{className:Qr.tabPanel,children:i.jsx(Va,{})},s)})]})}function pP(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=mt(),{showToast:d}=Sn();return i.jsxs(i.Fragment,{children:[i.jsx(ML,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),i.jsx(PO,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function mP(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=mt(),{showToast:c}=Sn(),d=kt();return i.jsx(FL,{personas:t,appDefaultPersonaId:o,onDeletePersona:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete persona",{personaId:u,error:p}),c("Failed to delete persona","error"),p}},onSetAppDefaultPersonaId:async u=>{try{await r(u)}catch(p){console.error("Failed to set app default persona ID",{personaId:u,error:p}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>d(tN),onNavigateToPersona:u=>d(Ox(u))})}const hP="_container_1ooin_1",gP="_form_1ooin_7",vP="_formActions_1ooin_75",yP="_editableSection_1ooin_82",bP="_defaultBadge_1ooin_93",xP="_typeToggle_1ooin_107",_P="_scriptEditor_1ooin_121",kP="_optional_1ooin_128",ls={container:hP,form:gP,formActions:vP,editableSection:yP,defaultBadge:bP,typeToggle:xP,scriptEditor:_P,optional:kP},tx=[{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)"}],nx=[{value:"genaiscript",label:"genaiscript"}],SP="0";function sx(){const{personaId:t}=fs(),s=kt(),{showToast:o}=Sn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:p,setAppDefaultPersonaId:m}=mt(),g=t===void 0,v=g?void 0:r.find(x=>x.id===t);if(!g&&r.length>0&&!v)return i.jsx(ds,{to:qf,replace:!0});const b=[{label:"Settings",url:Ro},{label:"Personas",url:qf},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return i.jsxs("div",{className:ls.container,children:[i.jsx(Ns,{segments:b}),i.jsx(TP,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(qf)},showToast:o})]})}function TP({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=kt(),[v,b]=y.useState((t==null?void 0:t.name)??""),[x,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,D]=y.useState((t==null?void 0:t.model)??"sonnet"),[O,E]=y.useState((t==null?void 0:t.maxTurns)??0),[A,P]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[I,U]=y.useState((t==null?void 0:t.script)??""),[Q,$]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[H,ue]=y.useState(!1),[W,oe]=y.useState(null),[L,Z]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!L){Z(!0),b(t.name),S(t.description),w(t.systemPrompt);const ie=t.type==="script"?"script":"agent";T(ie==="script"?t.runtime||"genaiscript":t.runtime),D(t.model),E(t.maxTurns),P(ie),U(t.script||""),$(t.allowedMcpTools)}},[s,t,L]);const J=ie=>{P(ie),ie==="script"?T("genaiscript"):N==="genaiscript"&&T("claude-code")},ce=!s&&t===void 0,X=v.trim().length>0&&!ce&&k.trim().length>0&&(A==="script"?I.trim().length>0:!!N&&!!C),ge=s&&X,pe=!s&&o===(t==null?void 0:t.id),Ce=!s&&t&&!pe&&A==="agent"&&!!N&&!!C,Ze=(ie,Ve)=>{if(!ie.trim())return`${Ve} is required`},me=ie=>{if(ie.preventDefault(),!(ce||!X)){if(t){c(t.id,v,x,k,N,C,O,A,I).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,x,k,N,C,O,A,I,Q).then(Ve=>{m("Persona created","success"),g(Ox(Ve.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},_e=()=>{t&&d(t.id).then(()=>{m("Persona deleted","success"),p()},()=>{m("Failed to delete persona","error")})},ve=async(ie,Ve,qt,te)=>ie().then(()=>{Ve(),m(qt,"success")},()=>{m(te,"error")}),Le=(ie,Ve)=>{if(!t)return;const qt=ie==="type"?String(Ve):A,te=ie==="runtime"?String(Ve):ie==="type"?String(Ve)==="script"?"genaiscript":N==="genaiscript"?"claude-code":N:N,ht=ie==="model"?String(Ve):C,at=ie==="maxTurns"?Number(Ve):O,Kt=ie==="systemPrompt"?String(Ve):k,gt=ie==="script"?String(Ve):I;ve(()=>c(t.id,ie==="name"?String(Ve):v,ie==="description"?String(Ve):x,Kt,te,ht,at,qt,gt),()=>{if(ie==="type"){const ps=String(Ve)==="script"?"script":"agent";P(ps),T(te)}ie==="runtime"&&T(String(Ve)),ie==="name"&&b(String(Ve)),ie==="description"&&S(String(Ve)),ie==="systemPrompt"&&w(String(Ve)),ie==="model"&&D(String(Ve)),ie==="maxTurns"&&E(Number(Ve)),ie==="script"&&U(String(Ve))},"Persona updated","Failed to update persona").catch(()=>{})},Mt=ie=>{me(ie)},Tn=()=>{t&&u(t.id).then(()=>{m("Set as app default","success")},()=>{m("Failed to set app default","error")})};return i.jsxs(i.Fragment,{children:[ce?i.jsxs("div",{className:ls.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsx("p",{children:"Loading persona..."})]}):s?i.jsxs("form",{onSubmit:Mt,className:ls.form,children:[i.jsx("h3",{children:"Create Persona"}),i.jsxs("div",{className:ls.typeToggle,"data-testid":"persona-type-toggle",children:[i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:A==="agent",onChange:()=>J("agent")}),"Agent"]}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"script",checked:A==="script",onChange:()=>J("script")}),"Script"]})]}),i.jsxs("label",{children:["Name",i.jsx("input",{type:"text",value:v,onChange:ie=>b(ie.target.value),placeholder:A==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx("input",{type:"text",value:x,onChange:ie=>S(ie.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Runtime",i.jsx("select",{value:N,onChange:ie=>T(ie.target.value),"data-testid":"persona-runtime-select",children:(A==="script"?nx:tx).map(ie=>i.jsx("option",{value:ie.value,children:ie.label},ie.value))})]}),A==="agent"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model",i.jsx("input",{type:"text",value:C,onChange:ie=>D(ie.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx("input",{type:"number",value:O,onChange:ie=>E(parseInt(ie.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:k,onChange:ie=>w(ie.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),A==="script"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model ",i.jsx("span",{className:ls.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:C,onChange:ie=>D(ie.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:k,onChange:ie=>w(ie.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),i.jsxs("label",{children:["Script",i.jsx("textarea",{value:I,onChange:ie=>U(ie.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:ls.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),A==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(qb,{selectedTools:Q,onChange:$})]}),i.jsxs("div",{className:ls.formActions,children:[i.jsx(Js,{type:"submit",variant:"primary",size:"md",disabled:!ge,"data-testid":"persona-detail-save",children:"Create"}),i.jsx(Js,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:ls.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsxs("div",{className:ls.formActions,children:[i.jsx(Js,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),Ce&&i.jsx(Js,{type:"button",variant:"ghost",size:"md",onClick:Tn,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),pe&&i.jsx("span",{className:ls.defaultBadge,children:"App Default"}),i.jsx(Js,{type:"button",variant:"danger",size:"md",onClick:()=>ue(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:ls.editableSection,children:[i.jsxs("label",{children:["Name",i.jsx(ln,{value:v,onSave:ie=>{Le("name",ie)},validate:ie=>Ze(ie,"Name"),fieldId:"persona-name",activeFieldId:W,onActivate:oe,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx(ln,{value:x,onSave:ie=>{Le("description",ie)},fieldId:"persona-description",activeFieldId:W,onActivate:oe,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Type",i.jsx(ud,{value:A,onSave:ie=>{Le("type",ie)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:W,onActivate:oe,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),i.jsxs("label",{children:["Runtime",i.jsx(ud,{value:N,onSave:ie=>{Le("runtime",ie)},options:A==="script"?nx:tx,fieldId:"persona-runtime",activeFieldId:W,onActivate:oe,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),i.jsxs("label",{children:["Model",A==="script"?" (optional)":"",i.jsx(ln,{value:C,onSave:ie=>{Le("model",ie)},validate:A==="agent"?ie=>Ze(ie,"Model"):void 0,fieldId:"persona-model",activeFieldId:W,onActivate:oe,placeholder:A==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx(ln,{value:String(O),onSave:ie=>{Le("maxTurns",parseInt(ie,10)||0)},validate:ie=>/^\d+$/.test(ie.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:W,onActivate:oe,placeholder:SP,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx(Xp,{value:k,onSave:ie=>{Le("systemPrompt",ie)},validate:ie=>Ze(ie,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:W,onActivate:oe,placeholder:A==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),A==="script"&&i.jsxs("label",{children:["Script",i.jsx(Xp,{value:I,onSave:ie=>{Le("script",ie)},validate:ie=>Ze(ie,"Script"),fieldId:"persona-script",activeFieldId:W,onActivate:oe,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"})]}),A==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(qb,{selectedTools:Q,onChange:ie=>{$(ie),ve(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,ie),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Ce&&!pe&&i.jsx("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-tertiary)",marginTop:"var(--space-xs)"},children:"Only agent personas with a runtime and model can be set as app default."})]}):null,i.jsx(Ei,{isOpen:H,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:_e,onCancel:()=>ue(!1)})]})}function wP(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=I1();return i.jsx(HO,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function jP(){const[t,s]=y.useState(void 0);return y.useEffect(()=>{let o=!1;return(async()=>{try{const c=await Ne.getVersionStatus({});o||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{o=!0}},[]),t}function NP(){const{connected:t,environments:{environments:s},sessions:{sessions:o}}=mt(),r=jP();return i.jsxs(i.Fragment,{children:[r&&i.jsx(FI,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),i.jsx(VO,{connected:t,environments:s,sessions:o})]})}function CP(){return i.jsx(DL,{})}const ax=Ri();function EP(){const t=kt();return Qs({key:"?"},()=>{t(nN)}),Qs({key:"n"},()=>{t(ax)}),Qs({key:"N"},()=>{t(ax)}),i.jsx(i.Fragment,{})}function gl(t){const s=r7();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function AP(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=mt(),o=y.useMemo(()=>i.jsx(kI,{workspaces:t,tasks:s}),[t,s]);return gl(o),i.jsx(Va,{})}function DP(){const{environments:{environments:t}}=mt(),s=y.useMemo(()=>i.jsx(R5,{environments:t}),[t]);return gl(s),i.jsx(Va,{})}function RP(){const t=y.useMemo(()=>i.jsx(p8,{}),[]);return gl(t),i.jsx(Va,{})}function MP(){const{findings:{findings:t,loadFindings:s,loadAllFindings:o}}=mt(),{workspaceId:r,environmentId:c}=fs();y.useEffect(()=>{r?s(r).catch(()=>{}):o().catch(()=>{})},[r,s,o]);const d=y.useMemo(()=>i.jsx(V5,{findings:t,workspaceId:r,environmentId:c}),[t,r,c]);return gl(d),i.jsx(Va,{})}function IP(){const{knowledge:t,workspaces:{workspaces:s}}=mt(),o=y.useCallback(p=>{t.search(p).catch(()=>{})},[t]),r=y.useCallback(()=>{t.clearSearch()},[t]),c=y.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),d=y.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),u=y.useMemo(()=>i.jsx(G6,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:o,onClearSearch:r,onSelectNode:c,onWorkspaceChange:d}),[t,s,o,r,c,d]);return gl(u),i.jsx(Va,{})}const OP="_container_ce571_1",BP="_title_ce571_6",md={container:OP,title:BP};function LP(){return i.jsxs("div",{className:md.container,"aria-hidden":"true",children:[i.jsx("h1",{className:md.title,children:"Findings"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:Array.from({length:4},(t,s)=>i.jsx(dd,{lines:3},s))})]})}function ix(){const{environmentId:t,workspaceId:s}=fs(),{findings:{findings:o,findingsLoading:r,loadFindings:c},workspaces:{workspaces:d},environments:{environments:u}}=mt(),p=kt();y.useEffect(()=>{s&&c(s).catch(()=>{})},[s,c]);const m=y.useCallback(v=>{p(Mp(v,s,t))},[p,s,t]);if(r)return i.jsx(LP,{});const g=s&&t?P1("Findings",s,t,d,u).slice(0,-1):b7();return i.jsxs("div",{className:md.container,"data-testid":"findings-list-page",children:[i.jsx(Ns,{segments:g}),i.jsx("h1",{className:md.title,children:"Findings"}),i.jsx(w1,{findings:o,onFindingClick:m})]})}const zP="_container_1wwpb_1",$P="_notFound_1wwpb_6",UP="_header_1wwpb_12",PP="_categoryBadge_1wwpb_19",HP="_title_1wwpb_28",VP="_content_1wwpb_35",qP="_tags_1wwpb_77",GP="_tag_1wwpb_77",FP="_meta_1wwpb_92",ZP="_metaTimestamp_1wwpb_100",KP="_metaLink_1wwpb_105",mn={container:zP,notFound:$P,header:UP,categoryBadge:PP,title:HP,content:VP,tags:qP,tag:GP,meta:FP,metaTimestamp:ZP,metaLink:KP};function ox(){const{findingId:t,environmentId:s,workspaceId:o}=fs(),{findings:{selectedFinding:r,findingLoading:c,loadFinding:d},workspaces:{workspaces:u},environments:{environments:p}}=mt(),m=kt();if(y.useEffect(()=>{t&&d(t).catch(()=>{})},[t,d]),c)return i.jsx("div",{className:mn.container,"data-testid":"finding-detail-page",children:i.jsx("div",{className:mn.notFound,children:"Loading..."})});if(!r)return i.jsx("div",{className:mn.container,"data-testid":"finding-detail-page",children:i.jsx("div",{className:mn.notFound,children:"Finding not found."})});const g=P1(r.title,o,s,u,p),v=fd(r.category);return i.jsxs("div",{className:mn.container,"data-testid":"finding-detail-page",children:[i.jsx(Ns,{segments:g}),i.jsxs("div",{className:mn.header,children:[i.jsx("span",{className:mn.categoryBadge,style:{background:v.bg,color:v.text},children:r.category}),i.jsx("h1",{className:mn.title,children:r.title})]}),r.content&&i.jsx("div",{className:mn.content,children:i.jsx(hd,{remarkPlugins:[gd],children:r.content})}),r.tags.length>0&&i.jsx("div",{className:mn.tags,children:r.tags.map(b=>i.jsx("span",{className:mn.tag,children:b},b))}),i.jsxs("div",{className:mn.meta,children:[i.jsx("span",{className:mn.metaTimestamp,title:r.createdAt,children:Qm(r.createdAt)}),r.taskId&&i.jsx("button",{type:"button",className:mn.metaLink,onClick:()=>{m(On(r.taskId))},children:"View Task"}),r.sessionId&&i.jsx("button",{type:"button",className:mn.metaLink,onClick:()=>{m(hm(r.sessionId))},children:"View Session"})]})]})}const YP="_wizard_1260s_1",JP="_container_1260s_10",WP="_stepContent_1260s_19",XP="_logoArea_1260s_28",QP="_logoImage_1260s_32",e9="_heading_1260s_41",t9="_tagline_1260s_49",n9="_subtitle_1260s_56",s9="_featureList_1260s_64",a9="_runtimeGrid_1260s_89",i9="_runtimeCard_1260s_101",o9="_runtimeName_1260s_133",r9="_runtimeDescription_1260s_139",l9="_buttonRow_1260s_144",c9="_primaryButton_1260s_151",d9="_ghostButton_1260s_185",u9="_dots_1260s_213",f9="_dot_1260s_213",Fe={wizard:YP,container:JP,stepContent:WP,logoArea:XP,logoImage:QP,heading:e9,tagline:t9,subtitle:n9,featureList:s9,runtimeGrid:a9,runtimeCard:i9,runtimeName:o9,runtimeDescription:r9,buttonRow:l9,primaryButton:c9,ghostButton:d9,dots:u9,dot:f9};function p9({onNext:t}){return i.jsxs("div",{className:Fe.stepContent,"data-testid":"setup-welcome",children:[i.jsx("div",{className:Fe.logoArea,children:i.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Fe.logoImage})}),i.jsx("h1",{className:Fe.heading,children:"Welcome to Grackle"}),i.jsx("p",{className:Fe.tagline,children:"Multi-agent orchestration for software teams"}),i.jsx("button",{type:"button",className:Fe.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function m9({onNext:t,onBack:s}){return i.jsxs("div",{className:Fe.stepContent,"data-testid":"setup-about",children:[i.jsx("h2",{className:Fe.heading,children:"What is Grackle?"}),i.jsxs("ul",{className:Fe.featureList,children:[i.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),i.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),i.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),i.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),i.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),i.jsxs("div",{className:Fe.buttonRow,children:[i.jsx("button",{type:"button",className:Fe.ghostButton,onClick:s,children:"Back"}),i.jsx("button",{type:"button",className:Fe.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const h9=[{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 g9({currentRuntime:t,onFinish:s,onBack:o,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),i.jsxs("div",{className:Fe.stepContent,"data-testid":"setup-runtime",children:[i.jsx("h2",{className:Fe.heading,children:"Choose Your Runtime"}),i.jsx("p",{className:Fe.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),i.jsx("div",{className:Fe.runtimeGrid,children:h9.map(u=>i.jsxs("button",{type:"button",className:Fe.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[i.jsx("span",{className:Fe.runtimeName,children:u.name}),i.jsx("span",{className:Fe.runtimeDescription,children:u.description})]},u.id))}),i.jsxs("div",{className:Fe.buttonRow,children:[i.jsx("button",{type:"button",className:Fe.ghostButton,onClick:o,children:"Back"}),i.jsx("button",{type:"button",className:Fe.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function v9(){return typeof Notification<"u"}function y9({onFinish:t,onBack:s,finishDisabled:o}){const r=v9(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return i.jsxs("div",{className:Fe.stepContent,"data-testid":"setup-notifications",children:[i.jsx("h2",{className:Fe.heading,children:"Stay in the Loop"}),i.jsx("p",{className:Fe.subtitle,children:"Grackle can send you a browser notification when an agent needs your input, so you never miss an important moment."}),c?i.jsx("p",{className:Fe.subtitle,children:Notification.permission==="granted"?"Notifications are already enabled.":"Notifications have been blocked. You can change this in your browser settings."}):null,i.jsxs("div",{className:Fe.buttonRow,children:[i.jsx("button",{type:"button",className:Fe.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:Fe.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),i.jsx("button",{type:"button",className:Fe.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):i.jsx("button",{type:"button",className:Fe.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const b9=4,rx={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function x9(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=mt(),{showToast:c}=Sn(),d=kt(),[u,p]=y.useState(0),[m,g]=y.useState("claude-code"),[v,b]=y.useState(!1),x=t.find(w=>w.id==="claude-code"),S=y.useCallback(w=>{g(w),p(3)},[]),k=y.useCallback(()=>{const w=m;b(!0);const N=[];if(x&&w!==x.runtime){const C=rx[w]??"sonnet";N.push(s(x.id,void 0,void 0,void 0,w,C))}const T=t.find(C=>C.id===W0);if(T&&w!==T.runtime){const C=rx[w]??"sonnet";N.push(s(W0,void 0,void 0,void 0,w,C))}Promise.all(N).then(()=>o()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),b(!1)})},[m,x,t,s,o,d,c]);return r===!0?i.jsx(ds,{to:"/",replace:!0}):i.jsx("div",{className:Fe.wizard,"data-testid":"setup-wizard",children:i.jsxs("div",{className:Fe.container,children:[i.jsx(us,{mode:"wait",children:i.jsxs(Rt.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&i.jsx(p9,{onNext:()=>p(1)}),u===1&&i.jsx(m9,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&i.jsx(g9,{currentRuntime:m,onFinish:S,onBack:()=>p(1),finishDisabled:!x}),u===3&&i.jsx(y9,{onFinish:k,onBack:()=>p(2),finishDisabled:v})]},u)}),i.jsx("div",{className:Fe.dots,children:Array.from({length:b9},(w,N)=>i.jsx("span",{className:Fe.dot,"data-active":N===u},N))})]})})}const _9="_root_zndgp_1",k9="_body_zndgp_7",S9="_main_zndgp_19",T9="_sidebarWrapper_zndgp_26",w9="_overlay_zndgp_51",Zr={root:_9,body:k9,main:S9,sidebarWrapper:T9,overlay:w9},j9=y.lazy(()=>DT(()=>import("./KnowledgePage-CmClxdks.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),V1=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function N9(){const{connected:t,environments:{environments:s},sessions:{sessions:o},tasks:{tasks:r}}=mt(),{toasts:c,dismissToast:d}=Sn(),u=Zt(),p=o7(),m=p!==void 0,[g,v]=y.useState(!1),b=y.useCallback(()=>v(x=>!x),[]);return y.useEffect(()=>{v(!1)},[u.pathname]),y.useEffect(()=>{if(!g)return;const x=S=>{S.key==="Escape"&&v(!1)};return document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x)}},[g]),i.jsxs(i.Fragment,{children:[i.jsx(t5,{connected:t,environments:s,sessions:o,onToggleSidebar:m?b:void 0,sidebarOpen:g}),i.jsx(l5,{}),i.jsxs("div",{className:Zr.body,children:[m&&i.jsx("div",{className:Zr.sidebarWrapper,"data-sidebar-open":g,children:i.jsx(m5,{content:p})}),m&&g&&i.jsx("div",{className:Zr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),i.jsxs("div",{className:Zr.main,children:[i.jsx(Va,{}),i.jsx(k5,{sessions:o,tasks:r,environments:s})]})]}),i.jsx(OI,{toasts:c,onDismiss:d}),i.jsx(EP,{})]})}function C9(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connected:d,onboardingCompleted:u}=mt(),{showToast:p}=Sn();iz(s,p),dz(c,p),oz(o,r,p);const m=kt(),g=Zt();return y.useEffect(()=>{t&&!g.pathname.includes("/tasks/")&&m(hm(t),{replace:!0})},[t,m,g.pathname]),d&&u===!1?i.jsx(ds,{to:"/setup",replace:!0}):i.jsx(i7,{children:i.jsxs("div",{className:Zr.root,children:[V1&&i.jsx(RN,{}),i.jsx(N9,{})]})})}function Cp(){const{workspaceId:t}=fs(),{workspaces:{workspaces:s}}=mt(),o=Zt(),r=s.find(m=>m.id===t);if(!(r!=null&&r.environmentId))return s.length===0?void 0:i.jsx(ds,{to:"/environments",replace:!0});const c=encodeURIComponent(t),d=`/workspaces/${c}`,u=o.pathname.startsWith(d)?o.pathname.slice(d.length):"",p=`/environments/${encodeURIComponent(r.environmentId)}/workspaces/${c}${u}${o.search}${o.hash}`;return i.jsx(ds,{to:p,replace:!0})}function E9(){return i.jsxs(vj,{children:[i.jsx(Ae,{path:"setup",element:i.jsx(x9,{})}),i.jsxs(Ae,{element:i.jsx(C9,{}),children:[i.jsx(Ae,{index:!0,element:i.jsx(J$,{})}),i.jsx(Ae,{path:"chat",element:i.jsx(oU,{})}),i.jsx(Ae,{path:"sessions/new",element:i.jsx(rU,{})}),i.jsx(Ae,{path:"sessions/:sessionId",element:i.jsx(uU,{})}),i.jsx(Ae,{element:i.jsx(IP,{}),children:i.jsx(Ae,{path:"knowledge",element:i.jsx(y.Suspense,{fallback:i.jsx(h1,{}),children:i.jsx(j9,{})})})}),i.jsxs(Ae,{element:i.jsx(AP,{}),children:[i.jsx(Ae,{path:"tasks",element:i.jsx(K$,{})}),i.jsx(Ae,{path:"tasks/new",element:i.jsx(ex,{})}),i.jsx(Ae,{path:"tasks/:taskId",element:i.jsx(Ia,{})}),i.jsx(Ae,{path:"tasks/:taskId/edit",element:i.jsx(Ia,{})}),i.jsx(Ae,{path:"tasks/:taskId/stream",element:i.jsx(Ia,{})}),i.jsx(Ae,{path:"tasks/:taskId/findings",element:i.jsx(Ia,{})})]}),i.jsxs(Ae,{element:i.jsx(MP,{}),children:[i.jsx(Ae,{path:"findings",element:i.jsx(ix,{})}),i.jsx(Ae,{path:"findings/:findingId",element:i.jsx(ox,{})}),i.jsx(Ae,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:i.jsx(ix,{})}),i.jsx(Ae,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:i.jsx(ox,{})})]}),i.jsxs(Ae,{element:i.jsx(DP,{}),children:[i.jsx(Ae,{path:"workspaces",element:i.jsx(ds,{to:"/environments",replace:!0})}),i.jsx(Ae,{path:"workspaces/new",element:i.jsx(jU,{})}),i.jsx(Ae,{path:"workspaces/:workspaceId",element:i.jsx(Cp,{})}),i.jsx(Ae,{path:"workspaces/:workspaceId/tasks/:taskId",element:i.jsx(Cp,{})}),i.jsx(Ae,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:i.jsx(Cp,{})}),i.jsx(Ae,{path:"environments/:environmentId/workspaces/:workspaceId",element:i.jsx(hU,{})}),i.jsx(Ae,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:i.jsx(ex,{})}),i.jsx(Ae,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:i.jsx(Ia,{})}),i.jsx(Ae,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:i.jsx(Ia,{})}),i.jsx(Ae,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:i.jsx(Ia,{})}),i.jsx(Ae,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:i.jsx(Ia,{})}),i.jsxs(Ae,{path:"environments",element:i.jsx(MU,{}),children:[i.jsx(Ae,{index:!0,element:i.jsx(Y$,{})}),i.jsx(Ae,{path:"new",element:i.jsx(CU,{})}),i.jsx(Ae,{path:":environmentId",element:i.jsx(cP,{})}),i.jsx(Ae,{path:":environmentId/edit",element:i.jsx(EU,{})})]})]}),i.jsx(Ae,{element:i.jsx(RP,{}),children:i.jsxs(Ae,{path:"settings",element:i.jsx(fP,{}),children:[i.jsx(Ae,{index:!0,element:i.jsx(ds,{to:"credentials",replace:!0})}),i.jsx(Ae,{path:"environments",element:i.jsx(ds,{to:"/environments",replace:!0})}),i.jsx(Ae,{path:"credentials",element:i.jsx(pP,{})}),i.jsx(Ae,{path:"tokens",element:i.jsx(ds,{to:"../credentials",replace:!0})}),i.jsx(Ae,{path:"personas",element:i.jsx(mP,{})}),i.jsx(Ae,{path:"personas/new",element:i.jsx(sx,{})}),i.jsx(Ae,{path:"personas/:personaId",element:i.jsx(sx,{})}),i.jsx(Ae,{path:"appearance",element:i.jsx(wP,{})}),i.jsx(Ae,{path:"shortcuts",element:i.jsx(CP,{})}),i.jsx(Ae,{path:"about",element:i.jsx(NP,{})})]})}),i.jsx(Ae,{path:"*",element:i.jsx(ds,{to:"/",replace:!0})})]})]})}const A9=1e4;function D9(){const{onboardingCompleted:t}=mt(),[s,o]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),A9);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return i.jsx(us,{mode:"wait",children:r?i.jsx(Rt.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:i.jsx(h1,{})},"splash"):i.jsx(Rt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:i.jsx(Hj,{basename:"/".replace(/\/$/,""),children:i.jsx(E9,{})})},"app")})}function R9(){const t=V1?I7:az;return i.jsx(a7,{children:i.jsx(e7,{children:i.jsx(t,{children:i.jsx(D9,{})})})})}CT.createRoot(document.getElementById("root")).render(i.jsx(y.StrictMode,{children:i.jsx(R9,{})}));export{Ns as B,Lx as K,mt as a,Mp as f,hm as s,On as t,kt as u};
|