@grackle-ai/web 0.115.2 → 0.116.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,755 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/McpAppWidget-DbYqtOnr.js","assets/dagview-tHPW3Rz3.js","assets/KnowledgePage-CBvUnREp.js","assets/grpc-DECHMJK_.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
+ import{r as v2,a as y2,b as y,j as i,d as Q0,H as ey,P as ty,i as b2,B as _2,c as x2,C as k2,M as S2,e as j2}from"./dagview-tHPW3Rz3.js";import{c as T2,a as pd,G as w2,b as N2,d as C2,e as E2,f as A2,M as D2,D as h_,A as g_,W as M2,O as R2,g as I2,C as ra,h as v_,i as y_,w as O2,t as B2,p as wc,j as L2,R as Nc,S as ny}from"./grpc-DECHMJK_.js";import{v as z2,r as $2,t as Cc,i as H2,f as P2,M as cm,a as dm}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 Hf={exports:{}},Mr={},Pf={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 sy;function U2(){return sy||(sy=1,(function(t){function s(H,B){var F=H.length;H.push(B);e:for(;0<F;){var ge=F-1>>>1,ne=H[ge];if(0<c(ne,B))H[ge]=B,H[F]=ne,F=ge;else break e}}function o(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var B=H[0],F=H.pop();if(F!==B){H[0]=F;e:for(var ge=0,ne=H.length,ce=ne>>>1;ge<ce;){var me=2*(ge+1)-1,ke=H[me],De=me+1,ot=H[De];if(0>c(ke,F))De<ne&&0>c(ot,ke)?(H[ge]=ot,H[De]=F,ge=De):(H[ge]=ke,H[me]=F,ge=me);else if(De<ne&&0>c(ot,F))H[ge]=ot,H[De]=F,ge=De;else break e}}return B}function c(H,B){var F=H.sortIndex-B.sortIndex;return F!==0?F:H.id-B.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,p=u.now();t.unstable_now=function(){return u.now()-p}}var m=[],g=[],v=1,b=null,_=3,k=!1,S=!1,j=!1,T=!1,w=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function R(H){for(var B=o(g);B!==null;){if(B.callback===null)r(g);else if(B.startTime<=H)r(g),B.sortIndex=B.expirationTime,s(m,B);else break;B=o(g)}}function E(H){if(j=!1,R(H),!S)if(o(m)!==null)S=!0,M||(M=!0,ee());else{var B=o(g);B!==null&&ae(E,B.startTime-H)}}var M=!1,O=-1,A=5,$=-1;function Y(){return T?!0:!(t.unstable_now()-$<A)}function V(){if(T=!1,M){var H=t.unstable_now();$=H;var B=!0;try{e:{S=!1,j&&(j=!1,C(O),O=-1),k=!0;var F=_;try{t:{for(R(H),b=o(m);b!==null&&!(b.expirationTime>H&&Y());){var ge=b.callback;if(typeof ge=="function"){b.callback=null,_=b.priorityLevel;var ne=ge(b.expirationTime<=H);if(H=t.unstable_now(),typeof ne=="function"){b.callback=ne,R(H),B=!0;break t}b===o(m)&&r(m),R(H)}else r(m);b=o(m)}if(b!==null)B=!0;else{var ce=o(g);ce!==null&&ae(E,ce.startTime-H),B=!1}}break e}finally{b=null,_=F,k=!1}B=void 0}}finally{B?ee():M=!1}}}var ee;if(typeof D=="function")ee=function(){D(V)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,Z=le.port2;le.port1.onmessage=V,ee=function(){Z.postMessage(null)}}else ee=function(){w(V,0)};function ae(H,B){O=w(function(){H(t.unstable_now())},B)}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(H){H.callback=null},t.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<H?Math.floor(1e3/H):5},t.unstable_getCurrentPriorityLevel=function(){return _},t.unstable_next=function(H){switch(_){case 1:case 2:case 3:var B=3;break;default:B=_}var F=_;_=B;try{return H()}finally{_=F}},t.unstable_requestPaint=function(){T=!0},t.unstable_runWithPriority=function(H,B){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var F=_;_=H;try{return B()}finally{_=F}},t.unstable_scheduleCallback=function(H,B,F){var ge=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?ge+F:ge):F=ge,H){case 1:var ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=F+ne,H={id:v++,callback:B,priorityLevel:H,startTime:F,expirationTime:ne,sortIndex:-1},F>ge?(H.sortIndex=F,s(g,H),o(m)===null&&H===o(g)&&(j?(C(O),O=-1):j=!0,ae(E,F-ge))):(H.sortIndex=ne,s(m,H),S||k||(S=!0,M||(M=!0,ee()))),H},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(H){var B=_;return function(){var F=_;_=B;try{return H.apply(this,arguments)}finally{_=F}}}})(Uf)),Uf}var ay;function V2(){return ay||(ay=1,Pf.exports=U2()),Pf.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 iy;function q2(){if(iy)return Mr;iy=1;var t=V2(),s=v2(),o=y2();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(d(e)!==e)throw Error(r(188))}function g(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(r(188));return n!==e?null:e}for(var a=e,l=n;;){var f=a.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===a)return m(f),e;if(h===l)return m(f),n;h=h.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=h;else{for(var x=!1,N=f.child;N;){if(N===a){x=!0,a=f,l=h;break}if(N===l){x=!0,l=f,a=h;break}N=N.sibling}if(!x){for(N=h.child;N;){if(N===a){x=!0,a=h,l=f;break}if(N===l){x=!0,l=h,a=f;break}N=N.sibling}if(!x)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),D=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function ee(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var le=Symbol.for("react.client.reference");function Z(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case w:return"Profiler";case T:return"StrictMode";case E:return"Suspense";case M:return"SuspenseList";case $:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case D:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case R:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return n=e.displayName||null,n!==null?n:Z(e.type)||"Memo";case A:n=e._payload,e=e._init;try{return Z(e(n))}catch{}}return null}var ae=Array.isArray,H=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},ge=[],ne=-1;function ce(e){return{current:e}}function me(e){0>ne||(e.current=ge[ne],ge[ne]=null,ne--)}function ke(e,n){ne++,ge[ne]=e.current,e.current=n}var De=ce(null),ot=ce(null),yt=ce(null),_e=ce(null);function Oe(e,n){switch(ke(yt,n),ke(ot,e),ke(De,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?k0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=k0(n),e=S0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}me(De),ke(De,e)}function Ht(){me(De),me(ot),me(yt)}function Nt(e){e.memoizedState!==null&&ke(_e,e);var n=De.current,a=S0(n,e.type);n!==a&&(ke(ot,e),ke(De,a))}function ue(e){ot.current===e&&(me(De),me(ot)),_e.current===e&&(me(_e),Cr._currentValue=F)}var Re,Q;function et(e){if(Re===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Re=n&&n[1]||"",Q=-1<a.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+Re+e+Q}var re=!1;function ve(e,n){if(!e||re)return"";re=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(J){var K=J}Reflect.construct(e,[],ie)}else{try{ie.call()}catch(J){K=J}e.call(ie.prototype)}}else{try{throw Error()}catch(J){K=J}(ie=e())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(J){if(J&&K&&typeof J.stack=="string")return[J.stack,K.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),x=h[0],N=h[1];if(x&&N){var I=x.split(`
21
+ `),G=N.split(`
22
+ `);for(f=l=0;l<I.length&&!I[l].includes("DetermineComponentFrameRoot");)l++;for(;f<G.length&&!G[f].includes("DetermineComponentFrameRoot");)f++;if(l===I.length||f===G.length)for(l=I.length-1,f=G.length-1;1<=l&&0<=f&&I[l]!==G[f];)f--;for(;1<=l&&0<=f;l--,f--)if(I[l]!==G[f]){if(l!==1||f!==1)do if(l--,f--,0>f||I[l]!==G[f]){var X=`
23
+ `+I[l].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=l&&0<=f);break}}}finally{re=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?et(a):""}function Xe(e,n){switch(e.tag){case 26:case 27:case 5:return et(e.type);case 16:return et("Lazy");case 13:return e.child!==n&&n!==null?et("Suspense Fallback"):et("Suspense");case 19:return et("SuspenseList");case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return et("Activity");default:return""}}function an(e){try{var n="",a=null;do n+=Xe(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
24
+ Error generating stack: `+l.message+`
25
+ `+l.stack}}var _s=Object.prototype.hasOwnProperty,ls=t.unstable_scheduleCallback,Os=t.unstable_cancelCallback,pa=t.unstable_shouldYield,Mi=t.unstable_requestPaint,Wt=t.unstable_now,Ja=t.unstable_getCurrentPriorityLevel,Wa=t.unstable_ImmediatePriority,ma=t.unstable_UserBlockingPriority,Bs=t.unstable_NormalPriority,xs=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,Ue=t.log,_n=t.unstable_setDisableYieldValue,mn=null,Pt=null;function Cn(e){if(typeof Ue=="function"&&_n(e),Pt&&typeof Pt.setStrictMode=="function")try{Pt.setStrictMode(mn,e)}catch{}}var Xt=Math.clz32?Math.clz32:pl,Ri=Math.log,Ii=Math.LN2;function pl(e){return e>>>=0,e===0?32:31-(Ri(e)/Ii|0)|0}var Oi=256,U=262144,se=4194304;function de(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 pe(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var N=l&134217727;return N!==0?(l=N&~h,l!==0?f=de(l):(x&=N,x!==0?f=de(x):a||(a=N&~e,a!==0&&(f=de(a))))):(N=l&~h,N!==0?f=de(N):x!==0?f=de(x):a||(a=l&~e,a!==0&&(f=de(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 ye(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Qe(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 je(){var e=se;return se<<=1,(se&62914560)===0&&(se=4194304),e}function Be(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Ge(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ht(e,n,a,l,f,h){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var N=e.entanglements,I=e.expirationTimes,G=e.hiddenUpdates;for(a=x&~a;0<a;){var X=31-Xt(a),ie=1<<X;N[X]=0,I[X]=-1;var K=G[X];if(K!==null)for(G[X]=null,X=0;X<K.length;X++){var J=K[X];J!==null&&(J.lane&=-536870913)}a&=~ie}l!==0&&tt(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function tt(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Xt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Qt(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-Xt(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function on(e,n){var a=n&-n;return a=(a&42)!==0?1:Et(a),(a&(e.suspendedLanes|n))!==0?0:a}function Et(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 ks(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ss(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:F0(e.type))}function Bi(e,n){var a=B.p;try{return B.p=e,n()}finally{B.p=a}}var ha=Math.random().toString(36).slice(2),rn="__reactFiber$"+ha,xn="__reactProps$"+ha,Li="__reactContainer$"+ha,Ad="__reactEvents$"+ha,ok="__reactListeners$"+ha,rk="__reactHandles$"+ha,ch="__reactResources$"+ha,Vo="__reactMarker$"+ha;function Dd(e){delete e[rn],delete e[xn],delete e[Ad],delete e[ok],delete e[rk]}function zi(e){var n=e[rn];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Li]||a[rn]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=A0(e);e!==null;){if(a=e[rn])return a;e=A0(e)}return n}e=a,a=e.parentNode}return null}function $i(e){if(e=e[rn]||e[Li]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function qo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function Hi(e){var n=e[ch];return n||(n=e[ch]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function en(e){e[Vo]=!0}var dh=new Set,uh={};function Xa(e,n){Pi(e,n),Pi(e+"Capture",n)}function Pi(e,n){for(uh[e]=n,e=0;e<n.length;e++)dh.add(n[e])}var lk=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fh={},ph={};function ck(e){return _s.call(ph,e)?!0:_s.call(fh,e)?!1:lk.test(e)?ph[e]=!0:(fh[e]=!0,!1)}function ml(e,n,a){if(ck(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function hl(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 Ls(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 Un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mh(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function dk(e,n,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(x){a=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Md(e){if(!e._valueTracker){var n=mh(e)?"checked":"value";e._valueTracker=dk(e,n,""+e[n])}}function hh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=mh(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function gl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var uk=/[\n"\\]/g;function Vn(e){return e.replace(uk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Rd(e,n,a,l,f,h,x,N){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Un(n)):e.value!==""+Un(n)&&(e.value=""+Un(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Id(e,x,Un(n)):a!=null?Id(e,x,Un(a)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Un(N):e.removeAttribute("name")}function gh(e,n,a,l,f,h,x,N){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)){Md(e);return}a=a!=null?""+Un(a):"",n=n!=null?""+Un(n):a,N||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=N?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),Md(e)}function Id(e,n,a){n==="number"&&gl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ui(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=""+Un(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 vh(e,n,a){if(n!=null&&(n=""+Un(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Un(a):""}function yh(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(r(92));if(ae(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=Un(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Md(e)}function Vi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var fk=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function bh(e,n,a){var l=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,a):typeof a!="number"||a===0||fk.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function _h(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&&bh(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&bh(e,h,n[h])}function Od(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pk=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),mk=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function vl(e){return mk.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function zs(){}var Bd=null;function Ld(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qi=null,Gi=null;function xh(e){var n=$i(e);if(n&&(e=n.stateNode)){var a=e[xn]||null;e:switch(e=n.stateNode,n.type){case"input":if(Rd(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="'+Vn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[xn]||null;if(!f)throw Error(r(90));Rd(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&&hh(l)}break e;case"textarea":vh(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Ui(e,!!a.multiple,n,!1)}}}var zd=!1;function kh(e,n,a){if(zd)return e(n,a);zd=!0;try{var l=e(n);return l}finally{if(zd=!1,(qi!==null||Gi!==null)&&(ac(),qi&&(n=qi,e=Gi,Gi=qi=null,xh(n),e)))for(n=0;n<e.length;n++)xh(e[n])}}function Go(e,n){var a=e.stateNode;if(a===null)return null;var l=a[xn]||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 $s=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$d=!1;if($s)try{var Fo={};Object.defineProperty(Fo,"passive",{get:function(){$d=!0}}),window.addEventListener("test",Fo,Fo),window.removeEventListener("test",Fo,Fo)}catch{$d=!1}var ga=null,Hd=null,yl=null;function Sh(){if(yl)return yl;var e,n=Hd,a=n.length,l,f="value"in ga?ga.value:ga.textContent,h=f.length;for(e=0;e<a&&n[e]===f[e];e++);var x=a-e;for(l=1;l<=x&&n[a-l]===f[h-l];l++);return yl=f.slice(e,1<l?1-l:void 0)}function bl(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 _l(){return!0}function jh(){return!1}function kn(e){function n(a,l,f,h,x){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(a=e[N],this[N]=a?a(h):h[N]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?_l:jh,this.isPropagationStopped=jh,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=_l)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=_l)},persist:function(){},isPersistent:_l}),n}var Qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xl=kn(Qa),Ko=b({},Qa,{view:0,detail:0}),hk=kn(Ko),Pd,Ud,Zo,kl=b({},Ko,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qd,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!==Zo&&(Zo&&e.type==="mousemove"?(Pd=e.screenX-Zo.screenX,Ud=e.screenY-Zo.screenY):Ud=Pd=0,Zo=e),Pd)},movementY:function(e){return"movementY"in e?e.movementY:Ud}}),Th=kn(kl),gk=b({},kl,{dataTransfer:0}),vk=kn(gk),yk=b({},Ko,{relatedTarget:0}),Vd=kn(yk),bk=b({},Qa,{animationName:0,elapsedTime:0,pseudoElement:0}),_k=kn(bk),xk=b({},Qa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kk=kn(xk),Sk=b({},Qa,{data:0}),wh=kn(Sk),jk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Tk={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},wk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nk(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=wk[e])?!!n[e]:!1}function qd(){return Nk}var Ck=b({},Ko,{key:function(e){if(e.key){var n=jk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=bl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Tk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qd,charCode:function(e){return e.type==="keypress"?bl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?bl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ek=kn(Ck),Ak=b({},kl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nh=kn(Ak),Dk=b({},Ko,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qd}),Mk=kn(Dk),Rk=b({},Qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ik=kn(Rk),Ok=b({},kl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Bk=kn(Ok),Lk=b({},Qa,{newState:0,oldState:0}),zk=kn(Lk),$k=[9,13,27,32],Gd=$s&&"CompositionEvent"in window,Yo=null;$s&&"documentMode"in document&&(Yo=document.documentMode);var Hk=$s&&"TextEvent"in window&&!Yo,Ch=$s&&(!Gd||Yo&&8<Yo&&11>=Yo),Eh=" ",Ah=!1;function Dh(e,n){switch(e){case"keyup":return $k.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Fi=!1;function Pk(e,n){switch(e){case"compositionend":return Mh(n);case"keypress":return n.which!==32?null:(Ah=!0,Eh);case"textInput":return e=n.data,e===Eh&&Ah?null:e;default:return null}}function Uk(e,n){if(Fi)return e==="compositionend"||!Gd&&Dh(e,n)?(e=Sh(),yl=Hd=ga=null,Fi=!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 Ch&&n.locale!=="ko"?null:n.data;default:return null}}var Vk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Rh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Vk[e.type]:n==="textarea"}function Ih(e,n,a,l){qi?Gi?Gi.push(l):Gi=[l]:qi=l,n=uc(n,"onChange"),0<n.length&&(a=new xl("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Jo=null,Wo=null;function qk(e){g0(e,0)}function Sl(e){var n=qo(e);if(hh(n))return e}function Oh(e,n){if(e==="change")return n}var Bh=!1;if($s){var Fd;if($s){var Kd="oninput"in document;if(!Kd){var Lh=document.createElement("div");Lh.setAttribute("oninput","return;"),Kd=typeof Lh.oninput=="function"}Fd=Kd}else Fd=!1;Bh=Fd&&(!document.documentMode||9<document.documentMode)}function zh(){Jo&&(Jo.detachEvent("onpropertychange",$h),Wo=Jo=null)}function $h(e){if(e.propertyName==="value"&&Sl(Wo)){var n=[];Ih(n,Wo,e,Ld(e)),kh(qk,n)}}function Gk(e,n,a){e==="focusin"?(zh(),Jo=n,Wo=a,Jo.attachEvent("onpropertychange",$h)):e==="focusout"&&zh()}function Fk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Sl(Wo)}function Kk(e,n){if(e==="click")return Sl(n)}function Zk(e,n){if(e==="input"||e==="change")return Sl(n)}function Yk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var En=typeof Object.is=="function"?Object.is:Yk;function Xo(e,n){if(En(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(!_s.call(n,f)||!En(e[f],n[f]))return!1}return!0}function Hh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ph(e,n){var a=Hh(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=Hh(a)}}function Uh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Uh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Vh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=gl(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=gl(e.document)}return n}function Zd(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Jk=$s&&"documentMode"in document&&11>=document.documentMode,Ki=null,Yd=null,Qo=null,Jd=!1;function qh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Jd||Ki==null||Ki!==gl(l)||(l=Ki,"selectionStart"in l&&Zd(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}),Qo&&Xo(Qo,l)||(Qo=l,l=uc(Yd,"onSelect"),0<l.length&&(n=new xl("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Ki)))}function ei(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Zi={animationend:ei("Animation","AnimationEnd"),animationiteration:ei("Animation","AnimationIteration"),animationstart:ei("Animation","AnimationStart"),transitionrun:ei("Transition","TransitionRun"),transitionstart:ei("Transition","TransitionStart"),transitioncancel:ei("Transition","TransitionCancel"),transitionend:ei("Transition","TransitionEnd")},Wd={},Gh={};$s&&(Gh=document.createElement("div").style,"AnimationEvent"in window||(delete Zi.animationend.animation,delete Zi.animationiteration.animation,delete Zi.animationstart.animation),"TransitionEvent"in window||delete Zi.transitionend.transition);function ti(e){if(Wd[e])return Wd[e];if(!Zi[e])return e;var n=Zi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Gh)return Wd[e]=n[a];return e}var Fh=ti("animationend"),Kh=ti("animationiteration"),Zh=ti("animationstart"),Wk=ti("transitionrun"),Xk=ti("transitionstart"),Qk=ti("transitioncancel"),Yh=ti("transitionend"),Jh=new Map,Xd="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(" ");Xd.push("scrollEnd");function cs(e,n){Jh.set(e,n),Xa(n,[e])}var jl=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)},qn=[],Yi=0,Qd=0;function Tl(){for(var e=Yi,n=Qd=Yi=0;n<e;){var a=qn[n];qn[n++]=null;var l=qn[n];qn[n++]=null;var f=qn[n];qn[n++]=null;var h=qn[n];if(qn[n++]=null,l!==null&&f!==null){var x=l.pending;x===null?f.next=f:(f.next=x.next,x.next=f),l.pending=f}h!==0&&Wh(a,f,h)}}function wl(e,n,a,l){qn[Yi++]=e,qn[Yi++]=n,qn[Yi++]=a,qn[Yi++]=l,Qd|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function eu(e,n,a,l){return wl(e,n,a,l),Nl(e)}function ni(e,n){return wl(e,null,null,n),Nl(e)}function Wh(e,n,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,h=e.return;h!==null;)h.childLanes|=a,l=h.alternate,l!==null&&(l.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-Xt(a),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),h):null}function Nl(e){if(50<xr)throw xr=0,df=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ji={};function eS(e,n,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function An(e,n,a,l){return new eS(e,n,a,l)}function tu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hs(e,n){var a=e.alternate;return a===null?(a=An(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 Xh(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 Cl(e,n,a,l,f,h){var x=0;if(l=e,typeof e=="function")tu(e)&&(x=1);else if(typeof e=="string")x=i2(e,a,De.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=An(31,a,n,f),e.elementType=$,e.lanes=h,e;case j:return si(a.children,f,h,n);case T:x=8,f|=24;break;case w:return e=An(12,a,n,f|2),e.elementType=w,e.lanes=h,e;case E:return e=An(13,a,n,f),e.elementType=E,e.lanes=h,e;case M:return e=An(19,a,n,f),e.elementType=M,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:x=10;break e;case C:x=9;break e;case R:x=11;break e;case O:x=14;break e;case A:x=16,l=null;break e}x=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=An(x,a,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function si(e,n,a,l){return e=An(7,e,l,n),e.lanes=a,e}function nu(e,n,a){return e=An(6,e,null,n),e.lanes=a,e}function Qh(e){var n=An(18,null,null,0);return n.stateNode=e,n}function su(e,n,a){return n=An(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var eg=new WeakMap;function Gn(e,n){if(typeof e=="object"&&e!==null){var a=eg.get(e);return a!==void 0?a:(n={value:e,source:n,stack:an(n)},eg.set(e,n),n)}return{value:e,source:n,stack:an(n)}}var Wi=[],Xi=0,El=null,er=0,Fn=[],Kn=0,va=null,js=1,Ts="";function Ps(e,n){Wi[Xi++]=er,Wi[Xi++]=El,El=e,er=n}function tg(e,n,a){Fn[Kn++]=js,Fn[Kn++]=Ts,Fn[Kn++]=va,va=e;var l=js;e=Ts;var f=32-Xt(l)-1;l&=~(1<<f),a+=1;var h=32-Xt(n)+f;if(30<h){var x=f-f%5;h=(l&(1<<x)-1).toString(32),l>>=x,f-=x,js=1<<32-Xt(n)+f|a<<f|l,Ts=h+e}else js=1<<h|a<<f|l,Ts=e}function au(e){e.return!==null&&(Ps(e,1),tg(e,1,0))}function iu(e){for(;e===El;)El=Wi[--Xi],Wi[Xi]=null,er=Wi[--Xi],Wi[Xi]=null;for(;e===va;)va=Fn[--Kn],Fn[Kn]=null,Ts=Fn[--Kn],Fn[Kn]=null,js=Fn[--Kn],Fn[Kn]=null}function ng(e,n){Fn[Kn++]=js,Fn[Kn++]=Ts,Fn[Kn++]=va,js=n.id,Ts=n.overflow,va=e}var ln=null,bt=null,Ye=!1,ya=null,Zn=!1,ou=Error(r(519));function ba(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw tr(Gn(n,e)),ou}function sg(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[rn]=e,n[xn]=l,a){case"dialog":qe("cancel",n),qe("close",n);break;case"iframe":case"object":case"embed":qe("load",n);break;case"video":case"audio":for(a=0;a<Sr.length;a++)qe(Sr[a],n);break;case"source":qe("error",n);break;case"img":case"image":case"link":qe("error",n),qe("load",n);break;case"details":qe("toggle",n);break;case"input":qe("invalid",n),gh(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":qe("invalid",n);break;case"textarea":qe("invalid",n),yh(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||_0(n.textContent,a)?(l.popover!=null&&(qe("beforetoggle",n),qe("toggle",n)),l.onScroll!=null&&qe("scroll",n),l.onScrollEnd!=null&&qe("scrollend",n),l.onClick!=null&&(n.onclick=zs),n=!0):n=!1,n||ba(e,!0)}function ag(e){for(ln=e.return;ln;)switch(ln.tag){case 5:case 31:case 13:Zn=!1;return;case 27:case 3:Zn=!0;return;default:ln=ln.return}}function Qi(e){if(e!==ln)return!1;if(!Ye)return ag(e),Ye=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Tf(e.type,e.memoizedProps)),a=!a),a&&bt&&ba(e),ag(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));bt=E0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));bt=E0(e)}else n===27?(n=bt,Ra(e.type)?(e=Af,Af=null,bt=e):bt=n):bt=ln?Jn(e.stateNode.nextSibling):null;return!0}function ai(){bt=ln=null,Ye=!1}function ru(){var e=ya;return e!==null&&(wn===null?wn=e:wn.push.apply(wn,e),ya=null),e}function tr(e){ya===null?ya=[e]:ya.push(e)}var lu=ce(null),ii=null,Us=null;function _a(e,n,a){ke(lu,n._currentValue),n._currentValue=a}function Vs(e){e._currentValue=lu.current,me(lu)}function cu(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 du(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var x=f.child;h=h.firstContext;e:for(;h!==null;){var N=h;h=f;for(var I=0;I<n.length;I++)if(N.context===n[I]){h.lanes|=a,N=h.alternate,N!==null&&(N.lanes|=a),cu(h.return,a,e),l||(x=null);break e}h=N.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(r(341));x.lanes|=a,h=x.alternate,h!==null&&(h.lanes|=a),cu(x,a,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function eo(e,n,a,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var N=f.type;En(f.pendingProps.value,x.value)||(e!==null?e.push(N):e=[N])}}else if(f===_e.current){if(x=f.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Cr):e=[Cr])}f=f.return}e!==null&&du(n,e,a,l),n.flags|=262144}function Al(e){for(e=e.firstContext;e!==null;){if(!En(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function oi(e){ii=e,Us=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function cn(e){return ig(ii,e)}function Dl(e,n){return ii===null&&oi(e),ig(e,n)}function ig(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Us===null){if(e===null)throw Error(r(308));Us=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Us=Us.next=n;return a}var tS=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},nS=t.unstable_scheduleCallback,sS=t.unstable_NormalPriority,Ut={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function uu(){return{controller:new tS,data:new Map,refCount:0}}function nr(e){e.refCount--,e.refCount===0&&nS(sS,function(){e.controller.abort()})}var sr=null,fu=0,to=0,no=null;function aS(e,n){if(sr===null){var a=sr=[];fu=0,to=gf(),no={status:"pending",value:void 0,then:function(l){a.push(l)}}}return fu++,n.then(og,og),n}function og(){if(--fu===0&&sr!==null){no!==null&&(no.status="fulfilled");var e=sr;sr=null,to=0,no=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function iS(e,n){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<a.length;f++)(0,a[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var rg=H.S;H.S=function(e,n){qv=Wt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&aS(e,n),rg!==null&&rg(e,n)};var ri=ce(null);function pu(){var e=ri.current;return e!==null?e:gt.pooledCache}function Ml(e,n){n===null?ke(ri,ri.current):ke(ri,n.pool)}function lg(){var e=pu();return e===null?null:{parent:Ut._currentValue,pool:e}}var so=Error(r(460)),mu=Error(r(474)),Rl=Error(r(542)),Il={then:function(){}};function cg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function dg(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(zs,zs),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,fg(e),e;default:if(typeof n.status=="string")n.then(zs,zs);else{if(e=gt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(l){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=l}},function(l){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,fg(e),e}throw ci=n,so}}function li(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ci=a,so):a}}var ci=null;function ug(){if(ci===null)throw Error(r(459));var e=ci;return ci=null,e}function fg(e){if(e===so||e===Rl)throw Error(r(483))}var ao=null,ar=0;function Ol(e){var n=ar;return ar+=1,ao===null&&(ao=[]),dg(ao,e,n)}function ir(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Bl(e,n){throw n.$$typeof===_?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function pg(e){function n(P,z){if(e){var q=P.deletions;q===null?(P.deletions=[z],P.flags|=16):q.push(z)}}function a(P,z){if(!e)return null;for(;z!==null;)n(P,z),z=z.sibling;return null}function l(P){for(var z=new Map;P!==null;)P.key!==null?z.set(P.key,P):z.set(P.index,P),P=P.sibling;return z}function f(P,z){return P=Hs(P,z),P.index=0,P.sibling=null,P}function h(P,z,q){return P.index=q,e?(q=P.alternate,q!==null?(q=q.index,q<z?(P.flags|=67108866,z):q):(P.flags|=67108866,z)):(P.flags|=1048576,z)}function x(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function N(P,z,q,te){return z===null||z.tag!==6?(z=nu(q,P.mode,te),z.return=P,z):(z=f(z,q),z.return=P,z)}function I(P,z,q,te){var we=q.type;return we===j?X(P,z,q.props.children,te,q.key):z!==null&&(z.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===A&&li(we)===z.type)?(z=f(z,q.props),ir(z,q),z.return=P,z):(z=Cl(q.type,q.key,q.props,null,P.mode,te),ir(z,q),z.return=P,z)}function G(P,z,q,te){return z===null||z.tag!==4||z.stateNode.containerInfo!==q.containerInfo||z.stateNode.implementation!==q.implementation?(z=su(q,P.mode,te),z.return=P,z):(z=f(z,q.children||[]),z.return=P,z)}function X(P,z,q,te,we){return z===null||z.tag!==7?(z=si(q,P.mode,te,we),z.return=P,z):(z=f(z,q),z.return=P,z)}function ie(P,z,q){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=nu(""+z,P.mode,q),z.return=P,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case k:return q=Cl(z.type,z.key,z.props,null,P.mode,q),ir(q,z),q.return=P,q;case S:return z=su(z,P.mode,q),z.return=P,z;case A:return z=li(z),ie(P,z,q)}if(ae(z)||ee(z))return z=si(z,P.mode,q,null),z.return=P,z;if(typeof z.then=="function")return ie(P,Ol(z),q);if(z.$$typeof===D)return ie(P,Dl(P,z),q);Bl(P,z)}return null}function K(P,z,q,te){var we=z!==null?z.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return we!==null?null:N(P,z,""+q,te);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case k:return q.key===we?I(P,z,q,te):null;case S:return q.key===we?G(P,z,q,te):null;case A:return q=li(q),K(P,z,q,te)}if(ae(q)||ee(q))return we!==null?null:X(P,z,q,te,null);if(typeof q.then=="function")return K(P,z,Ol(q),te);if(q.$$typeof===D)return K(P,z,Dl(P,q),te);Bl(P,q)}return null}function J(P,z,q,te,we){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return P=P.get(q)||null,N(z,P,""+te,we);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case k:return P=P.get(te.key===null?q:te.key)||null,I(z,P,te,we);case S:return P=P.get(te.key===null?q:te.key)||null,G(z,P,te,we);case A:return te=li(te),J(P,z,q,te,we)}if(ae(te)||ee(te))return P=P.get(q)||null,X(z,P,te,we,null);if(typeof te.then=="function")return J(P,z,q,Ol(te),we);if(te.$$typeof===D)return J(P,z,q,Dl(z,te),we);Bl(z,te)}return null}function xe(P,z,q,te){for(var we=null,nt=null,Se=z,He=z=0,Ke=null;Se!==null&&He<q.length;He++){Se.index>He?(Ke=Se,Se=null):Ke=Se.sibling;var st=K(P,Se,q[He],te);if(st===null){Se===null&&(Se=Ke);break}e&&Se&&st.alternate===null&&n(P,Se),z=h(st,z,He),nt===null?we=st:nt.sibling=st,nt=st,Se=Ke}if(He===q.length)return a(P,Se),Ye&&Ps(P,He),we;if(Se===null){for(;He<q.length;He++)Se=ie(P,q[He],te),Se!==null&&(z=h(Se,z,He),nt===null?we=Se:nt.sibling=Se,nt=Se);return Ye&&Ps(P,He),we}for(Se=l(Se);He<q.length;He++)Ke=J(Se,P,He,q[He],te),Ke!==null&&(e&&Ke.alternate!==null&&Se.delete(Ke.key===null?He:Ke.key),z=h(Ke,z,He),nt===null?we=Ke:nt.sibling=Ke,nt=Ke);return e&&Se.forEach(function(za){return n(P,za)}),Ye&&Ps(P,He),we}function Ce(P,z,q,te){if(q==null)throw Error(r(151));for(var we=null,nt=null,Se=z,He=z=0,Ke=null,st=q.next();Se!==null&&!st.done;He++,st=q.next()){Se.index>He?(Ke=Se,Se=null):Ke=Se.sibling;var za=K(P,Se,st.value,te);if(za===null){Se===null&&(Se=Ke);break}e&&Se&&za.alternate===null&&n(P,Se),z=h(za,z,He),nt===null?we=za:nt.sibling=za,nt=za,Se=Ke}if(st.done)return a(P,Se),Ye&&Ps(P,He),we;if(Se===null){for(;!st.done;He++,st=q.next())st=ie(P,st.value,te),st!==null&&(z=h(st,z,He),nt===null?we=st:nt.sibling=st,nt=st);return Ye&&Ps(P,He),we}for(Se=l(Se);!st.done;He++,st=q.next())st=J(Se,P,He,st.value,te),st!==null&&(e&&st.alternate!==null&&Se.delete(st.key===null?He:st.key),z=h(st,z,He),nt===null?we=st:nt.sibling=st,nt=st);return e&&Se.forEach(function(g2){return n(P,g2)}),Ye&&Ps(P,He),we}function mt(P,z,q,te){if(typeof q=="object"&&q!==null&&q.type===j&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case k:e:{for(var we=q.key;z!==null;){if(z.key===we){if(we=q.type,we===j){if(z.tag===7){a(P,z.sibling),te=f(z,q.props.children),te.return=P,P=te;break e}}else if(z.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===A&&li(we)===z.type){a(P,z.sibling),te=f(z,q.props),ir(te,q),te.return=P,P=te;break e}a(P,z);break}else n(P,z);z=z.sibling}q.type===j?(te=si(q.props.children,P.mode,te,q.key),te.return=P,P=te):(te=Cl(q.type,q.key,q.props,null,P.mode,te),ir(te,q),te.return=P,P=te)}return x(P);case S:e:{for(we=q.key;z!==null;){if(z.key===we)if(z.tag===4&&z.stateNode.containerInfo===q.containerInfo&&z.stateNode.implementation===q.implementation){a(P,z.sibling),te=f(z,q.children||[]),te.return=P,P=te;break e}else{a(P,z);break}else n(P,z);z=z.sibling}te=su(q,P.mode,te),te.return=P,P=te}return x(P);case A:return q=li(q),mt(P,z,q,te)}if(ae(q))return xe(P,z,q,te);if(ee(q)){if(we=ee(q),typeof we!="function")throw Error(r(150));return q=we.call(q),Ce(P,z,q,te)}if(typeof q.then=="function")return mt(P,z,Ol(q),te);if(q.$$typeof===D)return mt(P,z,Dl(P,q),te);Bl(P,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,z!==null&&z.tag===6?(a(P,z.sibling),te=f(z,q),te.return=P,P=te):(a(P,z),te=nu(q,P.mode,te),te.return=P,P=te),x(P)):a(P,z)}return function(P,z,q,te){try{ar=0;var we=mt(P,z,q,te);return ao=null,we}catch(Se){if(Se===so||Se===Rl)throw Se;var nt=An(29,Se,null,P.mode);return nt.lanes=te,nt.return=P,nt}finally{}}}var di=pg(!0),mg=pg(!1),xa=!1;function hu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gu(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 ka(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Sa(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(rt&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=Nl(e),Wh(e,null,a),n}return wl(e,l,n,a),Nl(e)}function or(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,Qt(e,a)}}function vu(e,n){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?f=h=x:h=h.next=x,a=a.next}while(a!==null);h===null?f=h=n:h=h.next=n}else f=h=n;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var yu=!1;function rr(){if(yu){var e=no;if(e!==null)throw e}}function lr(e,n,a,l){yu=!1;var f=e.updateQueue;xa=!1;var h=f.firstBaseUpdate,x=f.lastBaseUpdate,N=f.shared.pending;if(N!==null){f.shared.pending=null;var I=N,G=I.next;I.next=null,x===null?h=G:x.next=G,x=I;var X=e.alternate;X!==null&&(X=X.updateQueue,N=X.lastBaseUpdate,N!==x&&(N===null?X.firstBaseUpdate=G:N.next=G,X.lastBaseUpdate=I))}if(h!==null){var ie=f.baseState;x=0,X=G=I=null,N=h;do{var K=N.lane&-536870913,J=K!==N.lane;if(J?(Fe&K)===K:(l&K)===K){K!==0&&K===to&&(yu=!0),X!==null&&(X=X.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var xe=e,Ce=N;K=n;var mt=a;switch(Ce.tag){case 1:if(xe=Ce.payload,typeof xe=="function"){ie=xe.call(mt,ie,K);break e}ie=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=Ce.payload,K=typeof xe=="function"?xe.call(mt,ie,K):xe,K==null)break e;ie=b({},ie,K);break e;case 2:xa=!0}}K=N.callback,K!==null&&(e.flags|=64,J&&(e.flags|=8192),J=f.callbacks,J===null?f.callbacks=[K]:J.push(K))}else J={lane:K,tag:N.tag,payload:N.payload,callback:N.callback,next:null},X===null?(G=X=J,I=ie):X=X.next=J,x|=K;if(N=N.next,N===null){if(N=f.shared.pending,N===null)break;J=N,N=J.next,J.next=null,f.lastBaseUpdate=J,f.shared.pending=null}}while(!0);X===null&&(I=ie),f.baseState=I,f.firstBaseUpdate=G,f.lastBaseUpdate=X,h===null&&(f.shared.lanes=0),Ca|=x,e.lanes=x,e.memoizedState=ie}}function hg(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function gg(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)hg(a[e],n)}var io=ce(null),Ll=ce(0);function vg(e,n){e=Xs,ke(Ll,e),ke(io,n),Xs=e|n.baseLanes}function bu(){ke(Ll,Xs),ke(io,io.current)}function _u(){Xs=Ll.current,me(io),me(Ll)}var Dn=ce(null),Yn=null;function ja(e){var n=e.alternate;ke(Rt,Rt.current&1),ke(Dn,e),Yn===null&&(n===null||io.current!==null||n.memoizedState!==null)&&(Yn=e)}function xu(e){ke(Rt,Rt.current),ke(Dn,e),Yn===null&&(Yn=e)}function yg(e){e.tag===22?(ke(Rt,Rt.current),ke(Dn,e),Yn===null&&(Yn=e)):Ta()}function Ta(){ke(Rt,Rt.current),ke(Dn,Dn.current)}function Mn(e){me(Dn),Yn===e&&(Yn=null),me(Rt)}var Rt=ce(0);function zl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Cf(a)||Ef(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 qs=0,ze=null,ft=null,Vt=null,$l=!1,oo=!1,ui=!1,Hl=0,cr=0,ro=null,oS=0;function At(){throw Error(r(321))}function ku(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!En(e[a],n[a]))return!1;return!0}function Su(e,n,a,l,f,h){return qs=h,ze=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,H.H=e===null||e.memoizedState===null?tv:zu,ui=!1,h=a(l,f),ui=!1,oo&&(h=_g(n,a,l,f)),bg(e),h}function bg(e){H.H=fr;var n=ft!==null&&ft.next!==null;if(qs=0,Vt=ft=ze=null,$l=!1,cr=0,ro=null,n)throw Error(r(300));e===null||qt||(e=e.dependencies,e!==null&&Al(e)&&(qt=!0))}function _g(e,n,a,l){ze=e;var f=0;do{if(oo&&(ro=null),cr=0,oo=!1,25<=f)throw Error(r(301));if(f+=1,Vt=ft=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}H.H=nv,h=n(a,l)}while(oo);return h}function rS(){var e=H.H,n=e.useState()[0];return n=typeof n.then=="function"?dr(n):n,e=e.useState()[0],(ft!==null?ft.memoizedState:null)!==e&&(ze.flags|=1024),n}function ju(){var e=Hl!==0;return Hl=0,e}function Tu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function wu(e){if($l){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}$l=!1}qs=0,Vt=ft=ze=null,oo=!1,cr=Hl=0,ro=null}function vn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?ze.memoizedState=Vt=e:Vt=Vt.next=e,Vt}function It(){if(ft===null){var e=ze.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var n=Vt===null?ze.memoizedState:Vt.next;if(n!==null)Vt=n,ft=e;else{if(e===null)throw ze.alternate===null?Error(r(467)):Error(r(310));ft=e,e={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},Vt===null?ze.memoizedState=Vt=e:Vt=Vt.next=e}return Vt}function Pl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function dr(e){var n=cr;return cr+=1,ro===null&&(ro=[]),e=dg(ro,e,n),n=ze,(Vt===null?n.memoizedState:Vt.next)===null&&(n=n.alternate,H.H=n===null||n.memoizedState===null?tv:zu),e}function Ul(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return dr(e);if(e.$$typeof===D)return cn(e)}throw Error(r(438,String(e)))}function Nu(e){var n=null,a=ze.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=ze.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=Pl(),ze.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]=Y;return n.index++,a}function Gs(e,n){return typeof n=="function"?n(e):n}function Vl(e){var n=It();return Cu(n,ft,e)}function Cu(e,n,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var x=f.next;f.next=h.next,h.next=x}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var N=x=null,I=null,G=n,X=!1;do{var ie=G.lane&-536870913;if(ie!==G.lane?(Fe&ie)===ie:(qs&ie)===ie){var K=G.revertLane;if(K===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),ie===to&&(X=!0);else if((qs&K)===K){G=G.next,K===to&&(X=!0);continue}else ie={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},I===null?(N=I=ie,x=h):I=I.next=ie,ze.lanes|=K,Ca|=K;ie=G.action,ui&&a(h,ie),h=G.hasEagerState?G.eagerState:a(h,ie)}else K={lane:ie,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},I===null?(N=I=K,x=h):I=I.next=K,ze.lanes|=ie,Ca|=ie;G=G.next}while(G!==null&&G!==n);if(I===null?x=h:I.next=N,!En(h,e.memoizedState)&&(qt=!0,X&&(a=no,a!==null)))throw a;e.memoizedState=h,e.baseState=x,e.baseQueue=I,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Eu(e){var n=It(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,h=n.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do h=e(h,x.action),x=x.next;while(x!==f);En(h,n.memoizedState)||(qt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,l]}function xg(e,n,a){var l=ze,f=It(),h=Ye;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=n();var x=!En((ft||f).memoizedState,a);if(x&&(f.memoizedState=a,qt=!0),f=f.queue,Mu(jg.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||Vt!==null&&Vt.memoizedState.tag&1){if(l.flags|=2048,lo(9,{destroy:void 0},Sg.bind(null,l,f,a,n),null),gt===null)throw Error(r(349));h||(qs&127)!==0||kg(l,n,a)}return a}function kg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=ze.updateQueue,n===null?(n=Pl(),ze.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Sg(e,n,a,l){n.value=a,n.getSnapshot=l,Tg(n)&&wg(e)}function jg(e,n,a){return a(function(){Tg(n)&&wg(e)})}function Tg(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!En(e,a)}catch{return!0}}function wg(e){var n=ni(e,2);n!==null&&Nn(n,e,2)}function Au(e){var n=vn();if(typeof e=="function"){var a=e;if(e=a(),ui){Cn(!0);try{a()}finally{Cn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gs,lastRenderedState:e},n}function Ng(e,n,a,l){return e.baseState=a,Cu(e,ft,typeof l=="function"?l:Gs)}function lS(e,n,a,l,f){if(Fl(e))throw Error(r(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};H.T!==null?a(!0):h.isTransition=!1,l(h),a=n.pending,a===null?(h.next=n.pending=h,Cg(n,h)):(h.next=a.next,n.pending=a.next=h)}}function Cg(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=H.T,x={};H.T=x;try{var N=a(f,l),I=H.S;I!==null&&I(x,N),Eg(e,n,N)}catch(G){Du(e,n,G)}finally{h!==null&&x.types!==null&&(h.types=x.types),H.T=h}}else try{h=a(f,l),Eg(e,n,h)}catch(G){Du(e,n,G)}}function Eg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){Ag(e,n,l)},function(l){return Du(e,n,l)}):Ag(e,n,a)}function Ag(e,n,a){n.status="fulfilled",n.value=a,Dg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Cg(e,a)))}function Du(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,Dg(n),n=n.next;while(n!==l)}e.action=null}function Dg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Mg(e,n){return n}function Rg(e,n){if(Ye){var a=gt.formState;if(a!==null){e:{var l=ze;if(Ye){if(bt){t:{for(var f=bt,h=Zn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Jn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){bt=Jn(f.nextSibling),l=f.data==="F!";break e}}ba(l)}l=!1}l&&(n=a[0])}}return a=vn(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mg,lastRenderedState:n},a.queue=l,a=Xg.bind(null,ze,l),l.dispatch=a,l=Au(!1),h=Lu.bind(null,ze,!1,l.queue),l=vn(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=lS.bind(null,ze,f,h,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function Ig(e){var n=It();return Og(n,ft,e)}function Og(e,n,a){if(n=Cu(e,n,Mg)[0],e=Vl(Gs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=dr(n)}catch(x){throw x===so?Rl:x}else l=n;n=It();var f=n.queue,h=f.dispatch;return a!==n.memoizedState&&(ze.flags|=2048,lo(9,{destroy:void 0},cS.bind(null,f,a),null)),[l,h,e]}function cS(e,n){e.action=n}function Bg(e){var n=It(),a=ft;if(a!==null)return Og(n,a,e);It(),n=n.memoizedState,a=It();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function lo(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=ze.updateQueue,n===null&&(n=Pl(),ze.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 Lg(){return It().memoizedState}function ql(e,n,a,l){var f=vn();ze.flags|=e,f.memoizedState=lo(1|n,{destroy:void 0},a,l===void 0?null:l)}function Gl(e,n,a,l){var f=It();l=l===void 0?null:l;var h=f.memoizedState.inst;ft!==null&&l!==null&&ku(l,ft.memoizedState.deps)?f.memoizedState=lo(n,h,a,l):(ze.flags|=e,f.memoizedState=lo(1|n,h,a,l))}function zg(e,n){ql(8390656,8,e,n)}function Mu(e,n){Gl(2048,8,e,n)}function dS(e){ze.flags|=4;var n=ze.updateQueue;if(n===null)n=Pl(),ze.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function $g(e){var n=It().memoizedState;return dS({ref:n,nextImpl:e}),function(){if((rt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Hg(e,n){return Gl(4,2,e,n)}function Pg(e,n){return Gl(4,4,e,n)}function Ug(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 Vg(e,n,a){a=a!=null?a.concat([e]):null,Gl(4,4,Ug.bind(null,n,e),a)}function Ru(){}function qg(e,n){var a=It();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&ku(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Gg(e,n){var a=It();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&ku(n,l[1]))return l[0];if(l=e(),ui){Cn(!0);try{e()}finally{Cn(!1)}}return a.memoizedState=[l,n],l}function Iu(e,n,a){return a===void 0||(qs&1073741824)!==0&&(Fe&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Fv(),ze.lanes|=e,Ca|=e,a)}function Fg(e,n,a,l){return En(a,n)?a:io.current!==null?(e=Iu(e,a,l),En(e,n)||(qt=!0),e):(qs&42)===0||(qs&1073741824)!==0&&(Fe&261930)===0?(qt=!0,e.memoizedState=a):(e=Fv(),ze.lanes|=e,Ca|=e,n)}function Kg(e,n,a,l,f){var h=B.p;B.p=h!==0&&8>h?h:8;var x=H.T,N={};H.T=N,Lu(e,!1,n,a);try{var I=f(),G=H.S;if(G!==null&&G(N,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var X=iS(I,l);ur(e,n,X,On(e))}else ur(e,n,l,On(e))}catch(ie){ur(e,n,{then:function(){},status:"rejected",reason:ie},On())}finally{B.p=h,x!==null&&N.types!==null&&(x.types=N.types),H.T=x}}function uS(){}function Ou(e,n,a,l){if(e.tag!==5)throw Error(r(476));var f=Zg(e).queue;Kg(e,f,n,F,a===null?uS:function(){return Yg(e),a(l)})}function Zg(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gs,lastRenderedState:F},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gs,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Yg(e){var n=Zg(e);n.next===null&&(n=e.alternate.memoizedState),ur(e,n.next.queue,{},On())}function Bu(){return cn(Cr)}function Jg(){return It().memoizedState}function Wg(){return It().memoizedState}function fS(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=On();e=ka(a);var l=Sa(n,e,a);l!==null&&(Nn(l,n,a),or(l,n,a)),n={cache:uu()},e.payload=n;return}n=n.return}}function pS(e,n,a){var l=On();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Fl(e)?Qg(n,a):(a=eu(e,n,a,l),a!==null&&(Nn(a,e,l),ev(a,n,l)))}function Xg(e,n,a){var l=On();ur(e,n,a,l)}function ur(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Fl(e))Qg(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,N=h(x,a);if(f.hasEagerState=!0,f.eagerState=N,En(N,x))return wl(e,n,f,0),gt===null&&Tl(),!1}catch{}finally{}if(a=eu(e,n,f,l),a!==null)return Nn(a,e,l),ev(a,n,l),!0}return!1}function Lu(e,n,a,l){if(l={lane:2,revertLane:gf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Fl(e)){if(n)throw Error(r(479))}else n=eu(e,a,l,2),n!==null&&Nn(n,e,2)}function Fl(e){var n=e.alternate;return e===ze||n!==null&&n===ze}function Qg(e,n){oo=$l=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function ev(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Qt(e,a)}}var fr={readContext:cn,use:Ul,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useLayoutEffect:At,useInsertionEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useSyncExternalStore:At,useId:At,useHostTransitionStatus:At,useFormState:At,useActionState:At,useOptimistic:At,useMemoCache:At,useCacheRefresh:At};fr.useEffectEvent=At;var tv={readContext:cn,use:Ul,useCallback:function(e,n){return vn().memoizedState=[e,n===void 0?null:n],e},useContext:cn,useEffect:zg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,ql(4194308,4,Ug.bind(null,n,e),a)},useLayoutEffect:function(e,n){return ql(4194308,4,e,n)},useInsertionEffect:function(e,n){ql(4,2,e,n)},useMemo:function(e,n){var a=vn();n=n===void 0?null:n;var l=e();if(ui){Cn(!0);try{e()}finally{Cn(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=vn();if(a!==void 0){var f=a(n);if(ui){Cn(!0);try{a(n)}finally{Cn(!1)}}}else f=n;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=pS.bind(null,ze,e),[l.memoizedState,e]},useRef:function(e){var n=vn();return e={current:e},n.memoizedState=e},useState:function(e){e=Au(e);var n=e.queue,a=Xg.bind(null,ze,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Ru,useDeferredValue:function(e,n){var a=vn();return Iu(a,e,n)},useTransition:function(){var e=Au(!1);return e=Kg.bind(null,ze,e.queue,!0,!1),vn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=ze,f=vn();if(Ye){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),gt===null)throw Error(r(349));(Fe&127)!==0||kg(l,n,a)}f.memoizedState=a;var h={value:a,getSnapshot:n};return f.queue=h,zg(jg.bind(null,l,h,e),[e]),l.flags|=2048,lo(9,{destroy:void 0},Sg.bind(null,l,h,a,n),null),a},useId:function(){var e=vn(),n=gt.identifierPrefix;if(Ye){var a=Ts,l=js;a=(l&~(1<<32-Xt(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Hl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=oS++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Bu,useFormState:Rg,useActionState:Rg,useOptimistic:function(e){var n=vn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Lu.bind(null,ze,!0,a),a.dispatch=n,[e,n]},useMemoCache:Nu,useCacheRefresh:function(){return vn().memoizedState=fS.bind(null,ze)},useEffectEvent:function(e){var n=vn(),a={impl:e};return n.memoizedState=a,function(){if((rt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},zu={readContext:cn,use:Ul,useCallback:qg,useContext:cn,useEffect:Mu,useImperativeHandle:Vg,useInsertionEffect:Hg,useLayoutEffect:Pg,useMemo:Gg,useReducer:Vl,useRef:Lg,useState:function(){return Vl(Gs)},useDebugValue:Ru,useDeferredValue:function(e,n){var a=It();return Fg(a,ft.memoizedState,e,n)},useTransition:function(){var e=Vl(Gs)[0],n=It().memoizedState;return[typeof e=="boolean"?e:dr(e),n]},useSyncExternalStore:xg,useId:Jg,useHostTransitionStatus:Bu,useFormState:Ig,useActionState:Ig,useOptimistic:function(e,n){var a=It();return Ng(a,ft,e,n)},useMemoCache:Nu,useCacheRefresh:Wg};zu.useEffectEvent=$g;var nv={readContext:cn,use:Ul,useCallback:qg,useContext:cn,useEffect:Mu,useImperativeHandle:Vg,useInsertionEffect:Hg,useLayoutEffect:Pg,useMemo:Gg,useReducer:Eu,useRef:Lg,useState:function(){return Eu(Gs)},useDebugValue:Ru,useDeferredValue:function(e,n){var a=It();return ft===null?Iu(a,e,n):Fg(a,ft.memoizedState,e,n)},useTransition:function(){var e=Eu(Gs)[0],n=It().memoizedState;return[typeof e=="boolean"?e:dr(e),n]},useSyncExternalStore:xg,useId:Jg,useHostTransitionStatus:Bu,useFormState:Bg,useActionState:Bg,useOptimistic:function(e,n){var a=It();return ft!==null?Ng(a,ft,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Nu,useCacheRefresh:Wg};nv.useEffectEvent=$g;function $u(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 Hu={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=On(),f=ka(l);f.payload=n,a!=null&&(f.callback=a),n=Sa(e,f,l),n!==null&&(Nn(n,e,l),or(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=On(),f=ka(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=Sa(e,f,l),n!==null&&(Nn(n,e,l),or(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=On(),l=ka(a);l.tag=2,n!=null&&(l.callback=n),n=Sa(e,l,a),n!==null&&(Nn(n,e,a),or(n,e,a))}};function sv(e,n,a,l,f,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,x):n.prototype&&n.prototype.isPureReactComponent?!Xo(a,l)||!Xo(f,h):!0}function av(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&&Hu.enqueueReplaceState(n,n.state,null)}function fi(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 iv(e){jl(e)}function ov(e){console.error(e)}function rv(e){jl(e)}function Kl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function lv(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 Pu(e,n,a){return a=ka(a),a.tag=3,a.payload={element:null},a.callback=function(){Kl(e,n)},a}function cv(e){return e=ka(e),e.tag=3,e}function dv(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(){lv(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){lv(n,a,l),typeof f!="function"&&(Ea===null?Ea=new Set([this]):Ea.add(this));var N=l.stack;this.componentDidCatch(l.value,{componentStack:N!==null?N:""})})}function mS(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&eo(n,a,f,!0),a=Dn.current,a!==null){switch(a.tag){case 31:case 13:return Yn===null?ic():a.alternate===null&&Dt===0&&(Dt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Il?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),pf(e,l,f)),!1;case 22:return a.flags|=65536,l===Il?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)),pf(e,l,f)),!1}throw Error(r(435,a.tag))}return pf(e,l,f),ic(),!1}if(Ye)return n=Dn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==ou&&(e=Error(r(422),{cause:l}),tr(Gn(e,a)))):(l!==ou&&(n=Error(r(423),{cause:l}),tr(Gn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Gn(l,a),f=Pu(e.stateNode,l,f),vu(e,f),Dt!==4&&(Dt=2)),!1;var h=Error(r(520),{cause:l});if(h=Gn(h,a),_r===null?_r=[h]:_r.push(h),Dt!==4&&(Dt=2),n===null)return!0;l=Gn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Pu(a.stateNode,l,e),vu(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"&&(Ea===null||!Ea.has(h))))return a.flags|=65536,f&=-f,a.lanes|=f,f=cv(f),dv(f,e,a,l),vu(a,f),!1}a=a.return}while(a!==null);return!1}var Uu=Error(r(461)),qt=!1;function dn(e,n,a,l){n.child=e===null?mg(n,null,a,l):di(n,e.child,a,l)}function uv(e,n,a,l,f){a=a.render;var h=n.ref;if("ref"in l){var x={};for(var N in l)N!=="ref"&&(x[N]=l[N])}else x=l;return oi(n),l=Su(e,n,a,x,h,f),N=ju(),e!==null&&!qt?(Tu(e,n,f),Fs(e,n,f)):(Ye&&N&&au(n),n.flags|=1,dn(e,n,l,f),n.child)}function fv(e,n,a,l,f){if(e===null){var h=a.type;return typeof h=="function"&&!tu(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,pv(e,n,h,l,f)):(e=Cl(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Ju(e,f)){var x=h.memoizedProps;if(a=a.compare,a=a!==null?a:Xo,a(x,l)&&e.ref===n.ref)return Fs(e,n,f)}return n.flags|=1,e=Hs(h,l),e.ref=n.ref,e.return=n,n.child=e}function pv(e,n,a,l,f){if(e!==null){var h=e.memoizedProps;if(Xo(h,l)&&e.ref===n.ref)if(qt=!1,n.pendingProps=l=h,Ju(e,f))(e.flags&131072)!==0&&(qt=!0);else return n.lanes=e.lanes,Fs(e,n,f)}return Vu(e,n,a,l,f)}function mv(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 hv(e,n,h,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ml(n,h!==null?h.cachePool:null),h!==null?vg(n,h):bu(),yg(n);else return l=n.lanes=536870912,hv(e,n,h!==null?h.baseLanes|a:a,a,l)}else h!==null?(Ml(n,h.cachePool),vg(n,h),Ta(),n.memoizedState=null):(e!==null&&Ml(n,null),bu(),Ta());return dn(e,n,f,a),n.child}function pr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function hv(e,n,a,l,f){var h=pu();return h=h===null?null:{parent:Ut._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Ml(n,null),bu(),yg(n),e!==null&&eo(e,n,l,!0),n.childLanes=f,null}function Zl(e,n){return n=Jl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function gv(e,n,a){return di(n,e.child,null,a),e=Zl(n,n.pendingProps),e.flags|=2,Mn(n),n.memoizedState=null,e}function hS(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ye){if(l.mode==="hidden")return e=Zl(n,l),n.lanes=536870912,pr(null,e);if(xu(n),(e=bt)?(e=C0(e,Zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:va!==null?{id:js,overflow:Ts}:null,retryLane:536870912,hydrationErrors:null},a=Qh(e),a.return=n,n.child=a,ln=n,bt=null)):e=null,e===null)throw ba(n);return n.lanes=536870912,null}return Zl(n,l)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(xu(n),f)if(n.flags&256)n.flags&=-257,n=gv(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(qt||eo(e,n,a,!1),f=(a&e.childLanes)!==0,qt||f){if(l=gt,l!==null&&(x=on(l,a),x!==0&&x!==h.retryLane))throw h.retryLane=x,ni(e,x),Nn(l,e,x),Uu;ic(),n=gv(e,n,a)}else e=h.treeContext,bt=Jn(x.nextSibling),ln=n,Ye=!0,ya=null,Zn=!1,e!==null&&ng(n,e),n=Zl(n,l),n.flags|=4096;return n}return e=Hs(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Yl(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 Vu(e,n,a,l,f){return oi(n),a=Su(e,n,a,l,void 0,f),l=ju(),e!==null&&!qt?(Tu(e,n,f),Fs(e,n,f)):(Ye&&l&&au(n),n.flags|=1,dn(e,n,a,f),n.child)}function vv(e,n,a,l,f,h){return oi(n),n.updateQueue=null,a=_g(n,l,a,f),bg(e),l=ju(),e!==null&&!qt?(Tu(e,n,h),Fs(e,n,h)):(Ye&&l&&au(n),n.flags|=1,dn(e,n,a,h),n.child)}function yv(e,n,a,l,f){if(oi(n),n.stateNode===null){var h=Ji,x=a.contextType;typeof x=="object"&&x!==null&&(h=cn(x)),h=new a(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Hu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},hu(n),x=a.contextType,h.context=typeof x=="object"&&x!==null?cn(x):Ji,h.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&($u(n,a,x,l),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Hu.enqueueReplaceState(h,h.state,null),lr(n,l,h,f),rr(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var N=n.memoizedProps,I=fi(a,N);h.props=I;var G=h.context,X=a.contextType;x=Ji,typeof X=="object"&&X!==null&&(x=cn(X));var ie=a.getDerivedStateFromProps;X=typeof ie=="function"||typeof h.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,X||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(N||G!==x)&&av(n,h,l,x),xa=!1;var K=n.memoizedState;h.state=K,lr(n,l,h,f),rr(),G=n.memoizedState,N||K!==G||xa?(typeof ie=="function"&&($u(n,a,ie,l),G=n.memoizedState),(I=xa||sv(n,a,I,l,K,G,x))?(X||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=G),h.props=l,h.state=G,h.context=x,l=I):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,gu(e,n),x=n.memoizedProps,X=fi(a,x),h.props=X,ie=n.pendingProps,K=h.context,G=a.contextType,I=Ji,typeof G=="object"&&G!==null&&(I=cn(G)),N=a.getDerivedStateFromProps,(G=typeof N=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ie||K!==I)&&av(n,h,l,I),xa=!1,K=n.memoizedState,h.state=K,lr(n,l,h,f),rr();var J=n.memoizedState;x!==ie||K!==J||xa||e!==null&&e.dependencies!==null&&Al(e.dependencies)?(typeof N=="function"&&($u(n,a,N,l),J=n.memoizedState),(X=xa||sv(n,a,X,l,K,J,I)||e!==null&&e.dependencies!==null&&Al(e.dependencies))?(G||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,J,I),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,J,I)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=J),h.props=l,h.state=J,h.context=I,l=X):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,Yl(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=di(n,e.child,null,f),n.child=di(n,null,a,f)):dn(e,n,a,f),n.memoizedState=h.state,e=n.child):e=Fs(e,n,f),e}function bv(e,n,a,l){return ai(),n.flags|=256,dn(e,n,a,l),n.child}var qu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gu(e){return{baseLanes:e,cachePool:lg()}}function Fu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=In),e}function _v(e,n,a){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(Rt.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ye){if(f?ja(n):Ta(),(e=bt)?(e=C0(e,Zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:va!==null?{id:js,overflow:Ts}:null,retryLane:536870912,hydrationErrors:null},a=Qh(e),a.return=n,n.child=a,ln=n,bt=null)):e=null,e===null)throw ba(n);return Ef(e)?n.lanes=32:n.lanes=536870912,null}var N=l.children;return l=l.fallback,f?(Ta(),f=n.mode,N=Jl({mode:"hidden",children:N},f),l=si(l,f,a,null),N.return=n,l.return=n,N.sibling=l,n.child=N,l=n.child,l.memoizedState=Gu(a),l.childLanes=Fu(e,x,a),n.memoizedState=qu,pr(null,l)):(ja(n),Ku(n,N))}var I=e.memoizedState;if(I!==null&&(N=I.dehydrated,N!==null)){if(h)n.flags&256?(ja(n),n.flags&=-257,n=Zu(e,n,a)):n.memoizedState!==null?(Ta(),n.child=e.child,n.flags|=128,n=null):(Ta(),N=l.fallback,f=n.mode,l=Jl({mode:"visible",children:l.children},f),N=si(N,f,a,null),N.flags|=2,l.return=n,N.return=n,l.sibling=N,n.child=l,di(n,e.child,null,a),l=n.child,l.memoizedState=Gu(a),l.childLanes=Fu(e,x,a),n.memoizedState=qu,n=pr(null,l));else if(ja(n),Ef(N)){if(x=N.nextSibling&&N.nextSibling.dataset,x)var G=x.dgst;x=G,l=Error(r(419)),l.stack="",l.digest=x,tr({value:l,source:null,stack:null}),n=Zu(e,n,a)}else if(qt||eo(e,n,a,!1),x=(a&e.childLanes)!==0,qt||x){if(x=gt,x!==null&&(l=on(x,a),l!==0&&l!==I.retryLane))throw I.retryLane=l,ni(e,l),Nn(x,e,l),Uu;Cf(N)||ic(),n=Zu(e,n,a)}else Cf(N)?(n.flags|=192,n.child=e.child,n=null):(e=I.treeContext,bt=Jn(N.nextSibling),ln=n,Ye=!0,ya=null,Zn=!1,e!==null&&ng(n,e),n=Ku(n,l.children),n.flags|=4096);return n}return f?(Ta(),N=l.fallback,f=n.mode,I=e.child,G=I.sibling,l=Hs(I,{mode:"hidden",children:l.children}),l.subtreeFlags=I.subtreeFlags&65011712,G!==null?N=Hs(G,N):(N=si(N,f,a,null),N.flags|=2),N.return=n,l.return=n,l.sibling=N,n.child=l,pr(null,l),l=n.child,N=e.child.memoizedState,N===null?N=Gu(a):(f=N.cachePool,f!==null?(I=Ut._currentValue,f=f.parent!==I?{parent:I,pool:I}:f):f=lg(),N={baseLanes:N.baseLanes|a,cachePool:f}),l.memoizedState=N,l.childLanes=Fu(e,x,a),n.memoizedState=qu,pr(e.child,l)):(ja(n),a=e.child,e=a.sibling,a=Hs(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function Ku(e,n){return n=Jl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Jl(e,n){return e=An(22,e,null,n),e.lanes=0,e}function Zu(e,n,a){return di(n,e.child,null,a),e=Ku(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function xv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),cu(e.return,n,a)}function Yu(e,n,a,l,f,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=a,x.tailMode=f,x.treeForkCount=h)}function kv(e,n,a){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var x=Rt.current,N=(x&2)!==0;if(N?(x=x&1|2,n.flags|=128):x&=1,ke(Rt,x),dn(e,n,l,a),l=Ye?er:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xv(e,a,n);else if(e.tag===19)xv(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&&zl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Yu(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&&zl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Yu(n,!0,a,null,h,l);break;case"together":Yu(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Fs(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Ca|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(eo(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=Hs(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Hs(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Ju(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Al(e)))}function gS(e,n,a){switch(n.tag){case 3:Oe(n,n.stateNode.containerInfo),_a(n,Ut,e.memoizedState.cache),ai();break;case 27:case 5:Nt(n);break;case 4:Oe(n,n.stateNode.containerInfo);break;case 10:_a(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,xu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(ja(n),n.flags|=128,null):(a&n.child.childLanes)!==0?_v(e,n,a):(ja(n),e=Fs(e,n,a),e!==null?e.sibling:null);ja(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(eo(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return kv(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),ke(Rt,Rt.current),l)break;return null;case 22:return n.lanes=0,mv(e,n,a,n.pendingProps);case 24:_a(n,Ut,e.memoizedState.cache)}return Fs(e,n,a)}function Sv(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)qt=!0;else{if(!Ju(e,a)&&(n.flags&128)===0)return qt=!1,gS(e,n,a);qt=(e.flags&131072)!==0}else qt=!1,Ye&&(n.flags&1048576)!==0&&tg(n,er,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=li(n.elementType),n.type=e,typeof e=="function")tu(e)?(l=fi(e,l),n.tag=1,n=yv(null,n,e,l,a)):(n.tag=0,n=Vu(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===R){n.tag=11,n=uv(null,n,e,l,a);break e}else if(f===O){n.tag=14,n=fv(null,n,e,l,a);break e}}throw n=Z(e)||e,Error(r(306,n,""))}}return n;case 0:return Vu(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=fi(l,n.pendingProps),yv(e,n,l,f,a);case 3:e:{if(Oe(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var h=n.memoizedState;f=h.element,gu(e,n),lr(n,l,null,a);var x=n.memoizedState;if(l=x.cache,_a(n,Ut,l),l!==h.cache&&du(n,[Ut],a,!0),rr(),l=x.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=bv(e,n,l,a);break e}else if(l!==f){f=Gn(Error(r(424)),n),tr(f),n=bv(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(bt=Jn(e.firstChild),ln=n,Ye=!0,ya=null,Zn=!0,a=mg(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ai(),l===f){n=Fs(e,n,a);break e}dn(e,n,l,a)}n=n.child}return n;case 26:return Yl(e,n),e===null?(a=I0(n.type,null,n.pendingProps,null))?n.memoizedState=a:Ye||(a=n.type,e=n.pendingProps,l=fc(yt.current).createElement(a),l[rn]=n,l[xn]=e,un(l,a,e),en(l),n.stateNode=l):n.memoizedState=I0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Nt(n),e===null&&Ye&&(l=n.stateNode=D0(n.type,n.pendingProps,yt.current),ln=n,Zn=!0,f=bt,Ra(n.type)?(Af=f,bt=Jn(l.firstChild)):bt=f),dn(e,n,n.pendingProps.children,a),Yl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ye&&((f=l=bt)&&(l=FS(l,n.type,n.pendingProps,Zn),l!==null?(n.stateNode=l,ln=n,bt=Jn(l.firstChild),Zn=!1,f=!0):f=!1),f||ba(n)),Nt(n),f=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,l=h.children,Tf(f,h)?l=null:x!==null&&Tf(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=Su(e,n,rS,null,null,a),Cr._currentValue=f),Yl(e,n),dn(e,n,l,a),n.child;case 6:return e===null&&Ye&&((e=a=bt)&&(a=KS(a,n.pendingProps,Zn),a!==null?(n.stateNode=a,ln=n,bt=null,e=!0):e=!1),e||ba(n)),null;case 13:return _v(e,n,a);case 4:return Oe(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=di(n,null,l,a):dn(e,n,l,a),n.child;case 11:return uv(e,n,n.type,n.pendingProps,a);case 7:return dn(e,n,n.pendingProps,a),n.child;case 8:return dn(e,n,n.pendingProps.children,a),n.child;case 12:return dn(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,_a(n,n.type,l.value),dn(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,oi(n),f=cn(f),l=l(f),n.flags|=1,dn(e,n,l,a),n.child;case 14:return fv(e,n,n.type,n.pendingProps,a);case 15:return pv(e,n,n.type,n.pendingProps,a);case 19:return kv(e,n,a);case 31:return hS(e,n,a);case 22:return mv(e,n,a,n.pendingProps);case 24:return oi(n),l=cn(Ut),e===null?(f=pu(),f===null&&(f=gt,h=uu(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=a),f=h),n.memoizedState={parent:l,cache:f},hu(n),_a(n,Ut,f)):((e.lanes&a)!==0&&(gu(e,n),lr(n,null,null,a),rr()),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),_a(n,Ut,l)):(l=h.cache,_a(n,Ut,l),l!==f.cache&&du(n,[Ut],a,!0))),dn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Ks(e){e.flags|=4}function Wu(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(Jv())e.flags|=8192;else throw ci=Il,mu}else e.flags&=-16777217}function jv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!$0(n))if(Jv())e.flags|=8192;else throw ci=Il,mu}function Wl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?je():536870912,e.lanes|=n,po|=n)}function mr(e,n){if(!Ye)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 _t(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(n)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,n}function vS(e,n,a){var l=n.pendingProps;switch(iu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(n),null;case 1:return _t(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Vs(Ut),Ht(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Qi(n)?Ks(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,ru())),_t(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(Ks(n),h!==null?(_t(n),jv(n,h)):(_t(n),Wu(n,f,null,l,a))):h?h!==e.memoizedState?(Ks(n),_t(n),jv(n,h)):(_t(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Ks(n),_t(n),Wu(n,f,e,l,a)),null;case 27:if(ue(n),a=yt.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Ks(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return _t(n),null}e=De.current,Qi(n)?sg(n):(e=D0(f,l,a),n.stateNode=e,Ks(n))}return _t(n),null;case 5:if(ue(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Ks(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return _t(n),null}if(h=De.current,Qi(n))sg(n);else{var x=fc(yt.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?x.createElement(f,{is:l.is}):x.createElement(f)}}h[rn]=n,h[xn]=l;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(un(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&&Ks(n)}}return _t(n),Wu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Ks(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=yt.current,Qi(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=ln,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[rn]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||_0(e.nodeValue,a)),e||ba(n,!0)}else e=fc(e).createTextNode(l),e[rn]=n,n.stateNode=e}return _t(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=Qi(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[rn]=n}else ai(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;_t(n),e=!1}else a=ru(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Mn(n),n):(Mn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return _t(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=Qi(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[rn]=n}else ai(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;_t(n),f=!1}else f=ru(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Mn(n),n):(Mn(n),null)}return Mn(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),Wl(n,n.updateQueue),_t(n),null);case 4:return Ht(),e===null&&_f(n.stateNode.containerInfo),_t(n),null;case 10:return Vs(n.type),_t(n),null;case 19:if(me(Rt),l=n.memoizedState,l===null)return _t(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)mr(l,!1);else{if(Dt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=zl(e),h!==null){for(n.flags|=128,mr(l,!1),e=h.updateQueue,n.updateQueue=e,Wl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Xh(a,e),a=a.sibling;return ke(Rt,Rt.current&1|2),Ye&&Ps(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Wt()>nc&&(n.flags|=128,f=!0,mr(l,!1),n.lanes=4194304)}else{if(!f)if(e=zl(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Wl(n,e),mr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Ye)return _t(n),null}else 2*Wt()-l.renderingStartTime>nc&&a!==536870912&&(n.flags|=128,f=!0,mr(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=Wt(),e.sibling=null,a=Rt.current,ke(Rt,f?a&1|2:a&1),Ye&&Ps(n,l.treeForkCount),e):(_t(n),null);case 22:case 23:return Mn(n),_u(),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&&(_t(n),n.subtreeFlags&6&&(n.flags|=8192)):_t(n),a=n.updateQueue,a!==null&&Wl(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&&me(ri),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Vs(Ut),_t(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function yS(e,n){switch(iu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Vs(Ut),Ht(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ue(n),null;case 31:if(n.memoizedState!==null){if(Mn(n),n.alternate===null)throw Error(r(340));ai()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Mn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ai()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return me(Rt),null;case 4:return Ht(),null;case 10:return Vs(n.type),null;case 22:case 23:return Mn(n),_u(),e!==null&&me(ri),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Vs(Ut),null;case 25:return null;default:return null}}function Tv(e,n){switch(iu(n),n.tag){case 3:Vs(Ut),Ht();break;case 26:case 27:case 5:ue(n);break;case 4:Ht();break;case 31:n.memoizedState!==null&&Mn(n);break;case 13:Mn(n);break;case 19:me(Rt);break;case 10:Vs(n.type);break;case 22:case 23:Mn(n),_u(),e!==null&&me(ri);break;case 24:Vs(Ut)}}function hr(e,n){try{var a=n.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var h=a.create,x=a.inst;l=h(),x.destroy=l}a=a.next}while(a!==f)}}catch(N){dt(n,n.return,N)}}function wa(e,n,a){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var x=l.inst,N=x.destroy;if(N!==void 0){x.destroy=void 0,f=n;var I=a,G=N;try{G()}catch(X){dt(f,I,X)}}}l=l.next}while(l!==h)}}catch(X){dt(n,n.return,X)}}function wv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{gg(n,a)}catch(l){dt(e,e.return,l)}}}function Nv(e,n,a){a.props=fi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){dt(e,n,l)}}function gr(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){dt(e,n,f)}}function ws(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){dt(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){dt(e,n,f)}else a.current=null}function Cv(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){dt(e,e.return,f)}}function Xu(e,n,a){try{var l=e.stateNode;HS(l,e.type,a,n),l[xn]=n}catch(f){dt(e,e.return,f)}}function Ev(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ra(e.type)||e.tag===4}function Qu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ev(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&&Ra(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 ef(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=zs));else if(l!==4&&(l===27&&Ra(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(ef(e,n,a),e=e.sibling;e!==null;)ef(e,n,a),e=e.sibling}function Xl(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&&Ra(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Xl(e,n,a),e=e.sibling;e!==null;)Xl(e,n,a),e=e.sibling}function Av(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);un(n,l,a),n[rn]=e,n[xn]=a}catch(h){dt(e,e.return,h)}}var Zs=!1,Gt=!1,tf=!1,Dv=typeof WeakSet=="function"?WeakSet:Set,tn=null;function bS(e,n){if(e=e.containerInfo,Sf=bc,e=Vh(e),Zd(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var x=0,N=-1,I=-1,G=0,X=0,ie=e,K=null;t:for(;;){for(var J;ie!==a||f!==0&&ie.nodeType!==3||(N=x+f),ie!==h||l!==0&&ie.nodeType!==3||(I=x+l),ie.nodeType===3&&(x+=ie.nodeValue.length),(J=ie.firstChild)!==null;)K=ie,ie=J;for(;;){if(ie===e)break t;if(K===a&&++G===f&&(N=x),K===h&&++X===l&&(I=x),(J=ie.nextSibling)!==null)break;ie=K,K=ie.parentNode}ie=J}a=N===-1||I===-1?null:{start:N,end:I}}else a=null}a=a||{start:0,end:0}}else a=null;for(jf={focusedElem:e,selectionRange:a},bc=!1,tn=n;tn!==null;)if(n=tn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,tn=e;else for(;tn!==null;){switch(n=tn,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=fi(a.type,f);e=l.getSnapshotBeforeUpdate(xe,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){dt(a,a.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Nf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Nf(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,tn=e;break}tn=n.return}}function Mv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Js(e,a),l&4&&hr(5,a);break;case 1:if(Js(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){dt(a,a.return,x)}else{var f=fi(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){dt(a,a.return,x)}}l&64&&wv(a),l&512&&gr(a,a.return);break;case 3:if(Js(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{gg(e,n)}catch(x){dt(a,a.return,x)}}break;case 27:n===null&&l&4&&Av(a);case 26:case 5:Js(e,a),n===null&&l&4&&Cv(a),l&512&&gr(a,a.return);break;case 12:Js(e,a);break;case 31:Js(e,a),l&4&&Ov(e,a);break;case 13:Js(e,a),l&4&&Bv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=CS.bind(null,a),ZS(e,a))));break;case 22:if(l=a.memoizedState!==null||Zs,!l){n=n!==null&&n.memoizedState!==null||Gt,f=Zs;var h=Gt;Zs=l,(Gt=n)&&!h?Ws(e,a,(a.subtreeFlags&8772)!==0):Js(e,a),Zs=f,Gt=h}break;case 30:break;default:Js(e,a)}}function Rv(e){var n=e.alternate;n!==null&&(e.alternate=null,Rv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Dd(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 jt=null,Sn=!1;function Ys(e,n,a){for(a=a.child;a!==null;)Iv(e,n,a),a=a.sibling}function Iv(e,n,a){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(mn,a)}catch{}switch(a.tag){case 26:Gt||ws(a,n),Ys(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Gt||ws(a,n);var l=jt,f=Sn;Ra(a.type)&&(jt=a.stateNode,Sn=!1),Ys(e,n,a),Tr(a.stateNode),jt=l,Sn=f;break;case 5:Gt||ws(a,n);case 6:if(l=jt,f=Sn,jt=null,Ys(e,n,a),jt=l,Sn=f,jt!==null)if(Sn)try{(jt.nodeType===9?jt.body:jt.nodeName==="HTML"?jt.ownerDocument.body:jt).removeChild(a.stateNode)}catch(h){dt(a,n,h)}else try{jt.removeChild(a.stateNode)}catch(h){dt(a,n,h)}break;case 18:jt!==null&&(Sn?(e=jt,w0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),xo(e)):w0(jt,a.stateNode));break;case 4:l=jt,f=Sn,jt=a.stateNode.containerInfo,Sn=!0,Ys(e,n,a),jt=l,Sn=f;break;case 0:case 11:case 14:case 15:wa(2,a,n),Gt||wa(4,a,n),Ys(e,n,a);break;case 1:Gt||(ws(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Nv(a,n,l)),Ys(e,n,a);break;case 21:Ys(e,n,a);break;case 22:Gt=(l=Gt)||a.memoizedState!==null,Ys(e,n,a),Gt=l;break;default:Ys(e,n,a)}}function Ov(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{xo(e)}catch(a){dt(n,n.return,a)}}}function Bv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{xo(e)}catch(a){dt(n,n.return,a)}}function _S(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Dv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Dv),n;default:throw Error(r(435,e.tag))}}function Ql(e,n){var a=_S(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=ES.bind(null,e,l);l.then(f,f)}})}function jn(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],h=e,x=n,N=x;e:for(;N!==null;){switch(N.tag){case 27:if(Ra(N.type)){jt=N.stateNode,Sn=!1;break e}break;case 5:jt=N.stateNode,Sn=!1;break e;case 3:case 4:jt=N.stateNode.containerInfo,Sn=!0;break e}N=N.return}if(jt===null)throw Error(r(160));Iv(h,x,f),jt=null,Sn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Lv(n,e),n=n.sibling}var ds=null;function Lv(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:jn(n,e),Tn(e),l&4&&(wa(3,e,e.return),hr(3,e),wa(5,e,e.return));break;case 1:jn(n,e),Tn(e),l&512&&(Gt||a===null||ws(a,a.return)),l&64&&Zs&&(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=ds;if(jn(n,e),Tn(e),l&512&&(Gt||a===null||ws(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[Vo]||h[rn]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),un(h,l,a),h[rn]=e,en(h),l=h;break e;case"link":var x=L0("link","href",f).get(l+(a.href||""));if(x){for(var N=0;N<x.length;N++)if(h=x[N],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(N,1);break t}}h=f.createElement(l),un(h,l,a),f.head.appendChild(h);break;case"meta":if(x=L0("meta","content",f).get(l+(a.content||""))){for(N=0;N<x.length;N++)if(h=x[N],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(N,1);break t}}h=f.createElement(l),un(h,l,a),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[rn]=e,en(h),l=h}e.stateNode=l}else z0(f,e.type,e.stateNode);else e.stateNode=B0(f,l,e.memoizedProps);else h!==l?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,l===null?z0(f,e.type,e.stateNode):B0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Xu(e,e.memoizedProps,a.memoizedProps)}break;case 27:jn(n,e),Tn(e),l&512&&(Gt||a===null||ws(a,a.return)),a!==null&&l&4&&Xu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(jn(n,e),Tn(e),l&512&&(Gt||a===null||ws(a,a.return)),e.flags&32){f=e.stateNode;try{Vi(f,"")}catch(xe){dt(e,e.return,xe)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,Xu(e,f,a!==null?a.memoizedProps:f)),l&1024&&(tf=!0);break;case 6:if(jn(n,e),Tn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(xe){dt(e,e.return,xe)}}break;case 3:if(hc=null,f=ds,ds=pc(n.containerInfo),jn(n,e),ds=f,Tn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{xo(n.containerInfo)}catch(xe){dt(e,e.return,xe)}tf&&(tf=!1,zv(e));break;case 4:l=ds,ds=pc(e.stateNode.containerInfo),jn(n,e),Tn(e),ds=l;break;case 12:jn(n,e),Tn(e);break;case 31:jn(n,e),Tn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ql(e,l)));break;case 13:jn(n,e),Tn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(tc=Wt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ql(e,l)));break;case 22:f=e.memoizedState!==null;var I=a!==null&&a.memoizedState!==null,G=Zs,X=Gt;if(Zs=G||f,Gt=X||I,jn(n,e),Gt=X,Zs=G,Tn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||I||Zs||Gt||pi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){I=a=n;try{if(h=I.stateNode,f)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{N=I.stateNode;var ie=I.memoizedProps.style,K=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;N.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(xe){dt(I,I.return,xe)}}}else if(n.tag===6){if(a===null){I=n;try{I.stateNode.nodeValue=f?"":I.memoizedProps}catch(xe){dt(I,I.return,xe)}}}else if(n.tag===18){if(a===null){I=n;try{var J=I.stateNode;f?N0(J,!0):N0(I.stateNode,!1)}catch(xe){dt(I,I.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,Ql(e,a))));break;case 19:jn(n,e),Tn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ql(e,l)));break;case 30:break;case 21:break;default:jn(n,e),Tn(e)}}function Tn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(Ev(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,h=Qu(e);Xl(e,h,f);break;case 5:var x=a.stateNode;a.flags&32&&(Vi(x,""),a.flags&=-33);var N=Qu(e);Xl(e,N,x);break;case 3:case 4:var I=a.stateNode.containerInfo,G=Qu(e);ef(e,G,I);break;default:throw Error(r(161))}}catch(X){dt(e,e.return,X)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function zv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;zv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Js(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Mv(e,n.alternate,n),n=n.sibling}function pi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:wa(4,n,n.return),pi(n);break;case 1:ws(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Nv(n,n.return,a),pi(n);break;case 27:Tr(n.stateNode);case 26:case 5:ws(n,n.return),pi(n);break;case 22:n.memoizedState===null&&pi(n);break;case 30:pi(n);break;default:pi(n)}e=e.sibling}}function Ws(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:Ws(f,h,a),hr(4,h);break;case 1:if(Ws(f,h,a),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(G){dt(l,l.return,G)}if(l=h,f=l.updateQueue,f!==null){var N=l.stateNode;try{var I=f.shared.hiddenCallbacks;if(I!==null)for(f.shared.hiddenCallbacks=null,f=0;f<I.length;f++)hg(I[f],N)}catch(G){dt(l,l.return,G)}}a&&x&64&&wv(h),gr(h,h.return);break;case 27:Av(h);case 26:case 5:Ws(f,h,a),a&&l===null&&x&4&&Cv(h),gr(h,h.return);break;case 12:Ws(f,h,a);break;case 31:Ws(f,h,a),a&&x&4&&Ov(f,h);break;case 13:Ws(f,h,a),a&&x&4&&Bv(f,h);break;case 22:h.memoizedState===null&&Ws(f,h,a),gr(h,h.return);break;case 30:break;default:Ws(f,h,a)}n=n.sibling}}function nf(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&&nr(a))}function sf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&nr(e))}function us(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)$v(e,n,a,l),n=n.sibling}function $v(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:us(e,n,a,l),f&2048&&hr(9,n);break;case 1:us(e,n,a,l);break;case 3:us(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&&nr(e)));break;case 12:if(f&2048){us(e,n,a,l),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,N=h.onPostCommit;typeof N=="function"&&N(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(I){dt(n,n.return,I)}}else us(e,n,a,l);break;case 31:us(e,n,a,l);break;case 13:us(e,n,a,l);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?us(e,n,a,l):vr(e,n):h._visibility&2?us(e,n,a,l):(h._visibility|=2,co(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&nf(x,n);break;case 24:us(e,n,a,l),f&2048&&sf(n.alternate,n);break;default:us(e,n,a,l)}}function co(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,N=a,I=l,G=x.flags;switch(x.tag){case 0:case 11:case 15:co(h,x,N,I,f),hr(8,x);break;case 23:break;case 22:var X=x.stateNode;x.memoizedState!==null?X._visibility&2?co(h,x,N,I,f):vr(h,x):(X._visibility|=2,co(h,x,N,I,f)),f&&G&2048&&nf(x.alternate,x);break;case 24:co(h,x,N,I,f),f&&G&2048&&sf(x.alternate,x);break;default:co(h,x,N,I,f)}n=n.sibling}}function vr(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:vr(a,l),f&2048&&nf(l.alternate,l);break;case 24:vr(a,l),f&2048&&sf(l.alternate,l);break;default:vr(a,l)}n=n.sibling}}var yr=8192;function uo(e,n,a){if(e.subtreeFlags&yr)for(e=e.child;e!==null;)Hv(e,n,a),e=e.sibling}function Hv(e,n,a){switch(e.tag){case 26:uo(e,n,a),e.flags&yr&&e.memoizedState!==null&&o2(a,ds,e.memoizedState,e.memoizedProps);break;case 5:uo(e,n,a);break;case 3:case 4:var l=ds;ds=pc(e.stateNode.containerInfo),uo(e,n,a),ds=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=yr,yr=16777216,uo(e,n,a),yr=l):uo(e,n,a));break;default:uo(e,n,a)}}function Pv(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 br(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];tn=l,Vv(l,e)}Pv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Uv(e),e=e.sibling}function Uv(e){switch(e.tag){case 0:case 11:case 15:br(e),e.flags&2048&&wa(9,e,e.return);break;case 3:br(e);break;case 12:br(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,ec(e)):br(e);break;default:br(e)}}function ec(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];tn=l,Vv(l,e)}Pv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:wa(8,n,n.return),ec(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,ec(n));break;default:ec(n)}e=e.sibling}}function Vv(e,n){for(;tn!==null;){var a=tn;switch(a.tag){case 0:case 11:case 15:wa(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:nr(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,tn=l;else e:for(a=e;tn!==null;){l=tn;var f=l.sibling,h=l.return;if(Rv(l),l===a){tn=null;break e}if(f!==null){f.return=h,tn=f;break e}tn=h}}}var xS={getCacheForType:function(e){var n=cn(Ut),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return cn(Ut).controller.signal}},kS=typeof WeakMap=="function"?WeakMap:Map,rt=0,gt=null,Ve=null,Fe=0,ct=0,Rn=null,Na=!1,fo=!1,af=!1,Xs=0,Dt=0,Ca=0,mi=0,of=0,In=0,po=0,_r=null,wn=null,rf=!1,tc=0,qv=0,nc=1/0,sc=null,Ea=null,Ft=0,Aa=null,mo=null,Qs=0,lf=0,cf=null,Gv=null,xr=0,df=null;function On(){return(rt&2)!==0&&Fe!==0?Fe&-Fe:H.T!==null?gf():Ss()}function Fv(){if(In===0)if((Fe&536870912)===0||Ye){var e=U;U<<=1,(U&3932160)===0&&(U=262144),In=e}else In=536870912;return e=Dn.current,e!==null&&(e.flags|=32),In}function Nn(e,n,a){(e===gt&&(ct===2||ct===9)||e.cancelPendingCommit!==null)&&(ho(e,0),Da(e,Fe,In,!1)),Ge(e,a),((rt&2)===0||e!==gt)&&(e===gt&&((rt&2)===0&&(mi|=a),Dt===4&&Da(e,Fe,In,!1)),Ns(e))}function Kv(e,n,a){if((rt&6)!==0)throw Error(r(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ye(e,n),f=l?TS(e,n):ff(e,n,!0),h=l;do{if(f===0){fo&&!l&&Da(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!SS(a)){f=ff(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var N=e;f=_r;var I=N.current.memoizedState.isDehydrated;if(I&&(ho(N,x).flags|=256),x=ff(N,x,!1),x!==2){if(af&&!I){N.errorRecoveryDisabledLanes|=h,mi|=h,f=4;break e}h=wn,wn=f,h!==null&&(wn===null?wn=h:wn.push.apply(wn,h))}f=x}if(h=!1,f!==2)continue}}if(f===1){ho(e,0),Da(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:Da(l,n,In,!Na);break e;case 2:wn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=tc+300-Wt(),10<f)){if(Da(l,n,In,!Na),pe(l,0,!0)!==0)break e;Qs=n,l.timeoutHandle=j0(Zv.bind(null,l,a,wn,sc,rf,n,In,mi,po,Na,h,"Throttled",-0,0),f);break e}Zv(l,a,wn,sc,rf,n,In,mi,po,Na,h,null,-0,0)}}break}while(!0);Ns(e)}function Zv(e,n,a,l,f,h,x,N,I,G,X,ie,K,J){if(e.timeoutHandle=-1,ie=n.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zs},Hv(n,h,ie);var xe=(h&62914560)===h?tc-Wt():(h&4194048)===h?qv-Wt():0;if(xe=r2(ie,xe),xe!==null){Qs=h,e.cancelPendingCommit=xe(n0.bind(null,e,n,h,a,l,f,x,N,I,X,ie,null,K,J)),Da(e,h,x,!G);return}}n0(e,n,h,a,l,f,x,N,I)}function SS(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],h=f.getSnapshot;f=f.value;try{if(!En(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 Da(e,n,a,l){n&=~of,n&=~mi,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-Xt(f),x=1<<h;l[h]=-1,f&=~x}a!==0&&tt(e,a,n)}function ac(){return(rt&6)===0?(kr(0),!1):!0}function uf(){if(Ve!==null){if(ct===0)var e=Ve.return;else e=Ve,Us=ii=null,wu(e),ao=null,ar=0,e=Ve;for(;e!==null;)Tv(e.alternate,e),e=e.return;Ve=null}}function ho(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,VS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Qs=0,uf(),gt=e,Ve=a=Hs(e.current,null),Fe=n,ct=0,Rn=null,Na=!1,fo=ye(e,n),af=!1,po=In=of=mi=Ca=Dt=0,wn=_r=null,rf=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var f=31-Xt(l),h=1<<f;n|=e[f],l&=~h}return Xs=n,Tl(),a}function Yv(e,n){ze=null,H.H=fr,n===so||n===Rl?(n=ug(),ct=3):n===mu?(n=ug(),ct=4):ct=n===Uu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Rn=n,Ve===null&&(Dt=1,Kl(e,Gn(n,e.current)))}function Jv(){var e=Dn.current;return e===null?!0:(Fe&4194048)===Fe?Yn===null:(Fe&62914560)===Fe||(Fe&536870912)!==0?e===Yn:!1}function Wv(){var e=H.H;return H.H=fr,e===null?fr:e}function Xv(){var e=H.A;return H.A=xS,e}function ic(){Dt=4,Na||(Fe&4194048)!==Fe&&Dn.current!==null||(fo=!0),(Ca&134217727)===0&&(mi&134217727)===0||gt===null||Da(gt,Fe,In,!1)}function ff(e,n,a){var l=rt;rt|=2;var f=Wv(),h=Xv();(gt!==e||Fe!==n)&&(sc=null,ho(e,n)),n=!1;var x=Dt;e:do try{if(ct!==0&&Ve!==null){var N=Ve,I=Rn;switch(ct){case 8:uf(),x=6;break e;case 3:case 2:case 9:case 6:Dn.current===null&&(n=!0);var G=ct;if(ct=0,Rn=null,go(e,N,I,G),a&&fo){x=0;break e}break;default:G=ct,ct=0,Rn=null,go(e,N,I,G)}}jS(),x=Dt;break}catch(X){Yv(e,X)}while(!0);return n&&e.shellSuspendCounter++,Us=ii=null,rt=l,H.H=f,H.A=h,Ve===null&&(gt=null,Fe=0,Tl()),x}function jS(){for(;Ve!==null;)Qv(Ve)}function TS(e,n){var a=rt;rt|=2;var l=Wv(),f=Xv();gt!==e||Fe!==n?(sc=null,nc=Wt()+500,ho(e,n)):fo=ye(e,n);e:do try{if(ct!==0&&Ve!==null){n=Ve;var h=Rn;t:switch(ct){case 1:ct=0,Rn=null,go(e,n,h,1);break;case 2:case 9:if(cg(h)){ct=0,Rn=null,e0(n);break}n=function(){ct!==2&&ct!==9||gt!==e||(ct=7),Ns(e)},h.then(n,n);break e;case 3:ct=7;break e;case 4:ct=5;break e;case 7:cg(h)?(ct=0,Rn=null,e0(n)):(ct=0,Rn=null,go(e,n,h,7));break;case 5:var x=null;switch(Ve.tag){case 26:x=Ve.memoizedState;case 5:case 27:var N=Ve;if(x?$0(x):N.stateNode.complete){ct=0,Rn=null;var I=N.sibling;if(I!==null)Ve=I;else{var G=N.return;G!==null?(Ve=G,oc(G)):Ve=null}break t}}ct=0,Rn=null,go(e,n,h,5);break;case 6:ct=0,Rn=null,go(e,n,h,6);break;case 8:uf(),Dt=6;break e;default:throw Error(r(462))}}wS();break}catch(X){Yv(e,X)}while(!0);return Us=ii=null,H.H=l,H.A=f,rt=a,Ve!==null?0:(gt=null,Fe=0,Tl(),Dt)}function wS(){for(;Ve!==null&&!pa();)Qv(Ve)}function Qv(e){var n=Sv(e.alternate,e,Xs);e.memoizedProps=e.pendingProps,n===null?oc(e):Ve=n}function e0(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=vv(a,n,n.pendingProps,n.type,void 0,Fe);break;case 11:n=vv(a,n,n.pendingProps,n.type.render,n.ref,Fe);break;case 5:wu(n);default:Tv(a,n),n=Ve=Xh(n,Xs),n=Sv(a,n,Xs)}e.memoizedProps=e.pendingProps,n===null?oc(e):Ve=n}function go(e,n,a,l){Us=ii=null,wu(n),ao=null,ar=0;var f=n.return;try{if(mS(e,f,n,a,Fe)){Dt=1,Kl(e,Gn(a,e.current)),Ve=null;return}}catch(h){if(f!==null)throw Ve=f,h;Dt=1,Kl(e,Gn(a,e.current)),Ve=null;return}n.flags&32768?(Ye||l===1?e=!0:fo||(Fe&536870912)!==0?e=!1:(Na=e=!0,(l===2||l===9||l===3||l===6)&&(l=Dn.current,l!==null&&l.tag===13&&(l.flags|=16384))),t0(n,e)):oc(n)}function oc(e){var n=e;do{if((n.flags&32768)!==0){t0(n,Na);return}e=n.return;var a=vS(n.alternate,n,Xs);if(a!==null){Ve=a;return}if(n=n.sibling,n!==null){Ve=n;return}Ve=n=e}while(n!==null);Dt===0&&(Dt=5)}function t0(e,n){do{var a=yS(e.alternate,e);if(a!==null){a.flags&=32767,Ve=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Ve=e;return}Ve=e=a}while(e!==null);Dt=6,Ve=null}function n0(e,n,a,l,f,h,x,N,I){e.cancelPendingCommit=null;do rc();while(Ft!==0);if((rt&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=Qd,ht(e,a,h,x,N,I),e===gt&&(Ve=gt=null,Fe=0),mo=n,Aa=e,Qs=a,lf=h,cf=f,Gv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,AS(Bs,function(){return r0(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=H.T,H.T=null,f=B.p,B.p=2,x=rt,rt|=4;try{bS(e,n,a)}finally{rt=x,B.p=f,H.T=l}}Ft=1,s0(),a0(),i0()}}function s0(){if(Ft===1){Ft=0;var e=Aa,n=mo,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=H.T,H.T=null;var l=B.p;B.p=2;var f=rt;rt|=4;try{Lv(n,e);var h=jf,x=Vh(e.containerInfo),N=h.focusedElem,I=h.selectionRange;if(x!==N&&N&&N.ownerDocument&&Uh(N.ownerDocument.documentElement,N)){if(I!==null&&Zd(N)){var G=I.start,X=I.end;if(X===void 0&&(X=G),"selectionStart"in N)N.selectionStart=G,N.selectionEnd=Math.min(X,N.value.length);else{var ie=N.ownerDocument||document,K=ie&&ie.defaultView||window;if(K.getSelection){var J=K.getSelection(),xe=N.textContent.length,Ce=Math.min(I.start,xe),mt=I.end===void 0?Ce:Math.min(I.end,xe);!J.extend&&Ce>mt&&(x=mt,mt=Ce,Ce=x);var P=Ph(N,Ce),z=Ph(N,mt);if(P&&z&&(J.rangeCount!==1||J.anchorNode!==P.node||J.anchorOffset!==P.offset||J.focusNode!==z.node||J.focusOffset!==z.offset)){var q=ie.createRange();q.setStart(P.node,P.offset),J.removeAllRanges(),Ce>mt?(J.addRange(q),J.extend(z.node,z.offset)):(q.setEnd(z.node,z.offset),J.addRange(q))}}}}for(ie=[],J=N;J=J.parentNode;)J.nodeType===1&&ie.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ie.length;N++){var te=ie[N];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}bc=!!Sf,jf=Sf=null}finally{rt=f,B.p=l,H.T=a}}e.current=n,Ft=2}}function a0(){if(Ft===2){Ft=0;var e=Aa,n=mo,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=H.T,H.T=null;var l=B.p;B.p=2;var f=rt;rt|=4;try{Mv(e,n.alternate,n)}finally{rt=f,B.p=l,H.T=a}}Ft=3}}function i0(){if(Ft===4||Ft===3){Ft=0,Mi();var e=Aa,n=mo,a=Qs,l=Gv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ft=5:(Ft=0,mo=Aa=null,o0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Ea=null),ks(a),n=n.stateNode,Pt&&typeof Pt.onCommitFiberRoot=="function")try{Pt.onCommitFiberRoot(mn,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=H.T,f=B.p,B.p=2,H.T=null;try{for(var h=e.onRecoverableError,x=0;x<l.length;x++){var N=l[x];h(N.value,{componentStack:N.stack})}}finally{H.T=n,B.p=f}}(Qs&3)!==0&&rc(),Ns(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===df?xr++:(xr=0,df=e):xr=0,kr(0)}}function o0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,nr(n)))}function rc(){return s0(),a0(),i0(),r0()}function r0(){if(Ft!==5)return!1;var e=Aa,n=lf;lf=0;var a=ks(Qs),l=H.T,f=B.p;try{B.p=32>a?32:a,H.T=null,a=cf,cf=null;var h=Aa,x=Qs;if(Ft=0,mo=Aa=null,Qs=0,(rt&6)!==0)throw Error(r(331));var N=rt;if(rt|=4,Uv(h.current),$v(h,h.current,x,a),rt=N,kr(0,!1),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(mn,h)}catch{}return!0}finally{B.p=f,H.T=l,o0(e,n)}}function l0(e,n,a){n=Gn(a,n),n=Pu(e.stateNode,n,2),e=Sa(e,n,2),e!==null&&(Ge(e,2),Ns(e))}function dt(e,n,a){if(e.tag===3)l0(e,e,a);else for(;n!==null;){if(n.tag===3){l0(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ea===null||!Ea.has(l))){e=Gn(a,e),a=cv(2),l=Sa(n,a,2),l!==null&&(dv(a,l,n,e),Ge(l,2),Ns(l));break}}n=n.return}}function pf(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new kS;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(a)||(af=!0,f.add(a),e=NS.bind(null,e,n,a),n.then(e,e))}function NS(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,gt===e&&(Fe&a)===a&&(Dt===4||Dt===3&&(Fe&62914560)===Fe&&300>Wt()-tc?(rt&2)===0&&ho(e,0):of|=a,po===Fe&&(po=0)),Ns(e)}function c0(e,n){n===0&&(n=je()),e=ni(e,n),e!==null&&(Ge(e,n),Ns(e))}function CS(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),c0(e,a)}function ES(e,n){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(n),c0(e,a)}function AS(e,n){return ls(e,n)}var lc=null,vo=null,mf=!1,cc=!1,hf=!1,Ma=0;function Ns(e){e!==vo&&e.next===null&&(vo===null?lc=vo=e:vo=vo.next=e),cc=!0,mf||(mf=!0,MS())}function kr(e,n){if(!hf&&cc){hf=!0;do for(var a=!1,l=lc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var x=l.suspendedLanes,N=l.pingedLanes;h=(1<<31-Xt(42|e)+1)-1,h&=f&~(x&~N),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,p0(l,h))}else h=Fe,h=pe(l,l===gt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||ye(l,h)||(a=!0,p0(l,h));l=l.next}while(a);hf=!1}}function DS(){d0()}function d0(){cc=mf=!1;var e=0;Ma!==0&&US()&&(e=Ma);for(var n=Wt(),a=null,l=lc;l!==null;){var f=l.next,h=u0(l,n);h===0?(l.next=null,a===null?lc=f:a.next=f,f===null&&(vo=a)):(a=l,(e!==0||(h&3)!==0)&&(cc=!0)),l=f}Ft!==0&&Ft!==5||kr(e),Ma!==0&&(Ma=0)}function u0(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-Xt(h),N=1<<x,I=f[x];I===-1?((N&a)===0||(N&l)!==0)&&(f[x]=Qe(N,n)):I<=n&&(e.expiredLanes|=N),h&=~N}if(n=gt,a=Fe,a=pe(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(ct===2||ct===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Os(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ye(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&Os(l),ks(a)){case 2:case 8:a=ma;break;case 32:a=Bs;break;case 268435456:a=Ne;break;default:a=Bs}return l=f0.bind(null,e),a=ls(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&Os(l),e.callbackPriority=2,e.callbackNode=null,2}function f0(e,n){if(Ft!==0&&Ft!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(rc()&&e.callbackNode!==a)return null;var l=Fe;return l=pe(e,e===gt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Kv(e,l,n),u0(e,Wt()),e.callbackNode!=null&&e.callbackNode===a?f0.bind(null,e):null)}function p0(e,n){if(rc())return null;Kv(e,n,!0)}function MS(){qS(function(){(rt&6)!==0?ls(Wa,DS):d0()})}function gf(){if(Ma===0){var e=to;e===0&&(e=Oi,Oi<<=1,(Oi&261888)===0&&(Oi=256)),Ma=e}return Ma}function m0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:vl(""+e)}function h0(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function RS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var h=m0((f[xn]||null).action),x=l.submitter;x&&(n=(n=x[xn]||null)?m0(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var N=new xl("action","action",null,l,f);e.push({event:N,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ma!==0){var I=x?h0(f,x):new FormData(f);Ou(a,{pending:!0,data:I,method:f.method,action:h},null,I)}}else typeof h=="function"&&(N.preventDefault(),I=x?h0(f,x):new FormData(f),Ou(a,{pending:!0,data:I,method:f.method,action:h},h,I))},currentTarget:f}]})}}for(var vf=0;vf<Xd.length;vf++){var yf=Xd[vf],IS=yf.toLowerCase(),OS=yf[0].toUpperCase()+yf.slice(1);cs(IS,"on"+OS)}cs(Fh,"onAnimationEnd"),cs(Kh,"onAnimationIteration"),cs(Zh,"onAnimationStart"),cs("dblclick","onDoubleClick"),cs("focusin","onFocus"),cs("focusout","onBlur"),cs(Wk,"onTransitionRun"),cs(Xk,"onTransitionStart"),cs(Qk,"onTransitionCancel"),cs(Yh,"onTransitionEnd"),Pi("onMouseEnter",["mouseout","mouseover"]),Pi("onMouseLeave",["mouseout","mouseover"]),Pi("onPointerEnter",["pointerout","pointerover"]),Pi("onPointerLeave",["pointerout","pointerover"]),Xa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Sr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),BS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Sr));function g0(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var x=l.length-1;0<=x;x--){var N=l[x],I=N.instance,G=N.currentTarget;if(N=N.listener,I!==h&&f.isPropagationStopped())break e;h=N,f.currentTarget=G;try{h(f)}catch(X){jl(X)}f.currentTarget=null,h=I}else for(x=0;x<l.length;x++){if(N=l[x],I=N.instance,G=N.currentTarget,N=N.listener,I!==h&&f.isPropagationStopped())break e;h=N,f.currentTarget=G;try{h(f)}catch(X){jl(X)}f.currentTarget=null,h=I}}}}function qe(e,n){var a=n[Ad];a===void 0&&(a=n[Ad]=new Set);var l=e+"__bubble";a.has(l)||(v0(n,e,2,!1),a.add(l))}function bf(e,n,a){var l=0;n&&(l|=4),v0(a,e,l,n)}var dc="_reactListening"+Math.random().toString(36).slice(2);function _f(e){if(!e[dc]){e[dc]=!0,dh.forEach(function(a){a!=="selectionchange"&&(BS.has(a)||bf(a,!1,e),bf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[dc]||(n[dc]=!0,bf("selectionchange",!1,n))}}function v0(e,n,a,l){switch(F0(n)){case 2:var f=d2;break;case 8:f=u2;break;default:f=Of}a=f.bind(null,n,a,e),f=void 0,!$d||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 xf(e,n,a,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var N=l.stateNode.containerInfo;if(N===f)break;if(x===4)for(x=l.return;x!==null;){var I=x.tag;if((I===3||I===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;N!==null;){if(x=zi(N),x===null)return;if(I=x.tag,I===5||I===6||I===26||I===27){l=h=x;continue e}N=N.parentNode}}l=l.return}kh(function(){var G=h,X=Ld(a),ie=[];e:{var K=Jh.get(e);if(K!==void 0){var J=xl,xe=e;switch(e){case"keypress":if(bl(a)===0)break e;case"keydown":case"keyup":J=Ek;break;case"focusin":xe="focus",J=Vd;break;case"focusout":xe="blur",J=Vd;break;case"beforeblur":case"afterblur":J=Vd;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":J=Th;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=vk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=Mk;break;case Fh:case Kh:case Zh:J=_k;break;case Yh:J=Ik;break;case"scroll":case"scrollend":J=hk;break;case"wheel":J=Bk;break;case"copy":case"cut":case"paste":J=kk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=Nh;break;case"toggle":case"beforetoggle":J=zk}var Ce=(n&4)!==0,mt=!Ce&&(e==="scroll"||e==="scrollend"),P=Ce?K!==null?K+"Capture":null:K;Ce=[];for(var z=G,q;z!==null;){var te=z;if(q=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||q===null||P===null||(te=Go(z,P),te!=null&&Ce.push(jr(z,te,q))),mt)break;z=z.return}0<Ce.length&&(K=new J(K,xe,null,a,X),ie.push({event:K,listeners:Ce}))}}if((n&7)===0){e:{if(K=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",K&&a!==Bd&&(xe=a.relatedTarget||a.fromElement)&&(zi(xe)||xe[Li]))break e;if((J||K)&&(K=X.window===X?X:(K=X.ownerDocument)?K.defaultView||K.parentWindow:window,J?(xe=a.relatedTarget||a.toElement,J=G,xe=xe?zi(xe):null,xe!==null&&(mt=d(xe),Ce=xe.tag,xe!==mt||Ce!==5&&Ce!==27&&Ce!==6)&&(xe=null)):(J=null,xe=G),J!==xe)){if(Ce=Th,te="onMouseLeave",P="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=Nh,te="onPointerLeave",P="onPointerEnter",z="pointer"),mt=J==null?K:qo(J),q=xe==null?K:qo(xe),K=new Ce(te,z+"leave",J,a,X),K.target=mt,K.relatedTarget=q,te=null,zi(X)===G&&(Ce=new Ce(P,z+"enter",xe,a,X),Ce.target=q,Ce.relatedTarget=mt,te=Ce),mt=te,J&&xe)t:{for(Ce=LS,P=J,z=xe,q=0,te=P;te;te=Ce(te))q++;te=0;for(var we=z;we;we=Ce(we))te++;for(;0<q-te;)P=Ce(P),q--;for(;0<te-q;)z=Ce(z),te--;for(;q--;){if(P===z||z!==null&&P===z.alternate){Ce=P;break t}P=Ce(P),z=Ce(z)}Ce=null}else Ce=null;J!==null&&y0(ie,K,J,Ce,!1),xe!==null&&mt!==null&&y0(ie,mt,xe,Ce,!0)}}e:{if(K=G?qo(G):window,J=K.nodeName&&K.nodeName.toLowerCase(),J==="select"||J==="input"&&K.type==="file")var nt=Oh;else if(Rh(K))if(Bh)nt=Zk;else{nt=Fk;var Se=Gk}else J=K.nodeName,!J||J.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?G&&Od(G.elementType)&&(nt=Oh):nt=Kk;if(nt&&(nt=nt(e,G))){Ih(ie,nt,a,X);break e}Se&&Se(e,K,G),e==="focusout"&&G&&K.type==="number"&&G.memoizedProps.value!=null&&Id(K,"number",K.value)}switch(Se=G?qo(G):window,e){case"focusin":(Rh(Se)||Se.contentEditable==="true")&&(Ki=Se,Yd=G,Qo=null);break;case"focusout":Qo=Yd=Ki=null;break;case"mousedown":Jd=!0;break;case"contextmenu":case"mouseup":case"dragend":Jd=!1,qh(ie,a,X);break;case"selectionchange":if(Jk)break;case"keydown":case"keyup":qh(ie,a,X)}var He;if(Gd)e:{switch(e){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else Fi?Dh(e,a)&&(Ke="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ke="onCompositionStart");Ke&&(Ch&&a.locale!=="ko"&&(Fi||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&Fi&&(He=Sh()):(ga=X,Hd="value"in ga?ga.value:ga.textContent,Fi=!0)),Se=uc(G,Ke),0<Se.length&&(Ke=new wh(Ke,e,null,a,X),ie.push({event:Ke,listeners:Se}),He?Ke.data=He:(He=Mh(a),He!==null&&(Ke.data=He)))),(He=Hk?Pk(e,a):Uk(e,a))&&(Ke=uc(G,"onBeforeInput"),0<Ke.length&&(Se=new wh("onBeforeInput","beforeinput",null,a,X),ie.push({event:Se,listeners:Ke}),Se.data=He)),RS(ie,e,G,a,X)}g0(ie,n)})}function jr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function uc(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=Go(e,a),f!=null&&l.unshift(jr(e,f,h)),f=Go(e,n),f!=null&&l.push(jr(e,f,h))),e.tag===3)return l;e=e.return}return[]}function LS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function y0(e,n,a,l,f){for(var h=n._reactName,x=[];a!==null&&a!==l;){var N=a,I=N.alternate,G=N.stateNode;if(N=N.tag,I!==null&&I===l)break;N!==5&&N!==26&&N!==27||G===null||(I=G,f?(G=Go(a,h),G!=null&&x.unshift(jr(a,G,I))):f||(G=Go(a,h),G!=null&&x.push(jr(a,G,I)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var zS=/\r\n?/g,$S=/\u0000|\uFFFD/g;function b0(e){return(typeof e=="string"?e:""+e).replace(zS,`
26
+ `).replace($S,"")}function _0(e,n){return n=b0(n),b0(e)===n}function pt(e,n,a,l,f,h){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Vi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Vi(e,""+l);break;case"className":hl(e,"class",l);break;case"tabIndex":hl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":hl(e,a,l);break;case"style":_h(e,l,h);break;case"data":if(n!=="object"){hl(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=vl(""+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"&&pt(e,n,"name",f.name,f,null),pt(e,n,"formEncType",f.formEncType,f,null),pt(e,n,"formMethod",f.formMethod,f,null),pt(e,n,"formTarget",f.formTarget,f,null)):(pt(e,n,"encType",f.encType,f,null),pt(e,n,"method",f.method,f,null),pt(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=vl(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=zs);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("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=vl(""+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":qe("beforetoggle",e),qe("toggle",e),ml(e,"popover",l);break;case"xlinkActuate":Ls(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ls(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ls(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ls(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ls(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ls(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ls(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ls(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ls(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":ml(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=pk.get(a)||a,ml(e,a,l))}}function kf(e,n,a,l,f,h){switch(a){case"style":_h(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"?Vi(e,l):(typeof l=="number"||typeof l=="bigint")&&Vi(e,""+l);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=zs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!uh.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[xn]||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,""):ml(e,a,l)}}}function un(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var l=!1,f=!1,h;for(h in a)if(a.hasOwnProperty(h)){var x=a[h];if(x!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:pt(e,n,h,x,a,null)}}f&&pt(e,n,"srcSet",a.srcSet,a,null),l&&pt(e,n,"src",a.src,a,null);return;case"input":qe("invalid",e);var N=h=x=f=null,I=null,G=null;for(l in a)if(a.hasOwnProperty(l)){var X=a[l];if(X!=null)switch(l){case"name":f=X;break;case"type":x=X;break;case"checked":I=X;break;case"defaultChecked":G=X;break;case"value":h=X;break;case"defaultValue":N=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,n));break;default:pt(e,n,l,X,a,null)}}gh(e,h,N,I,G,x,f,!1);return;case"select":qe("invalid",e),l=x=h=null;for(f in a)if(a.hasOwnProperty(f)&&(N=a[f],N!=null))switch(f){case"value":h=N;break;case"defaultValue":x=N;break;case"multiple":l=N;default:pt(e,n,f,N,a,null)}n=h,a=x,e.multiple=!!l,n!=null?Ui(e,!!l,n,!1):a!=null&&Ui(e,!!l,a,!0);return;case"textarea":qe("invalid",e),h=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(N=a[x],N!=null))switch(x){case"value":l=N;break;case"defaultValue":f=N;break;case"children":h=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:pt(e,n,x,N,a,null)}yh(e,l,f,h);return;case"option":for(I in a)if(a.hasOwnProperty(I)&&(l=a[I],l!=null))switch(I){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:pt(e,n,I,l,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(l=0;l<Sr.length;l++)qe(Sr[l],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("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:pt(e,n,G,l,a,null)}return;default:if(Od(n)){for(X in a)a.hasOwnProperty(X)&&(l=a[X],l!==void 0&&kf(e,n,X,l,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(l=a[N],l!=null&&pt(e,n,N,l,a,null))}function HS(e,n,a,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,x=null,N=null,I=null,G=null,X=null;for(J in a){var ie=a[J];if(a.hasOwnProperty(J)&&ie!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":I=ie;default:l.hasOwnProperty(J)||pt(e,n,J,null,l,ie)}}for(var K in l){var J=l[K];if(ie=a[K],l.hasOwnProperty(K)&&(J!=null||ie!=null))switch(K){case"type":h=J;break;case"name":f=J;break;case"checked":G=J;break;case"defaultChecked":X=J;break;case"value":x=J;break;case"defaultValue":N=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:J!==ie&&pt(e,n,K,J,l,ie)}}Rd(e,x,N,I,G,X,h,f);return;case"select":J=x=N=K=null;for(h in a)if(I=a[h],a.hasOwnProperty(h)&&I!=null)switch(h){case"value":break;case"multiple":J=I;default:l.hasOwnProperty(h)||pt(e,n,h,null,l,I)}for(f in l)if(h=l[f],I=a[f],l.hasOwnProperty(f)&&(h!=null||I!=null))switch(f){case"value":K=h;break;case"defaultValue":N=h;break;case"multiple":x=h;default:h!==I&&pt(e,n,f,h,l,I)}n=N,a=x,l=J,K!=null?Ui(e,!!a,K,!1):!!l!=!!a&&(n!=null?Ui(e,!!a,n,!0):Ui(e,!!a,a?[]:"",!1));return;case"textarea":J=K=null;for(N in a)if(f=a[N],a.hasOwnProperty(N)&&f!=null&&!l.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:pt(e,n,N,null,l,f)}for(x in l)if(f=l[x],h=a[x],l.hasOwnProperty(x)&&(f!=null||h!=null))switch(x){case"value":K=f;break;case"defaultValue":J=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&pt(e,n,x,f,l,h)}vh(e,K,J);return;case"option":for(var xe in a)if(K=a[xe],a.hasOwnProperty(xe)&&K!=null&&!l.hasOwnProperty(xe))switch(xe){case"selected":e.selected=!1;break;default:pt(e,n,xe,null,l,K)}for(I in l)if(K=l[I],J=a[I],l.hasOwnProperty(I)&&K!==J&&(K!=null||J!=null))switch(I){case"selected":e.selected=K&&typeof K!="function"&&typeof K!="symbol";break;default:pt(e,n,I,K,l,J)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ce in a)K=a[Ce],a.hasOwnProperty(Ce)&&K!=null&&!l.hasOwnProperty(Ce)&&pt(e,n,Ce,null,l,K);for(G in l)if(K=l[G],J=a[G],l.hasOwnProperty(G)&&K!==J&&(K!=null||J!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,n));break;default:pt(e,n,G,K,l,J)}return;default:if(Od(n)){for(var mt in a)K=a[mt],a.hasOwnProperty(mt)&&K!==void 0&&!l.hasOwnProperty(mt)&&kf(e,n,mt,void 0,l,K);for(X in l)K=l[X],J=a[X],!l.hasOwnProperty(X)||K===J||K===void 0&&J===void 0||kf(e,n,X,K,l,J);return}}for(var P in a)K=a[P],a.hasOwnProperty(P)&&K!=null&&!l.hasOwnProperty(P)&&pt(e,n,P,null,l,K);for(ie in l)K=l[ie],J=a[ie],!l.hasOwnProperty(ie)||K===J||K==null&&J==null||pt(e,n,ie,K,l,J)}function x0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function PS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],h=f.transferSize,x=f.initiatorType,N=f.duration;if(h&&N&&x0(x)){for(x=0,N=f.responseEnd,l+=1;l<a.length;l++){var I=a[l],G=I.startTime;if(G>N)break;var X=I.transferSize,ie=I.initiatorType;X&&x0(ie)&&(I=I.responseEnd,x+=X*(I<N?1:(N-G)/(I-G)))}if(--l,n+=8*(h+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Sf=null,jf=null;function fc(e){return e.nodeType===9?e:e.ownerDocument}function k0(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 S0(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 Tf(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 wf=null;function US(){var e=window.event;return e&&e.type==="popstate"?e===wf?!1:(wf=e,!0):(wf=null,!1)}var j0=typeof setTimeout=="function"?setTimeout:void 0,VS=typeof clearTimeout=="function"?clearTimeout:void 0,T0=typeof Promise=="function"?Promise:void 0,qS=typeof queueMicrotask=="function"?queueMicrotask:typeof T0<"u"?function(e){return T0.resolve(null).then(e).catch(GS)}:j0;function GS(e){setTimeout(function(){throw e})}function Ra(e){return e==="head"}function w0(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),xo(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Tr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Tr(a);for(var h=a.firstChild;h;){var x=h.nextSibling,N=h.nodeName;h[Vo]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=x}}else a==="body"&&Tr(e.ownerDocument.body);a=f}while(a);xo(n)}function N0(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 Nf(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":Nf(a),Dd(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function FS(e,n,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Vo])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=Jn(e.nextSibling),e===null)break}return null}function KS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Jn(e.nextSibling),e===null))return null;return e}function C0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Jn(e.nextSibling),e===null))return null;return e}function Cf(e){return e.data==="$?"||e.data==="$~"}function Ef(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ZS(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 Jn(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 Af=null;function E0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Jn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function A0(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 D0(e,n,a){switch(n=fc(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 Tr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Dd(e)}var Wn=new Map,M0=new Set;function pc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ea=B.d;B.d={f:YS,r:JS,D:WS,C:XS,L:QS,m:e2,X:n2,S:t2,M:s2};function YS(){var e=ea.f(),n=ac();return e||n}function JS(e){var n=$i(e);n!==null&&n.tag===5&&n.type==="form"?Yg(n):ea.r(e)}var yo=typeof document>"u"?null:document;function R0(e,n,a){var l=yo;if(l&&typeof n=="string"&&n){var f=Vn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),M0.has(f)||(M0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),un(n,"link",e),en(n),l.head.appendChild(n)))}}function WS(e){ea.D(e),R0("dns-prefetch",e,null)}function XS(e,n){ea.C(e,n),R0("preconnect",e,n)}function QS(e,n,a){ea.L(e,n,a);var l=yo;if(l&&e&&n){var f='link[rel="preload"][as="'+Vn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Vn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Vn(a.imageSizes)+'"]')):f+='[href="'+Vn(e)+'"]';var h=f;switch(n){case"style":h=bo(e);break;case"script":h=_o(e)}Wn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Wn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(wr(h))||n==="script"&&l.querySelector(Nr(h))||(n=l.createElement("link"),un(n,"link",e),en(n),l.head.appendChild(n)))}}function e2(e,n){ea.m(e,n);var a=yo;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Vn(l)+'"][href="'+Vn(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=_o(e)}if(!Wn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Wn.set(h,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Nr(h)))return}l=a.createElement("link"),un(l,"link",e),en(l),a.head.appendChild(l)}}}function t2(e,n,a){ea.S(e,n,a);var l=yo;if(l&&e){var f=Hi(l).hoistableStyles,h=bo(e);n=n||"default";var x=f.get(h);if(!x){var N={loading:0,preload:null};if(x=l.querySelector(wr(h)))N.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Wn.get(h))&&Df(e,a);var I=x=l.createElement("link");en(I),un(I,"link",e),I._p=new Promise(function(G,X){I.onload=G,I.onerror=X}),I.addEventListener("load",function(){N.loading|=1}),I.addEventListener("error",function(){N.loading|=2}),N.loading|=4,mc(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:N},f.set(h,x)}}}function n2(e,n){ea.X(e,n);var a=yo;if(a&&e){var l=Hi(a).hoistableScripts,f=_o(e),h=l.get(f);h||(h=a.querySelector(Nr(f)),h||(e=b({src:e,async:!0},n),(n=Wn.get(f))&&Mf(e,n),h=a.createElement("script"),en(h),un(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function s2(e,n){ea.M(e,n);var a=yo;if(a&&e){var l=Hi(a).hoistableScripts,f=_o(e),h=l.get(f);h||(h=a.querySelector(Nr(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Wn.get(f))&&Mf(e,n),h=a.createElement("script"),en(h),un(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function I0(e,n,a,l){var f=(f=yt.current)?pc(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=bo(a.href),a=Hi(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=bo(a.href);var h=Hi(f).hoistableStyles,x=h.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=f.querySelector(wr(e)))&&!h._p&&(x.instance=h,x.state.loading=5),Wn.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},Wn.set(e,a),h||a2(f,e,a,x.state))),n&&l===null)throw Error(r(528,""));return x}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=_o(a),a=Hi(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 bo(e){return'href="'+Vn(e)+'"'}function wr(e){return'link[rel="stylesheet"]['+e+"]"}function O0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function a2(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}),un(n,"link",a),en(n),e.head.appendChild(n))}function _o(e){return'[src="'+Vn(e)+'"]'}function Nr(e){return"script[async]"+e}function B0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Vn(a.href)+'"]');if(l)return n.instance=l,en(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"),en(l),un(l,"style",f),mc(l,a.precedence,e),n.instance=l;case"stylesheet":f=bo(a.href);var h=e.querySelector(wr(f));if(h)return n.state.loading|=4,n.instance=h,en(h),h;l=O0(a),(f=Wn.get(f))&&Df(l,f),h=(e.ownerDocument||e).createElement("link"),en(h);var x=h;return x._p=new Promise(function(N,I){x.onload=N,x.onerror=I}),un(h,"link",l),n.state.loading|=4,mc(h,a.precedence,e),n.instance=h;case"script":return h=_o(a.src),(f=e.querySelector(Nr(h)))?(n.instance=f,en(f),f):(l=a,(f=Wn.get(h))&&(l=b({},a),Mf(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),en(f),un(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,mc(l,a.precedence,e));return n.instance}function mc(e,n,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,x=0;x<l.length;x++){var N=l[x];if(N.dataset.precedence===n)h=N;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 Df(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Mf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var hc=null;function L0(e,n,a){if(hc===null){var l=new Map,f=hc=new Map;f.set(a,l)}else f=hc,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[Vo]||h[rn]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var N=l.get(x);N?N.push(h):l.set(x,[h])}}return l}function z0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function i2(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 $0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function o2(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=bo(l.href),h=n.querySelector(wr(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=gc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,en(h);return}h=n.ownerDocument||n,l=O0(l),(f=Wn.get(f))&&Df(l,f),h=h.createElement("link"),en(h);var x=h;x._p=new Promise(function(N,I){x.onload=N,x.onerror=I}),un(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=gc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Rf=0;function r2(e,n){return e.stylesheets&&e.count===0&&yc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&yc(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Rf===0&&(Rf=62500*PS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&yc(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Rf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function gc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)yc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var vc=null;function yc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,vc=new Map,n.forEach(l2,e),vc=null,gc.call(e))}function l2(e,n){if(!(n.state.loading&4)){var a=vc.get(e);if(a)var l=a.get(null);else{a=new Map,vc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var x=f[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),l=x)}l&&a.set(null,l)}f=n.instance,x=f.getAttribute("data-precedence"),h=a.get(x)||l,h===l&&a.set(null,f),a.set(x,f),this.count++,l=gc.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 Cr={$$typeof:D,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function c2(e,n,a,l,f,h,x,N,I){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=Be(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Be(0),this.hiddenUpdates=Be(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function H0(e,n,a,l,f,h,x,N,I,G,X,ie){return e=new c2(e,n,a,x,I,G,X,ie,N),n=1,h===!0&&(n|=24),h=An(3,null,null,n),e.current=h,h.stateNode=e,n=uu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:a,cache:n},hu(h),e}function P0(e){return e?(e=Ji,e):Ji}function U0(e,n,a,l,f,h){f=P0(f),l.context===null?l.context=f:l.pendingContext=f,l=ka(n),l.payload={element:a},h=h===void 0?null:h,h!==null&&(l.callback=h),a=Sa(e,l,n),a!==null&&(Nn(a,e,n),or(a,e,n))}function V0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function If(e,n){V0(e,n),(e=e.alternate)&&V0(e,n)}function q0(e){if(e.tag===13||e.tag===31){var n=ni(e,67108864);n!==null&&Nn(n,e,67108864),If(e,67108864)}}function G0(e){if(e.tag===13||e.tag===31){var n=On();n=Et(n);var a=ni(e,n);a!==null&&Nn(a,e,n),If(e,n)}}var bc=!0;function d2(e,n,a,l){var f=H.T;H.T=null;var h=B.p;try{B.p=2,Of(e,n,a,l)}finally{B.p=h,H.T=f}}function u2(e,n,a,l){var f=H.T;H.T=null;var h=B.p;try{B.p=8,Of(e,n,a,l)}finally{B.p=h,H.T=f}}function Of(e,n,a,l){if(bc){var f=Bf(l);if(f===null)xf(e,n,l,_c,a),K0(e,l);else if(p2(f,e,n,a,l))l.stopPropagation();else if(K0(e,l),n&4&&-1<f2.indexOf(e)){for(;f!==null;){var h=$i(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=de(h.pendingLanes);if(x!==0){var N=h;for(N.pendingLanes|=2,N.entangledLanes|=2;x;){var I=1<<31-Xt(x);N.entanglements[1]|=I,x&=~I}Ns(h),(rt&6)===0&&(nc=Wt()+500,kr(0))}}break;case 31:case 13:N=ni(h,2),N!==null&&Nn(N,h,2),ac(),If(h,2)}if(h=Bf(l),h===null&&xf(e,n,l,_c,a),h===f)break;f=h}f!==null&&l.stopPropagation()}else xf(e,n,l,null,a)}}function Bf(e){return e=Ld(e),Lf(e)}var _c=null;function Lf(e){if(_c=null,e=zi(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 _c=e,null}function F0(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(Ja()){case Wa:return 2;case ma:return 8;case Bs:case xs:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var zf=!1,Ia=null,Oa=null,Ba=null,Er=new Map,Ar=new Map,La=[],f2="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 K0(e,n){switch(e){case"focusin":case"focusout":Ia=null;break;case"dragenter":case"dragleave":Oa=null;break;case"mouseover":case"mouseout":Ba=null;break;case"pointerover":case"pointerout":Er.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ar.delete(n.pointerId)}}function Dr(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=$i(n),n!==null&&q0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function p2(e,n,a,l,f){switch(n){case"focusin":return Ia=Dr(Ia,e,n,a,l,f),!0;case"dragenter":return Oa=Dr(Oa,e,n,a,l,f),!0;case"mouseover":return Ba=Dr(Ba,e,n,a,l,f),!0;case"pointerover":var h=f.pointerId;return Er.set(h,Dr(Er.get(h)||null,e,n,a,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Ar.set(h,Dr(Ar.get(h)||null,e,n,a,l,f)),!0}return!1}function Z0(e){var n=zi(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,Bi(e.priority,function(){G0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Bi(e.priority,function(){G0(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 xc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Bf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Bd=l,a.target.dispatchEvent(l),Bd=null}else return n=$i(a),n!==null&&q0(n),e.blockedOn=a,!1;n.shift()}return!0}function Y0(e,n,a){xc(e)&&a.delete(n)}function m2(){zf=!1,Ia!==null&&xc(Ia)&&(Ia=null),Oa!==null&&xc(Oa)&&(Oa=null),Ba!==null&&xc(Ba)&&(Ba=null),Er.forEach(Y0),Ar.forEach(Y0)}function kc(e,n){e.blockedOn===n&&(e.blockedOn=null,zf||(zf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,m2)))}var Sc=null;function J0(e){Sc!==e&&(Sc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Sc===e&&(Sc=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(Lf(l||a)===null)continue;break}var h=$i(a);h!==null&&(e.splice(n,3),n-=3,Ou(h,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function xo(e){function n(I){return kc(I,e)}Ia!==null&&kc(Ia,e),Oa!==null&&kc(Oa,e),Ba!==null&&kc(Ba,e),Er.forEach(n),Ar.forEach(n);for(var a=0;a<La.length;a++){var l=La[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<La.length&&(a=La[0],a.blockedOn===null);)Z0(a),a.blockedOn===null&&La.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],h=a[l+1],x=f[xn]||null;if(typeof h=="function")x||J0(a);else if(x){var N=null;if(h&&h.hasAttribute("formAction")){if(f=h,x=h[xn]||null)N=x.formAction;else if(Lf(f)!==null)continue}else N=x.action;typeof N=="function"?a[l+1]=N:(a.splice(l,3),l-=3),J0(a)}}}function W0(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function $f(e){this._internalRoot=e}jc.prototype.render=$f.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,l=On();U0(a,l,e,n,null,null)},jc.prototype.unmount=$f.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;U0(e.current,2,null,e,null,null),ac(),n[Li]=null}};function jc(e){this._internalRoot=e}jc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ss();e={blockedOn:null,target:e,priority:n};for(var a=0;a<La.length&&n!==0&&n<La[a].priority;a++);La.splice(a,0,e),a===0&&Z0(e)}};var X0=s.version;if(X0!=="19.2.4")throw Error(r(527,X0,"19.2.4"));B.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 h2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Tc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tc.isDisabled&&Tc.supportsFiber)try{mn=Tc.inject(h2),Pt=Tc}catch{}}return Mr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var a=!1,l="",f=iv,h=ov,x=rv;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=H0(e,1,!1,null,null,a,l,null,f,h,x,W0),e[Li]=n.current,_f(e),new $f(n)},Mr.hydrateRoot=function(e,n,a){if(!c(e))throw Error(r(299));var l=!1,f="",h=iv,x=ov,N=rv,I=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.formState!==void 0&&(I=a.formState)),n=H0(e,1,!0,n,a??null,l,f,I,h,x,N,W0),n.context=P0(null),a=n.current,l=On(),l=Et(l),f=ka(l),f.callback=null,Sa(a,f,l),a=l,n.current.lanes=a,Ge(n,a),Ns(n),e[Li]=n.current,_f(e),new jc(n)},Mr.version="19.2.4",Mr}var oy;function G2(){if(oy)return Hf.exports;oy=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(),Hf.exports=q2(),Hf.exports}var F2=G2();const K2="modulepreload",Z2=function(t){return"/"+t},ry={},b_=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=Z2(g),g in ry)return;ry[g]=!0;const v=g.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":K2,v||(_.as="script"),_.crossOrigin="",_.href=g,m&&_.setAttribute("nonce",m),document.head.appendChild(_),v)return new Promise((k,S)=>{_.addEventListener("load",k),_.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(u){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=u,window.dispatchEvent(p),!p.defaultPrevented)throw u}return c.then(u=>{for(const p of u||[])p.status==="rejected"&&d(p.reason);return s().catch(d)})},Y2=new Proxy(globalThis.fetch,{apply(t,s,o){return Reflect.apply(globalThis.fetch,s,o)}}),md=T2({baseUrl:"/",fetch:Y2}),$e=pd(w2,md),Ln=pd(N2,md),Ec=pd(C2,md),Ac=pd(E2,md),J2="_bar_1xlm9_1",W2="_textarea_1xlm9_32",X2="_select_1xlm9_73",Q2="_btnPrimary_1xlm9_109",ej="_btnGhost_1xlm9_179",tj="_badge_1xlm9_201",nj="_disconnectHint_1xlm9_211",vs={bar:J2,textarea:W2,select:X2,btnPrimary:Q2,btnGhost:ej,badge:tj,disconnectHint:nj},sj=200;function aj(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 ij({environmentId:t,onReconnect:s}){return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:vs.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),i.jsx("button",{type:"button",onClick:()=>s(t),className:vs.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function Vf({value:t,onChange:s,onSubmit:o,placeholder:r,disabled:c,autoFocus:d,ariaLabel:u}){const p=y.useRef(null);y.useLayoutEffect(()=>{const g=p.current;g&&(g.style.height="auto",g.style.height=`${Math.min(g.scrollHeight,sj)}px`)},[t]);const m=g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&!g.nativeEvent.isComposing&&(g.preventDefault(),o())};return i.jsx("textarea",{ref:p,rows:1,value:t,onChange:g=>s(g.target.value),onKeyDown:m,placeholder:r,disabled:c,autoFocus:d,className:vs.textarea,"aria-label":u})}function hd({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[_,k]=y.useState(""),[S,j]=y.useState(""),T=aj(o,u),w=()=>{if(_.trim())if(t==="send"){if(!s||T)return;p(s,_),k("")}else if(t==="spawn"){if(!o)return;m(o,_,S),b==null||b("Session started","success"),k(""),j("")}else{if(!r)return;g(r,void 0,o,_),k("")}},C=D=>{D.preventDefault(),w()};return t==="spawn"?i.jsxs("form",{onSubmit:C,className:vs.bar,children:[i.jsx("span",{className:vs.badge,children:"new chat"}),i.jsx(Vf,{value:_,onChange:k,onSubmit:w,placeholder:"Enter prompt...",autoFocus:!0,ariaLabel:"Enter prompt"}),c&&i.jsxs("select",{value:S,onChange:D=>j(D.target.value),className:vs.select,"aria-label":"Select persona",children:[i.jsx("option",{value:"",children:"(Default)"}),d.map(D=>i.jsx("option",{value:D.id,children:D.name},D.id))]}),i.jsx("button",{type:"submit",disabled:!_.trim()||!o,className:vs.btnPrimary,children:"Go"})]}):t==="start"?i.jsxs("form",{onSubmit:C,className:vs.bar,children:[i.jsx(Vf,{value:_,onChange:k,onSubmit:w,placeholder:"Type a message...",autoFocus:!0,ariaLabel:"Type a message"}),i.jsx("button",{type:"submit",disabled:!_.trim(),className:vs.btnPrimary,children:"Send"})]}):i.jsxs("form",{onSubmit:C,className:vs.bar,children:[T&&o&&i.jsx(ij,{environmentId:o,onReconnect:v}),i.jsx(Vf,{value:_,onChange:k,onSubmit:w,placeholder:"Type a message...",autoFocus:!T,disabled:T,ariaLabel:"Type a message"}),i.jsx("span",{title:T?"Environment is unavailable — reconnect first":void 0,children:i.jsx("button",{type:"submit",disabled:!_.trim()||T,className:vs.btnPrimary,children:"Send"})})]})}const ly=220,cy=70,oj=40,rj=60,lj="hierarchy",cj="dependency";function dj(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new Q0.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:oj,ranksep:rj});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:ly,height:cy});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:lj},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:cj},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return Q0.layout(s),{nodes:t.map(u=>{const p=s.node(u.id),m=r.get(u.id)||[];return{id:u.id,type:"task",position:{x:p.x-ly/2,y:p.y-cy/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 uj=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),__=(...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 fj={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 pj=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,...fj,width:s,height:s,stroke:t,strokeWidth:r?Number(o)*24/Number(s):o,className:__("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 Ie=(t,s)=>{const o=y.forwardRef(({className:r,...c},d)=>y.createElement(pj,{ref:d,iconNode:s,className:__(`lucide-${uj(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 mj=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],dy=Ie("ArrowDown",mj);/**
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 hj=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],uy=Ie("ArrowUp",hj);/**
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 gj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],vj=Ie("Ban",gj);/**
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 yj=[["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"}]],bj=Ie("Brain",yj);/**
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 _j=[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],xj=Ie("CalendarClock",_j);/**
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 kj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ni=Ie("Check",kj);/**
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 Sj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],x_=Ie("ChevronDown",Sj);/**
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 jj=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],da=Ie("ChevronRight",jj);/**
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 Tj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Si=Ie("Circle",Tj);/**
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 wj=[["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"}]],Nj=Ie("ClipboardList",wj);/**
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 Cj=[["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"}]],k_=Ie("Clipboard",Cj);/**
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 Ej=[["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"}]],Aj=Ie("Cog",Ej);/**
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 Dj=[["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"}]],Mj=Ie("Copy",Dj);/**
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 Rj=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],Ij=Ie("CornerDownRight",Rj);/**
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 Oj=[["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"}]],Bj=Ie("FilePen",Oj);/**
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 Lj=[["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"}]],zj=Ie("FileText",Lj);/**
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 $j=[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]],Hj=Ie("Forward",$j);/**
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 Pj=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Uj=Ie("GitBranch",Pj);/**
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 Vj=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],qj=Ie("Github",Vj);/**
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 Gj=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Fj=Ie("Hash",Gj);/**
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 Kj=[["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"}]],Zj=Ie("House",Kj);/**
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 Yj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],um=Ie("Info",Yj);/**
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 Jj=[["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"}]],Wj=Ie("Key",Jj);/**
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 Xj=[["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"}]],Qj=Ie("Keyboard",Xj);/**
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 eT=[["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"}]],tT=Ie("ListChecks",eT);/**
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 nT=[["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"}]],sT=Ie("List",nT);/**
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 aT=[["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"}]],iT=Ie("Loader",aT);/**
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 oT=[["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"}]],rT=Ie("Menu",oT);/**
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 lT=[["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"}]],cT=Ie("MessageSquare",lT);/**
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 dT=[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]],uT=Ie("MessagesSquare",dT);/**
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 fT=[["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"}]],pT=Ie("Monitor",fT);/**
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 mT=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],hT=Ie("Network",mT);/**
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 gT=[["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"}]],vT=Ie("Palette",gT);/**
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 yT=[["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"}]],bT=Ie("Pause",yT);/**
217
+ * @license lucide-react v0.474.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const _T=[["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"}]],xT=Ie("Pencil",_T);/**
222
+ * @license lucide-react v0.474.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ */const kT=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ST=Ie("Puzzle",kT);/**
227
+ * @license lucide-react v0.474.0 - ISC
228
+ *
229
+ * This source code is licensed under the ISC license.
230
+ * See the LICENSE file in the root directory of this source tree.
231
+ */const jT=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],TT=Ie("RefreshCw",jT);/**
232
+ * @license lucide-react v0.474.0 - ISC
233
+ *
234
+ * This source code is licensed under the ISC license.
235
+ * See the LICENSE file in the root directory of this source tree.
236
+ */const wT=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Dp=Ie("Search",wT);/**
237
+ * @license lucide-react v0.474.0 - ISC
238
+ *
239
+ * This source code is licensed under the ISC license.
240
+ * See the LICENSE file in the root directory of this source tree.
241
+ */const NT=[["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"}]],CT=Ie("Settings",NT);/**
242
+ * @license lucide-react v0.474.0 - ISC
243
+ *
244
+ * This source code is licensed under the ISC license.
245
+ * See the LICENSE file in the root directory of this source tree.
246
+ */const ET=[["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"}]],AT=Ie("SquareCheckBig",ET);/**
247
+ * @license lucide-react v0.474.0 - ISC
248
+ *
249
+ * This source code is licensed under the ISC license.
250
+ * See the LICENSE file in the root directory of this source tree.
251
+ */const DT=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],MT=Ie("Star",DT);/**
252
+ * @license lucide-react v0.474.0 - ISC
253
+ *
254
+ * This source code is licensed under the ISC license.
255
+ * See the LICENSE file in the root directory of this source tree.
256
+ */const RT=[["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"}]],fm=Ie("TriangleAlert",RT);/**
257
+ * @license lucide-react v0.474.0 - ISC
258
+ *
259
+ * This source code is licensed under the ISC license.
260
+ * See the LICENSE file in the root directory of this source tree.
261
+ */const IT=[["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"}]],OT=Ie("User",IT);/**
262
+ * @license lucide-react v0.474.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ */const BT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Is=Ie("X",BT),S_=8,Ze=12,zt=14,wt=16,Mp={not_started:{color:"var(--text-tertiary)",icon:i.jsx(Si,{size:Ze}),label:"Not Started"},working:{color:"var(--accent-green)",icon:i.jsx(Si,{size:Ze,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:i.jsx(bT,{size:Ze}),label:"Paused"},complete:{color:"var(--accent-green)",icon:i.jsx(Ni,{size:Ze}),label:"Complete"},failed:{color:"var(--accent-red)",icon:i.jsx(Is,{size:Ze}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:i.jsx(vj,{size:Ze}),label:"Blocked"}};function Fa(t){return t==="blocked"?Mp.blocked:Mp[il(t)]}const LT={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function zT(t){return LT[il(t)]??"statusPending"}const $T=["working","paused","failed","not_started","blocked","complete"],fy=["not_started","working","paused","complete","failed"],HT={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function il(t){return t in Mp&&t!=="blocked"?t:HT[t]??"not_started"}const PT={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"},UT="_dagContainer_js4w6_1",VT="_taskNode_js4w6_26",qT="_taskNodeBorder_js4w6_54",GT="_taskNodeContent_js4w6_60",FT="_taskNodeHeader_js4w6_70",KT="_taskNodeIcon_js4w6_77",ZT="_taskNodeTitle_js4w6_82",YT="_taskNodeBadges_js4w6_90",JT="_childBadge_js4w6_95",WT="_depBadge_js4w6_107",XT="_handle_js4w6_119",QT="_emptyCta_js4w6_126",ew="_ctaDescription_js4w6_137",tw="_ctaButton_js4w6_144",bn={dagContainer:UT,taskNode:VT,taskNodeBorder:qT,taskNodeContent:GT,taskNodeHeader:FT,taskNodeIcon:KT,taskNodeTitle:ZT,taskNodeBadges:YT,childBadge:JT,depBadge:WT,handle:XT,emptyCta:QT,ctaDescription:ew,ctaButton:tw};function nw({data:t}){const{task:s,childCount:o,doneChildCount:r,hasDependencies:c}=t,d=Fa(s.status);return i.jsxs("div",{className:bn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[i.jsx(ey,{type:"target",position:ty.Top,className:bn.handle}),i.jsx("div",{className:bn.taskNodeBorder,style:{backgroundColor:d.color}}),i.jsxs("div",{className:bn.taskNodeContent,children:[i.jsxs("div",{className:bn.taskNodeHeader,children:[i.jsx("span",{className:bn.taskNodeIcon,style:{color:d.color},children:d.icon}),i.jsx("span",{className:bn.taskNodeTitle,children:s.title})]}),i.jsxs("div",{className:bn.taskNodeBadges,children:[o>0&&i.jsxs("span",{className:bn.childBadge,children:[r,"/",o]}),c&&i.jsx("span",{className:bn.depBadge,children:"dep"})]})]}),i.jsx(ey,{type:"source",position:ty.Bottom,className:bn.handle})]})}/**
267
+ * react-router v7.13.2
268
+ *
269
+ * Copyright (c) Remix Software Inc.
270
+ *
271
+ * This source code is licensed under the MIT license found in the
272
+ * LICENSE.md file in the root directory of this source tree.
273
+ *
274
+ * @license MIT
275
+ */var py="popstate";function my(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function sw(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 Rp("",{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:Wr(c)}return iw(s,o,null,t)}function kt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function is(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function aw(){return Math.random().toString(36).substring(2,10)}function hy(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 Rp(t,s,o=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?zo(s):s,state:o,key:s&&s.key||r||aw(),unstable_mask:c}}function Wr({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 zo(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 iw(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 T=v(),w=T==null?null:T-g;g=T,m&&m({action:p,location:j.location,delta:w})}function _(T,w){p="PUSH";let C=my(T)?T:Rp(j.location,T,w);g=v()+1;let D=hy(C,g),R=j.createHref(C.unstable_mask||C);try{u.pushState(D,"",R)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;c.location.assign(R)}d&&m&&m({action:p,location:j.location,delta:1})}function k(T,w){p="REPLACE";let C=my(T)?T:Rp(j.location,T,w);g=v();let D=hy(C,g),R=j.createHref(C.unstable_mask||C);u.replaceState(D,"",R),d&&m&&m({action:p,location:j.location,delta:0})}function S(T){return ow(T)}let j={get action(){return p},get location(){return t(c,u)},listen(T){if(m)throw new Error("A history only accepts one active listener");return c.addEventListener(py,b),m=T,()=>{c.removeEventListener(py,b),m=null}},createHref(T){return s(c,T)},createURL:S,encodeLocation(T){let w=S(T);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:_,replace:k,go(T){return u.go(T)}};return j}function ow(t,s=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),kt(o,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Wr(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=o+r),new URL(r,o)}function j_(t,s,o="/"){return rw(t,s,o,!1)}function rw(t,s,o,r){let c=typeof s=="string"?zo(s):s,d=la(c.pathname||"/",o);if(d==null)return null;let u=T_(t);lw(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=N_(d);p=vw(u[m],g,r)}return p}function T_(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;kt(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=Ds([r,v.relativePath]),_=o.concat(v);u.children&&u.children.length>0&&(kt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),T_(u.children,s,_,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:hw(b,u.index),routesMeta:_})};return t.forEach((u,p)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))d(u,p);else for(let g of w_(u.path))d(u,p,!0,g)}),s}function w_(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=w_(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 lw(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:gw(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var cw=/^:[\w-]+$/,dw=3,uw=2,fw=1,pw=10,mw=-2,gy=t=>t==="*";function hw(t,s){let o=t.split("/"),r=o.length;return o.some(gy)&&(r+=mw),s&&(r+=uw),o.filter(c=>!gy(c)).reduce((c,d)=>c+(cw.test(d)?dw:d===""?fw:pw),r)}function gw(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 vw(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=Xr({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),_=m.route;if(!b&&g&&o&&!r[r.length-1].route.index&&(b=Xr({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:Ds([d,b.pathname]),pathnameBase:kw(Ds([d,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(d=Ds([d,b.pathnameBase]))}return u}function Xr(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=yw(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},_)=>{if(v==="*"){let S=p[_]||"";u=d.slice(0,d.length-S.length).replace(/(.)\/+$/,"$1")}const k=p[_];return b&&!k?g[v]=void 0:g[v]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function yw(t,s=!1,o=!0){is(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 N_(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return is(!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 la(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 _w(t,s="/"){let{pathname:o,search:r="",hash:c=""}=typeof t=="string"?zo(t):t,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=vy(o.substring(1),"/"):d=vy(o,s)):d=s,{pathname:d,search:Sw(r),hash:jw(c)}}function vy(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 qf(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 xw(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function pm(t){let s=xw(t);return s.map((o,r)=>r===s.length-1?o.pathname:o.pathnameBase)}function gd(t,s,o,r=!1){let c;typeof t=="string"?c=zo(t):(c={...t},kt(!c.pathname||!c.pathname.includes("?"),qf("?","pathname","search",c)),kt(!c.pathname||!c.pathname.includes("#"),qf("#","pathname","hash",c)),kt(!c.search||!c.search.includes("#"),qf("#","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 _=u.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}p=b>=0?s[b]:"/"}let m=_w(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&o.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var Ds=t=>t.join("/").replace(/\/\/+/g,"/"),kw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Sw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,jw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Tw=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 ww(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Nw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var C_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function E_(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(C_)try{let d=new URL(window.location.href),u=o.startsWith("//")?new URL(d.protocol+o):new URL(o),p=la(u.pathname,s);u.origin===d.origin&&p!=null?o=p+u.search+u.hash:c=!0}catch{is(!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 A_=["POST","PUT","PATCH","DELETE"];new Set(A_);var Cw=["GET",...A_];new Set(Cw);var $o=y.createContext(null);$o.displayName="DataRouter";var vd=y.createContext(null);vd.displayName="DataRouterState";var Ew=y.createContext(!1),D_=y.createContext({isTransitioning:!1});D_.displayName="ViewTransition";var Aw=y.createContext(new Map);Aw.displayName="Fetchers";var Dw=y.createContext(null);Dw.displayName="Await";var Pn=y.createContext(null);Pn.displayName="Navigation";var ol=y.createContext(null);ol.displayName="Location";var rs=y.createContext({outlet:null,matches:[],isDataRoute:!1});rs.displayName="Route";var mm=y.createContext(null);mm.displayName="RouteError";var M_="REACT_ROUTER_ERROR",Mw="REDIRECT",Rw="ROUTE_ERROR_RESPONSE";function Iw(t){if(t.startsWith(`${M_}:${Mw}:{`))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 Ow(t){if(t.startsWith(`${M_}:${Rw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Tw(s.status,s.statusText,s.data)}catch{}}function Bw(t,{relative:s}={}){kt(Ci(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=y.useContext(Pn),{hash:c,pathname:d,search:u}=rl(t,{relative:s}),p=d;return o!=="/"&&(p=d==="/"?o:Ds([o,d])),r.createHref({pathname:p,search:u,hash:c})}function Ci(){return y.useContext(ol)!=null}function Jt(){return kt(Ci(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(ol).location}function nn(t){kt(Ci(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Jt();return y.useMemo(()=>Xr(t,N_(s)),[s,t])}var R_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function I_(t){y.useContext(Pn).static||y.useLayoutEffect(t)}function yd(){let{isDataRoute:t}=y.useContext(rs);return t?Ww():Lw()}function Lw(){kt(Ci(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext($o),{basename:s,navigator:o}=y.useContext(Pn),{matches:r}=y.useContext(rs),{pathname:c}=Jt(),d=JSON.stringify(pm(r)),u=y.useRef(!1);return I_(()=>{u.current=!0}),y.useCallback((m,g={})=>{if(is(u.current,R_),!u.current)return;if(typeof m=="number"){o.go(m);return}let v=gd(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Ds([s,v.pathname])),(g.replace?o.replace:o.push)(v,g.state,g)},[s,o,d,c,t])}var zw=y.createContext(null);function $w(t){let s=y.useContext(rs).outlet;return y.useMemo(()=>s&&y.createElement(zw.Provider,{value:t},s),[s,t])}function ua(){let{matches:t}=y.useContext(rs),s=t[t.length-1];return s?s.params:{}}function rl(t,{relative:s}={}){let{matches:o}=y.useContext(rs),{pathname:r}=Jt(),c=JSON.stringify(pm(o));return y.useMemo(()=>gd(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function Hw(t,s){return O_(t,s)}function O_(t,s,o){var T;kt(Ci(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Pn),{matches:c}=y.useContext(rs),d=c[c.length-1],u=d?d.params:{},p=d?d.pathname:"/",m=d?d.pathnameBase:"/",g=d&&d.route;{let w=g&&g.path||"";L_(p,!g||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${w}">) 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.
276
+
277
+ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let v=Jt(),b;if(s){let w=typeof s=="string"?zo(s):s;kt(m==="/"||((T=w.pathname)==null?void 0:T.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 "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=v;let _=b.pathname||"/",k=_;if(m!=="/"){let w=m.replace(/^\//,"").split("/");k="/"+_.replace(/^\//,"").split("/").slice(w.length).join("/")}let S=j_(t,{pathname:k});is(g||S!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),is(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${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 j=Gw(S&&S.map(w=>Object.assign({},w,{params:Object.assign({},u,w.params),pathname:Ds([m,r.encodeLocation?r.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?m:Ds([m,r.encodeLocation?r.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),c,o);return s&&j?y.createElement(ol.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},j):j}function Pw(){let t=Jw(),s=ww(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 Uw=y.createElement(Pw,null),B_=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=Ow(t.digest);o&&(t=o)}let s=t!==void 0?y.createElement(rs.Provider,{value:this.props.routeContext},y.createElement(mm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(Vw,{error:t},s):s}};B_.contextType=Ew;var Gf=new WeakMap;function Vw({children:t,error:s}){let{basename:o}=y.useContext(Pn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=Iw(s.digest);if(r){let c=Gf.get(s);if(c)throw c;let d=E_(r.location,o);if(C_&&!Gf.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 Gf.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function qw({routeContext:t,match:s,children:o}){let r=y.useContext($o);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(rs.Provider,{value:t},o)}function Gw(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);kt(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:_,errors:k}=r,S=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!k||k[b.route.id]===void 0);if(b.route.lazy||S){o.isStatic&&(u=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let m=o==null?void 0:o.onError,g=r&&m?(v,b)=>{var _,k;m(v,{location:r.location,params:((k=(_=r.matches)==null?void 0:_[0])==null?void 0:k.params)??{},unstable_pattern:Nw(r.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let k,S=!1,j=null,T=null;r&&(k=d&&b.route.id?d[b.route.id]:void 0,j=b.route.errorElement||Uw,u&&(p<0&&_===0?(L_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,T=null):p===_&&(S=!0,T=b.route.hydrateFallbackElement||null)));let w=s.concat(c.slice(0,_+1)),C=()=>{let D;return k?D=j:S?D=T:b.route.Component?D=y.createElement(b.route.Component,null):b.route.element?D=b.route.element:D=v,y.createElement(qw,{match:b,routeContext:{outlet:v,matches:w,isDataRoute:r!=null},children:D})};return r&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement(B_,{location:r.location,revalidation:r.revalidation,component:j,error:k,children:C(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:g}):C()},null)}function hm(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Fw(t){let s=y.useContext($o);return kt(s,hm(t)),s}function Kw(t){let s=y.useContext(vd);return kt(s,hm(t)),s}function Zw(t){let s=y.useContext(rs);return kt(s,hm(t)),s}function gm(t){let s=Zw(t),o=s.matches[s.matches.length-1];return kt(o.route.id,`${t} can only be used on routes that contain a unique "id"`),o.route.id}function Yw(){return gm("useRouteId")}function Jw(){var r;let t=y.useContext(mm),s=Kw("useRouteError"),o=gm("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function Ww(){let{router:t}=Fw("useNavigate"),s=gm("useNavigate"),o=y.useRef(!1);return I_(()=>{o.current=!0}),y.useCallback(async(c,d={})=>{is(o.current,R_),o.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var yy={};function L_(t,s,o){!s&&!yy[t]&&(yy[t]=!0,is(!1,o))}y.memo(Xw);function Xw({routes:t,future:s,state:o,isStatic:r,onError:c}){return O_(t,void 0,{state:o,isStatic:r,onError:c})}function zn({to:t,replace:s,state:o,relative:r}){kt(Ci(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Pn);is(!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(rs),{pathname:u}=Jt(),p=yd(),m=gd(t,pm(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 Ei(t){return $w(t.context)}function Ee(t){kt(!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 Qw({basename:t="/",children:s=null,location:o,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){kt(!Ci(),"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=zo(o));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:k="default",unstable_mask:S}=o,j=y.useMemo(()=>{let T=la(g,p);return T==null?null:{location:{pathname:T,search:v,hash:b,state:_,key:k,unstable_mask:S},navigationType:r}},[p,g,v,b,_,k,r,S]);return is(j!=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.`),j==null?null:y.createElement(Pn.Provider,{value:m},y.createElement(ol.Provider,{children:s,value:j}))}function eN({children:t,location:s}){return Hw(Ip(t),s)}function Ip(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,Ip(r.props.children,d));return}kt(r.type===Ee,`[${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>`),kt(!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=Ip(r.props.children,d)),o.push(u)}),o}var Fc="get",Kc="application/x-www-form-urlencoded";function bd(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function tN(t){return bd(t)&&t.tagName.toLowerCase()==="button"}function nN(t){return bd(t)&&t.tagName.toLowerCase()==="form"}function sN(t){return bd(t)&&t.tagName.toLowerCase()==="input"}function aN(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function iN(t,s){return t.button===0&&(!s||s==="_self")&&!aN(t)}function Op(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 oN(t,s){let o=Op(t);return s&&s.forEach((r,c)=>{o.has(c)||s.getAll(c).forEach(d=>{o.append(c,d)})}),o}var Dc=null;function rN(){if(Dc===null)try{new FormData(document.createElement("form"),0),Dc=!1}catch{Dc=!0}return Dc}var lN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ff(t){return t!=null&&!lN.has(t)?(is(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Kc}"`),null):t}function cN(t,s){let o,r,c,d,u;if(nN(t)){let p=t.getAttribute("action");r=p?la(p,s):null,o=t.getAttribute("method")||Fc,c=Ff(t.getAttribute("enctype"))||Kc,d=new FormData(t)}else if(tN(t)||sN(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?la(m,s):null,o=t.getAttribute("formmethod")||p.getAttribute("method")||Fc,c=Ff(t.getAttribute("formenctype"))||Ff(p.getAttribute("enctype"))||Kc,d=new FormData(p,t),!rN()){let{name:g,type:v,value:b}=t;if(v==="image"){let _=g?`${g}.`:"";d.append(`${_}x`,"0"),d.append(`${_}y`,"0")}else g&&d.append(g,b)}}else{if(bd(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Fc,r=null,c=Kc,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 vm(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function dN(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&&la(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function uN(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 fN(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 pN(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await uN(d,o);return u.links?u.links():[]}return[]}));return vN(r.flat(1).filter(fN).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function by(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 _=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 _=="boolean")return _}return!0}):[]}function mN(t,s,{includeHydrateFallback:o}={}){return hN(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 hN(t){return[...new Set(t)]}function gN(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function vN(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(gN(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function z_(){let t=y.useContext($o);return vm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function yN(){let t=y.useContext(vd);return vm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var ym=y.createContext(void 0);ym.displayName="FrameworkContext";function $_(){let t=y.useContext(ym);return vm(t,"You must render this element inside a <HydratedRouter> element"),t}function bN(t,s){let o=y.useContext(ym),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,_=y.useRef(null);y.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let j=w=>{w.forEach(C=>{u(C.isIntersecting)})},T=new IntersectionObserver(j,{threshold:.5});return _.current&&T.observe(_.current),()=>{T.disconnect()}}},[t]),y.useEffect(()=>{if(r){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[r]);let k=()=>{c(!0)},S=()=>{c(!1),u(!1)};return o?t!=="intent"?[d,_,{}]:[d,_,{onFocus:Rr(p,k),onBlur:Rr(m,S),onMouseEnter:Rr(g,k),onMouseLeave:Rr(v,S),onTouchStart:Rr(b,k)}]:[!1,_,{}]}function Rr(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function _N({page:t,...s}){let{router:o}=z_(),r=y.useMemo(()=>j_(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?y.createElement(kN,{page:t,matches:r,...s}):null}function xN(t){let{manifest:s,routeModules:o}=$_(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return pN(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function kN({page:t,matches:s,...o}){let r=Jt(),{future:c,manifest:d,routeModules:u}=$_(),{basename:p}=z_(),{loaderData:m,matches:g}=yN(),v=y.useMemo(()=>by(t,s,g,d,r,"data"),[t,s,g,d,r]),b=y.useMemo(()=>by(t,s,g,d,r,"assets"),[t,s,g,d,r]),_=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let j=new Set,T=!1;if(s.forEach(C=>{var R;let D=d.routes[C.route.id];!D||!D.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((R=u[C.route.id])!=null&&R.shouldRevalidate)||D.hasClientLoader?T=!0:j.add(C.route.id))}),j.size===0)return[];let w=dN(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return T&&j.size>0&&w.searchParams.set("_routes",s.filter(C=>j.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[p,c.unstable_trailingSlashAwareDataRequests,m,r,d,v,s,t,u]),k=y.useMemo(()=>mN(b,d),[b,d]),S=xN(b);return y.createElement(y.Fragment,null,_.map(j=>y.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...o})),k.map(j=>y.createElement("link",{key:j,rel:"modulepreload",href:j,...o})),S.map(({key:j,link:T})=>y.createElement("link",{key:j,nonce:o.nonce,...T,crossOrigin:T.crossOrigin??o.crossOrigin})))}function SN(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var jN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{jN&&(window.__reactRouterVersion="7.13.2")}catch{}function TN({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=y.useRef();c.current==null&&(c.current=sw({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(Qw,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var H_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bm=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:_,unstable_defaultShouldRevalidate:k,...S},j){let{basename:T,navigator:w,unstable_useTransitions:C}=y.useContext(Pn),D=typeof v=="string"&&H_.test(v),R=E_(v,T);v=R.to;let E=Bw(v,{relative:c}),M=Jt(),O=null;if(p){let ae=gd(p,[],M.unstable_mask?M.unstable_mask.pathname:"/",!0);T!=="/"&&(ae.pathname=ae.pathname==="/"?T:Ds([T,ae.pathname])),O=w.createHref(ae)}let[A,$,Y]=bN(r,S),V=EN(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:k,unstable_useTransitions:C});function ee(ae){s&&s(ae),ae.defaultPrevented||V(ae)}let le=!(R.isExternal||d),Z=y.createElement("a",{...S,...Y,href:(le?O:void 0)||R.absoluteURL||E,onClick:le?ee:s,ref:SN(j,$),target:g,"data-discover":!D&&o==="render"?"true":void 0});return A&&!D?y.createElement(y.Fragment,null,Z,y.createElement(_N,{page:E})):Z});bm.displayName="Link";var wN=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=rl(u,{relative:g.relative}),_=Jt(),k=y.useContext(vd),{navigator:S,basename:j}=y.useContext(Pn),T=k!=null&&IN(b)&&p===!0,w=S.encodeLocation?S.encodeLocation(b).pathname:b.pathname,C=_.pathname,D=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;o||(C=C.toLowerCase(),D=D?D.toLowerCase():null,w=w.toLowerCase()),D&&j&&(D=la(D,j)||D);const R=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let E=C===w||!c&&C.startsWith(w)&&C.charAt(R)==="/",M=D!=null&&(D===w||!c&&D.startsWith(w)&&D.charAt(w.length)==="/"),O={isActive:E,isPending:M,isTransitioning:T},A=E?s:void 0,$;typeof r=="function"?$=r(O):$=[r,E?"active":null,M?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let Y=typeof d=="function"?d(O):d;return y.createElement(bm,{...g,"aria-current":A,className:$,ref:v,style:Y,to:u,viewTransition:p},typeof m=="function"?m(O):m)});wN.displayName="NavLink";var NN=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:_,...k},S)=>{let{unstable_useTransitions:j}=y.useContext(Pn),T=MN(),w=RN(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",D=typeof p=="string"&&H_.test(p),R=E=>{if(m&&m(E),E.defaultPrevented)return;E.preventDefault();let M=E.nativeEvent.submitter,O=(M==null?void 0:M.getAttribute("formmethod"))||u,A=()=>T(M||E.currentTarget,{fetcherKey:s,method:O,navigate:o,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_});j&&o!==!1?y.startTransition(()=>A()):A()};return y.createElement("form",{ref:S,method:C,action:w,onSubmit:r?m:R,...k,"data-discover":!D&&t==="render"?"true":void 0})});NN.displayName="Form";function CN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function P_(t){let s=y.useContext($o);return kt(s,CN(t)),s}function EN(t,{target:s,replace:o,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=yd(),b=Jt(),_=rl(t,{relative:u});return y.useCallback(k=>{if(iN(k,s)){k.preventDefault();let S=o!==void 0?o:Wr(b)===Wr(_),j=()=>v(t,{replace:S,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m});g?y.startTransition(()=>j()):j()}},[b,v,_,o,r,c,s,t,d,u,p,m,g])}function _m(t){is(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(Op(t)),o=y.useRef(!1),r=Jt(),c=y.useMemo(()=>oN(r.search,o.current?null:s.current),[r.search]),d=yd(),u=y.useCallback((p,m)=>{const g=Op(typeof p=="function"?p(new URLSearchParams(c)):p);o.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var AN=0,DN=()=>`__${String(++AN)}__`;function MN(){let{router:t}=P_("useSubmit"),{basename:s}=y.useContext(Pn),o=Yw(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:b}=cN(d,s);if(u.navigate===!1){let _=u.fetcherKey||DN();await r(_,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 RN(t,{relative:s}={}){let{basename:o}=y.useContext(Pn),r=y.useContext(rs);kt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...rl(t||".",{relative:s})},u=Jt();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:Ds([o,d.pathname])),Wr(d)}function IN(t,{relative:s}={}){let o=y.useContext(D_);kt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=P_("useViewTransitionState"),c=rl(t,{relative:s});if(!o.isTransitioning)return!1;let d=la(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=la(o.nextLocation.pathname,r)||o.nextLocation.pathname;return Xr(c.pathname,u)!=null||Xr(c.pathname,d)!=null}function vt(){const t=yd();return y.useCallback((s,o)=>{typeof s=="number"?t(s):t(s,o)},[t])}function xm(t){return`/sessions/${encodeURIComponent(t)}`}function ji(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function os(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 Ai(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 U_(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const Mo="/environments",ON="/environments/new";function Ro(t){return`/environments/${encodeURIComponent(t)}`}function BN(t){return`/environments/${encodeURIComponent(t)}/edit`}const xi="/settings",LN="/settings/credentials",Kf="/settings/personas",zN="/settings/personas/new";function V_(t){return`/settings/personas/${encodeURIComponent(t)}`}const Zf="/settings/schedules",$N="/settings/schedules/new";function q_(t){return`/settings/schedules/${encodeURIComponent(t)}`}const HN="/settings/shortcuts",PN="/pair",UN="/chat",G_="/coordination",Ho="/",VN="/tasks",F_="/workspaces/new",K_="/knowledge",qN=PT,GN={task:nw};function FN({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=vt(),d=y.useMemo(()=>o.filter(b=>b.workspaceId===t),[o,t]),{nodes:u,edges:p}=dj(d),m=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[k,S]of Object.entries(qN))_[k]=b.getPropertyValue(S).trim()||"#6b7a8d";return _},[r]),g=y.useCallback((b,_)=>{c(os(_.id,void 0,t,s))},[c,t,s]),v=y.useCallback(b=>{const _=b.data;return m[_.task.status]||m.pending},[m]);return d.length===0?i.jsxs("div",{className:bn.emptyCta,children:[i.jsx("button",{className:bn.ctaButton,onClick:()=>c(Ai(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:bn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):i.jsx("div",{className:bn.dagContainer,children:i.jsxs(b2,{nodes:u,edges:p,nodeTypes:GN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[i.jsx(_2,{variant:x2.Dots,gap:24,size:1,color:"var(--text-disabled)"}),i.jsx(k2,{showInteractive:!1}),i.jsx(S2,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const KN="_breadcrumbs_17or2_1",ZN="_list_17or2_11",YN="_item_17or2_21",JN="_separator_17or2_28",WN="_link_17or2_34",XN="_current_17or2_57",ko={breadcrumbs:KN,list:ZN,item:YN,separator:JN,link:WN,current:XN};function fa({segments:t}){return i.jsx("nav",{className:ko.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:i.jsx("ol",{className:ko.list,children:t.map((s,o)=>{const r=o===t.length-1;return i.jsxs("li",{className:ko.item,children:[o>0&&i.jsx("span",{className:ko.separator,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),s.url&&!r?i.jsx(bm,{className:ko.link,to:s.url,title:s.label,children:s.label}):i.jsx("span",{className:ko.current,"aria-current":"page",title:s.label,children:s.label})]},o)})})})}const QN="_btn_dwk2o_1",eC="_sm_dwk2o_22",tC="_md_dwk2o_28",nC="_lg_dwk2o_34",sC="_primary_dwk2o_40",aC="_danger_dwk2o_55",iC="_outline_dwk2o_70",oC="_ghost_dwk2o_80",Yf={btn:QN,sm:eC,md:tC,lg:nC,primary:sC,danger:aC,outline:iC,ghost:oC},sn=y.forwardRef(function({variant:s="primary",size:o="md",className:r,children:c,...d},u){const p=[Yf.btn,Yf[s],Yf[o],r].filter(Boolean).join(" ");return i.jsx("button",{ref:u,className:p,...d,children:c})}),rC="_copyButton_1bqk0_1",lC={copyButton:rC},cC=2e3;function dC({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},cC)}catch{}},[t]);return i.jsx("button",{type:"button",className:`${lC.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":o??"copy-button",children:r?i.jsx(Ni,{size:zt,"aria-hidden":"true"}):i.jsx(k_,{size:zt,"aria-hidden":"true"})})}const uC="_banner_bxqlh_1",fC="_label_bxqlh_15",pC="_text_bxqlh_25",mC="_link_bxqlh_29",Mc={banner:uC,label:fC,text:pC,link:mC};function hC(){return i.jsxs("div",{className:Mc.banner,"data-testid":"demo-banner",children:[i.jsx("span",{className:Mc.label,children:"DEMO"}),i.jsxs("span",{className:Mc.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:Mc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const gC="_container_og0yp_1",vC="_chevronButton_og0yp_6",yC="_mainButton_og0yp_6",bC="_sm_og0yp_34",_C="_md_og0yp_34",xC="_lg_og0yp_34",kC="_primary_og0yp_57",SC="_danger_og0yp_70",jC="_outline_og0yp_83",TC="_ghost_og0yp_92",wC="_dropdown_og0yp_100",NC="_option_og0yp_113",CC="_optionLabel_og0yp_130",EC="_optionDesc_og0yp_135",ta={container:gC,chevronButton:vC,mainButton:yC,sm:bC,md:_C,lg:xC,primary:kC,danger:SC,outline:jC,ghost:TC,dropdown:wC,option:NC,optionLabel:CC,optionDesc:EC};function Z_({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 _(k){m.current&&k.target instanceof Node&&!m.current.contains(k.target)&&p(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[u]),y.useEffect(()=>{if(!u)return;function _(k){k.key==="Escape"&&p(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const g=ta[r]||"",v=ta[c]||"",b=()=>{u&&p(!1),s()};return i.jsxs("div",{ref:m,className:ta.container,"data-testid":d,children:[i.jsx("button",{type:"button",className:`${ta.mainButton} ${g} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),i.jsx("button",{type:"button",className:`${ta.chevronButton} ${g} ${v}`,onClick:()=>p(_=>!_),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:i.jsx(x_,{size:zt,"aria-hidden":"true"})}),u&&i.jsx("div",{className:ta.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((_,k)=>i.jsxs("button",{type:"button",className:ta.option,onClick:()=>{_.onClick(),p(!1)},children:[i.jsx("span",{className:ta.optionLabel,children:_.label}),_.description&&i.jsx("span",{className:ta.optionDesc,children:_.description})]},k))})]})}function Bp(){Bp=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)),td(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&&td(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)},Bp.apply(this,arguments)}function td(t,s){return td=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},td(t,s)}function _y(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 Jf(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 _y(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)?_y(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.
278
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var AC=(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){z2(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 M,O=Jf(E.properties.className);!(M=O()).done;){var A=M.value;if(A.slice(0,9)==="language-")return A.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 _,k;k=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,g=t.highlight(Cc(r),k),d.properties.className=(d.properties.className||[]).concat("language-"+k)}catch(E){if(!s.ignoreMissing||!/Unknown language/.test(E.message))throw E;g=r}else g=r;g.children=(v=1,function E(M){return M.reduce(function(O,A){if(A.type==="text"){var $=A.value,Y=($.match(/\n/g)||"").length;if(Y===0)A.position={start:{line:v,column:1},end:{line:v,column:1}},O.push(A);else for(var V,ee=$.split(`
279
+ `),le=Jf(ee.entries());!(V=le()).done;){var Z=V.value,ae=Z[0],H=Z[1];O.push({type:"text",value:ae===ee.length-1?H:H+`
280
+ `,position:{start:{line:v+ae,column:1},end:{line:v+ae,column:1}}})}return v+=Y,O}if(Object.prototype.hasOwnProperty.call(A,"children")){var B=v;return A.children=E(A.children),O.push(A),A.position={start:{line:B,column:1},end:{line:v,column:1}},O}return O.push(A),O},[])})(g.children),g.position=g.children.length>0?{start:{line:g.children[0].position.start.line,column:0},end:{line:g.children[g.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var S,j=(function(E){var M=/{([\d,-]+)}/,O=E.split(",").map(function(Y){return Y.trim()}).join();if(M.test(O)){var A=M.exec(O)[1],$=H2(A);return function(Y){return $.includes(Y+1)}}return function(){return!1}})(m),T=(function(E){var M=Bp(/showLineNumbers=(\d+)/i,{lines:1});if(M.test(E)){var O=M.exec(E);return Number(O.groups.lines)}return 1})(m),w=(function(E){for(var M=new Array(E),O=0;O<E;O++)M[O]={type:"element",tagName:"span",properties:{className:[]},children:[]};return M})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],D=function(){var E,M,O=S.value,A=O[0],$=O[1];$.properties.className=["code-line"];var Y=P2(g,function(V){return V.position.start.line<=A+1&&V.position.end.line>=A+1});$.children=Y.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function(V){return m.toLowerCase().includes(V)})&&($.properties.line=[(A+T).toString()],$.properties.className.push("line-number")),j(A)&&$.properties.className.push("highlight-line"),(b==="diff"||(E=b)!=null&&E.includes("diff-"))&&Cc($).substring(0,1)==="-"?$.properties.className.push("deleted"):(b==="diff"||(M=b)!=null&&M.includes("diff-"))&&Cc($).substring(0,1)==="+"&&$.properties.className.push("inserted")},R=Jf(w.entries());!(S=R()).done;)D();w.length>0&&Cc(w[w.length-1]).trim()===""&&w.pop(),r.children=w}}}})($2);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 As(t){if(t===0)return"-";const s=t/1e5;if(s<.01){const o=t<5?5:4;return`$${s.toFixed(o)}`}return`$${s.toFixed(2)}`}const xy=new Set(["grackle"]);function ll(t){if(t.startsWith("mcp__")){const o=t.indexOf("__",5);if(o>5){const r=t.slice(5,o);if(xy.has(r))return t.slice(o+2)}}const s=t.indexOf("-");if(s>0){const o=t.slice(0,s);if(xy.has(o))return t.slice(s+1)}return t}const DC={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",task_list:"task",task_create:"task",task_show:"task",task_update:"task",task_start:"task",task_complete:"task",task_resume:"task",task_delete:"task",workpad_write:"workpad",workpad_read:"workpad",knowledge_search:"knowledge",knowledge_get_node:"knowledge",knowledge_create_node:"knowledge",ipc_spawn:"ipc",ipc_write:"ipc",ipc_close:"ipc",ipc_list_fds:"ipc",ipc_terminate:"ipc",ipc_create_stream:"ipc",ipc_attach:"ipc",ipc_share_stream:"ipc",ipc_list_streams:"ipc",toolsearch:"tool-search",agent:"agent",task:"agent",read_agent:"agent"};function MC(t){const s=ll(t);return DC[s.toLowerCase()]??"generic"}const RC="_card_qkm9i_2",IC="_cardBlue_qkm9i_20",OC="_cardOrange_qkm9i_24",BC="_cardGreen_qkm9i_28",LC="_cardPurple_qkm9i_32",zC="_cardNeutral_qkm9i_36",$C="_cardRed_qkm9i_40",HC="_cardTeal_qkm9i_44",PC="_header_qkm9i_48",UC="_icon_qkm9i_55",VC="_toolName_qkm9i_64",qC="_fileName_qkm9i_71",GC="_badge_qkm9i_80",FC="_spacer_qkm9i_87",KC="_bodyToggle_qkm9i_91",ZC="_chevron_qkm9i_109",YC="_chevronExpanded_qkm9i_115",JC="_pre_qkm9i_119",WC="_diffAdd_qkm9i_143",XC="_diffRemove_qkm9i_155",QC="_diffContext_qkm9i_167",eE="_diffHeader_qkm9i_176",tE="_diffLine_qkm9i_182",nE="_exitOk_qkm9i_188",sE="_exitError_qkm9i_194",aE="_exitPending_qkm9i_200",iE="_inProgress_qkm9i_228",oE="_metadata_qkm9i_232",rE="_metadataPrefix_qkm9i_239",L={card:RC,cardBlue:IC,cardOrange:OC,cardGreen:BC,cardPurple:LC,cardNeutral:zC,cardRed:$C,cardTeal:HC,header:PC,icon:UC,toolName:VC,fileName:qC,badge:GC,spacer:FC,bodyToggle:KC,chevron:ZC,chevronExpanded:YC,pre:JC,diffAdd:WC,diffRemove:XC,diffContext:QC,diffHeader:eE,diffLine:tE,exitOk:nE,exitError:sE,exitPending:aE,inProgress:iE,metadata:oE,metadataPrefix:rE};function lE(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 cE(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const Wf=5;function ky({tool:t,args:s,result:o,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=lE(s),m=cE(p),g=o===void 0,v=r?L.cardRed:c?L.cardGreen:L.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?i.jsx(Bj,{size:zt}):i.jsx(zj,{size:zt}),k=c?"tool-card-file-write":"tool-card-file-read",S=(o==null?void 0:o.split(`
281
+ `))??[],j=S.length>Wf,T=d?S:S.slice(0,Wf);return i.jsxs("div",{className:`${L.card} ${v} ${g?L.inProgress:""}`,"data-testid":k,children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:_}),i.jsx("span",{className:L.toolName,style:{color:b},children:t}),m&&i.jsx("span",{className:L.fileName,title:p,children:m}),!g&&S.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,children:[S.length," lines"]})]})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&S.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-content",children:T.map((w,C)=>i.jsxs("span",{className:L.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}),w]},C))}),j&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{u(w=>!w)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${d?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),d?"collapse":`${S.length-Wf} more lines`]})]})]})}function dE(t){const s=t.split(`
282
+ `),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 uE(t,s){const o=t.split(`
283
+ `),r=s.split(`
284
+ `),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 fE(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 pE(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 mE(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 hE(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function gE(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=dE(r);if(c.length>0)return c}}const o=mE(t);if(o)return uE(o.oldStr,o.newStr)}const Xf=5;function vE({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=pE(s),m=hE(p),g=o===void 0,v=gE(s,c),b=v?fE(v):null,_=((v==null?void 0:v.length)??0)>Xf,k=d?v:v==null?void 0:v.slice(0,Xf);return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardOrange} ${g?L.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(xT,{size:zt})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&i.jsx("span",{className:L.fileName,title:p,children:m}),b&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.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:L.pre,"data-testid":"tool-card-error",children:o}),!r&&k&&k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-diff",children:k.map((S,j)=>{let T=L.diffContext;return S.type==="add"&&(T=L.diffAdd),S.type==="remove"&&(T=L.diffRemove),S.type==="header"&&(T=L.diffHeader),i.jsx("span",{className:`${L.diffLine} ${T}`,children:S.content},j)})}),_&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${d?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),d?"collapse":`${((v==null?void 0:v.length)??0)-Xf} more lines`]})]}),!r&&!v&&!g&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-content",children:o})]})}const yE=/^\[exit (\d+)\]\s*/;function bE(t){const s=yE.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function _E(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function xE(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 Qf=3;function kE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=_E(s),p=xE(u),m=o===void 0,g=o?bE(o):null,v=(g==null?void 0:g.output.split(`
285
+ `))??[],b=v.length>Qf,_=c?v:v.slice(0,Qf),k=g==null?void 0:g.exitCode,S=r||k!==void 0&&k!==0;return i.jsxs("div",{className:`${L.card} ${S?L.cardRed:L.cardNeutral}`,"data-testid":"tool-card-shell",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),i.jsx("span",{className:L.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==p?u:void 0,"data-testid":"tool-card-command",children:p}),k!==void 0&&i.jsxs("span",{className:k===0?L.exitOk:L.exitError,"data-testid":"tool-card-exit-code",children:[k===0?i.jsx(Ni,{size:Ze,"aria-hidden":"true"}):i.jsx(Is,{size:Ze,"aria-hidden":"true"})," ","exit ",k]}),m&&i.jsx("span",{className:L.exitPending,"data-testid":"tool-card-pending",children:i.jsx(iT,{size:Ze,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-output",children:_.join(`
286
+ `)}),b&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),c?"collapse":`${v.length-Qf} more lines`]})]})]})}function SE(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 ep=5;function jE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=SE(s),m=o===void 0,g=(o==null?void 0:o.split(`
287
+ `).filter(_=>_.length>0))??[],v=g.length>ep,b=c?g:g.slice(0,ep);return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardPurple} ${m?L.inProgress:""}`,"data-testid":"tool-card-search",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(Dp,{size:zt})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&i.jsxs("span",{className:L.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:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&b.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-results",children:b.join(`
288
+ `)}),v&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),c?"collapse":`${g.length-ep} more matches`]})]})]})}const TE="_progressBar_14f5c_1",wE="_progressFill_14f5c_9",NE="_activeTask_14f5c_16",CE="_activeIcon_14f5c_27",EE="_todoPulse_14f5c_1",AE="_activeText_14f5c_34",DE="_checklist_14f5c_48",ME="_item_14f5c_55",RE="_itemIcon_14f5c_65",IE="_itemText_14f5c_73",OE="_pending_14f5c_78",BE="_in_progress_14f5c_85",LE="_completed_14f5c_97",zE="_emptyMessage_14f5c_108",fs={progressBar:TE,progressFill:wE,activeTask:NE,activeIcon:CE,todoPulse:EE,activeText:AE,checklist:DE,item:ME,itemIcon:RE,itemText:IE,pending:OE,in_progress:BE,completed:LE,emptyMessage:zE},$E=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function HE(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:Sy(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:Sy(o.status)})):typeof s.content=="string"?PE(s.content):[]}function Sy(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 PE(t){const s=t.split(`
289
+ `),o=[];for(const r of s){const c=$E.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 UE(t){switch(t){case"completed":return i.jsx(Ni,{size:Ze});case"in_progress":return i.jsx(Si,{size:Ze,fill:"currentColor"});default:return i.jsx(Si,{size:Ze})}}function VE({args:t}){const s=HE(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:`${L.card} ${L.cardBlue}`,"data-testid":"tool-card-todo",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(tT,{size:zt})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-todo-progress",children:[o,"/",s.length]})]})]}),!c&&i.jsx("div",{className:fs.progressBar,"data-testid":"tool-card-todo-bar",children:i.jsx("div",{className:fs.progressFill,style:{width:`${o/s.length*100}%`}})}),r&&i.jsxs("div",{className:fs.activeTask,"data-testid":"tool-card-todo-active",children:[i.jsx("span",{className:fs.activeIcon,children:i.jsx(Si,{size:Ze,fill:"currentColor"})}),i.jsx("span",{className:fs.activeText,children:r.activeForm||r.content})]}),!c&&i.jsx("div",{className:fs.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>i.jsxs("div",{className:`${fs.item} ${fs[d.status]}`,"data-testid":"tool-card-todo-item",children:[i.jsx("span",{className:fs.itemIcon,children:UE(d.status)}),i.jsx("span",{className:fs.itemText,children:d.content})]},u))}),c&&i.jsx("div",{className:fs.emptyMessage,children:"All items completed and cleared."})]})}function qE(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 GE({tool:t,args:s}){const o=qE(t,s);return i.jsxs("div",{className:L.metadata,"data-testid":"tool-card-metadata",children:[i.jsx("span",{className:L.metadataPrefix,children:i.jsx(Ij,{size:Ze})}),o]})}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 KE(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 jy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function ZE(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 tp=5;function YE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=ll(t),p=FE(s),m=o===void 0,{single:g,list:v,sessionId:b}=KE(o),_=(g==null?void 0:g.title)??p.title,k=(g==null?void 0:g.status)??p.status;return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardBlue} ${m?L.inProgress:""}`,"data-testid":"tool-card-task",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"📋"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:u}),_&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-task-title",children:['"',_,'"']}),!_&&p.taskId&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),k&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,style:{color:ZE(k)},"data-testid":"tool-card-task-status",children:[jy(k)," ",k]})]}),v&&!k&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),m&&!_&&!p.taskId&&s!==null&&s!==void 0&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&b&&i.jsxs("div",{className:L.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:L.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(`
290
+ `)}),!r&&v&&v.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,tp)).map(S=>{const j=jy(S.status),T=S.title??S.id??"untitled";return`${j} ${T}`}).join(`
291
+ `)}),v.length>tp&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-tp} more tasks`]})]})]})}function JE(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 WE(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 XE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=ll(t),p=JE(s),m=o===void 0,g=WE(o),v=g.status??p.status,b=g.summary??p.summary;return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardGreen} ${m?L.inProgress:""}`,"data-testid":"tool-card-workpad",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"📓"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsx("span",{className:L.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&i.jsx("pre",{className:L.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&!b&&!v&&!g.extra&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:o}),!r&&g.extra&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function QE(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 eA(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 np=5;function tA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=ll(t),p=QE(s),m=o===void 0,g=eA(o);return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardPurple} ${m?L.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🧠"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.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:L.spacer}),i.jsxs("span",{className:L.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:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&g.results&&g.results.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,np)).map(v=>{var k,S,j;const b=((k=v.node)==null?void 0:k.title)??((S=v.node)==null?void 0:S.label)??((j=v.node)==null?void 0:j.id)??"node",_=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${b}${_}`}).join(`
292
+ `)}),g.results.length>np&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-np} more results`]})]}),!r&&g.node&&!g.results&&i.jsx("pre",{className:L.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(`
293
+ `)})]})}function nA(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 sA(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 aA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=ll(t),p=nA(s),m=o===void 0,g=sA(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:`${L.card} ${r?L.cardRed:L.cardOrange} ${m?L.inProgress:""}`,"data-testid":"tool-card-ipc",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🔀"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&i.jsx("span",{className:L.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.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:L.spacer}),i.jsx("span",{className:L.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:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&g.sessionId&&i.jsxs("div",{className:L.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:L.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:L.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(_=>{const k=[`fd:${_.fd??"?"}`,_.permission??"",_.deliveryMode??""];return _.streamName&&k.push(_.streamName),_.owned&&k.push("(owned)"),k.filter(Boolean).join(" ")}).join(`
294
+ `)}),g.fds.length>5&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function iA(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const sp=8;function oA({args:t,result:s,isError:o}){const[r,c]=y.useState(!1),d=iA(t),u=s===void 0,p=(s==null?void 0:s.split(`
295
+ `))??[],m=p.length>sp,g=r?s:p.slice(0,sp).join(`
296
+ `);return i.jsxs("div",{className:`${L.card} ${o?L.cardRed:L.cardNeutral} ${u?L.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🔧"}),i.jsx("span",{className:L.toolName,children:"ToolSearch"}),d&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!o&&s&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),o&&s&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:s}),!o&&!u&&s&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${r?L.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-sp} more lines`]})]})]})}function rA(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function lA(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 ap=5;function cA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{display:u}=rA(t),p=lA(s),m=o===void 0,g=(o==null?void 0:o.split(`
297
+ `))??[],v=g.length>ap,b=c?o:g.slice(0,ap).join(`
298
+ `);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardBlue} ${m?L.inProgress:""}`,"data-testid":"tool-card-generic",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(Aj,{size:zt,"aria-hidden":"true"})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&i.jsx("span",{className:L.fileName,children:p})]}),m&&_&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:_}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:b}),v&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),c?"collapse":`${g.length-ap} more lines`]})]})]})}const dA="_badgePill_o7eqc_1",uA="_modelBadge_o7eqc_14",fA="_backgroundBadge_o7eqc_26",pA="_backgroundDot_o7eqc_36",mA="_backgroundDotPulsing_o7eqc_41",hA="_description_o7eqc_55",gA="_statusLine_o7eqc_62",vA="_statusCompleted_o7eqc_72",yA="_statusRunning_o7eqc_77",bA="_statusError_o7eqc_83",_A="_promptToggle_o7eqc_88",ps={badgePill:dA,modelBadge:uA,backgroundBadge:fA,backgroundDot:pA,backgroundDotPulsing:mA,description:hA,statusLine:gA,statusCompleted:vA,statusRunning:yA,statusError:bA,promptToggle:_A};function xA(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 kA=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function SA(t){const s=kA.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 ip=5;function jA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),m=xA(t,s),g=o===void 0,v=m.isPoll&&o?SA(o):void 0,b=(v==null?void 0:v.content)??o,_=(b==null?void 0:b.split(`
299
+ `))??[],k=_.length>ip,S=c?b:_.slice(0,ip).join(`
300
+ `),j=m.isPoll?"Subagent":"Agent";return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardTeal} ${g?L.inProgress:""}`,"data-testid":"tool-card-agent",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:j}),m.agentType&&i.jsx("span",{className:ps.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&i.jsx("span",{className:ps.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&i.jsxs("span",{className:ps.backgroundBadge,"data-testid":"tool-card-agent-background",children:[i.jsx("span",{className:g?ps.backgroundDotPulsing:ps.backgroundDot,children:"●"}),"BG"]}),m.agentName&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),i.jsx("span",{className:L.spacer}),g&&!m.isBackground&&i.jsx("span",{className:L.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&i.jsx("div",{className:ps.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&i.jsxs("div",{className:ps.statusLine,"data-testid":"tool-card-agent-status",children:[i.jsx("span",{className:v.status==="completed"?ps.statusCompleted:v.status==="running"?ps.statusRunning:ps.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:ps.promptToggle,onClick:()=>{p(T=>!T)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[i.jsx("span",{className:`${L.chevron} ${u?L.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&b&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:S}),k&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${_.length-ip} more lines`]})]})]})}function op(t){switch(MC(t.tool)){case"file-read":return i.jsx(ky,{...t});case"file-edit":return i.jsx(vE,{...t});case"file-write":return i.jsx(ky,{...t,writeVariant:!0});case"shell":return i.jsx(kE,{...t});case"search":return i.jsx(jE,{...t});case"todo":return i.jsx(VE,{...t});case"metadata":return i.jsx(GE,{...t});case"task":return i.jsx(YE,{...t});case"workpad":return i.jsx(XE,{...t});case"knowledge":return i.jsx(tA,{...t});case"ipc":return i.jsx(aA,{...t});case"tool-search":return i.jsx(oA,{...t});case"agent":return i.jsx(jA,{...t});default:return i.jsx(cA,{...t})}}const TA="_systemContextEvent_1kdcc_1",wA="_systemContextHeader_1kdcc_7",NA="_systemContextBadge_1kdcc_28",CA="_systemContextToggle_1kdcc_37",EA="_systemContextPre_1kdcc_43",AA="_systemContextEllipsis_1kdcc_54",DA="_systemEvent_1kdcc_58",MA="_systemTimestamp_1kdcc_65",RA="_textEvent_1kdcc_69",IA="_codeBlockWrapper_1kdcc_156",OA="_codeBlockCopyButton_1kdcc_159",BA="_errorEvent_1kdcc_163",LA="_statusEvent_1kdcc_171",zA="_userInputEvent_1kdcc_180",$A="_userInputContent_1kdcc_186",HA="_signalEvent_1kdcc_293",PA="_signalBadge_1kdcc_304",UA="_signalContent_1kdcc_313",VA="_usageEvent_1kdcc_318",qA="_usageBadge_1kdcc_325",GA="_defaultEvent_1kdcc_334",Lt={systemContextEvent:TA,systemContextHeader:wA,systemContextBadge:NA,systemContextToggle:CA,systemContextPre:EA,systemContextEllipsis:AA,systemEvent:DA,systemTimestamp:MA,textEvent:RA,codeBlockWrapper:IA,codeBlockCopyButton:OA,errorEvent:BA,statusEvent:LA,userInputEvent:zA,userInputContent:$A,signalEvent:HA,signalBadge:PA,signalContent:UA,usageEvent:VA,usageBadge:qA,defaultEvent:GA},FA=y.lazy(()=>b_(()=>import("./McpAppWidget-DbYqtOnr.js"),__vite__mapDeps([0,1])).then(t=>({default:t.McpAppWidget}))),Ty=3;function KA({content:t}){const[s,o]=y.useState(!1),r=t.split(`
301
+ `),c=r.length>Ty,d=s?t:r.slice(0,Ty).join(`
302
+ `);return i.jsxs("div",{className:Lt.systemContextEvent,"data-testid":"system-context-event",children:[i.jsxs("button",{type:"button",className:Lt.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[i.jsx("span",{className:Lt.systemContextBadge,children:"SYSTEM PROMPT"}),c&&i.jsx("span",{className:Lt.systemContextToggle,"aria-hidden":"true",children:s?i.jsx(x_,{size:Ze}):i.jsx(da,{size:Ze})})]}),i.jsxs("pre",{className:Lt.systemContextPre,children:[d,!s&&c&&i.jsx("span",{className:Lt.systemContextEllipsis,children:"…"})]})]})}function ZA({time:t,content:s}){return i.jsxs("div",{className:Lt.systemEvent,children:[i.jsxs("span",{className:Lt.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Lp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Lp).join(""):t!=null&&typeof t=="object"&&"props"in t?Lp(t.props.children):""}function YA({children:t,node:s,...o}){const r=Lp(t);return i.jsxs("div",{className:Lt.codeBlockWrapper,children:[i.jsx("pre",{...o,children:t}),i.jsx(dC,{text:r,"data-testid":"copy-code-block",className:Lt.codeBlockCopyButton})]})}const JA={pre:YA};function Y_({content:t}){return i.jsx(cm,{remarkPlugins:[dm],rehypePlugins:[AC],components:JA,children:t})}function WA({content:t}){return i.jsx("div",{className:Lt.textEvent,children:i.jsx(Y_,{content:t})})}function XA({content:t}){return i.jsxs("div",{className:Lt.errorEvent,children:["Error: ",t]})}function QA({content:t}){return i.jsxs("div",{className:Lt.statusEvent,children:["--- ",t," ---"]})}function eD({content:t}){return i.jsx("div",{className:Lt.userInputEvent,children:i.jsx("div",{className:Lt.userInputContent,"data-testid":"user-input-content",children:i.jsx(Y_,{content:t})})})}function tD({content:t}){return i.jsxs("div",{className:Lt.signalEvent,"data-testid":"signal-event",children:[i.jsx("span",{className:Lt.signalBadge,children:"SIGNAL"}),i.jsx("span",{className:Lt.signalContent,children:t})]})}function nD({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=As(Number(o.cost_millicents)||0);s=`${d} tokens · ${u}`}catch{}return i.jsx("div",{className:Lt.usageEvent,"data-testid":"usage-event",children:i.jsx("span",{className:Lt.usageBadge,children:s})})}function Rc({content:t}){return i.jsx("div",{className:Lt.defaultEvent,children:t})}function sD({event:t,toolUseCtx:s,settled:o,sandboxProxyUrl:r}){const c=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"widget":{if(!r)return i.jsx(Rc,{content:t.content});let d={};try{d=JSON.parse(t.content)}catch{}return(d.rendererKind??"mcp-app-html")!=="mcp-app-html"||!d.html?i.jsx(Rc,{content:t.content}):i.jsx(y.Suspense,{fallback:i.jsx(Rc,{content:"Loading widget..."}),children:i.jsx(FA,{widgetHtml:d.html,sandboxProxyUrl:r,csp:d.csp,toolInput:d.toolInput,toolResult:d.toolResult})})}case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return i.jsx(KA,{content:t.content})}catch{}return i.jsx(ZA,{time:c,content:t.content})}case"text":case"output":return i.jsx(WA,{content:t.content});case"tool_use":{let d="",u={};try{const p=JSON.parse(t.content);d=p.tool||"",u=p.args}catch{}return i.jsx(op,{tool:d,args:u,result:o?"":void 0})}case"tool_result":{let d=!1;if(t.raw)try{d=JSON.parse(t.raw).is_error===!0}catch{}let u=t.content;if(t.content.trimStart().startsWith("{"))try{const p=JSON.parse(t.content);typeof p.content=="string"&&(u=p.content)}catch{}return s?i.jsx(op,{tool:s.tool,args:s.args,result:u,isError:d,detailedResult:s.detailedResult}):i.jsx(op,{tool:"Tool output",args:void 0,result:u,isError:d})}case"error":return i.jsx(XA,{content:t.content});case"status":return i.jsx(QA,{content:t.content});case"user_input":return i.jsx(eD,{content:t.content});case"signal":return i.jsx(tD,{content:t.content});case"usage":return i.jsx(nD,{content:t.content});default:return i.jsx(Rc,{content:t.content})}}const km=y.createContext({});function Sm(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const _d=y.createContext(null),jm=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class aD 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 iD({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(jm);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(`
303
+ [data-motion-pop-id="${o}"] {
304
+ position: absolute !important;
305
+ width: ${u}px !important;
306
+ height: ${p}px !important;
307
+ top: ${m}px !important;
308
+ left: ${g}px !important;
309
+ }
310
+ `),()=>{document.head.removeChild(v)}},[s]),i.jsx(aD,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const oD=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=Sm(rD),m=y.useId(),g=y.useCallback(b=>{p.set(b,!0);for(const _ of p.values())if(!_)return;r&&r()},[p,r]),v=y.useMemo(()=>({id:m,initial:s,isPresent: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,_)=>p.set(_,!1))},[o]),y.useEffect(()=>{!o&&!p.size&&r&&r()},[o]),u==="popLayout"&&(t=i.jsx(iD,{isPresent:o,children:t})),i.jsx(_d.Provider,{value:v,children:t})};function rD(){return new Map}function J_(t=!0){const s=y.useContext(_d);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 Ic=t=>t.key||"";function wy(t){const s=[];return y.Children.forEach(t,o=>{y.isValidElement(o)&&s.push(o)}),s}const Tm=typeof window<"u",W_=Tm?y.useLayoutEffect:y.useEffect,as=({children:t,custom:s,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=J_(u),g=y.useMemo(()=>wy(t),[t]),v=u&&!p?[]:g.map(Ic),b=y.useRef(!0),_=y.useRef(g),k=Sm(()=>new Map),[S,j]=y.useState(g),[T,w]=y.useState(g);W_(()=>{b.current=!1,_.current=g;for(let R=0;R<T.length;R++){const E=Ic(T[R]);v.includes(E)?k.delete(E):k.get(E)!==!0&&k.set(E,!1)}},[T,v.length,v.join("-")]);const C=[];if(g!==S){let R=[...g];for(let E=0;E<T.length;E++){const M=T[E],O=Ic(M);v.includes(O)||(R.splice(E,0,M),C.push(M))}d==="wait"&&C.length&&(R=C),w(wy(R)),j(g);return}const{forceRender:D}=y.useContext(km);return i.jsx(i.Fragment,{children:T.map(R=>{const E=Ic(R),M=u&&!p?!1:g===T||v.includes(E),O=()=>{if(k.has(E))k.set(E,!0);else return;let A=!0;k.forEach($=>{$||(A=!1)}),A&&(D==null||D(),w(_.current),u&&(m==null||m()),r&&r())};return i.jsx(oD,{isPresent:M,initial:!b.current||o?void 0:!1,custom:M?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:M?void 0:O,children:R},E)})})},$n=t=>t;let X_=$n;const lD={useManualTiming:!1};function cD(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 k=b&&r?s:o;return v&&d.add(g),k.has(g)||k.add(g),g},cancel:g=>{o.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,o]=[o,s],s.forEach(p),s.clear(),r=!1,c&&(c=!1,m.process(g))}};return m}const Oc=["read","resolveKeyframes","update","preRender","render","postRender"],dD=40;function Q_(t,s){let o=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>o=!0,u=Oc.reduce((w,C)=>(w[C]=cD(d),w),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:b,postRender:_}=u,k=()=>{const w=performance.now();o=!1,c.delta=r?1e3/60:Math.max(Math.min(w-c.timestamp,dD),1),c.timestamp=w,c.isProcessing=!0,p.process(c),m.process(c),g.process(c),v.process(c),b.process(c),_.process(c),c.isProcessing=!1,o&&s&&(r=!1,t(k))},S=()=>{o=!0,r=!0,c.isProcessing||t(k)};return{schedule:Oc.reduce((w,C)=>{const D=u[C];return w[C]=(R,E=!1,M=!1)=>(o||S(),D.schedule(R,E,M)),w},{}),cancel:w=>{for(let C=0;C<Oc.length;C++)u[Oc[C]].cancel(w)},state:c,steps:u}}const{schedule:St,cancel:Ka,state:fn,steps:rp}=Q_(typeof requestAnimationFrame<"u"?requestAnimationFrame:$n,!0),ex=y.createContext({strict:!1}),Ny={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 Ny)Oo[t]={isEnabled:s=>Ny[t].some(o=>!!s[o])};function uD(t){for(const s in t)Oo[s]={...Oo[s],...t[s]}}const fD=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 nd(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||fD.has(t)}let tx=t=>!nd(t);function pD(t){t&&(tx=s=>s.startsWith("on")?!nd(s):t(s))}try{pD(require("@emotion/is-prop-valid").default)}catch{}function mD(t,s,o){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(tx(c)||o===!0&&nd(c)||!s&&!nd(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function hD(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 xd=y.createContext({});function Qr(t){return typeof t=="string"||Array.isArray(t)}function kd(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const wm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Nm=["initial",...wm];function Sd(t){return kd(t.animate)||Nm.some(s=>Qr(t[s]))}function nx(t){return!!(Sd(t)||t.variants)}function gD(t,s){if(Sd(t)){const{initial:o,animate:r}=t;return{initial:o===!1||Qr(o)?o:void 0,animate:Qr(r)?r:void 0}}return t.inherit!==!1?s:{}}function vD(t){const{initial:s,animate:o}=gD(t,y.useContext(xd));return y.useMemo(()=>({initial:s,animate:o}),[Cy(s),Cy(o)])}function Cy(t){return Array.isArray(t)?t.join(" "):t}const yD=Symbol.for("motionComponentSymbol");function No(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function bD(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):No(o)&&(o.current=r))},[s])}const Cm=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),_D="framerAppearId",sx="data-"+Cm(_D),{schedule:Em}=Q_(queueMicrotask,!1),ax=y.createContext({});function xD(t,s,o,r,c){var d,u;const{visualElement:p}=y.useContext(xd),m=y.useContext(ex),g=y.useContext(_d),v=y.useContext(jm).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 _=b.current,k=y.useContext(ax);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&kD(b.current,o,c,k);const S=y.useRef(!1);y.useInsertionEffect(()=>{_&&S.current&&_.update(o,g)});const j=o[sx],T=y.useRef(!!j&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,j))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,j)));return W_(()=>{_&&(S.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Em.render(_.render),T.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!T.current&&_.animationState&&_.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{var w;(w=window.MotionHandoffMarkAsComplete)===null||w===void 0||w.call(window,j)}),T.current=!1))}),_}function kD(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:ix(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&No(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function ix(t){if(t)return t.options.allowProjection!==!1?t.projection:ix(t.parent)}function SD({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&uD(t);function p(g,v){let b;const _={...y.useContext(jm),...g,layoutId:jD(g)},{isStatic:k}=_,S=vD(g),j=r(g,k);if(!k&&Tm){TD();const T=wD(_);b=T.MeasureLayout,S.visualElement=xD(c,j,_,s,T.ProjectionNode)}return i.jsxs(xd.Provider,{value:S,children:[b&&S.visualElement?i.jsx(b,{visualElement:S.visualElement,..._}):null,o(c,g,bD(j,S.visualElement,v),j,k,S.visualElement)]})}p.displayName=`motion.${typeof c=="string"?c:`create(${(u=(d=c.displayName)!==null&&d!==void 0?d:c.name)!==null&&u!==void 0?u:""})`}`;const m=y.forwardRef(p);return m[yD]=c,m}function jD({layoutId:t}){const s=y.useContext(km).id;return s&&t!==void 0?s+"-"+t:t}function TD(t,s){y.useContext(ex).strict}function wD(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 ND=["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 Am(t){return typeof t!="string"||t.includes("-")?!1:!!(ND.indexOf(t)>-1||/[A-Z]/u.test(t))}function Ey(t){const s=[{},{}];return t==null||t.values.forEach((o,r)=>{s[0][r]=o.get(),s[1][r]=o.getVelocity()}),s}function Dm(t,s,o,r){if(typeof s=="function"){const[c,d]=Ey(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]=Ey(r);s=s(o!==void 0?o:t.custom,c,d)}return s}const zp=t=>Array.isArray(t),CD=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),ED=t=>zp(t)?t[t.length-1]||0:t,gn=t=>!!(t&&t.getVelocity);function Zc(t){const s=gn(t)?t.get():t;return CD(s)?s.toValue():s}function AD({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:DD(r,c,d,t),renderState:s()};return o&&(u.onMount=p=>o({props:r,current:p,...u}),u.onUpdate=p=>o(p)),u}const ox=t=>(s,o)=>{const r=y.useContext(xd),c=y.useContext(_d),d=()=>AD(t,s,r,c);return o?d():Sm(d)};function DD(t,s,o,r){const c={},d=r(t,{});for(const _ in d)c[_]=Zc(d[_]);let{initial:u,animate:p}=t;const m=Sd(t),g=nx(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"&&!kd(b)){const _=Array.isArray(b)?b:[b];for(let k=0;k<_.length;k++){const S=Dm(t,_[k]);if(S){const{transitionEnd:j,transition:T,...w}=S;for(const C in w){let D=w[C];if(Array.isArray(D)){const R=v?D.length-1:0;D=D[R]}D!==null&&(c[C]=D)}for(const C in j)c[C]=j[C]}}}return c}const Po=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Di=new Set(Po),rx=t=>s=>typeof s=="string"&&s.startsWith(t),lx=rx("--"),MD=rx("var(--"),Mm=t=>MD(t)?RD.test(t.split("/*")[0].trim()):!1,RD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,cx=(t,s)=>s&&typeof t=="number"?s.transform(t):t,ca=(t,s,o)=>o>s?s:o<t?t:o,Uo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},el={...Uo,transform:t=>ca(0,1,t)},Bc={...Uo,default:1},cl=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),qa=cl("deg"),Ms=cl("%"),Ae=cl("px"),ID=cl("vh"),OD=cl("vw"),Ay={...Ms,parse:t=>Ms.parse(t)/100,transform:t=>Ms.transform(t*100)},BD={borderWidth:Ae,borderTopWidth:Ae,borderRightWidth:Ae,borderBottomWidth:Ae,borderLeftWidth:Ae,borderRadius:Ae,radius:Ae,borderTopLeftRadius:Ae,borderTopRightRadius:Ae,borderBottomRightRadius:Ae,borderBottomLeftRadius:Ae,width:Ae,maxWidth:Ae,height:Ae,maxHeight:Ae,top:Ae,right:Ae,bottom:Ae,left:Ae,padding:Ae,paddingTop:Ae,paddingRight:Ae,paddingBottom:Ae,paddingLeft:Ae,margin:Ae,marginTop:Ae,marginRight:Ae,marginBottom:Ae,marginLeft:Ae,backgroundPositionX:Ae,backgroundPositionY:Ae},LD={rotate:qa,rotateX:qa,rotateY:qa,rotateZ:qa,scale:Bc,scaleX:Bc,scaleY:Bc,scaleZ:Bc,skew:qa,skewX:qa,skewY:qa,distance:Ae,translateX:Ae,translateY:Ae,translateZ:Ae,x:Ae,y:Ae,z:Ae,perspective:Ae,transformPerspective:Ae,opacity:el,originX:Ay,originY:Ay,originZ:Ae},Dy={...Uo,transform:Math.round},Rm={...BD,...LD,zIndex:Dy,size:Ae,fillOpacity:el,strokeOpacity:el,numOctaves:Dy},zD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$D=Po.length;function HD(t,s,o){let r="",c=!0;for(let d=0;d<$D;d++){const u=Po[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=cx(p,Rm[u]);if(!m){c=!1;const v=zD[u]||u;r+=`${v}(${g}) `}o&&(s[u]=g)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Im(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(Di.has(m)){u=!0;continue}else if(lx(m)){c[m]=g;continue}else{const v=cx(g,Rm[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||o?r.transform=HD(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 PD={offset:"stroke-dashoffset",array:"stroke-dasharray"},UD={offset:"strokeDashoffset",array:"strokeDasharray"};function VD(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?PD:UD;t[d.offset]=Ae.transform(-r);const u=Ae.transform(s),p=Ae.transform(o);t[d.array]=`${u} ${p}`}function My(t,s,o){return typeof t=="string"?t:Ae.transform(s+o*t)}function qD(t,s,o){const r=My(s,t.x,t.width),c=My(o,t.y,t.height);return`${r} ${c}`}function Om(t,{attrX:s,attrY:o,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,b){if(Im(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:_,style:k,dimensions:S}=t;_.transform&&(S&&(k.transform=_.transform),delete _.transform),S&&(c!==void 0||d!==void 0||k.transform)&&(k.transformOrigin=qD(S,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(_.x=s),o!==void 0&&(_.y=o),r!==void 0&&(_.scale=r),u!==void 0&&VD(_,u,p,m,!1)}const Bm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),dx=()=>({...Bm(),attrs:{}}),Lm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function ux(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 fx=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 px(t,s,o,r){ux(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(fx.has(c)?c:Cm(c),s.attrs[c])}const sd={};function GD(t){Object.assign(sd,t)}function mx(t,{layout:s,layoutId:o}){return Di.has(t)||t.startsWith("origin")||(s||o!==void 0)&&(!!sd[t]||t==="opacity")}function zm(t,s,o){var r;const{style:c}=t,d={};for(const u in c)(gn(c[u])||s.style&&gn(s.style[u])||mx(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 hx(t,s,o){const r=zm(t,s,o);for(const c in t)if(gn(t[c])||gn(s[c])){const d=Po.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 Ry=["x","y","width","height","cx","cy","r"],KD={useVisualState:ox({scrapeMotionValuesFromProps:hx,createRenderState:dx,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(Di.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<Ry.length;p++){const m=Ry[p];t[m]!==s[m]&&(u=!0)}u&&St.read(()=>{FD(o,r),St.render(()=>{Om(r,c,Lm(o.tagName),t.transformTemplate),px(o,r)})})}})},ZD={useVisualState:ox({scrapeMotionValuesFromProps:zm,createRenderState:Bm})};function gx(t,s,o){for(const r in s)!gn(s[r])&&!mx(r,o)&&(t[r]=s[r])}function YD({transformTemplate:t},s){return y.useMemo(()=>{const o=Bm();return Im(o,s,t),Object.assign({},o.vars,o.style)},[s])}function JD(t,s){const o=t.style||{},r={};return gx(r,o,t),Object.assign(r,YD(t,s)),r}function WD(t,s){const o={},r=JD(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 XD(t,s,o,r){const c=y.useMemo(()=>{const d=dx();return Om(d,s,Lm(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};gx(d,t.style,t),c.style={...d,...c.style}}return c}function QD(t=!1){return(o,r,c,{latestValues:d},u)=>{const m=(Am(o)?XD:WD)(r,d,u,o),g=mD(r,typeof o=="string",t),v=o!==y.Fragment?{...g,...m,ref:c}:{},{children:b}=r,_=y.useMemo(()=>gn(b)?b.get():b,[b]);return y.createElement(o,{...v,children:_})}}function eM(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Am(r)?KD:ZD,preloadedFeatures:t,useRender:QD(c),createVisualElement:s,Component:r};return SD(u)}}function vx(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 Dm(r,s,o!==void 0?o:r.custom,t)}function $m(t,s){return t?t[s]||t.default||t:void 0}const yx=new Set(["width","height","top","left","right","bottom",...Po]);let Yc;function tM(){Yc=void 0}const Rs={now:()=>(Yc===void 0&&Rs.set(fn.isProcessing||lD.useManualTiming?fn.timestamp:performance.now()),Yc),set:t=>{Yc=t,queueMicrotask(tM)}};function Hm(t,s){t.indexOf(s)===-1&&t.push(s)}function Pm(t,s){const o=t.indexOf(s);o>-1&&t.splice(o,1)}class Um{constructor(){this.subscriptions=[]}add(s){return Hm(this.subscriptions,s),()=>Pm(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 bx(t,s){return s?t*(1e3/s):0}const Iy=30,nM=t=>!isNaN(parseFloat(t));class sM{constructor(s,o={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=Rs.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=Rs.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=nM(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 Um);const r=this.events[s].add(o);return s==="change"?()=>{r(),St.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=Rs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Iy)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,Iy);return bx(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 tl(t,s){return new sM(t,s)}function aM(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,tl(o))}function iM(t,s){const o=jd(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const p=ED(d[u]);aM(t,u,p)}}function oM(t){return!!(gn(t)&&t.add)}function $p(t,s){const o=t.getValue("willChange");if(oM(o))return o.add(s)}function _x(t){return t.props[sx]}function Vm(t){let s;return()=>(s===void 0&&(s=t()),s)}const rM=Vm(()=>window.ScrollTimeline!==void 0);class lM{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(rM()&&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 cM extends lM{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const ia=t=>t*1e3,oa=t=>t/1e3;function qm(t){return typeof t=="function"}function Oy(t,s){t.timeline=s,t.onfinish=null}const Gm=t=>Array.isArray(t)&&typeof t[0]=="number",dM={linearEasing:void 0};function uM(t,s){const o=Vm(t);return()=>{var r;return(r=dM[s])!==null&&r!==void 0?r:o()}}const ad=uM(()=>{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},xx=(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 kx(t){return!!(typeof t=="function"&&ad()||!t||typeof t=="string"&&(t in Hp||ad())||Gm(t)||Array.isArray(t)&&t.every(kx))}const Hr=([t,s,o,r])=>`cubic-bezier(${t}, ${s}, ${o}, ${r})`,Hp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Hr([0,.65,.55,1]),circOut:Hr([.55,0,1,.45]),backIn:Hr([.31,.01,.66,-.59]),backOut:Hr([.33,1.53,.69,.99])};function Sx(t,s){if(t)return typeof t=="function"&&ad()?xx(t,s):Gm(t)?Hr(t):Array.isArray(t)?t.map(o=>Sx(o,s)||Hp.easeOut):Hp[t]}const jx=(t,s,o)=>(((1-3*o+3*s)*t+(3*o-6*s))*t+3*s)*t,fM=1e-7,pM=12;function mM(t,s,o,r,c){let d,u,p=0;do u=s+(o-s)/2,d=jx(u,r,c)-t,d>0?o=u:s=u;while(Math.abs(d)>fM&&++p<pM);return u}function dl(t,s,o,r){if(t===s&&o===r)return $n;const c=d=>mM(d,0,1,t,o);return d=>d===0||d===1?d:jx(c(d),s,r)}const Tx=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,wx=t=>s=>1-t(1-s),Nx=dl(.33,1.53,.69,.99),Fm=wx(Nx),Cx=Tx(Fm),Ex=t=>(t*=2)<1?.5*Fm(t):.5*(2-Math.pow(2,-10*(t-1))),Km=t=>1-Math.sin(Math.acos(t)),Ax=wx(Km),Dx=Tx(Km),Mx=t=>/^0[^.\s]+$/u.test(t);function hM(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Mx(t):!0}const Gr=t=>Math.round(t*1e5)/1e5,Zm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function gM(t){return t==null}const vM=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ym=(t,s)=>o=>!!(typeof o=="string"&&vM.test(o)&&o.startsWith(t)||s&&!gM(o)&&Object.prototype.hasOwnProperty.call(o,s)),Rx=(t,s,o)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(Zm);return{[t]:parseFloat(c),[s]:parseFloat(d),[o]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},yM=t=>ca(0,255,t),lp={...Uo,transform:t=>Math.round(yM(t))},_i={test:Ym("rgb","red"),parse:Rx("red","green","blue"),transform:({red:t,green:s,blue:o,alpha:r=1})=>"rgba("+lp.transform(t)+", "+lp.transform(s)+", "+lp.transform(o)+", "+Gr(el.transform(r))+")"};function bM(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 Pp={test:Ym("#"),parse:bM,transform:_i.transform},Co={test:Ym("hsl","hue"),parse:Rx("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:o,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ms.transform(Gr(s))+", "+Ms.transform(Gr(o))+", "+Gr(el.transform(r))+")"},hn={test:t=>_i.test(t)||Pp.test(t)||Co.test(t),parse:t=>_i.test(t)?_i.parse(t):Co.test(t)?Co.parse(t):Pp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?_i.transform(t):Co.transform(t)},_M=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function xM(t){var s,o;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Zm))===null||s===void 0?void 0:s.length)||0)+(((o=t.match(_M))===null||o===void 0?void 0:o.length)||0)>0}const Ix="number",Ox="color",kM="var",SM="var(",By="${}",jM=/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 nl(t){const s=t.toString(),o=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace(jM,m=>(hn.test(m)?(r.color.push(d),c.push(Ox),o.push(hn.parse(m))):m.startsWith(SM)?(r.var.push(d),c.push(kM),o.push(m)):(r.number.push(d),c.push(Ix),o.push(parseFloat(m))),++d,By)).split(By);return{values:o,split:p,indexes:r,types:c}}function Bx(t){return nl(t).values}function Lx(t){const{split:s,types:o}=nl(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===Ix?d+=Gr(c[u]):p===Ox?d+=hn.transform(c[u]):d+=c[u]}return d}}const TM=t=>typeof t=="number"?0:t;function wM(t){const s=Bx(t);return Lx(t)(s.map(TM))}const Za={test:xM,parse:Bx,createTransformer:Lx,getAnimatableNone:wM},NM=new Set(["brightness","contrast","saturate","opacity"]);function CM(t){const[s,o]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=o.match(Zm)||[];if(!r)return t;const c=o.replace(r,"");let d=NM.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const EM=/\b([a-z-]*)\(.*?\)/gu,Up={...Za,getAnimatableNone:t=>{const s=t.match(EM);return s?s.map(CM).join(" "):t}},AM={...Rm,color:hn,backgroundColor:hn,outlineColor:hn,fill:hn,stroke:hn,borderColor:hn,borderTopColor:hn,borderRightColor:hn,borderBottomColor:hn,borderLeftColor:hn,filter:Up,WebkitFilter:Up},Jm=t=>AM[t];function zx(t,s){let o=Jm(t);return o!==Up&&(o=Za),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const DM=new Set(["auto","none","0"]);function MM(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!DM.has(d)&&nl(d).values.length&&(c=t[r]),r++}if(c&&o)for(const d of s)t[d]=zx(o,c)}const Ly=t=>t===Uo||t===Ae,zy=(t,s)=>parseFloat(t.split(", ")[s]),$y=(t,s)=>(o,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return zy(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?zy(d[1],t):0}},RM=new Set(["x","y","z"]),IM=Po.filter(t=>!RM.has(t));function OM(t){const s=[];return IM.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:$y(4,13),y:$y(5,14)};Lo.translateX=Lo.x;Lo.translateY=Lo.y;const ki=new Set;let Vp=!1,qp=!1;function $x(){if(qp){const t=Array.from(ki).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),o=new Map;s.forEach(r=>{const c=OM(r);c.length&&(o.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=o.get(r);c&&c.forEach(([d,u])=>{var p;(p=r.getValue(d))===null||p===void 0||p.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}qp=!1,Vp=!1,ki.forEach(t=>t.complete()),ki.clear()}function Hx(){ki.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(qp=!0)})}function BM(){Hx(),$x()}class Wm{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?(ki.add(this),Vp||(Vp=!0,St.read(Hx),St.resolveKeyframes($x))):(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),ki.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,ki.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Px=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),LM=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function zM(t){const s=LM.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function Ux(t,s,o=1){const[r,c]=zM(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return Px(u)?parseFloat(u):u}return Mm(c)?Ux(c,s,o+1):c}const Vx=t=>s=>s.test(t),$M={test:t=>t==="auto",parse:t=>t},qx=[Uo,Ae,Ms,qa,OD,ID,$M],Hy=t=>qx.find(Vx(t));class Gx extends Wm{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(),Mm(g))){const v=Ux(g,o.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!yx.has(r)||s.length!==2)return;const[c,d]=s,u=Hy(c),p=Hy(d);if(u!==p)if(Ly(u)&&Ly(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++)hM(s[c])&&r.push(c);r.length&&MM(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 Py=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Za.test(t)||t==="0")&&!t.startsWith("url("));function HM(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 PM(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=Py(c,s),p=Py(d,s);return!u||!p?!1:HM(t)||(o==="spring"||qm(o))&&r}const UM=t=>t!==null;function Td(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(UM),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const VM=40;class Fx{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=Rs.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>VM?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&BM(),this._resolved}onKeyframesResolved(s,o){this.resolvedAt=Rs.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!PM(s,r,c,d))if(u)this.options.duration=0;else{m&&m(Td(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 Gp=2e4;function Kx(t){let s=0;const o=50;let r=t.next(s);for(;!r.done&&s<Gp;)s+=o,r=t.next(s);return s>=Gp?1/0:s}const Ct=(t,s,o)=>t+(s-t)*o;function cp(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 qM({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=cp(m,p,t+1/3),d=cp(m,p,t),u=cp(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function id(t,s){return o=>o>0?s:t}const dp=(t,s,o)=>{const r=t*t,c=o*(s*s-r)+r;return c<0?0:Math.sqrt(c)},GM=[Pp,_i,Co],FM=t=>GM.find(s=>s.test(t));function Uy(t){const s=FM(t);if(!s)return!1;let o=s.parse(t);return s===Co&&(o=qM(o)),o}const Vy=(t,s)=>{const o=Uy(t),r=Uy(s);if(!o||!r)return id(t,s);const c={...o};return d=>(c.red=dp(o.red,r.red,d),c.green=dp(o.green,r.green,d),c.blue=dp(o.blue,r.blue,d),c.alpha=Ct(o.alpha,r.alpha,d),_i.transform(c))},KM=(t,s)=>o=>s(t(o)),ul=(...t)=>t.reduce(KM),Fp=new Set(["none","hidden"]);function ZM(t,s){return Fp.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function YM(t,s){return o=>Ct(t,s,o)}function Xm(t){return typeof t=="number"?YM:typeof t=="string"?Mm(t)?id:hn.test(t)?Vy:XM:Array.isArray(t)?Zx:typeof t=="object"?hn.test(t)?Vy:JM:id}function Zx(t,s){const o=[...t],r=o.length,c=t.map((d,u)=>Xm(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)o[u]=c[u](d);return o}}function JM(t,s){const o={...t,...s},r={};for(const c in o)t[c]!==void 0&&s[c]!==void 0&&(r[c]=Xm(t[c])(t[c],s[c]));return c=>{for(const d in r)o[d]=r[d](c);return o}}function WM(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 XM=(t,s)=>{const o=Za.createTransformer(s),r=nl(t),c=nl(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?Fp.has(t)&&!c.values.length||Fp.has(s)&&!r.values.length?ZM(t,s):ul(Zx(WM(r,c),c.values),o):id(t,s)};function Yx(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?Ct(t,s,o):Xm(t)(t,s)}const QM=5;function Jx(t,s,o){const r=Math.max(s-QM,0);return bx(o-t(r),s-r)}const Mt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},up=.001;function eR({duration:t=Mt.duration,bounce:s=Mt.bounce,velocity:o=Mt.velocity,mass:r=Mt.mass}){let c,d,u=1-s;u=ca(Mt.minDamping,Mt.maxDamping,u),t=ca(Mt.minDuration,Mt.maxDuration,oa(t)),u<1?(c=g=>{const v=g*u,b=v*t,_=v-o,k=Kp(g,u),S=Math.exp(-b);return up-_/k*S},d=g=>{const b=g*u*t,_=b*o+o,k=Math.pow(u,2)*Math.pow(g,2)*t,S=Math.exp(-b),j=Kp(Math.pow(g,2),u);return(-c(g)+up>0?-1:1)*((_-k)*S)/j}):(c=g=>{const v=Math.exp(-g*t),b=(g-o)*t+1;return-up+v*b},d=g=>{const v=Math.exp(-g*t),b=(o-g)*(t*t);return v*b});const p=5/t,m=nR(c,d,p);if(t=ia(t),isNaN(m))return{stiffness:Mt.stiffness,damping:Mt.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const tR=12;function nR(t,s,o){let r=o;for(let c=1;c<tR;c++)r=r-t(r)/s(r);return r}function Kp(t,s){return t*Math.sqrt(1-s*s)}const sR=["duration","bounce"],aR=["stiffness","damping","mass"];function qy(t,s){return s.some(o=>t[o]!==void 0)}function iR(t){let s={velocity:Mt.velocity,stiffness:Mt.stiffness,damping:Mt.damping,mass:Mt.mass,isResolvedFromDuration:!1,...t};if(!qy(t,aR)&&qy(t,sR))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*ca(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Mt.mass,stiffness:c,damping:d}}else{const o=eR(t);s={...s,...o,mass:Mt.mass},s.isResolvedFromDuration=!0}return s}function Wx(t=Mt.visualDuration,s=Mt.bounce){const o=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=o;const d=o.keyframes[0],u=o.keyframes[o.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:v,duration:b,velocity:_,isResolvedFromDuration:k}=iR({...o,velocity:-oa(o.velocity||0)}),S=_||0,j=g/(2*Math.sqrt(m*v)),T=u-d,w=oa(Math.sqrt(m/v)),C=Math.abs(T)<5;r||(r=C?Mt.restSpeed.granular:Mt.restSpeed.default),c||(c=C?Mt.restDelta.granular:Mt.restDelta.default);let D;if(j<1){const E=Kp(w,j);D=M=>{const O=Math.exp(-j*w*M);return u-O*((S+j*w*T)/E*Math.sin(E*M)+T*Math.cos(E*M))}}else if(j===1)D=E=>u-Math.exp(-w*E)*(T+(S+w*T)*E);else{const E=w*Math.sqrt(j*j-1);D=M=>{const O=Math.exp(-j*w*M),A=Math.min(E*M,300);return u-O*((S+j*w*T)*Math.sinh(A)+E*T*Math.cosh(A))/E}}const R={calculatedDuration:k&&b||null,next:E=>{const M=D(E);if(k)p.done=E>=b;else{let O=0;j<1&&(O=E===0?ia(S):Jx(D,E,M));const A=Math.abs(O)<=r,$=Math.abs(u-M)<=c;p.done=A&&$}return p.value=p.done?u:M,p},toString:()=>{const E=Math.min(Kx(R),Gp),M=xx(O=>R.next(E*O).value,E,30);return E+"ms "+M}};return R}function Gy({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],_={done:!1,value:b},k=A=>p!==void 0&&A<p||m!==void 0&&A>m,S=A=>p===void 0?m:m===void 0||Math.abs(p-A)<Math.abs(m-A)?p:m;let j=o*s;const T=b+j,w=u===void 0?T:u(T);w!==T&&(j=w-b);const C=A=>-j*Math.exp(-A/r),D=A=>w+C(A),R=A=>{const $=C(A),Y=D(A);_.done=Math.abs($)<=g,_.value=_.done?w:Y};let E,M;const O=A=>{k(_.value)&&(E=A,M=Wx({keyframes:[_.value,S(_.value)],velocity:Jx(D,A,_.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return O(0),{calculatedDuration:null,next:A=>{let $=!1;return!M&&E===void 0&&($=!0,R(A),O(A)),E!==void 0&&A>=E?M.next(A-E):(!$&&R(A),_)}}}const oR=dl(.42,0,1,1),rR=dl(0,0,.58,1),Xx=dl(.42,0,.58,1),lR=t=>Array.isArray(t)&&typeof t[0]!="number",cR={linear:$n,easeIn:oR,easeInOut:Xx,easeOut:rR,circIn:Km,circInOut:Dx,circOut:Ax,backIn:Fm,backInOut:Cx,backOut:Nx,anticipate:Ex},Fy=t=>{if(Gm(t)){X_(t.length===4);const[s,o,r,c]=t;return dl(s,o,r,c)}else if(typeof t=="string")return cR[t];return t};function dR(t,s,o){const r=[],c=o||Yx,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]||$n:s;p=ul(m,p)}r.push(p)}return r}function uR(t,s,{clamp:o=!0,ease:r,mixer:c}={}){const d=t.length;if(X_(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=dR(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 _=Bo(t[b],t[b+1],v);return p[b](_)};return o?v=>g(ca(t[0],t[d-1],v)):g}function fR(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=Bo(0,s,r);t.push(Ct(o,1,c))}}function pR(t){const s=[0];return fR(s,t.length-1),s}function mR(t,s){return t.map(o=>o*s)}function hR(t,s){return t.map(()=>s||Xx).splice(0,t.length-1)}function od({duration:t=300,keyframes:s,times:o,ease:r="easeInOut"}){const c=lR(r)?r.map(Fy):Fy(r),d={done:!1,value:s[0]},u=mR(o&&o.length===s.length?o:pR(s),t),p=uR(u,s,{ease:Array.isArray(c)?c:hR(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const gR=t=>{const s=({timestamp:o})=>t(o);return{start:()=>St.update(s,!0),stop:()=>Ka(s),now:()=>fn.isProcessing?fn.timestamp:Rs.now()}},vR={decay:Gy,inertia:Gy,tween:od,keyframes:od,spring:Wx},yR=t=>t/100;class Qm extends Fx{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)||Wm,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=qm(o)?o:vR[o]||od;let m,g;p!==od&&typeof s[0]!="number"&&(m=ul(yR,Yx(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=Kx(v));const{calculatedDuration:b}=v,_=b+c,k=_*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:b,resolvedDuration:_,totalDuration:k}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,o=!1){const{resolved:r}=this;if(!r){const{keyframes:A}=this.options;return{done:!0,value:A[A.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:p,keyframes:m,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=r;if(this.startTime===null)return d.next(0);const{delay:_,repeat:k,repeatType:S,repeatDelay:j,onUpdate:T}=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 w=this.currentTime-_*(this.speed>=0?1:-1),C=this.speed>=0?w<0:w>v;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let D=this.currentTime,R=d;if(k){const A=Math.min(this.currentTime,v)/b;let $=Math.floor(A),Y=A%1;!Y&&A>=1&&(Y=1),Y===1&&$--,$=Math.min($,k+1),!!($%2)&&(S==="reverse"?(Y=1-Y,j&&(Y-=j/b)):S==="mirror"&&(R=u)),D=ca(0,1,Y)*b}const E=C?{done:!1,value:m[0]}:R.next(D);p&&(E.value=p(E.value));let{done:M}=E;!C&&g!==null&&(M=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&M);return O&&c!==void 0&&(E.value=Td(m,this.options,c)),T&&T(E.value),O&&this.finish(),E}get duration(){const{resolved:s}=this;return s?oa(s.calculatedDuration):0}get time(){return oa(this.currentTime)}set time(s){s=ia(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=oa(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=gR,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 bR=new Set(["opacity","clipPath","filter","transform"]);function _R(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=Sx(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 xR=Vm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),rd=10,kR=2e4;function SR(t){return qm(t.type)||t.type==="spring"||!kx(t.ease)}function jR(t,s){const o=new Qm({...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<kR;)r=o.sample(d),c.push(r.value),d+=rd;return{times:void 0,keyframes:c,duration:d-rd,ease:"linear"}}const Qx={anticipate:Ex,backInOut:Cx,circInOut:Dx};function TR(t){return t in Qx}class Ky extends Fx{constructor(s){super(s);const{name:o,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new Gx(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"&&ad()&&TR(d)&&(d=Qx[d]),SR(this.options)){const{onComplete:b,onUpdate:_,motionValue:k,element:S,...j}=this.options,T=jR(s,j);s=T.keyframes,s.length===1&&(s[1]=s[0]),r=T.duration,c=T.times,d=T.ease,u="keyframes"}const v=_R(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(Oy(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(Td(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 oa(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return oa(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=ia(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 $n;const{animation:r}=o;Oy(r,s)}return $n}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:_,...k}=this.options,S=new Qm({...k,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),j=ia(this.time);g.setWithVelocity(S.sample(j-rd).value,S.sample(j).value,rd)}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 xR()&&r&&bR.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const wR={type:"spring",stiffness:500,damping:25,restSpeed:10},NR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),CR={type:"keyframes",duration:.8},ER={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},AR=(t,{keyframes:s})=>s.length>2?CR:Di.has(t)?t.startsWith("scale")?NR(s[1]):wR:ER;function DR({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 eh=(t,s,o,r={},c,d)=>u=>{const p=$m(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-ia(m);let v={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:_=>{s.set(_),p.onUpdate&&p.onUpdate(_)},onComplete:()=>{u(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:d?void 0:c};DR(p)||(v={...v,...AR(t,v)}),v.duration&&(v.duration=ia(v.duration)),v.repeatDelay&&(v.repeatDelay=ia(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 _=Td(v.keyframes,p);if(_!==void 0)return St.update(()=>{v.onUpdate(_),v.onComplete()}),new cM([])}return!d&&Ky.supports(v)?new Ky(v):new Qm(v)};function MR({protectedKeys:t,needsAnimating:s},o){const r=t.hasOwnProperty(o)&&s[o]!==!0;return s[o]=!1,r}function e1(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 _=t.getValue(b,(d=t.latestValues[b])!==null&&d!==void 0?d:null),k=m[b];if(k===void 0||v&&MR(v,b))continue;const S={delay:o,...$m(u||{},b)};let j=!1;if(window.MotionHandoffAnimation){const w=_x(t);if(w){const C=window.MotionHandoffAnimation(w,b,St);C!==null&&(S.startTime=C,j=!0)}}$p(t,b),_.start(eh(b,_,k,t.shouldReduceMotion&&yx.has(b)?{type:!1}:S,t,j));const T=_.animation;T&&g.push(T)}return p&&Promise.all(g).then(()=>{St.update(()=>{p&&iM(t,p)})}),g}function Zp(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(e1(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=d;return RR(t,s,v+g,b,_,o)}:()=>Promise.resolve(),{when:m}=d;if(m){const[g,v]=m==="beforeChildren"?[u,p]:[p,u];return g().then(()=>v())}else return Promise.all([u(),p(o.delay)])}function RR(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(IR).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(Zp(g,s,{...d,delay:o+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function IR(t,s){return t.sortNodePosition(s)}function OR(t,s,o={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>Zp(t,d,o));r=Promise.all(c)}else if(typeof s=="string")r=Zp(t,s,o);else{const c=typeof s=="function"?jd(t,s,o.custom):s;r=Promise.all(e1(t,c,o))}return r.then(()=>{t.notify("AnimationComplete",s)})}const BR=Nm.length;function t1(t){if(!t)return;if(!t.isControllingVariants){const o=t.parent?t1(t.parent)||{}:{};return t.props.initial!==void 0&&(o.initial=t.props.initial),o}const s={};for(let o=0;o<BR;o++){const r=Nm[o],c=t.props[r];(Qr(c)||c===!1)&&(s[r]=c)}return s}const LR=[...wm].reverse(),zR=wm.length;function $R(t){return s=>Promise.all(s.map(({animation:o,options:r})=>OR(t,o,r)))}function HR(t){let s=$R(t),o=Zy(),r=!0;const c=m=>(g,v)=>{var b;const _=jd(t,v,m==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:k,transitionEnd:S,...j}=_;g={...g,...j,...S}}return g};function d(m){s=m(t)}function u(m){const{props:g}=t,v=t1(t.parent)||{},b=[],_=new Set;let k={},S=1/0;for(let T=0;T<zR;T++){const w=LR[T],C=o[w],D=g[w]!==void 0?g[w]:v[w],R=Qr(D),E=w===m?C.isActive:null;E===!1&&(S=T);let M=D===v[w]&&D!==g[w]&&R;if(M&&r&&t.manuallyAnimateOnMount&&(M=!1),C.protectedKeys={...k},!C.isActive&&E===null||!D&&!C.prevProp||kd(D)||typeof D=="boolean")continue;const O=PR(C.prevProp,D);let A=O||w===m&&C.isActive&&!M&&R||T>S&&R,$=!1;const Y=Array.isArray(D)?D:[D];let V=Y.reduce(c(w),{});E===!1&&(V={});const{prevResolvedValues:ee={}}=C,le={...ee,...V},Z=B=>{A=!0,_.has(B)&&($=!0,_.delete(B)),C.needsAnimating[B]=!0;const F=t.getValue(B);F&&(F.liveStyle=!1)};for(const B in le){const F=V[B],ge=ee[B];if(k.hasOwnProperty(B))continue;let ne=!1;zp(F)&&zp(ge)?ne=!vx(F,ge):ne=F!==ge,ne?F!=null?Z(B):_.add(B):F!==void 0&&_.has(B)?Z(B):C.protectedKeys[B]=!0}C.prevProp=D,C.prevResolvedValues=V,C.isActive&&(k={...k,...V}),r&&t.blockInitialAnimation&&(A=!1),A&&(!(M&&O)||$)&&b.push(...Y.map(B=>({animation:B,options:{type:w}})))}if(_.size){const T={};_.forEach(w=>{const C=t.getBaseTarget(w),D=t.getValue(w);D&&(D.liveStyle=!0),T[w]=C??null}),b.push({animation:T})}let j=!!b.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(j=!1),r=!1,j?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(_=>{var k;return(k=_.animationState)===null||k===void 0?void 0:k.setActive(m,g)}),o[m].isActive=g;const b=u(m);for(const _ in o)o[_].protectedKeys={};return b}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>o,reset:()=>{o=Zy(),r=!0}}}function PR(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!vx(s,t):!1}function hi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Zy(){return{animate:hi(!0),whileInView:hi(),whileHover:hi(),whileTap:hi(),whileDrag:hi(),whileFocus:hi(),exit:hi()}}class Ya{constructor(s){this.isMounted=!1,this.node=s}update(){}}class UR extends Ya{constructor(s){super(s),s.animationState||(s.animationState=HR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();kd(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 VR=0;class qR extends Ya{constructor(){super(...arguments),this.id=VR++}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 GR={animation:{Feature:UR},exit:{Feature:qR}},gs={x:!1,y:!1};function n1(){return gs.x||gs.y}function FR(t){return t==="x"||t==="y"?gs[t]?null:(gs[t]=!0,()=>{gs[t]=!1}):gs.x||gs.y?null:(gs.x=gs.y=!0,()=>{gs.x=gs.y=!1})}const th=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function sl(t,s,o,r={passive:!0}){return t.addEventListener(s,o,r),()=>t.removeEventListener(s,o)}function fl(t){return{point:{x:t.pageX,y:t.pageY}}}const KR=t=>s=>th(s)&&t(s,fl(s));function Fr(t,s,o,r){return sl(t,s,KR(o),r)}const Yy=(t,s)=>Math.abs(t-s);function ZR(t,s){const o=Yy(t.x,s.x),r=Yy(t.y,s.y);return Math.sqrt(o**2+r**2)}class s1{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=pp(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,k=ZR(b.offset,{x:0,y:0})>=3;if(!_&&!k)return;const{point:S}=b,{timestamp:j}=fn;this.history.push({...S,timestamp:j});const{onStart:T,onMove:w}=this.handlers;_||(T&&T(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=fp(_,this.transformPagePoint),St.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:j}=this.handlers;if(this.dragSnapToOrigin&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=pp(b.type==="pointercancel"?this.lastMoveEventInfo:fp(_,this.transformPagePoint),this.history);this.startEvent&&k&&k(b,T),S&&S(b,T)},!th(s))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=r,this.contextWindow=c||window;const u=fl(s),p=fp(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=fn;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=o;v&&v(s,pp(p,this.history)),this.removeListeners=ul(Fr(this.contextWindow,"pointermove",this.handlePointerMove),Fr(this.contextWindow,"pointerup",this.handlePointerUp),Fr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Ka(this.updatePoint)}}function fp(t,s){return s?{point:s(t.point)}:t}function Jy(t,s){return{x:t.x-s.x,y:t.y-s.y}}function pp({point:t},s){return{point:t,delta:Jy(t,a1(s)),offset:Jy(t,YR(s)),velocity:JR(s,.1)}}function YR(t){return t[0]}function a1(t){return t[t.length-1]}function JR(t,s){if(t.length<2)return{x:0,y:0};let o=t.length-1,r=null;const c=a1(t);for(;o>=0&&(r=t[o],!(c.timestamp-r.timestamp>ia(s)));)o--;if(!r)return{x:0,y:0};const d=oa(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 i1=1e-4,WR=1-i1,XR=1+i1,o1=.01,QR=0-o1,e4=0+o1;function Hn(t){return t.max-t.min}function t4(t,s,o){return Math.abs(t-s)<=o}function Wy(t,s,o,r=.5){t.origin=r,t.originPoint=Ct(s.min,s.max,t.origin),t.scale=Hn(o)/Hn(s),t.translate=Ct(o.min,o.max,t.origin)-t.originPoint,(t.scale>=WR&&t.scale<=XR||isNaN(t.scale))&&(t.scale=1),(t.translate>=QR&&t.translate<=e4||isNaN(t.translate))&&(t.translate=0)}function Kr(t,s,o,r){Wy(t.x,s.x,o.x,r?r.originX:void 0),Wy(t.y,s.y,o.y,r?r.originY:void 0)}function Xy(t,s,o){t.min=o.min+s.min,t.max=t.min+Hn(s)}function n4(t,s,o){Xy(t.x,s.x,o.x),Xy(t.y,s.y,o.y)}function Qy(t,s,o){t.min=s.min-o.min,t.max=t.min+Hn(s)}function Zr(t,s,o){Qy(t.x,s.x,o.x),Qy(t.y,s.y,o.y)}function s4(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?Ct(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?Ct(o,t,r.max):Math.min(t,o)),t}function eb(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 a4(t,{top:s,left:o,bottom:r,right:c}){return{x:eb(t.x,o,c),y:eb(t.y,s,r)}}function tb(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 i4(t,s){return{x:tb(t.x,s.x),y:tb(t.y,s.y)}}function o4(t,s){let o=.5;const r=Hn(t),c=Hn(s);return c>r?o=Bo(s.min,s.max-r,t.min):r>c&&(o=Bo(t.min,t.max-c,s.min)),ca(0,1,o)}function r4(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 Yp=.35;function l4(t=Yp){return t===!1?t=0:t===!0&&(t=Yp),{x:nb(t,"left","right"),y:nb(t,"top","bottom")}}function nb(t,s,o){return{min:sb(t,s),max:sb(t,o)}}function sb(t,s){return typeof t=="number"?t:t[s]||0}const ab=()=>({translate:0,scale:1,origin:0,originPoint:0}),Eo=()=>({x:ab(),y:ab()}),ib=()=>({min:0,max:0}),Ot=()=>({x:ib(),y:ib()});function ss(t){return[t("x"),t("y")]}function r1({top:t,left:s,right:o,bottom:r}){return{x:{min:s,max:o},y:{min:t,max:r}}}function c4({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function d4(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 mp(t){return t===void 0||t===1}function Jp({scale:t,scaleX:s,scaleY:o}){return!mp(t)||!mp(s)||!mp(o)}function yi(t){return Jp(t)||l1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function l1(t){return ob(t.x)||ob(t.y)}function ob(t){return t&&t!=="0%"}function ld(t,s,o){const r=t-o,c=s*r;return o+c}function rb(t,s,o,r,c){return c!==void 0&&(t=ld(t,c,r)),ld(t,o,r)+s}function Wp(t,s=0,o=1,r,c){t.min=rb(t.min,s,o,r,c),t.max=rb(t.max,s,o,r,c)}function c1(t,{x:s,y:o}){Wp(t.x,s.translate,s.scale,s.originPoint),Wp(t.y,o.translate,o.scale,o.originPoint)}const lb=.999999999999,cb=1.0000000000001;function u4(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&&Do(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,c1(t,u)),r&&yi(d.latestValues)&&Do(t,d.latestValues))}s.x<cb&&s.x>lb&&(s.x=1),s.y<cb&&s.y>lb&&(s.y=1)}function Ao(t,s){t.min=t.min+s,t.max=t.max+s}function db(t,s,o,r,c=.5){const d=Ct(t.min,t.max,c);Wp(t,s,o,d,r)}function Do(t,s){db(t.x,s.x,s.scaleX,s.scale,s.originX),db(t.y,s.y,s.scaleY,s.scale,s.originY)}function d1(t,s){return r1(d4(t.getBoundingClientRect(),s))}function f4(t,s,o){const r=d1(t,o),{scroll:c}=s;return c&&(Ao(r.x,c.offset.x),Ao(r.y,c.offset.y)),r}const u1=({current:t})=>t?t.ownerDocument.defaultView:null,p4=new WeakMap;class m4{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=Ot(),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(fl(v).point)},d=(v,b)=>{const{drag:_,dragPropagation:k,onDragStart:S}=this.getProps();if(_&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=FR(_),!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),ss(T=>{let w=this.getAxisMotionValue(T).get()||0;if(Ms.test(w)){const{projection:C}=this.visualElement;if(C&&C.layout){const D=C.layout.layoutBox[T];D&&(w=Hn(D)*(parseFloat(w)/100))}}this.originPoint[T]=w}),S&&St.postRender(()=>S(v,b)),$p(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},u=(v,b)=>{const{dragPropagation:_,dragDirectionLock:k,onDirectionLock:S,onDrag:j}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:T}=b;if(k&&this.currentDirection===null){this.currentDirection=h4(T),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",b.point,T),this.updateAxis("y",b.point,T),this.visualElement.render(),j&&j(v,b)},p=(v,b)=>this.stop(v,b),m=()=>ss(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 s1(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:u1(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&&St.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||!Lc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=s4(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&&No(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=a4(c.layoutBox,o):this.constraints=!1,this.elastic=l4(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&ss(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=r4(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:o}=this.getProps();if(!s||!No(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=f4(r,c.root,this.visualElement.getTransformPagePoint());let u=i4(c.layout.layoutBox,d);if(o){const p=o(c4(u));this.hasMutatedConstraints=!!p,p&&(u=r1(p))}return u}startAnimation(s){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=ss(v=>{if(!Lc(v,o,this.currentDirection))return;let b=m&&m[v]||{};u&&(b={min:0,max:0});const _=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:r?s[v]:0,bounceStiffness:_,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...d,...b};return this.startAxisValueAnimation(v,S)});return Promise.all(g).then(p)}startAxisValueAnimation(s,o){const r=this.getAxisMotionValue(s);return $p(this.visualElement,s),r.start(eh(s,r,0,o,this.visualElement,!1))}stopAnimation(){ss(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){ss(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){ss(o=>{const{drag:r}=this.getProps();if(!Lc(o,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:u,max:p}=c.layout.layoutBox[o];d.set(s[o]-Ct(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!No(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};ss(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=o4({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(),ss(u=>{if(!Lc(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(Ct(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;p4.set(this.visualElement,this);const s=this.visualElement.current,o=Fr(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();No(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()),St.read(r);const u=sl(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(ss(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=Yp,dragMomentum:p=!0}=s;return{...s,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function Lc(t,s,o){return(s===!0||s===t)&&(o===null||o===t)}function h4(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class g4 extends Ya{constructor(s){super(s),this.removeGroupControls=$n,this.removeListeners=$n,this.controls=new m4(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||$n}unmount(){this.removeGroupControls(),this.removeListeners()}}const ub=t=>(s,o)=>{t&&St.postRender(()=>t(s,o))};class v4 extends Ya{constructor(){super(...arguments),this.removePointerDownListener=$n}onPointerDown(s){this.session=new s1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:u1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:o,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:ub(s),onStart:ub(o),onMove:r,onEnd:(d,u)=>{delete this.session,c&&St.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Fr(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 fb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Ir={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ae.test(t))t=parseFloat(t);else return t;const o=fb(t,s.target.x),r=fb(t,s.target.y);return`${o}% ${r}%`}},y4={correct:(t,{treeScale:s,projectionDelta:o})=>{const r=t,c=Za.parse(t);if(c.length>5)return r;const d=Za.createTransformer(t),u=typeof c[0]!="number"?1:0,p=o.x.scale*s.x,m=o.y.scale*s.y;c[0+u]/=p,c[1+u]/=m;const g=Ct(p,m,.5);return typeof c[2+u]=="number"&&(c[2+u]/=g),typeof c[3+u]=="number"&&(c[3+u]/=g),d(c)}};class b4 extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;GD(_4),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()||St.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Em.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 f1(t){const[s,o]=J_(),r=y.useContext(km);return i.jsx(b4,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(ax),isPresent:s,safeToRemove:o})}const _4={borderRadius:{...Ir,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ir,borderTopRightRadius:Ir,borderBottomLeftRadius:Ir,borderBottomRightRadius:Ir,boxShadow:y4};function x4(t,s,o){const r=gn(t)?t:tl(t);return r.start(eh("",r,s,o)),r.animation}function k4(t){return t instanceof SVGElement&&t.tagName!=="svg"}const S4=(t,s)=>t.depth-s.depth;class j4{constructor(){this.children=[],this.isDirty=!1}add(s){Hm(this.children,s),this.isDirty=!0}remove(s){Pm(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(S4),this.isDirty=!1,this.children.forEach(s)}}function T4(t,s){const o=Rs.now(),r=({timestamp:c})=>{const d=c-o;d>=s&&(Ka(r),t(d-s))};return St.read(r,!0),()=>Ka(r)}const p1=["TopLeft","TopRight","BottomLeft","BottomRight"],w4=p1.length,pb=t=>typeof t=="string"?parseFloat(t):t,mb=t=>typeof t=="number"||Ae.test(t);function N4(t,s,o,r,c,d){c?(t.opacity=Ct(0,o.opacity!==void 0?o.opacity:1,C4(r)),t.opacityExit=Ct(s.opacity!==void 0?s.opacity:1,0,E4(r))):d&&(t.opacity=Ct(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<w4;u++){const p=`border${p1[u]}Radius`;let m=hb(s,p),g=hb(o,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||mb(m)===mb(g)?(t[p]=Math.max(Ct(pb(m),pb(g),r),0),(Ms.test(g)||Ms.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||o.rotate)&&(t.rotate=Ct(s.rotate||0,o.rotate||0,r))}function hb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const C4=m1(0,.5,Ax),E4=m1(.5,.95,$n);function m1(t,s,o){return r=>r<t?0:r>s?1:o(Bo(t,s,r))}function gb(t,s){t.min=s.min,t.max=s.max}function Xn(t,s){gb(t.x,s.x),gb(t.y,s.y)}function vb(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function yb(t,s,o,r,c){return t-=s,t=ld(t,1/o,r),c!==void 0&&(t=ld(t,1/c,r)),t}function A4(t,s=0,o=1,r=.5,c,d=t,u=t){if(Ms.test(s)&&(s=parseFloat(s),s=Ct(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=Ct(d.min,d.max,r);t===d&&(p-=s),t.min=yb(t.min,s,o,p,c),t.max=yb(t.max,s,o,p,c)}function bb(t,s,[o,r,c],d,u){A4(t,s[o],s[r],s[c],s.scale,d,u)}const D4=["x","scaleX","originX"],M4=["y","scaleY","originY"];function _b(t,s,o,r){bb(t.x,s,D4,o?o.x:void 0,r?r.x:void 0),bb(t.y,s,M4,o?o.y:void 0,r?r.y:void 0)}function xb(t){return t.translate===0&&t.scale===1}function h1(t){return xb(t.x)&&xb(t.y)}function kb(t,s){return t.min===s.min&&t.max===s.max}function R4(t,s){return kb(t.x,s.x)&&kb(t.y,s.y)}function Sb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function g1(t,s){return Sb(t.x,s.x)&&Sb(t.y,s.y)}function jb(t){return Hn(t.x)/Hn(t.y)}function Tb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class I4{constructor(){this.members=[]}add(s){Hm(this.members,s),s.scheduleRender()}remove(s){if(Pm(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 O4(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:_,skewX:k,skewY:S}=o;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),b&&(r+=`rotateX(${b}deg) `),_&&(r+=`rotateY(${_}deg) `),k&&(r+=`skewX(${k}deg) `),S&&(r+=`skewY(${S}deg) `)}const p=t.x.scale*s.x,m=t.y.scale*s.y;return(p!==1||m!==1)&&(r+=`scale(${p}, ${m})`),r||"none"}const bi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Pr=typeof window<"u"&&window.MotionDebug!==void 0,hp=["","X","Y","Z"],B4={visibility:"hidden"},wb=1e3;let L4=0;function gp(t,s,o,r){const{latestValues:c}=s;c[t]&&(o[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function v1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const o=_x(s);if(window.MotionHasOptimisedAnimation(o,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(o,"transform",St,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&v1(r)}function y1({attachResizeListener:t,defaultParent:s,measureScroll:o,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=L4++,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,Pr&&(bi.totalNodes=bi.resolvedTargetDeltas=bi.recalculatedProjection=0),this.nodes.forEach(H4),this.nodes.forEach(G4),this.nodes.forEach(F4),this.nodes.forEach(P4),Pr&&window.MotionDebug.record(bi)},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 j4)}addEventListener(u,p){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Um),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=k4(u),this.instance=u;const{layoutId:m,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(g||m)&&(this.isLayoutDirty=!0),t){let b;const _=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=T4(_,250),Jc.hasAnimatedSinceResize&&(Jc.hasAnimatedSinceResize=!1,this.nodes.forEach(Cb))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||v.getDefaultTransition()||W4,{onLayoutAnimationStart:T,onLayoutAnimationComplete:w}=v.getProps(),C=!this.targetLayout||!g1(this.targetLayout,S)||k,D=!_&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||D||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,D);const R={...$m(j,"layout"),onPlay:T,onComplete:w};(v.shouldReduceMotion||this.options.layoutRoot)&&(R.delay=0,R.type=!1),this.startAnimation(R)}else _||Cb(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ka(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(K4),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&&v1(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(Nb);return}this.isUpdating||this.nodes.forEach(V4),this.isUpdating=!1,this.nodes.forEach(q4),this.nodes.forEach(z4),this.nodes.forEach($4),this.clearAllSnapshots();const p=Rs.now();fn.delta=ca(0,1e3/60,p-fn.timestamp),fn.timestamp=p,fn.isProcessing=!0,rp.update.process(fn),rp.preRender.process(fn),rp.render.process(fn),fn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Em.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(U4),this.sharedNodes.forEach(Z4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,St.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){St.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=Ot(),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&&!h1(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||yi(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)),X4(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return Ot();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(Q4))){const{scroll:v}=this.root;v&&(Ao(m.x,v.offset.x),Ao(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=Ot();if(Xn(m,u),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return m;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:b,options:_}=v;v!==this.root&&b&&_.layoutScroll&&(b.wasRoot&&Xn(m,u),Ao(m.x,b.offset.x),Ao(m.y,b.offset.y))}return m}applyTransform(u,p=!1){const m=Ot();Xn(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&&Do(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),yi(v.latestValues)&&Do(m,v.latestValues)}return yi(this.latestValues)&&Do(m,this.latestValues),m}removeTransform(u){const p=Ot();Xn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!yi(g.latestValues))continue;Jp(g.latestValues)&&g.updateSnapshot();const v=Ot(),b=g.measurePageBox();Xn(v,b),_b(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return yi(this.latestValues)&&_b(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!==fn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var p;const m=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=m.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=m.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=m.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==m;if(!(u||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:_}=this.options;if(!(!this.layout||!(b||_))){if(this.resolvedRelativeTargetAt=fn.timestamp,!this.targetDelta&&!this.relativeTarget){const k=this.getClosestProjectingParent();k&&k.layout&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ot(),this.relativeTargetOrigin=Ot(),Zr(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),Xn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Ot(),this.targetWithTransforms=Ot()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),n4(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Xn(this.target,this.layout.layoutBox),c1(this.target,this.targetDelta)):Xn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const k=this.getClosestProjectingParent();k&&!!k.resumingFrom==!!this.resumingFrom&&!k.options.layoutScroll&&k.target&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ot(),this.relativeTargetOrigin=Ot(),Zr(this.relativeTargetOrigin,this.target,k.target),Xn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Pr&&bi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Jp(this.parent.latestValues)||l1(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===fn.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;Xn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,k=this.treeScale.y;u4(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=Ot());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(vb(this.prevProjectionDelta.x,this.projectionDelta.x),vb(this.prevProjectionDelta.y,this.projectionDelta.y)),Kr(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==k||!Tb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Tb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Pr&&bi.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=Eo(),this.projectionDelta=Eo(),this.projectionDeltaWithTransform=Eo()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},b=Eo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const _=Ot(),k=m?m.source:void 0,S=this.layout?this.layout.source:void 0,j=k!==S,T=this.getStack(),w=!T||T.members.length<=1,C=!!(j&&!w&&this.options.crossfade===!0&&!this.path.some(J4));this.animationProgress=0;let D;this.mixTargetDelta=R=>{const E=R/1e3;Eb(b.x,u.x,E),Eb(b.y,u.y,E),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Zr(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Y4(this.relativeTarget,this.relativeTargetOrigin,_,E),D&&R4(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=Ot()),Xn(D,this.relativeTarget)),j&&(this.animationValues=v,N4(v,g,this.latestValues,E,C,w)),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&&(Ka(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=St.update(()=>{Jc.hasAnimatedSinceResize=!0,this.currentAnimation=x4(0,wb,{...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(wb),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&&b1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Ot();const b=Hn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const _=Hn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+_}Xn(p,m),Do(p,v),Kr(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new I4),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&&gp("z",u,g,this.animationValues);for(let v=0;v<hp.length;v++)gp(`rotate${hp[v]}`,u,g,this.animationValues),gp(`skew${hp[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 B4;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=Zc(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 j={};return this.options.layoutId&&(j.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,j.pointerEvents=Zc(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!yi(this.latestValues)&&(j.transform=v?v({},""):"none",this.hasProjected=!1),j}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=O4(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,b.animationValues?g.opacity=b===this?(m=(p=_.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:g.opacity=b===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const j in sd){if(_[j]===void 0)continue;const{correct:T,applyTo:w}=sd[j],C=g.transform==="none"?_[j]:T(_[j],b);if(w){const D=w.length;for(let R=0;R<D;R++)g[w[R]]=C}else g[j]=C}return this.options.layoutId&&(g.pointerEvents=b===this?Zc(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(Nb),this.root.sharedNodes.clear()}}}function z4(t){t.updateLayout()}function $4(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"?ss(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],k=Hn(_);_.min=r[b].min,_.max=_.min+k}):b1(d,o.layoutBox,r)&&ss(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],k=Hn(r[b]);_.max=_.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+k)});const p=Eo();Kr(p,r,o.layoutBox);const m=Eo();u?Kr(m,t.applyTransform(c,!0),o.measuredBox):Kr(m,r,o.layoutBox);const g=!h1(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:k}=b;if(_&&k){const S=Ot();Zr(S,o.layoutBox,_.layoutBox);const j=Ot();Zr(j,r,k.layoutBox),g1(S,j)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=j,t.relativeTargetOrigin=S,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 H4(t){Pr&&bi.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 P4(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function U4(t){t.clearSnapshot()}function Nb(t){t.clearMeasurements()}function V4(t){t.isLayoutDirty=!1}function q4(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function Cb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function G4(t){t.resolveTargetDelta()}function F4(t){t.calcProjection()}function K4(t){t.resetSkewAndRotation()}function Z4(t){t.removeLeadSnapshot()}function Eb(t,s,o){t.translate=Ct(s.translate,0,o),t.scale=Ct(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function Ab(t,s,o,r){t.min=Ct(s.min,o.min,r),t.max=Ct(s.max,o.max,r)}function Y4(t,s,o,r){Ab(t.x,s.x,o.x,r),Ab(t.y,s.y,o.y,r)}function J4(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const W4={duration:.45,ease:[.4,0,.1,1]},Db=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Mb=Db("applewebkit/")&&!Db("chrome/")?Math.round:$n;function Rb(t){t.min=Mb(t.min),t.max=Mb(t.max)}function X4(t){Rb(t.x),Rb(t.y)}function b1(t,s,o){return t==="position"||t==="preserve-aspect"&&!t4(jb(s),jb(o),.2)}function Q4(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const e3=y1({attachResizeListener:(t,s)=>sl(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),vp={current:void 0},_1=y1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!vp.current){const t=new e3({});t.mount(window),t.setOptions({layoutScroll:!0}),vp.current=t}return vp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),t3={pan:{Feature:v4},drag:{Feature:g4,ProjectionNode:_1,MeasureLayout:f1}};function n3(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 x1(t,s){const o=n3(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[o,c,()=>r.abort()]}function Ib(t){return s=>{s.pointerType==="touch"||n1()||t(s)}}function s3(t,s,o={}){const[r,c,d]=x1(t,o),u=Ib(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=Ib(b=>{g(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function Ob(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&&St.postRender(()=>d(s,fl(s)))}class a3 extends Ya{mount(){const{current:s}=this.node;s&&(this.unmount=s3(s,o=>(Ob(this.node,o,"Start"),r=>Ob(this.node,r,"End"))))}unmount(){}}class i3 extends Ya{constructor(){super(...arguments),this.isActive=!1}onFocus(){let s=!1;try{s=this.node.current.matches(":focus-visible")}catch{s=!0}!s||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ul(sl(this.node.current,"focus",()=>this.onFocus()),sl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const k1=(t,s)=>s?t===s?!0:k1(t,s.parentElement):!1,o3=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function r3(t){return o3.has(t.tagName)||t.tabIndex!==-1}const Ur=new WeakSet;function Bb(t){return s=>{s.key==="Enter"&&t(s)}}function yp(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const l3=(t,s)=>{const o=t.currentTarget;if(!o)return;const r=Bb(()=>{if(Ur.has(o))return;yp(o,"down");const c=Bb(()=>{yp(o,"up")}),d=()=>yp(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 Lb(t){return th(t)&&!n1()}function c3(t,s,o={}){const[r,c,d]=x1(t,o),u=p=>{const m=p.currentTarget;if(!Lb(p)||Ur.has(m))return;Ur.add(m);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!Lb(k)||!Ur.has(m))&&(Ur.delete(m),typeof g=="function"&&g(k,{success:S}))},b=k=>{v(k,o.useGlobalTarget||k1(m,k.target))},_=k=>{v(k,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return r.forEach(p=>{!r3(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(o.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>l3(g,c),c)}),d}function zb(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&&St.postRender(()=>d(s,fl(s)))}class d3 extends Ya{mount(){const{current:s}=this.node;s&&(this.unmount=c3(s,o=>(zb(this.node,o,"Start"),(r,{success:c})=>zb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Xp=new WeakMap,bp=new WeakMap,u3=t=>{const s=Xp.get(t.target);s&&s(t)},f3=t=>{t.forEach(u3)};function p3({root:t,...s}){const o=t||document;bp.has(o)||bp.set(o,{});const r=bp.get(o),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(f3,{root:t,...s})),r[c]}function m3(t,s,o){const r=p3(s);return Xp.set(t,o),r.observe(t),()=>{Xp.delete(t),r.unobserve(t)}}const h3={some:0,all:1};class g3 extends Ya{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:o,margin:r,amount:c="some",once:d}=s,u={root:o?o.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:h3[c]},p=m=>{const{isIntersecting:g}=m;if(this.isInView===g||(this.isInView=g,d&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:b}=this.node.getProps(),_=g?v:b;_&&_(m)};return m3(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(v3(s,o))&&this.startObserver()}unmount(){}}function v3({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const y3={inView:{Feature:g3},tap:{Feature:d3},focus:{Feature:i3},hover:{Feature:a3}},b3={layout:{ProjectionNode:_1,MeasureLayout:f1}},cd={current:null},nh={current:!1};function S1(){if(nh.current=!0,!!Tm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>cd.current=t.matches;t.addListener(s),s()}else cd.current=!1}const _3=[...qx,hn,Za],x3=t=>_3.find(Vx(t)),$b=new WeakMap;function k3(t,s,o){for(const r in s){const c=s[r],d=o[r];if(gn(c))t.addValue(r,c);else if(gn(d))t.addValue(r,tl(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,tl(u!==void 0?u:c,{owner:t}))}}for(const r in o)s[r]===void 0&&t.removeValue(r);return s}const Hb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class S3{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=Wm,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const k=Rs.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,St.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=Sd(o),this.isVariantNode=nx(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(o,{},this);for(const k in _){const S=_[k];m[k]!==void 0&&gn(S)&&S.set(m[k],!1)}}mount(s){this.current=s,$b.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)),nh.current||S1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:cd.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){$b.delete(this.current),this.projection&&this.projection.unmount(),Ka(this.notifyUpdate),Ka(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=Di.has(s),c=o.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&St.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):Ot()}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<Hb.length;r++){const c=Hb[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=k3(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=tl(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"&&(Px(c)||Mx(c))?c=parseFloat(c):!x3(c)&&Za.test(o)&&(c=zx(s,o)),this.setBaseTarget(s,gn(c)?c.get():c)),gn(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=Dm(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&&!gn(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 Um),this.events[s].add(o)}notify(s,...o){this.events[s]&&this.events[s].notify(...o)}}class j1 extends S3{constructor(){super(...arguments),this.KeyframeResolver=Gx}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;gn(s)&&(this.childSubscription=s.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}}function j3(t){return window.getComputedStyle(t)}class T3 extends j1{constructor(){super(...arguments),this.type="html",this.renderInstance=ux}readValueFromInstance(s,o){if(Di.has(o)){const r=Jm(o);return r&&r.default||0}else{const r=j3(s),c=(lx(o)?r.getPropertyValue(o):r[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:o}){return d1(s,o)}build(s,o,r){Im(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return zm(s,o,r)}}class w3 extends j1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ot}getBaseTargetFromProps(s,o){return s[o]}readValueFromInstance(s,o){if(Di.has(o)){const r=Jm(o);return r&&r.default||0}return o=fx.has(o)?o:Cm(o),s.getAttribute(o)}scrapeMotionValuesFromProps(s,o,r){return hx(s,o,r)}build(s,o,r){Om(s,o,this.isSVGTag,r.transformTemplate)}renderInstance(s,o,r,c){px(s,o,r,c)}mount(s){this.isSVGTag=Lm(s.tagName),super.mount(s)}}const N3=(t,s)=>Am(t)?new w3(s):new T3(s,{allowProjection:t!==y.Fragment}),C3=eM({...GR,...y3,...t3,...b3},N3),$t=hD(C3);function E3(){!nh.current&&S1();const[t]=y.useState(cd.current);return t}const A3="_overlay_cmicx_1",D3="_dialog_cmicx_11",M3="_title_cmicx_30",R3="_description_cmicx_38",I3="_actions_cmicx_45",O3="_cancelButton_cmicx_52",B3="_confirmButton_cmicx_79",gi={overlay:A3,dialog:D3,title:M3,description:R3,actions:I3,cancelButton:O3,confirmButton:B3};function ys({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return i.jsx(as,{children:t&&i.jsx($t.div,{className:gi.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($t.div,{className:gi.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:gi.title,children:s}),o&&i.jsx("p",{id:p,className:gi.description,children:o}),i.jsxs("div",{className:gi.actions,children:[i.jsx("button",{type:"button",className:gi.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),i.jsx("button",{type:"button",className:gi.confirmButton,onClick:c,children:r})]})]})})})}const L3="_skeleton_1gqp4_9",z3="_circular_1gqp4_17",$3="_textContainer_1gqp4_26",H3="_card_1gqp4_31",dd={skeleton:L3,circular:z3,textContainer:$3,card:H3};function Te({width:t="100%",height:s="1rem",borderRadius:o,variant:r="rectangular",className:c}){const d=[dd.skeleton,r==="circular"?dd.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 Qp({lines:t=3,lastLineWidth:s="60%",lineHeight:o="0.75rem",gap:r="var(--space-sm)",className:c}){return i.jsx("div",{className:`${dd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>i.jsx(Te,{width:u===t-1&&t>1?s:"100%",height:o},u))})}function em({lines:t=2,className:s}){return i.jsxs("div",{className:`${dd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[i.jsx(Te,{width:"40%",height:"1.25rem"}),i.jsx(Qp,{lines:t})]})}const P3="_spinner_1uyt1_1",U3="_spin_1uyt1_1",V3="_sm_1uyt1_14",q3="_md_1uyt1_20",G3="_lg_1uyt1_26",F3="_xl_1uyt1_32",Pb={spinner:P3,spin:U3,sm:V3,md:q3,lg:G3,xl:F3};function T1({size:t="md",className:s,label:o="Loading",liveRegion:r=!1}){return i.jsx("span",{className:`${Pb.spinner} ${Pb[t]} ${s??""}`,role:r?"status":void 0,"aria-label":o,"aria-hidden":r?void 0:!0})}function wd(t){return`/${t.replace(/^\//,"")}`}const K3="_splash_1bn1g_1",Z3="_logo_1bn1g_11",Ub={splash:K3,logo:Z3};function w1(){return i.jsxs("div",{className:Ub.splash,"data-testid":"splash-screen",children:[i.jsx("img",{src:wd("grackle-logo.png"),alt:"Grackle",className:Ub.logo}),i.jsx(T1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const Y3="_wrapper_4e5yt_1",J3="_wrapperBlock_4e5yt_6",W3="_tooltip_4e5yt_11",X3="_visible_4e5yt_31",Q3="_top_4e5yt_41",e6="_bottom_4e5yt_48",t6="_left_4e5yt_55",n6="_right_4e5yt_62",Or={wrapper:Y3,wrapperBlock:J3,tooltip:W3,visible:X3,top:Q3,bottom:e6,left:t6,right:n6},s6=300,zc=6;function Ti({text:t,placement:s="top",delayMs:o=s6,inline:r=!0,children:c,className:d,"data-testid":u}){const[p,m]=y.useState(!1),[g,v]=y.useState({top:0,left:0}),b=y.useRef(null),_=y.useRef(null),k=y.useRef(void 0),S=y.useId(),j=typeof document<"u",T=y.useCallback(()=>{if(!b.current||!_.current)return;const $=b.current.getBoundingClientRect(),Y=_.current.getBoundingClientRect();let V=0,ee=0;switch(s){case"top":V=$.top-Y.height-zc,ee=$.left+$.width/2-Y.width/2;break;case"bottom":V=$.bottom+zc,ee=$.left+$.width/2-Y.width/2;break;case"left":V=$.top+$.height/2-Y.height/2,ee=$.left-Y.width-zc;break;case"right":V=$.top+$.height/2-Y.height/2,ee=$.right+zc;break}v({top:V,left:ee})},[s]),w=y.useCallback($=>{k.current!==void 0&&clearTimeout(k.current),k.current=setTimeout(()=>{T(),m(!0),k.current=void 0},$)},[T]),C=y.useCallback(()=>{w(o)},[o,w]),D=y.useCallback(()=>{w(0)},[w]),R=y.useCallback(()=>{k.current!==void 0&&(clearTimeout(k.current),k.current=void 0),m(!1)},[]);y.useEffect(()=>{if(!p)return;const $=Y=>{Y.key==="Escape"&&R()};return document.addEventListener("keydown",$),window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{document.removeEventListener("keydown",$),window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[p,R,T]),y.useEffect(()=>()=>{k.current!==void 0&&clearTimeout(k.current)},[]);const E=r?"span":"div",M=[r?Or.wrapper:Or.wrapperBlock,d].filter(Boolean).join(" ");let O=c;if(y.isValidElement(c)){const $=c,Y=$.props["aria-describedby"],V=p?Y?`${Y} ${S}`:S:Y;O=y.cloneElement($,{"aria-describedby":V})}const A=i.jsx("div",{ref:_,id:S,role:"tooltip",className:`${Or.tooltip} ${Or[s]} ${p?Or.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return i.jsxs(E,{ref:b,className:M,onMouseEnter:C,onMouseLeave:R,onFocus:D,onBlur:R,children:[O,j?j2.createPortal(A,document.body):null]})}const a6="_attemptSelector_ggigl_1",i6="_attemptLabel_ggigl_17",o6="_attemptButton_ggigl_21",r6="_attemptActive_ggigl_38",l6="_attemptStatus_ggigl_44",Br={attemptSelector:a6,attemptLabel:i6,attemptButton:o6,attemptActive:r6,attemptStatus:l6};function c6({taskSessions:t,selectedSessionId:s,onSelect:o}){if(!(t.length<2))return i.jsxs("div",{className:Br.attemptSelector,"data-testid":"attempt-selector",children:[i.jsx("span",{className:Br.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:`${Br.attemptButton} ${d?Br.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:Br.attemptStatus,children:u})]},r.id)})]})}const d6="_row_ldkru_1",u6="_hoverActions_ldkru_5",f6="_hoverButton_ldkru_31",p6="_selectingRow_ldkru_72",m6="_selected_ldkru_83",h6="_checkboxArea_ldkru_90",g6="_checkbox_ldkru_90",v6="_contentArea_ldkru_106",ms={row:d6,hoverActions:u6,hoverButton:f6,selectingRow:p6,selected:m6,checkboxArea:h6,checkbox:g6,contentArea:v6};function y6({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 _=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]),k=y.useCallback(S=>{!o||S.target.closest("a, button, input, textarea, select, [role=button]")||(S.preventDefault(),u(S.shiftKey))},[o,u]);return s?o?i.jsxs("div",{className:`${ms.row} ${ms.selectingRow} ${r?ms.selected:""}`,onClick:k,"data-testid":"event-selectable-row",children:[i.jsx("div",{className:ms.checkboxArea,children:i.jsx("input",{type:"checkbox",checked:r,onChange:S=>{u(S.nativeEvent.shiftKey)},onClick:S=>{S.stopPropagation()},className:ms.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),i.jsx("div",{className:ms.contentArea,children:m})]}):i.jsxs("div",{className:ms.row,"data-testid":"event-hover-row",children:[i.jsxs("div",{className:ms.hoverActions,"data-testid":"event-hover-actions",children:[i.jsx("button",{type:"button",className:ms.hoverButton,onClick:()=>{_().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?i.jsx(Ni,{size:Ze,"aria-hidden":"true"}):i.jsx(k_,{size:Ze,"aria-hidden":"true"})}),i.jsx("button",{type:"button",className:ms.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:i.jsx(AT,{size:Ze,"aria-hidden":"true"})})]}),m]}):i.jsx("div",{className:ms.row,children:m})}const b6="_bar_lagql_1",_6="_left_lagql_21",x6="_right_lagql_27",k6="_count_lagql_33",S6="_toggleButton_lagql_40",j6="_copyButton_lagql_68",T6="_forwardButton_lagql_108",w6="_cancelButton_lagql_148",$a={bar:b6,left:_6,right:x6,count:k6,toggleButton:S6,copyButton:j6,forwardButton:T6,cancelButton:w6};function N6({selectedCount:t,totalSelectable:s,onSelectAll:o,onDeselectAll:r,onCopy:c,onForward:d,forwardDisabled:u=!1,onCancel:p}){const m=t>0&&t>=s;return i.jsxs($t.div,{className:$a.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:$a.left,children:[i.jsxs("span",{className:$a.count,"data-testid":"floating-bar-count",children:[t," selected"]}),i.jsx("button",{type:"button",className:$a.toggleButton,onClick:m?r:o,"data-testid":"floating-bar-select-all",children:m?"Deselect all":"Select all"})]}),i.jsxs("div",{className:$a.right,children:[i.jsxs("button",{type:"button",className:$a.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[i.jsx(Mj,{size:Ze,"aria-hidden":"true"}),"Copy"]}),d!==void 0&&i.jsx(Ti,{text:u?"No active sessions to forward to":"Forward to another session",children:i.jsxs("button",{type:"button",className:$a.forwardButton,"aria-disabled":u||t===0,onClick:()=>{!u&&t>0&&d()},"data-testid":"floating-bar-forward",children:[i.jsx(Hj,{size:Ze,"aria-hidden":"true"}),"Forward"]})}),i.jsx("button",{type:"button",className:$a.cancelButton,onClick:p,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:i.jsx(Is,{size:Ze,"aria-hidden":"true"})})]})]})}const C6="_overlay_1hra6_1",E6="_dialog_1hra6_11",A6="_header_1hra6_27",D6="_title_1hra6_35",M6="_closeButton_1hra6_42",R6="_filterRow_1hra6_78",I6="_searchIcon_1hra6_86",O6="_filterInput_1hra6_91",B6="_list_1hra6_108",L6="_emptyItem_1hra6_116",z6="_sessionRow_1hra6_123",$6="_sessionMain_1hra6_158",H6="_envName_1hra6_165",P6="_personaName_1hra6_175",U6="_statusBadge_1hra6_189",V6="_status_running_1hra6_198",q6="_status_idle_1hra6_202",G6="_status_other_1hra6_206",F6="_sessionPrompt_1hra6_211",K6="_noSessions_1hra6_220",Kt={overlay:C6,dialog:E6,header:A6,title:D6,closeButton:M6,filterRow:R6,searchIcon:I6,filterInput:O6,list:B6,emptyItem:L6,sessionRow:z6,sessionMain:$6,envName:H6,personaName:P6,statusBadge:U6,status_running:V6,status_idle:q6,status_other:G6,sessionPrompt:F6,noSessions:K6};function Z6(t){return t==="running"?"running":t==="idle"?"idle":t}function Y6({isOpen:t,sessions:s,environments:o,personas:r,onSelect:c,onCancel:d}){const[u,p]=y.useState(""),m=y.useRef(null),g=y.useRef(null);y.useEffect(()=>{var j;t&&s.length<=4&&((j=g.current)==null||j.focus())},[t,s.length]);const v=new Map(o.map(j=>[j.id,j.displayName])),b=new Map((r??[]).map(j=>[j.id,j.name])),_=s.map(j=>({session:j,environmentName:v.get(j.environmentId)??j.environmentId})),k=s.length>4,S=u.trim()?_.filter(({session:j,environmentName:T})=>T.toLowerCase().includes(u.toLowerCase())||j.prompt.toLowerCase().includes(u.toLowerCase())):_;return i.jsx(as,{children:t&&i.jsx($t.div,{className:Kt.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:j=>{j.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-label":"Forward to session","data-testid":"session-picker-overlay",children:i.jsxs($t.div,{ref:m,className:Kt.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:j=>{j.stopPropagation()},"data-testid":"session-picker-dialog",children:[i.jsxs("div",{className:Kt.header,children:[i.jsx("h3",{className:Kt.title,children:"Forward to session"}),i.jsx("button",{ref:g,type:"button",className:Kt.closeButton,onClick:d,"aria-label":"Close session picker","data-testid":"session-picker-close",children:i.jsx(Is,{size:Ze,"aria-hidden":"true"})})]}),k&&i.jsxs("div",{className:Kt.filterRow,children:[i.jsx(Dp,{size:Ze,className:Kt.searchIcon,"aria-hidden":"true"}),i.jsx("input",{type:"text",className:Kt.filterInput,placeholder:"Filter sessions...",value:u,onChange:j=>{p(j.target.value)},"data-testid":"session-picker-filter",autoFocus:!0})]}),s.length===0?i.jsxs("div",{className:Kt.noSessions,"data-testid":"session-picker-no-sessions",children:[i.jsx(Dp,{size:zt,"aria-hidden":"true"}),i.jsx("p",{children:"No active sessions to forward to."})]}):i.jsx("ul",{className:Kt.list,"data-testid":"session-picker-list",children:S.length===0?i.jsx("li",{className:Kt.emptyItem,"data-testid":"session-picker-empty",children:"No matching sessions"}):S.map(({session:j,environmentName:T})=>{const w=j.personaId?b.get(j.personaId)??void 0:void 0;return i.jsx("li",{children:i.jsxs("button",{type:"button",className:Kt.sessionRow,onClick:()=>{c(j.id)},"data-testid":`session-picker-item-${j.id}`,children:[i.jsxs("div",{className:Kt.sessionMain,children:[i.jsx("span",{className:Kt.envName,children:T}),w!==void 0&&i.jsx("span",{className:Kt.personaName,"data-testid":`session-picker-persona-${j.id}`,children:w}),i.jsx("span",{className:`${Kt.statusBadge} ${Kt[`status_${j.status}`]??Kt.status_other}`,"data-testid":`session-picker-status-${j.id}`,children:Z6(j.status)})]}),i.jsx("div",{className:Kt.sessionPrompt,children:j.prompt.length>80?`${j.prompt.slice(0,80)}...`:j.prompt})]})},j.id)})})]})})})}const N1=50;function J6(t,s,o,r,c=N1){return r?t<c:s-t-o<c}function W6(t,s){const o=s-t;return o>0?o:0}function X6({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 _=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const k=J6(v.scrollTop,v.scrollHeight,v.clientHeight,o,N1);k!==b&&(b=k,d(k))}))};return v.addEventListener("scroll",_,{passive:!0}),()=>{v.removeEventListener("scroll",_),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=W6(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 Q6=new Set(["text","output","user_input","tool_use","tool_result","error"]);function al(t){return Q6.has(t.eventType)}function e5(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}
311
+ ${c}`}catch{return t.content}default:return t.content}}function Vb(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 C1(t){var o;const s=[];for(const r of t){if(!al(r))continue;const c=new Date(r.timestamp).toLocaleTimeString();switch(r.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
312
+ ${r.content}`);break}case"user_input":{s.push(`**User** (${c}):
313
+ ${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=Vb(r.toolUseCtx.args),p=u?`**Tool: ${r.toolUseCtx.tool}** ${u}`:`**Tool: ${r.toolUseCtx.tool}**`;s.push(`${p} (${c}):
314
+ ${d}`)}else s.push(`**Tool output** (${c}):
315
+ ${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=Vb(u),m=p?`**Tool: ${d}** ${p}`:`**Tool: ${d}**`;u!==void 0?s.push(`${m} (${c}):
316
+ \`\`\`json
317
+ ${JSON.stringify(u,void 0,2)}
318
+ \`\`\``):s.push(`${m} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
319
+ ${r.content}`);break}}}return s.join(`
320
+
321
+ `)}function t5(t,s){const o=n5(t),r=C1(s);return`--- Forwarded from ${o} ---
322
+
323
+ ${r}
324
+
325
+ --- End forwarded ---`}function n5(t){return t.replace(/[\r\n]+/g," ").trim().replace(/---/g,"—")}function s5({events:t,formatForClipboard:s}){const[o,r]=y.useState(!1),[c,d]=y.useState(new Set),u=y.useRef(void 0),p=y.useMemo(()=>c.size,[c]),m=y.useCallback(S=>{r(!0),S!==void 0?(d(new Set([S])),u.current=S):(d(new Set),u.current=void 0)},[]),g=y.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=y.useCallback((S,j)=>{if(j&&u.current!==void 0){const T=Math.min(u.current,S),w=Math.max(u.current,S);d(C=>{const D=new Set(C);for(let R=T;R<=w;R++)R<t.length&&al(t[R])&&D.add(R);return D})}else d(T=>{const w=new Set(T);return w.has(S)?w.delete(S):w.add(S),w.size===0?(r(!1),u.current=void 0):u.current=S,w})},[t]),b=y.useCallback(()=>{const S=new Set;for(let j=0;j<t.length;j++)al(t[j])&&S.add(j);d(S)},[t]),_=y.useCallback(()=>{d(new Set)},[]),k=y.useCallback(async()=>{const j=[...c].sort((w,C)=>w-C).filter(w=>w<t.length).map(w=>t[w]);if(j.length===0)return!1;const T=s(j);try{return await navigator.clipboard.writeText(T),!0}catch{return!1}},[c,t,s]);return{isSelecting:o,selectedIndices:c,selectedCount:p,enterSelectionMode:m,cancelSelection:g,toggleEvent:v,selectAll:b,deselectAll:_,copySelected:k}}const a5="_wrapper_1cdza_1",i5="_scrollContainer_1cdza_9",o5="_selectingPadding_1cdza_16",r5="_toolbar_1cdza_20",l5="_directionToggle_1cdza_27",c5="_scrollToAnchor_1cdza_65",d5="_scrollToAnchorBottom_1cdza_89",u5="_scrollToAnchorTop_1cdza_93",f5="_eventOverflowWarning_1cdza_97",sa={wrapper:a5,scrollContainer:i5,selectingPadding:o5,toolbar:r5,directionToggle:l5,scrollToAnchor:c5,scrollToAnchorBottom:d5,scrollToAnchorTop:u5,eventOverflowWarning:f5},p5=10*1024,m5=new Set(["running","idle"]);function h5(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 E1="grackle-stream-direction";function g5(){try{return localStorage.getItem(E1)==="reversed"}catch{return!1}}function v5({eventsDropped:t}){return t<=0?i.jsx(i.Fragment,{}):i.jsxs("div",{className:sa.eventOverflowWarning,role:"alert",children:[i.jsx(fm,{size:zt,"aria-hidden":"true"})," ",t.toLocaleString()," older event",t===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function sh({events:t,eventsDropped:s,emptyState:o,onShowToast:r,sessions:c,currentSessionId:d,environments:u,personas:p,onForward:m,sandboxProxyUrl:g}){const v=y.useRef(null),[b,_]=y.useState(g5),k=E3(),[S,j]=y.useState(!1),[T,w]=y.useState(!1),[C,D]=y.useState(void 0),R=s5({events:t,formatForClipboard:C1}),E=y.useMemo(()=>t.filter(al).length,[t]),M=y.useMemo(()=>c?c.filter(ce=>m5.has(ce.status)&&ce.id!==d):[],[c,d]),O=y.useMemo(()=>b?[...t].reverse():t,[t,b]),{isAtAnchor:A,scrollToAnchor:$}=X6({scrollRef:v,contentLength:t.length,isReversed:b,paused:R.isSelecting}),Y=()=>{const ce=!b;_(ce);try{localStorage.setItem(E1,ce?"reversed":"default")}catch{}};y.useEffect(()=>{if(!R.isSelecting)return;const ce=me=>{me.key==="Escape"&&!S&&!T&&R.cancelSelection()};return window.addEventListener("keydown",ce),()=>{window.removeEventListener("keydown",ce)}},[R.isSelecting,R.cancelSelection,S,T]);const V=y.useCallback(async()=>{await R.copySelected()&&(r==null||r(`Copied ${R.selectedCount} message${R.selectedCount===1?"":"s"} to clipboard`,"success"))},[R,r]),ee=y.useCallback(()=>[...R.selectedIndices].sort((me,ke)=>me-ke).filter(me=>me<t.length).map(me=>t[me]),[R.selectedIndices,t]),le=y.useCallback(ce=>{if(!ce)return"this session";const me=c==null?void 0:c.find(De=>De.id===ce);if(!me)return ce.slice(0,8);const ke=u==null?void 0:u.find(De=>De.id===me.environmentId);return(ke==null?void 0:ke.displayName)??me.environmentId.slice(0,8)},[c,u]),Z=y.useCallback(async(ce,me)=>{if(!m)return;const ke=le(ce);try{await m(ce,me);const De=R.selectedCount;r==null||r(`Forwarded ${De} message${De===1?"":"s"} to ${ke}`,"success"),R.cancelSelection()}catch{r==null||r("Failed to forward messages","error")}},[m,le,r,R]),ae=y.useCallback(ce=>{j(!1);const me=ee(),ke=le(d),De=t5(ke,me);if(new TextEncoder().encode(De).length>p5){D({sessionId:ce,text:De}),w(!0);return}Z(ce,De).catch(()=>{})},[ee,le,d,Z]),H=y.useCallback(()=>{w(!1),C&&(Z(C.sessionId,C.text).catch(()=>{}),D(void 0))},[C,Z]),B=y.useCallback(()=>{w(!1),D(void 0)},[]),F=k?0:.2,ge=b?-8:8,ne=C?Math.round(new TextEncoder().encode(C.text).length/1024):0;return i.jsxs("div",{className:sa.wrapper,children:[i.jsx("div",{className:sa.toolbar,children:i.jsx(Ti,{text:b?"Showing newest first":"Showing oldest first",children:i.jsx("button",{className:sa.directionToggle,onClick:Y,"aria-label":b?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:b?i.jsx(dy,{size:zt,"aria-hidden":"true"}):i.jsx(uy,{size:zt,"aria-hidden":"true"})})})}),i.jsxs("div",{ref:v,className:`${sa.scrollContainer} ${R.isSelecting?sa.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,i.jsx(v5,{eventsDropped:s}),i.jsx(as,{initial:!1,children:O.map((ce,me)=>{const ke=b?t.length-1-me:me;return i.jsx($t.div,{initial:{opacity:0,y:ge},animate:{opacity:1,y:0},transition:{duration:F,ease:"easeOut"},children:i.jsx(y6,{copyText:e5(ce),isContentBearing:al(ce),isSelecting:R.isSelecting,isSelected:R.selectedIndices.has(ke),checkboxLabel:h5(ce),onSelect:()=>{R.enterSelectionMode(ke)},onToggle:De=>{R.toggleEvent(ke,De)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:i.jsx(sD,{event:ce,toolUseCtx:ce.toolUseCtx,settled:ce.settled,sandboxProxyUrl:g})})},`${ce.sessionId}-${ce.timestamp}-${ke}`)})})]}),i.jsx(as,{children:R.isSelecting&&i.jsx(N6,{selectedCount:R.selectedCount,totalSelectable:E,onSelectAll:R.selectAll,onDeselectAll:R.deselectAll,onCopy:()=>{V().catch(()=>{})},onForward:m!==void 0?()=>{j(!0)}:void 0,forwardDisabled:M.length===0,onCancel:R.cancelSelection})}),i.jsx(Y6,{isOpen:S,sessions:M,environments:u??[],personas:p,onSelect:ae,onCancel:()=>{j(!1)}}),i.jsx(ys,{isOpen:T,title:"Send large message?",description:`This will forward a large message (${ne} KB). Continue?`,confirmLabel:"Send",onConfirm:H,onCancel:B}),i.jsx(as,{children:!A&&i.jsxs($t.button,{className:`${sa.scrollToAnchor} ${b?sa.scrollToAnchorTop:sa.scrollToAnchorBottom}`,onClick:$,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[b?i.jsx(uy,{size:zt,"aria-hidden":"true"}):i.jsx(dy,{size:zt,"aria-hidden":"true"})," New events"]})})]})}function ah(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,_]=y.useState(""),k=y.useRef(!1),S=d===c,j=y.useCallback(O=>{v(O),_("")},[]),T=y.useCallback(()=>{_("")},[]),w=y.useCallback(()=>{k.current=!1,u==null||u(null),v(""),_("")},[u]),C=y.useCallback(()=>{const O=m?g.trim():g;if(r){const $=r(g);if($){_($);return}}const A=m?s.trim():s;if(O===A){w();return}o(O),w()},[g,s,m,r,o,w]),D=y.useCallback(()=>{k.current=!0,u==null||u(c),v(s),_("")},[c,s,u]),R=y.useCallback(O=>{if(k.current){k.current=!1;return}O.relatedTarget instanceof HTMLElement&&O.relatedTarget.dataset.editAction===c||C()},[c,C]),E=y.useCallback(O=>{O.key==="Escape"?w():O.key==="Enter"&&p&&C()},[w,p,C]),M=(()=>{if(!S)return!1;const O=m?s.trim():s;return(m?g.trim():g)!==O})();return y.useEffect(()=>{!S&&(g!==""||b!=="")&&(v(""),_(""))},[S,g,b]),{isEditing:S,draft:g,error:b,isDirty:M,startEdit:D,cancelEdit:w,save:C,setDraft:j,clearError:T,handleBlur:R,handleKeyDown:E,ignoreInitialBlurRef:k}}const y5="_editFieldWrapper_yuzty_1",b5="_editInput_yuzty_10",_5="_editTextarea_yuzty_42",x5="_editSelect_yuzty_78",k5="_editError_yuzty_111",S5="_editInputInvalid_yuzty_118",j5="_editHint_yuzty_123",T5="_unsavedDot_yuzty_132",w5="_metaValueClickable_yuzty_140",N5="_editButton_yuzty_159",C5="_metaPlaceholder_yuzty_175",E5="_worktreeToggle_yuzty_180",it={editFieldWrapper:y5,editInput:b5,editTextarea:_5,editSelect:x5,editError:k5,editInputInvalid:S5,editHint:j5,unsavedDot:T5,metaValueClickable:w5,editButton:N5,metaPlaceholder:C5,worktreeToggle:E5};function Bt(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:_,"data-testid":k}=t,S=y.useRef(null),j=ah({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(j.isEditing){const w=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(w)}},[j.isEditing]),c==="create"){const w=D=>{m==null||m(D.target.value)},C=r==null?void 0:r(s);return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("input",{className:`${it.editInput} ${C?it.editInputInvalid:""}`,value:s,onChange:w,maxLength:b,placeholder:v,"aria-label":_,"data-testid":k?`${k}-input`:void 0}),C&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:C})]})}if(j.isEditing)return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("input",{ref:S,className:`${it.editInput} ${j.error?it.editInputInvalid:""}`,value:j.draft,onChange:w=>j.setDraft(w.target.value),onBlur:j.handleBlur,onKeyDown:j.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":k?`${k}-input`:void 0}),j.isDirty&&i.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),j.error&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:j.error}),i.jsx("span",{className:it.editHint,children:"Enter to save · Esc to cancel"})]});const T=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:it.metaValueClickable,onClick:()=>j.startEdit(),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),j.startEdit())},title:"Click to edit","aria-label":_,"data-testid":k?`${k}-button`:void 0,children:[T!==void 0?T:s?i.jsx("span",{children:s}):i.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function tm(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":_}=t,k=y.useRef(null),S=ah({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(S.isEditing){const T=window.setTimeout(()=>{var w;(w=k.current)==null||w.focus()},0);return()=>window.clearTimeout(T)}},[S.isEditing]),c==="create"){const T=C=>{m==null||m(C.target.value)},w=r==null?void 0:r(s);return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("textarea",{className:`${it.editTextarea} ${w?it.editInputInvalid:""}`,value:s,onChange:T,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),w&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:w})]})}if(S.isEditing)return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("textarea",{ref:k,className:`${it.editTextarea} ${S.error?it.editInputInvalid:""}`,value:S.draft,onChange:T=>S.setDraft(T.target.value),onBlur:S.handleBlur,onKeyDown:S.handleKeyDown,title:b,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),S.isDirty&&i.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),S.error&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:S.error}),i.jsx("span",{className:it.editHint,children:"Tab to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:it.metaValueClickable,onClick:()=>S.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),S.startEdit())},title:"Click to edit","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[j!==void 0?j:s?i.jsx("span",{children:s}):i.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:it.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":_}=t,k=y.useRef(null),S=ah({value:s,onSave:o,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(S.isEditing){const R=window.setTimeout(()=>{var E;(E=k.current)==null||E.focus()},0);return()=>window.clearTimeout(R)}},[S.isEditing]);const j=y.useCallback(R=>{const E=R.target.value;S.ignoreInitialBlurRef.current=!1,E!==s&&o(E),S.cancelEdit()},[s,o,S]),T=y.useCallback(R=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}R.relatedTarget instanceof HTMLElement&&R.relatedTarget.dataset.editAction===d||S.cancelEdit()},[d,S]);if(r==="create")return i.jsx("select",{className:it.editSelect,value:s,onChange:R=>m==null?void 0:m(R.target.value),"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(R=>i.jsx("option",{value:R.value,children:R.label},R.value))});if(S.isEditing)return i.jsx("select",{ref:k,className:it.editSelect,value:S.draft,onChange:j,onBlur:T,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(R=>i.jsx("option",{value:R.value,children:R.label},R.value))});const w=g==null?void 0:g(s),C=(D=c.find(R=>R.value===s))==null?void 0:D.label;return i.jsxs("button",{type:"button",className:it.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[w!==void 0?w:C?i.jsx("span",{children:C}):i.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function A5(t){const{checked:s,onChange:o,label:r,ariaLabel:c,"data-testid":d}=t;return i.jsxs("label",{className:it.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 D5="_nav_1snmp_1",M5="_searchForm_1snmp_8",R5="_searchInput_1snmp_15",I5="_searchButton_1snmp_33",O5="_clearButton_1snmp_68",B5="_workspaceSelect_1snmp_85",L5="_listHeader_1snmp_99",z5="_nodeList_1snmp_108",$5="_nodeItem_1snmp_116",H5="_indicator_1snmp_129",P5="_label_1snmp_136",U5="_badge_1snmp_145",Qn={nav:D5,searchForm:M5,searchInput:R5,searchButton:I5,clearButton:O5,workspaceSelect:B5,listHeader:L5,nodeList:z5,nodeItem:$5,indicator:H5,label:P5,badge:U5};function V5({nodes:t,workspaces:s,loading:o,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:p}){const[m,g]=y.useState(""),v=y.useCallback(S=>{S.preventDefault(),m.trim()&&c(m.trim())},[m,c]),b=y.useCallback(()=>{g(""),d()},[d]),_=y.useCallback(S=>{u(S)},[u]),k=y.useCallback(S=>{g(""),p(S)},[p]);return i.jsxs("div",{className:Qn.nav,"data-testid":"knowledge-nav",children:[i.jsxs("form",{className:Qn.searchForm,onSubmit:v,children:[i.jsx("input",{className:Qn.searchInput,type:"text",placeholder:"Search...",value:m,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),i.jsx("button",{type:"submit",className:Qn.searchButton,disabled:o,children:"Go"})]}),r&&i.jsx("button",{type:"button",className:Qn.clearButton,onClick:b,children:"Clear search"}),i.jsxs("select",{className:Qn.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[i.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>i.jsx("option",{value:S.id,children:S.name},S.id))]}),i.jsxs("div",{className:Qn.listHeader,children:["Nodes (",t.length,")"]}),i.jsx("ul",{className:Qn.nodeList,children:t.map(S=>i.jsxs("li",{className:Qn.nodeItem,onClick:()=>{_(S.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),_(S.id))},role:"button",tabIndex:0,children:[i.jsx("span",{className:Qn.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),i.jsx("span",{className:Qn.label,children:S.label}),i.jsx("span",{className:Qn.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const q5="_container_bwu10_1",G5="_hamburger_bwu10_33",F5="_brand_bwu10_49",K5="_brandLogo_bwu10_68",Z5="_info_bwu10_75",Y5="_connectionLabel_bwu10_90",J5="_connectionDot_bwu10_103",W5="_connected_bwu10_106",X5="_disconnected_bwu10_110",Q5="_connecting_bwu10_113",Es={container:q5,hamburger:G5,brand:F5,brandLogo:K5,info:Z5,connectionLabel:Y5,connectionDot:J5,connected:W5,disconnected:X5,connecting:Q5},eI={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},tI={connected:Es.connected,connecting:Es.connecting,disconnected:Es.disconnected};function nI({connectionStatus:t,environments:s,sessions:o,onToggleSidebar:r,sidebarOpen:c}){const d=vt(),u=s.length,p=s.filter(v=>v.status==="connected").length,m=o.filter(v=>["running","idle"].includes(v.status)).length,g=eI[t];return i.jsxs("div",{className:Es.container,children:[r&&i.jsx("button",{type:"button",className:Es.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:i.jsx(rT,{size:wt,"aria-hidden":"true"})}),i.jsx(Ti,{text:"Home",placement:"bottom",children:i.jsxs("button",{type:"button",className:Es.brand,onClick:()=>d(Ho),"data-testid":"statusbar-brand",children:[i.jsx("img",{src:wd("icon-192x192.png"),alt:"",className:Es.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),i.jsxs("div",{className:Es.info,children:[i.jsxs("span",{"aria-label":g,children:[i.jsx("span",{className:`${Es.connectionDot} ${tI[t]}`,"aria-hidden":"true",children:i.jsx(Si,{size:S_,fill:"currentColor"})})," ",i.jsx("span",{className:Es.connectionLabel,"aria-hidden":"true",children:g})]}),i.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),i.jsxs("span",{children:[m," active"]})]})]})}const sI="_nav_gx5h3_1",aI="_tab_gx5h3_35",iI="_tabIcon_gx5h3_68",oI="_tabLabel_gx5h3_79",rI="_tabActive_gx5h3_84",lI="_tabEnd_gx5h3_90",So={nav:sI,tab:aI,tabIcon:iI,tabLabel:oI,tabActive:rI,tabEnd:lI},Wc=[{view:"dashboard",label:"Dashboard",icon:i.jsx(Zj,{size:wt}),route:Ho,testId:"sidebar-tab-dashboard",order:0},{view:"tasks",label:"Tasks",icon:i.jsx(Nj,{size:wt}),route:VN,testId:"sidebar-tab-tasks",order:1},{view:"environments",label:"Environments",icon:i.jsx(pT,{size:wt}),route:Mo,testId:"sidebar-tab-environments",order:2},{view:"chat",label:"Root",icon:i.jsx(cT,{size:wt}),route:UN,testId:"sidebar-tab-chat",order:3},{view:"knowledge",label:"Knowledge",icon:i.jsx(bj,{size:wt}),route:K_,testId:"sidebar-tab-knowledge",order:5},{view:"coordination",label:"Coordination",icon:i.jsx(hT,{size:wt}),route:G_,testId:"sidebar-tab-coordination",order:6},{view:"settings",label:"Settings",icon:i.jsx(CT,{size:wt}),route:LN,testId:"sidebar-tab-settings",align:"end"}];function cI(t){return t===Ho||t==="/"?"dashboard":t.startsWith(G_)?"coordination":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(K_)?"knowledge":t.startsWith(xi)?"settings":"tasks"}function dI({tabs:t=Wc}){var g;const s=Jt(),o=vt(),r=y.useRef(null),c=cI(s.pathname),d=y.useMemo(()=>{const v=(b,_)=>(b.order??Number.MAX_SAFE_INTEGER)-(_.order??Number.MAX_SAFE_INTEGER);return[...t.filter(b=>b.align!=="end").sort(v),...t.filter(b=>b.align==="end")]},[t]),u=(g=d.find(v=>v.align==="end"))==null?void 0:g.view,p=y.useCallback(v=>{o(v.route)},[o]),m=y.useCallback(v=>{var j,T;const b=(j=r.current)==null?void 0:j.querySelectorAll('[role="tab"]');if(!b)return;const _=Array.from(b).findIndex(w=>w===document.activeElement),k=_>=0?_:d.findIndex(w=>w.view===c);let S=k;if(v.key==="ArrowRight"||v.key==="j"||v.key==="J")v.preventDefault(),S=(k+1)%d.length;else if(v.key==="ArrowLeft"||v.key==="k"||v.key==="K")v.preventDefault(),S=(k-1+d.length)%d.length;else if(v.key==="Home")v.preventDefault(),S=0;else if(v.key==="End")v.preventDefault(),S=d.length-1;else return;o(d[S].route),(T=b[S])==null||T.focus()},[c,o,d]);return i.jsx("nav",{className:So.nav,ref:r,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:m,"data-testid":"sidebar-nav",children:d.map(v=>{const b=v.view===c,_=v.view===u;return i.jsx(Ti,{text:v.label,placement:"bottom",className:_?So.tabEnd:void 0,children:i.jsxs("button",{role:"tab",type:"button","aria-selected":b,tabIndex:b?0:-1,className:`${So.tab} ${b?So.tabActive:""}`,onClick:()=>p(v),"data-testid":v.testId,"aria-label":v.label,children:[i.jsx("span",{className:So.tabIcon,"aria-hidden":"true",children:v.icon}),i.jsx("span",{className:So.tabLabel,children:v.label})]})},v.view)})})}const uI="_container_pi6ii_1",fI="_content_pi6ii_66",qb={container:uI,content:fI},pI=320,A1=220,D1=600,M1="grackle-sidebar-width";function mI(){try{const t=localStorage.getItem(M1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=A1&&s<=D1)return s}}catch{}return pI}function hI(t){try{localStorage.setItem(M1,String(t))}catch{}}function gI({content:t}){const[s]=y.useState(mI),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>=A1&&m<=D1&&hI(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return i.jsx("div",{className:qb.container,ref:o,"data-testid":"sidebar",style:{width:s},children:i.jsx("div",{className:qb.content,children:t})})}const vI="_bar_tnfsh_1",yI="_btnPrimary_tnfsh_32",bI="_statusText_tnfsh_85",_I="_statusCompleted_tnfsh_90",xI="_statusFailed_tnfsh_94",kI="_statusBlocked_tnfsh_98",SI="_hintText_tnfsh_103",Tt={bar:vI,btnPrimary:yI,statusText:bI,statusCompleted:_I,statusFailed:xI,statusBlocked:kI,hintText:SI};function jI({sessions:t,tasks:s,environments:o}){const r=vt(),c=Jt(),d=nn("/sessions/:sessionId"),u=nn("/tasks/:taskId"),p=nn("/tasks/:taskId/stream"),m=nn("/tasks/:taskId/edit"),g=nn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),v=nn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),b=nn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),_=nn("/sessions/new"),k=nn("/environments/:environmentId/workspaces/:workspaceId"),S=nn("/tasks/new"),j=nn("/chat"),T=nn("/"),w=nn("/settings/*"),C=d==null?void 0:d.params.sessionId,D=(u==null?void 0:u.params.taskId)??(p==null?void 0:p.params.taskId)??(g==null?void 0:g.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId),R=g??v??b,E=(R==null?void 0:R.params.environmentId)??(k==null?void 0:k.params.environmentId),M=c.pathname.startsWith("/environments")&&!k&&!R,O=!!j,A=!!_,$=!!k&&!g&&!v&&!b,Y=!!S;if(!!T&&!A&&!$&&!Y||!!w||(!!m||!!b)||Y||M||A)return i.jsx(i.Fragment,{});if(O)return o.find(ae=>ae.adapterType==="local"&&ae.status==="connected")?i.jsx(i.Fragment,{}):i.jsx("div",{className:Tt.bar,children:i.jsx("span",{className:Tt.hintText,children:"Add a local environment to start chatting"})});if($)return i.jsx("div",{className:Tt.bar,children:i.jsx("span",{className:Tt.hintText,children:"Select a task or click + to create one"})});if(D){const Z=s.find(B=>B.id===D);if(!Z)return i.jsx("div",{className:Tt.bar,children:i.jsx("span",{className:Tt.hintText,children:"Loading..."})});const ae=new Map(s.map(B=>[B.id,B])),H=Z.dependsOn.some(B=>{const F=ae.get(B);return F!==void 0&&F.status!=="complete"});if(Z.status==="not_started"){const B=H?Z.dependsOn.map(F=>ae.get(F)).filter(F=>F&&F.status!=="complete").map(F=>F.title):[];return i.jsx("div",{className:Tt.bar,children:H?i.jsxs("span",{className:Tt.statusBlocked,children:["Blocked by: ",B.join(", ")]}):i.jsx("span",{className:Tt.hintText,children:"Use the buttons above to start or manage this task"})})}if(Z.status==="working"||Z.status==="paused"){const B=Z.latestSessionId||void 0,F=B?t.find(ne=>ne.id===B):void 0;return F&&F.status!=="stopped"?i.jsx(i.Fragment,{}):i.jsx("div",{className:Tt.bar,children:i.jsx("span",{className:Tt.hintText,children:"Waiting for agent..."})})}if(Z.status==="complete")return i.jsxs("div",{className:Tt.bar,children:[i.jsx("span",{className:`${Tt.statusText} ${Tt.statusCompleted}`,children:"Task completed"}),i.jsx("button",{onClick:()=>r(Ai(Z.workspaceId,void 0,E)),className:Tt.btnPrimary,children:"+ New Task"})]});if(Z.status==="failed")return i.jsx("div",{className:Tt.bar,children:i.jsx("span",{className:`${Tt.statusText} ${Tt.statusFailed}`,children:"Task failed"})})}if(C){const Z=t.find(B=>B.id===C),ae=(Z==null?void 0:Z.status)==="stopped";if(Z!==void 0&&!ae)return i.jsx(i.Fragment,{});if(ae)return i.jsxs("div",{className:Tt.bar,children:[i.jsxs("span",{className:`${Tt.statusText} ${Tt.hintText}`,children:["Session ",Z.endReason||Z.status]}),i.jsx("button",{onClick:()=>r(U_(Z.environmentId)),className:Tt.btnPrimary,children:"+ New Chat"})]})}return i.jsx("div",{className:Tt.bar,children:i.jsx("span",{className:Tt.hintText,children:"Loading..."})})}const TI="_nav_14i94_1",wI="_tab_14i94_24",NI="_tabActive_14i94_62",CI="_tabLabel_14i94_75",EI="_statusDot_14i94_81",AI="_pulse_14i94_87",DI="_addButton_14i94_99",MI="_empty_14i94_132",Ha={nav:TI,tab:wI,tabActive:NI,tabLabel:CI,statusDot:EI,pulse:AI,addButton:DI,empty:MI},RI={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function II({environments:t}){const s=vt(),o=y.useRef(null),r=nn("/environments/:environmentId"),c=nn("/environments/:environmentId/edit"),d=nn("/environments/:environmentId/workspaces/:workspaceId"),u=nn("/environments/:environmentId/workspaces/:workspaceId/*"),p=(r==null?void 0:r.params.environmentId)??(c==null?void 0:c.params.environmentId)??(d==null?void 0:d.params.environmentId)??(u==null?void 0:u.params.environmentId),m=p==="new"?void 0:p,g=y.useCallback(_=>{s(Ro(_))},[s]),v=y.useCallback(_=>{var w;const k=(w=o.current)==null?void 0:w.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),j=S>=0?S:t.findIndex(C=>C.id===m);let T=j;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),T=(j+1)%k.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),T=(j-1+k.length)%k.length;else if(_.key==="Home")_.preventDefault(),T=0;else if(_.key==="End")_.preventDefault(),T=k.length-1;else return;T<t.length&&s(Ro(t[T].id)),k[T].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return i.jsxs("div",{className:Ha.nav,"data-testid":"environment-nav",children:[i.jsx("nav",{ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(_=>{const k=_.id===m,S=_.id===b,j=RI[_.status]||"var(--text-tertiary)",T=_.status==="connected";return i.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${Ha.tab} ${k?Ha.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[i.jsx("span",{className:`${Ha.statusDot} ${T?Ha.pulse:""}`,style:{color:j},"aria-hidden":"true",children:i.jsx(Si,{size:S_,fill:"currentColor"})}),i.jsx("span",{className:Ha.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),i.jsx("button",{type:"button",className:Ha.addButton,onClick:()=>s(ON),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&i.jsx("div",{className:Ha.empty,children:"No environments yet."})]})}function OI(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 R1({text:t,indices:s,highlightClass:o}){if(!s||s.length===0)return i.jsx(i.Fragment,{children:t});const r=OI(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 BI(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 LI(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 $T){c.add(d);const u=o.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Fa(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=Fa(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const zI="_container_z4i38_1",$I="_header_z4i38_5",HI="_headerActions_z4i38_17",PI="_searchInput_z4i38_23",UI="_searchHighlight_z4i38_56",VI="_groupToggle_z4i38_62",qI="_groupToggleActive_z4i38_89",GI="_addButton_z4i38_93",FI="_taskRow_z4i38_120",KI="_selected_z4i38_140",ZI="_expandArrow_z4i38_150",YI="_expanded_z4i38_157",JI="_leafSpacer_z4i38_161",WI="_taskStatusIcon_z4i38_166",XI="_taskTitle_z4i38_170",QI="_workspaceBadge_z4i38_177",eO="_childCountBadge_z4i38_195",tO="_dependencyBadge_z4i38_208",nO="_blockedBadge_z4i38_220",sO="_addChildButton_z4i38_225",aO="_emptyState_z4i38_268",iO="_statusGroupHeader_z4i38_275",oO="_statusGroupIcon_z4i38_294",rO="_statusGroupLabel_z4i38_298",lO="_statusGroupCount_z4i38_303",Je={container:zI,header:$I,headerActions:HI,searchInput:PI,searchHighlight:UI,groupToggle:VI,groupToggleActive:qI,addButton:GI,taskRow:FI,selected:KI,expandArrow:ZI,expanded:YI,leafSpacer:JI,taskStatusIcon:WI,taskTitle:XI,workspaceBadge:QI,childCountBadge:eO,dependencyBadge:tO,blockedBadge:nO,addChildButton:sO,emptyState:aO,statusGroupHeader:iO,statusGroupIcon:oO,statusGroupLabel:rO,statusGroupCount:lO},cO=[{name:"title",weight:2},{name:"description",weight:1}],I1=16,dO=16,O1="grackle-task-group-by-status";function Gb(){try{return localStorage.getItem(O1)==="true"}catch{return!1}}function uO(t){try{localStorage.setItem(O1,String(t))}catch{}}function fO({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:Je.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:`${Je.expandArrow} ${s?Je.expanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),i.jsx("span",{className:Je.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),i.jsx("span",{className:Je.statusGroupLabel,children:t.label}),i.jsx("span",{className:Je.statusGroupCount,children:t.tasks.length})]}),i.jsx(as,{children:s&&i.jsx($t.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=Fa(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return i.jsxs("div",{onClick:()=>c(os(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(os(p.id)))},className:`${Je.taskRow} ${g?Je.selected:""}`,style:{"--task-indent":`${I1}px`},"data-task-id":p.id,children:[i.jsx("span",{className:Je.leafSpacer}),i.jsx("span",{className:Je.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${il(p.status)}`,children:m.icon}),i.jsx("span",{className:Je.taskTitle,title:p.title,children:i.jsx(R1,{text:p.title,indices:d.get(p.id),highlightClass:Je.searchHighlight})}),v&&i.jsx("span",{className:Je.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function B1({node:t,depth:s,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=Fa(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(w=>u.get(w)!=="complete"),b=o.has(t.id),_=t.children.length>0,k=c===t.id,S=I1+s*dO,T=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{onClick:()=>d(os(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:w=>{w.currentTarget===w.target&&(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),d(os(t.id)))},className:`${Je.taskRow} ${k?Je.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[_&&i.jsx("span",{className:`${Je.expandArrow} ${b?Je.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:w=>{w.stopPropagation(),r(t.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),w.stopPropagation(),r(t.id))},children:i.jsx(da,{size:Ze,"aria-hidden":"true"})}),!_&&i.jsx("span",{className:Je.leafSpacer}),i.jsx("span",{className:Je.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${il(t.status)}`,children:g.icon}),i.jsx("span",{className:Je.taskTitle,title:t.title,children:i.jsx(R1,{text:t.title,indices:p.get(t.id),highlightClass:Je.searchHighlight})}),T&&i.jsx("span",{className:Je.workspaceBadge,title:T,children:T}),_&&i.jsxs("span",{className:Je.childCountBadge,children:[t.children.filter(w=>w.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&i.jsx("span",{className:`${Je.dependencyBadge} ${v?Je.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<D2&&i.jsx(Ti,{text:"Add child task",children:i.jsx("button",{onClick:w=>{w.stopPropagation(),d(Ai(t.workspaceId,t.id))},"aria-label":"Add child task",className:Je.addChildButton,children:"+"})})]}),i.jsx(as,{children:_&&b&&i.jsx($t.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(w=>i.jsx(B1,{node:w,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},w.id))})})]})}function pO({workspaces:t,tasks:s}){const o=vt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,m]=y.useState(Gb),[g,v]=y.useState(Gb),[b,_]=y.useState(new Map),k=nn("/tasks/:taskId/*"),S=(k==null?void 0:k.params.taskId)!=="new"?k==null?void 0:k.params.taskId:void 0,j=y.useMemo(()=>new Map(s.map(Z=>[Z.id,Z.status])),[s]),T=y.useMemo(()=>new Map(t.map(Z=>[Z.id,Z.name])),[t]),w=()=>{const Z=!p;uO(Z),m(Z),Z&&(v(!0),_(new Map))},C=Z=>{_(ae=>{const H=new Map(ae),B=H.has(Z)?H.get(Z):g;return H.set(Z,!B),H})},D=Z=>b.has(Z)?b.get(Z):g,R=Z=>{c(ae=>{const H=new Set(ae);return H.has(Z)?(H.delete(Z),u(B=>new Set(B).add(Z))):(H.add(Z),u(B=>{const F=new Set(B);return F.delete(Z),F})),H})};y.useEffect(()=>{const Z=new Set(s.filter(ae=>ae.parentTaskId).map(ae=>ae.parentTaskId));Z.size>0&&c(ae=>{const H=new Set(ae);for(const B of Z)d.has(B)||H.add(B);return H})},[s,d]);const[E,M]=y.useState(""),{directMatchTaskIds:O,treeMatchTaskIds:A,titleHighlights:$}=y.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const Z=A2(s,E,cO),ae=new Set(Z.map(ge=>ge.item.id)),H=new Map;for(const ge of Z){const ne=ge.matches.find(ce=>ce.key==="title");ne&&H.set(ge.item.id,ne.indices)}const B=new Set(ae),F=new Map(s.map(ge=>[ge.id,ge]));for(const ge of[...ae]){let ne=F.get(ge);for(;ne!=null&&ne.parentTaskId;)B.add(ne.parentTaskId),ne=F.get(ne.parentTaskId)}return{directMatchTaskIds:ae,treeMatchTaskIds:B,titleHighlights:H}},[E,s]),Y=O!==null,V=Y?p?O:A:null,ee=V?s.filter(Z=>V.has(Z.id)):s,le=p?[]:BI(ee);return i.jsxs("div",{className:Je.container,children:[i.jsxs("div",{className:Je.header,children:[i.jsx("span",{children:"Tasks"}),i.jsxs("div",{className:Je.headerActions,children:[i.jsx(Ti,{text:p?"Switch to tree view":"Group tasks by status",children:i.jsx("button",{className:`${Je.groupToggle} ${p?Je.groupToggleActive:""}`,onClick:w,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,"data-testid":"task-group-by-status-toggle",children:i.jsx(sT,{size:zt})})}),i.jsx(Ti,{text:"New task",children:i.jsx("button",{className:Je.addButton,onClick:()=>o(Ai()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&i.jsx("input",{type:"text",value:E,onChange:Z=>M(Z.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Je.searchInput,"data-testid":"sidebar-search"}),p?LI(ee,j).map(Z=>i.jsx(fO,{group:Z,isExpanded:D(Z.status),onToggle:()=>C(Z.status),selectedTaskId:S,navigate:o,titleHighlights:$,workspaceNames:T},Z.status)):le.map(Z=>i.jsx(B1,{node:Z,depth:0,expandedTasks:r,toggleTask:R,selectedTaskId:S,navigate:o,taskStatusById:j,titleHighlights:$,workspaceNames:T},Z.id)),ee.length===0&&!Y&&i.jsx("div",{className:Je.emptyState,children:"No tasks yet. Click + to create one."}),ee.length===0&&Y&&i.jsx("div",{className:Je.emptyState,children:"No matching tasks"})]})}const mO="_toast_ed2dk_1",hO="_success_ed2dk_18",gO="_icon_ed2dk_22",vO="_error_ed2dk_25",yO="_warning_ed2dk_32",bO="_info_ed2dk_38",_O="_message_ed2dk_53",xO="_close_ed2dk_60",Lr={toast:mO,success:hO,icon:gO,error:vO,warning:yO,info:bO,message:_O,close:xO},kO={success:i.jsx(Ni,{size:wt}),error:i.jsx(Is,{size:wt}),warning:i.jsx(fm,{size:wt}),info:i.jsx(um,{size:wt})};function SO({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($t.div,{className:`${Lr.toast} ${Lr[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:Lr.icon,"aria-hidden":"true",children:kO[t.variant]}),i.jsx("span",{className:Lr.message,children:t.message}),i.jsx("button",{type:"button",className:Lr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:i.jsx(Is,{size:zt,"aria-hidden":"true"})})]})}const jO="_container_qqse2_1",TO={container:jO};function wO({toasts:t,onDismiss:s}){return i.jsx("div",{className:TO.container,"data-testid":"toast-container",children:i.jsx(as,{children:t.map(o=>i.jsx(SO,{toast:o,onDismiss:s},o.id))})})}const NO="_callout_e5awm_1",CO="_success_e5awm_11",EO="_icon_e5awm_15",AO="_error_e5awm_18",DO="_warning_e5awm_25",MO="_info_e5awm_32",RO="_content_e5awm_48",IO="_close_e5awm_53",zr={callout:NO,success:CO,icon:EO,error:AO,warning:DO,info:MO,content:RO,close:IO},OO={success:i.jsx(Ni,{size:wt}),error:i.jsx(Is,{size:wt}),warning:i.jsx(fm,{size:wt}),info:i.jsx(um,{size:wt})};function BO({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:[zr.callout,zr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[i.jsx("span",{className:zr.icon,"aria-hidden":"true",children:OO[t]}),i.jsx("span",{className:zr.content,children:s}),o&&i.jsx("button",{type:"button",className:zr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:i.jsx(Is,{size:zt,"aria-hidden":"true"})})]})})}function LO({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(BO,{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 zO="_container_m1fsr_1",$O="_heading_m1fsr_7",HO="_section_m1fsr_14",PO="_sectionTitle_m1fsr_26",UO="_sectionDescription_m1fsr_35",VO="_emptyState_m1fsr_41",qO="_tokenList_m1fsr_48",GO="_tokenRow_m1fsr_55",FO="_tokenBadge_m1fsr_68",KO="_tokenName_m1fsr_83",ZO="_tokenTarget_m1fsr_90",YO="_deleteButton_m1fsr_99",JO="_addForm_m1fsr_113",WO="_formRow_m1fsr_119",XO="_input_m1fsr_125",QO="_select_m1fsr_155",eB="_addButton_m1fsr_187",tB="_emptyStateInfo_m1fsr_221",nB="_themeOptions_m1fsr_229",sB="_themeOption_m1fsr_229",aB="_themeOptionSelected_m1fsr_254",iB="_themeOptionHeader_m1fsr_259",oB="_themeOptionLabel_m1fsr_266",rB="_themeOptionDesc_m1fsr_273",lB="_variantToggle_m1fsr_279",cB="_variantButton_m1fsr_286",dB="_variantActive_m1fsr_305",uB="_themeSwatches_m1fsr_311",fB="_themeSwatch_m1fsr_311",pB="_systemToggle_m1fsr_325",mB="_systemToggleHint_m1fsr_341",hB="_themeActive_m1fsr_348",gB="_aboutGrid_m1fsr_354",vB="_aboutItem_m1fsr_360",yB="_aboutLabel_m1fsr_373",bB="_aboutValue_m1fsr_379",_B="_aboutDot_m1fsr_387",xB="_aboutDotConnected_m1fsr_394",kB="_aboutDotDisconnected_m1fsr_398",SB="_aboutDotConnecting_m1fsr_402",fe={container:zO,heading:$O,section:HO,sectionTitle:PO,sectionDescription:UO,emptyState:VO,tokenList:qO,tokenRow:GO,tokenBadge:FO,tokenName:KO,tokenTarget:ZO,deleteButton:YO,addForm:JO,formRow:WO,input:XO,select:QO,addButton:eB,emptyStateInfo:tB,themeOptions:nB,themeOption:sB,themeOptionSelected:aB,themeOptionHeader:iB,themeOptionLabel:oB,themeOptionDesc:rB,variantToggle:lB,variantButton:cB,variantActive:dB,themeSwatches:uB,themeSwatch:fB,systemToggle:pB,systemToggleHint:mB,themeActive:hB,aboutGrid:gB,aboutItem:vB,aboutLabel:yB,aboutValue:bB,aboutDot:_B,aboutDotConnected:xB,aboutDotDisconnected:kB,aboutDotConnecting:SB},jB=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function TB({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(""),[_,k]=y.useState(null),S=w=>{if(w.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("")},j=w=>{k(w)},T=()=>{_&&(o(_),r==null||r("Token deleted","info")),k(null)};return i.jsxs(i.Fragment,{children:[i.jsx(ys,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:T,onCancel:()=>k(null)}),i.jsxs("section",{className:fe.section,children:[i.jsx("h3",{className:fe.sectionTitle,children:"Tokens"}),i.jsx("p",{className:fe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?i.jsx("div",{className:fe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):i.jsx("div",{className:fe.tokenList,children:t.map(w=>i.jsxs("div",{className:fe.tokenRow,children:[i.jsx("span",{className:fe.tokenBadge,children:w.tokenType}),i.jsx("span",{className:fe.tokenName,children:w.name}),i.jsx("span",{className:fe.tokenTarget,children:w.tokenType==="env_var"?w.envVar:w.filePath}),i.jsx("button",{className:fe.deleteButton,onClick:()=>j(w.name),title:`Delete ${w.name}`,"aria-label":`Delete ${w.name}`,children:i.jsx(Is,{size:zt,"aria-hidden":"true"})})]},w.name))}),i.jsxs("form",{className:fe.addForm,onSubmit:S,children:[i.jsxs("div",{className:fe.formRow,children:[i.jsx("input",{className:fe.input,type:"text",placeholder:"Token name",value:c,onChange:w=>d(w.target.value)}),i.jsx("input",{className:fe.input,type:"password",placeholder:"Value",value:u,onChange:w=>p(w.target.value)})]}),i.jsxs("div",{className:fe.formRow,children:[i.jsx("select",{className:fe.select,value:m,onChange:w=>g(w.target.value),children:jB.map(w=>i.jsx("option",{value:w.value,children:w.label},w.value))}),i.jsx("input",{className:fe.input,type:"text",placeholder:m==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:w=>b(w.target.value)}),i.jsx("button",{className:fe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const Nd=[{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"]}],L1=new Set(Nd.map(t=>t.id)),Fb="grackle";function nm(t){return Nd.find(s=>s.id===t)}function wB({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return i.jsxs("section",{className:fe.section,children:[i.jsx("h3",{className:fe.sectionTitle,children:"Appearance"}),i.jsx("p",{className:fe.sectionDescription,children:"Choose how Grackle looks across the app."}),i.jsx("div",{className:fe.themeOptions,children:Nd.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:`${fe.themeOption} ${p?fe.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>o(d.id),children:[i.jsxs("span",{className:fe.themeOptionHeader,children:[i.jsxs("span",{children:[i.jsx("span",{className:fe.themeOptionLabel,children:d.label}),i.jsx("span",{className:fe.themeOptionDesc,children:d.description})]}),u&&i.jsxs("span",{className:fe.variantToggle,children:[i.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${p&&m?fe.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:`${fe.variantButton} ${p&&!m?fe.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:fe.themeSwatches,children:d.swatches.map((g,v)=>i.jsx("span",{className:fe.themeSwatch,style:{background:g}},v))})]},d.id)})}),i.jsxs("label",{className:fe.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:fe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),i.jsxs("p",{className:fe.themeActive,children:["Active theme: ",i.jsx("strong",{children:s})]})]})}const NB={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},CB={connected:fe.aboutDotConnected,connecting:fe.aboutDotConnecting,disconnected:fe.aboutDotDisconnected};function EB({connectionStatus:t,environments:s,sessions:o}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=o.filter(u=>["running","idle"].includes(u.status)).length;return i.jsxs("section",{className:fe.section,"data-testid":"about-panel",children:[i.jsx("h3",{className:fe.sectionTitle,children:"About"}),i.jsx("p",{className:fe.sectionDescription,children:"Connection status and application information."}),i.jsxs("div",{className:fe.aboutGrid,children:[i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Connection"}),i.jsxs("span",{className:fe.aboutValue,children:[i.jsx("span",{className:`${fe.aboutDot} ${CB[t]}`}),NB[t]]})]}),i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Environments"}),i.jsxs("span",{className:fe.aboutValue,children:[r,"/",c," connected"]})]}),i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Active Sessions"}),i.jsx("span",{className:fe.aboutValue,children:d})]}),i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Version"}),i.jsx("span",{className:fe.aboutValue,children:"0.115.2"})]})]})]})}const AB="_container_cddyd_1",DB="_header_cddyd_8",MB="_headerTitle_cddyd_35",RB="_badge_cddyd_44",IB="_headerActions_cddyd_54",OB="_body_cddyd_61",BB="_formContent_cddyd_73",LB="_section_cddyd_85",zB="_label_cddyd_91",$B="_titleInput_cddyd_98",HB="_descriptionTextarea_cddyd_131",PB="_parentContext_cddyd_167",UB="_parentLabel_cddyd_175",VB="_parentName_cddyd_182",qB="_personaSelect_cddyd_186",GB="_depList_cddyd_220",FB="_depItem_cddyd_226",KB="_depItemSelected_cddyd_248",ZB="_noDeps_cddyd_252",YB="_btnPrimary_cddyd_258",JB="_btnGhost_cddyd_289",at={container:AB,header:DB,headerTitle:MB,badge:RB,headerActions:IB,body:OB,formContent:BB,section:LB,label:zB,titleInput:$B,descriptionTextarea:HB,parentContext:PB,parentLabel:UB,parentName:VB,personaSelect:qB,depList:GB,depItem:FB,depItemSelected:KB,noDeps:ZB,btnPrimary:YB,btnGhost:JB};function z1({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 _=vt(),k=t==="edit",S=k&&s?d.find(_e=>_e.id===s):void 0,j=k?(S==null?void 0:S.workspaceId)??"":o??"",[T,w]=y.useState(j),C=j||T,D=u.find(_e=>_e.id===C),R=c??(D==null?void 0:D.linkedEnvironmentIds[0]),E=!k&&!o,M=k?(S==null?void 0:S.parentTaskId)??"":r??"",O=M?d.find(_e=>_e.id===M):void 0,[A,$]=y.useState((S==null?void 0:S.title)??""),[Y,V]=y.useState((S==null?void 0:S.description)??""),[ee,le]=y.useState((S==null?void 0:S.dependsOn)??[]),[Z,ae]=y.useState((S==null?void 0:S.defaultPersonaId)??""),[H,B]=y.useState((S==null?void 0:S.canDecompose)??!1),[F,ge]=y.useState(!1),ne=y.useRef(!1);y.useEffect(()=>{k&&S&&!ne.current&&(ne.current=!0,$(S.title),V(S.description),le(S.dependsOn),ae(S.defaultPersonaId),B(S.canDecompose))},[k,S]);const ce=d.filter(_e=>_e.workspaceId===C&&(!k||_e.id!==s)&&_e.id!==M),me=A.trim().length>0&&(!k||S!==void 0)&&C.length>0,ke=_e=>{le(Oe=>Oe.includes(_e)?Oe.filter(Ht=>Ht!==_e):[...Oe,_e])},De=()=>{!me||F||k&&S===void 0||(k&&s?(g(s,A.trim(),Y,ee,Z),b==null||b("Task updated","success"),v?v():_(os(s,void 0,C,R),{replace:!0})):(ge(!0),m(C,A.trim(),Y,ee.length>0?ee:void 0,M||void 0,Z,H,()=>{b==null||b("Task created","success"),_(o?ji(o,R):"/tasks",{replace:!0})},_e=>{b==null||b(_e,"error"),ge(!1)})))},ot=()=>{if(v){v();return}_(k&&s?os(s,void 0,C,R):o?ji(o,R):"/tasks")},yt=k?"edit task":M?"child task":"new task";return i.jsxs("div",{className:at.container,children:[i.jsxs("div",{className:at.header,children:[i.jsxs("div",{className:at.headerTitle,children:[i.jsx("span",{className:at.badge,children:yt}),O&&i.jsxs("span",{className:at.parentContext,children:[i.jsx("span",{className:at.parentLabel,children:"Child of"}),i.jsx("span",{className:at.parentName,children:O.title})]})]}),i.jsxs("div",{className:at.headerActions,children:[i.jsx("button",{onClick:De,disabled:!me||F,className:at.btnPrimary,"data-testid":"task-edit-save",children:F?"Creating…":k?"Save Changes":"Create"}),i.jsx("button",{onClick:ot,className:at.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:at.body,children:i.jsxs("div",{className:at.formContent,children:[E&&i.jsxs("div",{className:at.section,children:[i.jsx("label",{className:at.label,htmlFor:"task-edit-workspace",children:"Workspace"}),i.jsxs("select",{id:"task-edit-workspace",value:T,onChange:_e=>w(_e.target.value),className:at.personaSelect,"data-testid":"task-edit-workspace",children:[i.jsx("option",{value:"",children:"Select a workspace..."}),u.map(_e=>i.jsx("option",{value:_e.id,children:_e.name},_e.id))]})]}),i.jsxs("div",{className:at.section,children:[i.jsx("label",{className:at.label,htmlFor:"task-edit-title",children:"Title"}),i.jsx("input",{id:"task-edit-title",type:"text",value:A,onChange:_e=>$(_e.target.value),placeholder:"Task title...",autoFocus:!0,className:at.titleInput,"data-testid":"task-edit-title",onKeyDown:_e=>{_e.key==="Enter"&&me&&De()}})]}),i.jsxs("div",{className:at.section,children:[i.jsx("label",{className:at.label,htmlFor:"task-edit-description",children:"Description"}),i.jsx("textarea",{id:"task-edit-description",value:Y,onChange:_e=>V(_e.target.value),placeholder:"Describe the task... (markdown supported)",className:at.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),i.jsxs("div",{className:at.section,children:[i.jsx("label",{className:at.label,htmlFor:"task-edit-persona",children:"Default Persona"}),i.jsxs("select",{id:"task-edit-persona",value:Z,onChange:_e=>ae(_e.target.value),className:at.personaSelect,"data-testid":"task-edit-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),p.map(_e=>i.jsx("option",{value:_e.id,children:_e.name},_e.id))]})]}),!k&&i.jsx("div",{className:at.section,children:i.jsxs("label",{className:at.depItem,"data-testid":"task-edit-can-decompose",children:[i.jsx("input",{type:"checkbox",checked:H,onChange:_e=>B(_e.target.checked)}),"Can spawn subtasks"]})}),i.jsxs("div",{className:at.section,children:[i.jsx("div",{className:at.label,children:"Dependencies"}),ce.length===0?i.jsx("div",{className:at.noDeps,children:"No other tasks in this workspace"}):i.jsx("div",{className:at.depList,children:ce.map(_e=>{const Oe=ee.includes(_e.id);return i.jsxs("label",{className:`${at.depItem} ${Oe?at.depItemSelected:""}`,"data-testid":`dep-option-${_e.id}`,children:[i.jsx("input",{type:"checkbox",checked:Oe,onChange:()=>ke(_e.id)}),_e.title,i.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",_e.status,")"]})]},_e.id)})})]})]})})]})}const WB="_actionButtons_1rjka_1",XB="_btnPrimary_1rjka_8",QB="_btnDanger_1rjka_39",eL="_btnGhost_1rjka_78",Zt={actionButtons:WB,btnPrimary:XB,btnDanger:QB,btnGhost:eL};function tL({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:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:m,className:Zt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{"data-testid":"task-header-start",onClick:r,className:Zt.btnPrimary,children:"Start"}),i.jsx("button",{onClick:m,className:Zt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Zt.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:u,disabled:!s,className:Zt.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused")return i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Zt.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:c,className:Zt.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="complete")return i.jsx("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:r,className:Zt.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const nL="_workpadSection_y8nj9_1",sL="_workpadLabel_y8nj9_9",aL="_workpadStatus_y8nj9_17",iL="_workpadSummary_y8nj9_23",oL="_workpadExtra_y8nj9_29",Pa={workpadSection:nL,workpadLabel:sL,workpadStatus:aL,workpadSummary:iL,workpadExtra:oL};function rL({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:Pa.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:Pa.workpadLabel,children:"Workpad"}),i.jsx("div",{className:Pa.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return i.jsxs("div",{className:Pa.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:Pa.workpadLabel,children:"Workpad"}),s.status&&i.jsx("div",{className:Pa.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&i.jsx("div",{className:Pa.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&i.jsx("div",{className:Pa.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const lL="_overviewDashboard_r05qm_1",cL="_overviewHero_r05qm_7",dL="_statusBadge_r05qm_14",uL="_statusPending_r05qm_26",fL="_statusAssigned_r05qm_31",pL="_statusInProgress_r05qm_36",mL="_statusReview_r05qm_41",hL="_statusDone_r05qm_46",gL="_statusFailed_r05qm_51",vL="_statusWaitingInput_r05qm_56",yL="_overviewBranchPill_r05qm_61",bL="_branchLink_r05qm_76",_L="_overviewSection_r05qm_87",xL="_overviewLabel_r05qm_93",kL="_overviewValue_r05qm_100",SL="_overviewMuted_r05qm_105",jL="_overviewMarkdown_r05qm_111",TL="_envRow_r05qm_180",wL="_envDot_r05qm_186",NL="_envDotGreen_r05qm_193",CL="_envDotYellow_r05qm_197",EL="_envDotRed_r05qm_201",AL="_envDotGray_r05qm_205",DL="_depList_r05qm_209",ML="_depItem_r05qm_215",RL="_depBlocked_r05qm_222",IL="_depDone_r05qm_226",OL="_timeline_r05qm_230",BL="_timelineRow_r05qm_236",LL="_timelineKey_r05qm_243",zL="_timelineValue_r05qm_249",$L="_timelineDelta_r05qm_253",HL="_reviewNotes_r05qm_264",be={overviewDashboard:lL,overviewHero:cL,statusBadge:dL,statusPending:uL,statusAssigned:fL,statusInProgress:pL,statusReview:mL,statusDone:hL,statusFailed:gL,statusWaitingInput:vL,overviewBranchPill:yL,branchLink:bL,overviewSection:_L,overviewLabel:xL,overviewValue:kL,overviewMuted:SL,overviewMarkdown:jL,envRow:TL,envDot:wL,envDotGreen:NL,envDotYellow:CL,envDotRed:EL,envDotGray:AL,depList:DL,depItem:ML,depBlocked:RL,depDone:IL,timeline:OL,timelineRow:BL,timelineKey:LL,timelineValue:zL,timelineDelta:$L,reviewNotes:HL};function $c(t){if(!t)return"—";const s=new Date(t);return isNaN(s.getTime())?"—":s.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function _p(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 Kb(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?be.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?be.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?be.envDotRed:be.envDotGray}function PL({status:t}){const s=Fa(t),o=zT(t);return i.jsx("span",{className:`${be.statusBadge} ${be[o]??be.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function UL({task:t,tasksById:s,environments:o,workspaces:r,taskSessions:c,selectedEnvId:d,taskUsage:u,treeUsage:p}){const m=c.length>0?c[c.length-1]:void 0,g=(m==null?void 0:m.environmentId)??"",v=g?o.find(S=>S.id===g):void 0,b=r.find(S=>S.id===t.workspaceId),_=o.find(S=>S.id===d),k=t.branch&&(b!=null&&b.repoUrl)?`${b.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return i.jsxs("div",{className:be.overviewDashboard,"data-testid":"task-overview-panel",children:[i.jsxs("div",{className:be.overviewHero,children:[i.jsx(PL,{status:t.status}),t.branch&&i.jsx("span",{className:be.overviewBranchPill,"data-testid":"task-overview-branch",children:k?i.jsxs("a",{href:k,target:"_blank",rel:"noreferrer noopener",className:be.branchLink,children:["🔗"," ",t.branch]}):i.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-description",children:[i.jsx("div",{className:be.overviewLabel,children:"Description"}),i.jsx("div",{className:be.overviewMarkdown,children:i.jsx(cm,{remarkPlugins:[dm],children:t.description})})]}),t.workpad&&i.jsx(rL,{workpad:t.workpad}),i.jsxs("div",{className:be.overviewSection,children:[i.jsx("div",{className:be.overviewLabel,children:"Environment"}),g&&v?i.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${be.envDot} ${Kb(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),i.jsx("span",{className:be.overviewValue,children:v.displayName})]}):_?i.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${be.envDot} ${Kb(_.status)}`,title:_.status,"aria-label":`Status: ${_.status}`,role:"img"}),i.jsx("span",{className:be.overviewValue,children:_.displayName}),i.jsx("span",{className:be.overviewMuted,children:"(workspace default)"})]}):i.jsx("div",{className:be.overviewMuted,children:"Set in workspace settings"})]}),i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-dependencies",children:[i.jsx("div",{className:be.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?i.jsx("div",{className:be.overviewMuted,children:"None"}):i.jsx("div",{className:be.depList,children:t.dependsOn.map(S=>{const j=s.get(S),T=(j==null?void 0:j.status)==="complete";return i.jsxs("div",{className:`${be.depItem} ${T?be.depDone:be.depBlocked}`,children:[i.jsx("span",{children:T?"✓":"○"}),i.jsx("span",{children:(j==null?void 0:j.title)??S})]},S)})})]}),i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-timeline",children:[i.jsx("div",{className:be.overviewLabel,children:"Timeline"}),i.jsxs("div",{className:be.timeline,children:[t.createdAt&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Created"}),i.jsx("span",{className:be.timelineValue,children:$c(t.createdAt)})]}),t.assignedAt&&(()=>{const S=_p(t.createdAt,t.assignedAt);return i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Assigned"}),i.jsx("span",{className:be.timelineValue,children:$c(t.assignedAt)}),S!==void 0&&i.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.startedAt&&(()=>{const S=_p(t.assignedAt??t.createdAt,t.startedAt);return i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Started"}),i.jsx("span",{className:be.timelineValue,children:$c(t.startedAt)}),S!==void 0&&i.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.completedAt&&(()=>{const S=_p(t.startedAt,t.completedAt);return i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Completed"}),i.jsx("span",{className:be.timelineValue,children:$c(t.completedAt)}),S!==void 0&&i.jsx("span",{className:be.timelineDelta,children:S})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&i.jsx("div",{className:be.overviewMuted,children:"No timing data"})]})]}),u&&u.costMillicents>0&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-usage",children:[i.jsx("div",{className:be.overviewLabel,children:"Usage"}),i.jsxs("div",{className:be.timeline,children:[i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Cost"}),i.jsx("span",{className:be.timelineValue,children:As(u.costMillicents)}),i.jsxs("span",{className:be.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),p&&p.costMillicents>u.costMillicents&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Total (incl. subtasks)"}),i.jsx("span",{className:be.timelineValue,children:As(p.costMillicents)}),i.jsxs("span",{className:be.timelineDelta,children:[p.sessionCount," session",p.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-budget",children:[i.jsx("div",{className:be.overviewLabel,children:"Budget"}),i.jsxs("div",{className:be.timeline,children:[t.tokenBudget>0&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Tokens"}),i.jsxs("span",{className:be.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:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Cost"}),i.jsxs("span",{className:be.timelineValue,children:[As((u==null?void 0:u.costMillicents)??0)," / ",As(t.costBudgetMillicents)]})]})]})]}),t.reviewNotes&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-review-notes",children:[i.jsx("div",{className:be.overviewLabel,children:"Review Notes"}),i.jsx("div",{className:be.reviewNotes,children:t.reviewNotes})]})]})}function VL({plugins:t,loading:s,onSetPluginEnabled:o}){return i.jsxs("div",{className:fe.container,"data-testid":"plugins-panel",children:[i.jsx("h2",{className:fe.heading,children:"Plugins"}),i.jsxs("div",{className:fe.section,children:[i.jsx("p",{className:fe.sectionDescription,children:"Enable or disable optional Grackle plugins. A server restart is required for changes to take effect."}),s&&i.jsx("p",{className:fe.emptyState,children:"Loading plugins..."}),!s&&t.length===0&&i.jsx("p",{className:fe.emptyState,children:"No plugins found."}),!s&&t.map(r=>{const c=r.enabled!==r.loaded;return i.jsxs("div",{className:fe.tokenRow,"data-testid":`plugin-row-${r.name}`,children:[i.jsxs("div",{style:{flex:1},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("span",{className:fe.tokenName,children:r.name}),r.required&&i.jsx("span",{className:fe.tokenBadge,title:"Required — cannot be disabled",children:"required"})]}),i.jsx("div",{className:fe.tokenTarget,children:r.description}),c&&i.jsx("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--accent-yellow)",marginTop:"2px"},"data-testid":`plugin-restart-notice-${r.name}`,children:"Restart Grackle to apply changes"})]}),i.jsx("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:r.required?"not-allowed":"pointer"},title:r.required?"Core is required and cannot be disabled":void 0,children:i.jsx("input",{type:"checkbox",checked:r.enabled,disabled:r.required,onChange:d=>o(r.name,d.target.checked),"data-testid":`plugin-toggle-${r.name}`,"aria-label":`Enable or disable ${r.name} plugin`,style:{accentColor:"var(--accent-green)",width:"16px",height:"16px"}})})]},r.name)})]})]})}function qL({githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u}){const[p,m]=y.useState(""),[g,v]=y.useState(""),[b,_]=y.useState(!1),[k,S]=y.useState(!1),[j,T]=y.useState(!1),[w,C]=y.useState(null),D=t.find(A=>A.id===w),R=async A=>{if(A.preventDefault(),!(!p.trim()||!g.trim())){S(!0);try{await o(p.trim(),g.trim(),"",b),u==null||u("GitHub account added","success"),m(""),v(""),_(!1)}catch($){const Y=$ instanceof Error?$.message:"Failed to add account";u==null||u(Y,"error")}finally{S(!1)}}},E=async A=>{try{await r(A,{isDefault:!0}),u==null||u("Default account updated","success")}catch($){const Y=$ instanceof Error?$.message:"Failed to update account";u==null||u(Y,"error")}},M=async()=>{if(w)try{await c(w),u==null||u("GitHub account removed","info")}catch(A){const $=A instanceof Error?A.message:"Failed to remove account";u==null||u($,"error")}finally{C(null)}},O=async()=>{T(!0);try{const A=await d();A.imported>0?u==null||u(`Imported ${A.imported} account(s): ${A.usernames.join(", ")}`,"success"):u==null||u("No new accounts to import","info")}catch(A){const $=A instanceof Error?A.message:"Import failed";u==null||u($,"error")}finally{T(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(ys,{isOpen:w!==null,title:"Remove GitHub Account?",description:D?`"${D.label}"${D.username?` (@${D.username})`:""} will be permanently removed.`:void 0,onConfirm:()=>{M().catch(()=>{})},onCancel:()=>C(null)}),i.jsxs("section",{className:fe.section,"data-testid":"github-accounts-panel",children:[i.jsx("h3",{className:fe.sectionTitle,children:"GitHub Accounts"}),i.jsx("p",{className:fe.sectionDescription,children:"Register multiple GitHub accounts to use different identities per environment. The default account is used when no specific account is assigned."}),s&&t.length===0?i.jsx("div",{className:fe.emptyState,children:"Loading..."}):t.length===0?i.jsx("div",{className:fe.emptyStateInfo,children:"No GitHub accounts registered. Add one below or import from the gh CLI."}):i.jsx("div",{className:fe.tokenList,children:t.map(A=>i.jsxs("div",{className:fe.tokenRow,"data-testid":`github-account-row-${A.id}`,children:[A.isDefault&&i.jsx("span",{className:fe.tokenBadge,title:"Default account",children:"default"}),i.jsx("span",{className:fe.tokenName,children:A.label}),A.username&&i.jsxs("span",{className:fe.tokenTarget,children:["@",A.username]}),!A.isDefault&&i.jsx("button",{className:fe.deleteButton,onClick:()=>{E(A.id).catch(()=>{})},title:"Set as default","aria-label":`Set ${A.label} as default`,"data-testid":`github-account-set-default-${A.id}`,children:i.jsx(MT,{size:zt,"aria-hidden":"true"})}),i.jsx("button",{className:fe.deleteButton,onClick:()=>C(A.id),title:`Remove ${A.label}`,"aria-label":`Remove ${A.label}`,"data-testid":`github-account-remove-${A.id}`,children:i.jsx(Is,{size:zt,"aria-hidden":"true"})})]},A.id))}),i.jsxs("form",{className:fe.addForm,onSubmit:A=>{R(A).catch(()=>{})},children:[i.jsxs("div",{className:fe.formRow,children:[i.jsx("input",{className:fe.input,type:"text",placeholder:"Label (e.g. personal, work)",value:p,onChange:A=>m(A.target.value),"data-testid":"github-account-label-input"}),i.jsx("input",{className:fe.input,type:"password",placeholder:"Personal access token",value:g,onChange:A=>v(A.target.value),"data-testid":"github-account-token-input"})]}),i.jsxs("div",{className:fe.formRow,children:[i.jsxs("label",{className:fe.tokenTarget,style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:b,onChange:A=>_(A.target.checked),"data-testid":"github-account-default-checkbox"}),"Set as default"]}),i.jsx("button",{className:fe.addButton,type:"submit",disabled:!p.trim()||!g.trim()||k,"data-testid":"github-account-add-button",children:k?"Adding...":"Add Account"}),i.jsx("button",{className:fe.addButton,type:"button",onClick:()=>{O().catch(()=>{})},disabled:j,"data-testid":"github-account-import-button",children:j?"Importing...":"Import from gh CLI"})]})]})]})]})}const GL="_container_legrg_1",FL="_header_legrg_8",KL="_headerTitle_legrg_35",ZL="_badge_legrg_44",YL="_headerActions_legrg_54",JL="_body_legrg_61",WL="_formContent_legrg_73",XL="_section_legrg_85",QL="_label_legrg_91",e8="_nameInput_legrg_98",t8="_fieldInput_legrg_131",n8="_adapterSelect_legrg_164",s8="_readOnlyValue_legrg_198",a8="_codespaceSection_legrg_204",i8="_codespaceActions_legrg_210",o8="_creatingHint_legrg_216",r8="_errorHint_legrg_222",l8="_btnPrimary_legrg_235",c8="_btnGhost_legrg_266",oe={container:GL,header:FL,headerTitle:KL,badge:ZL,headerActions:YL,body:JL,formContent:WL,section:XL,label:QL,nameInput:e8,fieldInput:t8,adapterSelect:n8,readOnlyValue:s8,codespaceSection:a8,codespaceActions:i8,creatingHint:o8,errorHint:r8,btnPrimary:l8,btnGhost:c8},Xc=1,Qc=65535;function xp(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=Xc&&s<=Qc}function kp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function d8({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,_]=y.useState(""),[k,S]=y.useState("");return g==="create"?i.jsxs("div",{className:oe.codespaceSection,children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Repository"}),i.jsx("input",{type:"text",value:b,onChange:j=>_(j.target.value),placeholder:"owner/repo",className:oe.fieldInput,"data-testid":"env-codespace-repo"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Machine Type"}),i.jsx("input",{type:"text",value:k,onChange:j=>S(j.target.value),placeholder:"Machine type (optional)...",className:oe.fieldInput,"data-testid":"env-codespace-machine"})]}),i.jsxs("div",{className:oe.codespaceActions,children:[i.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),k.trim()||void 0),v("pick"),_(""),S(""))},disabled:!b.trim(),className:oe.btnPrimary,children:"Create"}),i.jsx("button",{onClick:()=>{v("pick"),_(""),S("")},className:oe.btnGhost,children:"Cancel"})]})]}):i.jsx("div",{className:oe.codespaceSection,children:i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Codespace"}),!u&&i.jsxs("select",{value:t,onChange:j=>{j.target.value==="__create__"?(v("create"),s("")):(s(j.target.value),j.target.value&&!o.trim()&&r(j.target.value))},disabled:p,className:oe.adapterSelect,"data-testid":"env-codespace-select",children:[i.jsx("option",{value:"",children:"Select a codespace..."}),c.map(j=>i.jsxs("option",{value:j.name,children:[j.name," (",j.repository,") — ",j.state]},j.name)),i.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&i.jsx("span",{className:oe.creatingHint,children:"Creating codespace..."}),u&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:oe.errorHint,children:u}),i.jsx("input",{type:"text",value:t,onChange:j=>s(j.target.value),placeholder:"Or enter codespace name manually...",className:oe.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&i.jsx("span",{className:oe.errorHint,children:d})]})})}function $1({mode:t,environmentId:s,environments:o,githubAccounts:r,onAddEnvironment:c,onUpdateEnvironment:d,onListCodespaces:u,codespaces:p,codespaceError:m,codespaceListError:g,codespaceCreating:v,onCreateCodespace:b,onListDockerContainers:_,dockerContainers:k,dockerContainersError:S,onShowToast:j}){const T=vt(),w=t==="edit",C=w&&s?o.find(re=>re.id===s):void 0,[D,R]=y.useState(""),[E,M]=y.useState("local"),[O,A]=y.useState(""),[$,Y]=y.useState(""),[V,ee]=y.useState(""),[le,Z]=y.useState(""),[ae,H]=y.useState(""),[B,F]=y.useState(""),[ge,ne]=y.useState(""),[ce,me]=y.useState(""),[ke,De]=y.useState("create"),[ot,yt]=y.useState(""),[_e,Oe]=y.useState(null),Ht=y.useCallback(()=>{const re={};if(E==="local"){if(O.trim()&&(re.host=O.trim()),$.trim()){const ve=Number($);Number.isInteger(ve)&&(re.port=ve)}}else if(E==="ssh"){if(re.host=O.trim(),V.trim()&&(re.user=V.trim()),$.trim()){const ve=Number($);Number.isInteger(ve)&&(re.sshPort=ve)}le.trim()&&(re.identityFile=le.trim())}else E==="docker"?ke==="attach"?ot.trim()&&(re.attach=ot.trim()):(ae.trim()&&(re.image=ae.trim()),B.trim()&&(re.repo=B.trim())):E==="codespace"&&(re.codespaceName=ge.trim());return re},[E,O,$,V,le,ae,B,ge,ke,ot]),Nt=()=>!(!D.trim()||E==="ssh"&&!O.trim()||E==="codespace"&&!ge.trim()||E==="docker"&&ke==="attach"&&!ot.trim()||(E==="local"||E==="ssh")&&!xp($)),ue=()=>{Nt()&&(c(D.trim(),E,Ht(),ce||void 0),j==null||j("Environment added successfully","success"),T(Mo,{replace:!0}))},Re=()=>{T(s?Ro(s):Mo)},Q=y.useCallback((re,ve)=>{if(!C||!s)return;const Xe=kp(C.adapterConfig),an=ve.trim();an?Xe[re]=an:delete Xe[re],d(s,{adapterConfig:Xe})},[C,s,d]),et=y.useCallback((re,ve)=>{if(!C||!s)return;const Xe=kp(C.adapterConfig);if(ve.trim()){const an=Number(ve);Number.isInteger(an)&&an>=Xc&&an<=Qc&&(Xe[re]=an)}else delete Xe[re];d(s,{adapterConfig:Xe})},[C,s,d]);if(w){if(!C)return i.jsxs("div",{className:oe.container,children:[i.jsxs("div",{className:oe.header,children:[i.jsx("div",{className:oe.headerTitle,children:i.jsx("span",{className:oe.badge,children:"edit environment"})}),i.jsx("div",{className:oe.headerActions,children:i.jsx("button",{onClick:Re,className:oe.btnGhost,children:"Back"})})]}),i.jsx("div",{className:oe.body,children:i.jsx("div",{className:oe.formContent,children:i.jsx("span",{className:oe.readOnlyValue,children:"Environment not found"})})})]});const re=kp(C.adapterConfig);return i.jsxs("div",{className:oe.container,"data-testid":"env-edit-panel",children:[i.jsxs("div",{className:oe.header,children:[i.jsx("div",{className:oe.headerTitle,children:i.jsx("span",{className:oe.badge,children:"edit environment"})}),i.jsx("div",{className:oe.headerActions,children:i.jsx("button",{onClick:Re,className:oe.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),i.jsx("div",{className:oe.body,children:i.jsxs("div",{className:oe.formContent,children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Name"}),i.jsx(Bt,{value:C.displayName,onSave:ve=>{s&&d(s,{displayName:ve})},validate:ve=>ve.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:_e,onActivate:Oe,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Adapter Type"}),i.jsx("span",{className:oe.readOnlyValue,"data-testid":"env-edit-adapter-type",children:C.adapterType})]}),(C.adapterType==="codespace"||C.adapterType==="docker")&&(r.length>0||!!C.githubAccountId)&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"GitHub Account"}),i.jsxs("select",{value:C.githubAccountId||"",onChange:ve=>{s&&d(s,{githubAccountId:ve.target.value})},className:oe.adapterSelect,"data-testid":"env-edit-github-account",children:[i.jsx("option",{value:"",children:"(Default)"}),r.map(ve=>i.jsxs("option",{value:ve.id,children:[ve.label,ve.username?` (@${ve.username})`:"",ve.isDefault?" — default":""]},ve.id))]})]}),C.adapterType==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Host"}),i.jsx(Bt,{value:String(re.host??""),onSave:ve=>Q("host",ve),mode:"edit",fieldId:"host",activeFieldId:_e,onActivate:Oe,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Port"}),i.jsx(Bt,{value:String(re.port??""),onSave:ve=>et("port",ve),validate:ve=>xp(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:_e,onActivate:Oe,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),C.adapterType==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Host"}),i.jsx(Bt,{value:String(re.host??""),onSave:ve=>Q("host",ve),validate:ve=>ve.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:_e,onActivate:Oe,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"User"}),i.jsx(Bt,{value:String(re.user??""),onSave:ve=>Q("user",ve),mode:"edit",fieldId:"user",activeFieldId:_e,onActivate:Oe,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"SSH Port"}),i.jsx(Bt,{value:String(re.sshPort??""),onSave:ve=>et("sshPort",ve),validate:ve=>xp(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:_e,onActivate:Oe,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Identity File"}),i.jsx(Bt,{value:String(re.identityFile??""),onSave:ve=>Q("identityFile",ve),mode:"edit",fieldId:"identityFile",activeFieldId:_e,onActivate:Oe,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),C.adapterType==="docker"&&re.attach!==void 0&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Attach (container)"}),i.jsx(Bt,{value:String(re.attach??""),onSave:ve=>Q("attach",ve),validate:ve=>ve.trim()===""?"Container name is required":void 0,mode:"edit",fieldId:"attach",activeFieldId:_e,onActivate:Oe,placeholder:"container name or ID",ariaLabel:"Attach container","data-testid":"env-edit-attach"})]}),C.adapterType==="docker"&&re.attach===void 0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Image"}),i.jsx(Bt,{value:String(re.image??""),onSave:ve=>Q("image",ve),mode:"edit",fieldId:"image",activeFieldId:_e,onActivate:Oe,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Repo"}),i.jsx(Bt,{value:String(re.repo??""),onSave:ve=>Q("repo",ve),mode:"edit",fieldId:"repo",activeFieldId:_e,onActivate:Oe,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),C.adapterType==="codespace"&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Codespace Name"}),i.jsx(Bt,{value:String(re.codespaceName??""),onSave:ve=>Q("codespaceName",ve),validate:ve=>ve.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:_e,onActivate:Oe,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return i.jsxs("div",{className:oe.container,"data-testid":"env-create-panel",children:[i.jsxs("div",{className:oe.header,children:[i.jsx("div",{className:oe.headerTitle,children:i.jsx("span",{className:oe.badge,children:"new environment"})}),i.jsxs("div",{className:oe.headerActions,children:[i.jsx("button",{onClick:ue,disabled:!Nt(),className:oe.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),i.jsx("button",{onClick:Re,className:oe.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:oe.body,children:i.jsxs("div",{className:oe.formContent,children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-name",children:"Name"}),i.jsx("input",{id:"env-create-name",type:"text",value:D,onChange:re=>R(re.target.value),placeholder:"Environment name...",autoFocus:!0,className:oe.nameInput,"data-testid":"env-create-name",onKeyDown:re=>{re.key==="Enter"&&Nt()&&ue()}})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),i.jsxs("select",{id:"env-create-adapter",value:E,onChange:re=>{M(re.target.value),re.target.value==="codespace"&&u(ce||void 0)},className:oe.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"})]})]}),(E==="codespace"||E==="docker")&&r.length>0&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-github-account",children:"GitHub Account"}),i.jsxs("select",{id:"env-create-github-account",value:ce,onChange:re=>{me(re.target.value),E==="codespace"&&u(re.target.value||void 0)},className:oe.adapterSelect,"data-testid":"env-create-github-account",children:[i.jsx("option",{value:"",children:"(Default)"}),r.map(re=>i.jsxs("option",{value:re.id,children:[re.label," (@",re.username,")",re.isDefault?" — default":""]},re.id))]})]}),E==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:O,onChange:re=>A(re.target.value),placeholder:"Host (optional)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:Xc,max:Qc,value:$,onChange:re=>Y(re.target.value),placeholder:"Port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]})]}),E==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:O,onChange:re=>A(re.target.value),placeholder:"Host (required)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-user",children:"User"}),i.jsx("input",{id:"env-create-user",type:"text",value:V,onChange:re=>ee(re.target.value),placeholder:"User (optional)...",className:oe.fieldInput,"data-testid":"env-create-user"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"SSH Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:Xc,max:Qc,value:$,onChange:re=>Y(re.target.value),placeholder:"SSH port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-identity",children:"Identity File"}),i.jsx("input",{id:"env-create-identity",type:"text",value:le,onChange:re=>Z(re.target.value),placeholder:"Identity file (optional)...",className:oe.fieldInput,"data-testid":"env-create-identity"})]})]}),E==="docker"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-docker-mode",children:"Source"}),i.jsxs("select",{id:"env-docker-mode",value:ke,onChange:re=>{const ve=re.target.value;De(ve),ve==="attach"&&_()},className:oe.adapterSelect,"data-testid":"env-docker-mode",children:[i.jsx("option",{value:"create",children:"Create new container"}),i.jsx("option",{value:"attach",children:"Attach to existing container"})]})]}),ke==="create"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-image",children:"Image"}),i.jsx("input",{id:"env-create-image",type:"text",value:ae,onChange:re=>H(re.target.value),placeholder:"Image (optional)...",className:oe.fieldInput,"data-testid":"env-create-image"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-repo",children:"Repo"}),i.jsx("input",{id:"env-create-repo",type:"text",value:B,onChange:re=>F(re.target.value),placeholder:"Repo (optional)...",className:oe.fieldInput,"data-testid":"env-create-repo"})]})]}):i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Container"}),!S&&k.length>0&&i.jsxs("select",{value:ot,onChange:re=>{yt(re.target.value),re.target.value&&!D.trim()&&R(re.target.value)},className:oe.adapterSelect,"data-testid":"env-docker-container-select",children:[i.jsx("option",{value:"",children:"Select a container..."}),k.map(re=>i.jsxs("option",{value:re.name,children:[re.name," (",re.image,") ",re.status]},re.id))]}),(S||k.length===0)&&i.jsxs(i.Fragment,{children:[S?i.jsx("span",{className:oe.errorHint,children:S}):i.jsx("span",{className:oe.creatingHint,children:"No running containers found."}),i.jsx("input",{type:"text",value:ot,onChange:re=>{yt(re.target.value),re.target.value&&!D.trim()&&R(re.target.value)},placeholder:"Enter container name/ID...",className:oe.fieldInput,"data-testid":"env-docker-container-manual"})]})]})]}),E==="codespace"&&i.jsx(d8,{codespaceName:ge,onCodespaceNameChange:ne,envName:D,onEnvNameChange:R,codespaces:p,codespaceError:m,codespaceListError:g,codespaceCreating:v,onCreateCodespace:b})]})})]})}const u8="_group_1iprv_1",f8="_groupTitle_1iprv_8",p8="_shortcutList_1iprv_17",m8="_shortcutRow_1iprv_23",h8="_keys_1iprv_36",g8="_kbd_1iprv_43",v8="_description_1iprv_60",vi={group:u8,groupTitle:f8,shortcutList:p8,shortcutRow:m8,keys:h8,kbd:g8,description:v8},y8=[{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"}]},{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:"Root",shortcuts:[{keys:["Ctrl/Cmd","Enter"],description:"Send message (when the composer is focused)"},{keys:["Enter"],description:"Insert a new line in the message composer"}]}];function b8(){return i.jsxs("section",{className:fe.section,"data-testid":"keyboard-shortcuts-panel",children:[i.jsx("h3",{className:fe.sectionTitle,children:"Keyboard Shortcuts"}),i.jsx("p",{className:fe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),y8.map(t=>i.jsxs("div",{className:vi.group,children:[i.jsx("h4",{className:vi.groupTitle,children:t.title}),i.jsx("div",{className:vi.shortcutList,children:t.shortcuts.map(s=>i.jsxs("div",{className:vi.shortcutRow,children:[i.jsx("span",{className:vi.keys,children:s.keys.map(o=>i.jsx("kbd",{className:vi.kbd,children:o},o))}),i.jsx("span",{className:vi.description,children:s.description})]},s.description))})]},t.title))]})}const _8=[{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 x8({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:fe.section,children:[i.jsx("h3",{className:fe.sectionTitle,children:"Credential Providers"}),i.jsx("p",{className:fe.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:fe.tokenList,children:_8.map(r=>i.jsxs("div",{className:fe.tokenRow,children:[i.jsx("span",{className:fe.tokenName,children:r.label}),i.jsx("span",{className:fe.tokenTarget,children:r.description}),i.jsx("select",{className:fe.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 k8="_container_10efq_1",S8="_header_10efq_7",j8="_list_10efq_105",T8="_card_10efq_111",w8="_cardHeader_10efq_125",N8="_cardTitle_10efq_135",C8="_defaultBadge_10efq_141",E8="_cardActions_10efq_155",A8="_description_10efq_160",D8="_meta_10efq_166",M8="_empty_10efq_212",R8="_typeBadge_10efq_362",es={container:k8,header:S8,list:j8,card:T8,cardHeader:w8,cardTitle:N8,defaultBadge:C8,cardActions:E8,description:A8,meta:D8,empty:M8,typeBadge:R8};function I8({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:es.container,children:[i.jsxs("div",{className:es.header,children:[i.jsx("h2",{children:"Personas"}),i.jsx(sn,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?i.jsx("p",{className:es.empty,children:"No personas yet. Create one to get started."}):i.jsx("div",{className:es.list,children:t.map(v=>{const b=s===v.id,_=v.type==="script";return i.jsxs("div",{className:es.card,"data-testid":`persona-card-${v.id}`,onClick:()=>d(v.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),d(v.id))},children:[i.jsxs("div",{className:es.cardHeader,children:[i.jsxs("span",{className:es.cardTitle,children:[i.jsx("strong",{children:v.name}),i.jsx("span",{className:es.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&i.jsx("span",{className:es.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),i.jsxs("div",{className:es.cardActions,onClick:k=>k.stopPropagation(),children:[!b&&i.jsx(sn,{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(sn,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),i.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&i.jsx("p",{className:es.description,children:v.description}),i.jsxs("div",{className:es.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(ys,{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 O8="_container_uy08i_1",B8="_header_uy08i_7",L8="_count_uy08i_13",z8="_presets_uy08i_18",$8="_presetButton_uy08i_24",H8="_filterInput_uy08i_41",P8="_groups_uy08i_53",U8="_group_uy08i_53",V8="_groupHeader_uy08i_68",q8="_groupName_uy08i_77",G8="_groupCount_uy08i_81",F8="_toolList_uy08i_87",K8="_toolItem_uy08i_95",Z8="_toolName_uy08i_103",yn={container:O8,header:B8,count:L8,presets:z8,presetButton:$8,filterInput:H8,groups:P8,group:U8,groupHeader:V8,groupName:q8,groupCount:G8,toolList:F8,toolItem:K8,toolName:Z8},Y8=(()=>{const t=new Map;for(const s of g_){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()}))})(),J8=[{name:"default",label:"Default",tools:h_},{name:"worker",label:"Worker",tools:M2},{name:"orchestrator",label:"Orchestrator",tools:R2},{name:"admin",label:"Admin",tools:I2}];function Zb({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 _=new Set(d);for(const k of v)b?_.delete(k):_.add(k);s([..._].sort())},[d,s,o]),m=y.useCallback(v=>{o||s([...v].sort())},[s,o]),g=r.toLowerCase();return i.jsxs("div",{className:yn.container,"data-testid":"mcp-tool-selector",children:[i.jsx("div",{className:yn.header,children:i.jsx("span",{className:yn.count,children:t.length===0?`Using default (${h_.length} tools)`:`${t.length} of ${g_.size} tools selected`})}),i.jsxs("div",{className:yn.presets,"data-testid":"mcp-tool-presets",children:[J8.map(v=>i.jsx("button",{type:"button",className:yn.presetButton,disabled:o,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),i.jsx("button",{type:"button",className:yn.presetButton,disabled:o,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),i.jsx("input",{type:"text",className:yn.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:o,"data-testid":"mcp-tool-filter"}),i.jsx("div",{className:yn.groups,children:Y8.map(({group:v,tools:b})=>{const _=g?b.filter(S=>S.toLowerCase().includes(g)):b;if(_.length===0)return null;const k=_.every(S=>d.has(S));return i.jsxs("div",{className:yn.group,"data-testid":`tool-group-${v}`,children:[i.jsxs("label",{className:yn.groupHeader,children:[i.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(_,k),disabled:o,"data-testid":`group-toggle-${v}`}),i.jsx("span",{className:yn.groupName,children:v}),i.jsxs("span",{className:yn.groupCount,children:["(",_.filter(S=>d.has(S)).length,"/",_.length,")"]})]}),i.jsx("div",{className:yn.toolList,children:_.map(S=>i.jsxs("label",{className:yn.toolItem,children:[i.jsx("input",{type:"checkbox",checked:d.has(S),onChange:()=>u(S),disabled:o,"data-testid":`tool-${S}`}),i.jsx("span",{className:yn.toolName,children:S})]},S))})]},v)})})]})}function sm(t){const s=new Date(t),o=new Date,r=o.getTime()-s.getTime(),c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return"just now";if(d<60)return`${d}m ago`;if(u<24)return`${u}h ago`;if(p===1)return"yesterday";if(p<7)return`${p} days ago`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}function H1(t){const s=new Date(t);if(Number.isNaN(s.getTime()))return"—";const o=new Date,r=s.getTime()-o.getTime();if(r<=0)return"overdue";const c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return`in ${c}s`;if(d<60)return`in ${d}m`;if(u<24)return`in ${u}h`;if(p<7)return`in ${p} day${p===1?"":"s"}`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const W8="_container_1gfuq_1",X8="_header_1gfuq_7",Q8="_list_1gfuq_19",e7="_card_1gfuq_25",t7="_cardHeader_1gfuq_40",n7="_cardTitle_1gfuq_46",s7="_statusBadge_1gfuq_56",a7="_enabled_1gfuq_68",i7="_disabled_1gfuq_71",o7="_cardActions_1gfuq_75",r7="_cardMeta_1gfuq_80",l7="_empty_1gfuq_98",ts={container:W8,header:X8,list:Q8,card:e7,cardHeader:t7,cardTitle:n7,statusBadge:s7,enabled:a7,disabled:i7,cardActions:o7,cardMeta:r7,empty:l7};function c7({schedules:t,personas:s,onDeleteSchedule:o,onToggleEnabled:r,onNavigateToNew:c,onNavigateToSchedule:d}){const[u,p]=y.useState(null),m=u?t.find(_=>_.id===u):void 0,g=async _=>{await o(_),p(null)},v=y.useMemo(()=>{const _=new Map;for(const k of s)_.set(k.id,k.name);return _},[s]),b=_=>v.get(_)??_;return i.jsxs("div",{className:ts.container,children:[i.jsxs("div",{className:ts.header,children:[i.jsx("h2",{children:"Schedules"}),i.jsx(sn,{variant:"primary",size:"md",onClick:c,"data-testid":"schedule-new-button",children:"+ New Schedule"})]}),t.length===0?i.jsx("p",{className:ts.empty,"data-testid":"schedule-empty-state",children:"No schedules yet. Create one to run tasks on a recurring cadence."}):i.jsx("div",{className:ts.list,children:t.map(_=>i.jsxs("div",{className:ts.card,"data-testid":`schedule-card-${_.id}`,onClick:()=>d(_.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),d(_.id))},children:[i.jsxs("div",{className:ts.cardHeader,children:[i.jsxs("span",{className:ts.cardTitle,children:[i.jsx("strong",{children:_.title}),i.jsx("span",{className:`${ts.statusBadge} ${_.enabled?ts.enabled:ts.disabled}`,"data-testid":`schedule-status-badge-${_.id}`,children:_.enabled?"Enabled":"Disabled"})]}),i.jsxs("div",{className:ts.cardActions,onClick:k=>k.stopPropagation(),children:[i.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>{(async()=>{await r(_.id,{enabled:!_.enabled})})().catch(()=>{})},"data-testid":`schedule-toggle-${_.id}`,title:_.enabled?"Disable schedule":"Enable schedule",children:_.enabled?"Disable":"Enable"}),i.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>d(_.id),"data-testid":`schedule-edit-${_.id}`,children:"Edit"}),i.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>p(_.id),"data-testid":`schedule-delete-${_.id}`,children:"Delete"})]})]}),i.jsxs("div",{className:ts.cardMeta,children:[i.jsx("span",{"data-testid":`schedule-expression-${_.id}`,children:_.scheduleExpression}),_.personaId&&i.jsxs("span",{"data-testid":`schedule-persona-${_.id}`,children:["Persona: ",b(_.personaId)]}),i.jsxs("span",{"data-testid":`schedule-last-run-${_.id}`,children:["Last run: ",_.lastRunAt?sm(_.lastRunAt):"Never"]}),_.enabled&&_.nextRunAt?i.jsxs("span",{"data-testid":`schedule-next-run-${_.id}`,children:["Next run: ",H1(_.nextRunAt)]}):null,_.runCount>0&&i.jsxs("span",{"data-testid":`schedule-run-count-${_.id}`,children:["Runs: ",_.runCount]})]})]},_.id))}),i.jsx(ys,{isOpen:u!==null,title:"Delete Schedule?",description:`"${(m==null?void 0:m.title)??""}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const d7="_nav_1bhou_1",u7="_tab_1bhou_24",f7="_tabIcon_1bhou_62",p7="_tabActive_1bhou_68",Hc={nav:d7,tab:u7,tabIcon:f7,tabActive:p7},na=[{path:"credentials",label:"Credentials",icon:i.jsx(Wj,{size:wt})},{path:"github-accounts",label:"GitHub Accounts",icon:i.jsx(qj,{size:wt})},{path:"personas",label:"Personas",icon:i.jsx(OT,{size:wt})},{path:"schedules",label:"Schedules",icon:i.jsx(xj,{size:wt})},{path:"appearance",label:"Appearance",icon:i.jsx(vT,{size:wt})},{path:"shortcuts",label:"Shortcuts",icon:i.jsx(Qj,{size:wt})},{path:"plugins",label:"Plugins",icon:i.jsx(ST,{size:wt})},{path:"about",label:"About",icon:i.jsx(um,{size:wt})}];function m7(){var u;const t=Jt(),s=vt(),o=y.useRef(null),r=((u=na.find(p=>{const m=`${xi}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??na[0].path,c=y.useCallback(p=>{s(`${xi}/${p}`)},[s]),d=y.useCallback(p=>{var k,S;const m=(k=o.current)==null?void 0:k.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(j=>j===document.activeElement),v=g>=0?g:na.findIndex(j=>j.path===r);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%na.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+na.length)%na.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=na.length-1;else return;const _=na[b].path;s(`${xi}/${_}`),(S=m[b])==null||S.focus()},[r,s]);return i.jsx("nav",{className:Hc.nav,ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:na.map(p=>{const m=p.path===r;return i.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Hc.tab} ${m?Hc.tabActive:""}`,onClick:()=>c(p.path),children:[i.jsx("span",{className:Hc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}const h7=["lifecycle:","pipe:","stdin:"];function P1(t){return t.selfEcho?"chatroom":t.name.startsWith("pipe:")?"pipe":"channel"}function g7(t,s){let o=!1;for(const r of t.subscribers){const c=s.get(r.sessionId);if(c&&(o=!0,c.taskId))return{kind:"task",taskId:c.taskId}}return o?{kind:"unattached"}:{kind:"external"}}function v7(t,s){const o=new Map(s.map(u=>[u.id,u])),r=new Map,c=[];for(const u of t){const p=g7(u,o);if(p.kind==="task"){const m=r.get(p.taskId);m?m.push(u):r.set(p.taskId,[u])}else c.push(u)}const d=Array.from(r,([u,p])=>({taskId:u,streams:p}));return c.length>0&&d.push({taskId:void 0,streams:c}),d}const y7="_container_16qkd_1",b7="_header_16qkd_7",_7="_title_16qkd_15",x7="_headerActions_16qkd_21",k7="_internalsToggle_16qkd_27",S7="_refreshButton_16qkd_37",j7="_state_16qkd_52",T7="_group_16qkd_59",w7="_groupHeader_16qkd_63",N7="_row_16qkd_72",C7="_selected_16qkd_92",E7="_kindBadge_16qkd_96",A7="_kindChatroom_16qkd_108",D7="_kindPipe_16qkd_114",M7="_kindChannel_16qkd_120",R7="_streamName_16qkd_126",I7="_meta_16qkd_135",Yt={container:y7,header:b7,title:_7,headerActions:x7,internalsToggle:k7,refreshButton:S7,state:j7,group:T7,groupHeader:w7,row:N7,selected:C7,kindBadge:E7,kindChatroom:A7,kindPipe:D7,kindChannel:M7,streamName:R7,meta:I7},O7={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function B7({kind:t}){return t==="chatroom"?i.jsx(uT,{size:Ze,"aria-hidden":"true"}):t==="pipe"?i.jsx(Uj,{size:Ze,"aria-hidden":"true"}):i.jsx(Fj,{size:Ze,"aria-hidden":"true"})}function L7({streams:t,sessions:s,tasks:o,loading:r,loadError:c=!1,loadedOnce:d=!0,showInternals:u,onToggleInternals:p,selectedStreamId:m,onSelectStream:g,onRefresh:v}){const b=v7(t,s),_={chatroom:Yt.kindChatroom,pipe:Yt.kindPipe,channel:Yt.kindChannel},k=S=>{var j;return((j=o.find(T=>T.id===S))==null?void 0:j.title)??S};return i.jsxs("div",{className:Yt.container,"data-testid":"coordination-list",children:[i.jsxs("div",{className:Yt.header,children:[i.jsx("span",{className:Yt.title,children:"Coordination"}),i.jsxs("div",{className:Yt.headerActions,children:[i.jsxs("label",{className:Yt.internalsToggle,children:[i.jsx("input",{type:"checkbox",checked:u,onChange:S=>p(S.target.checked),"data-testid":"coordination-show-internals"}),"Show internals"]}),v&&i.jsx("button",{type:"button",className:Yt.refreshButton,onClick:v,"aria-label":"Refresh streams","data-testid":"coordination-refresh",children:i.jsx(TT,{size:Ze,"aria-hidden":"true"})})]})]}),r&&t.length===0&&i.jsxs("div",{className:Yt.state,children:["Loading","…"]}),!r&&c&&i.jsx("div",{className:Yt.state,"data-testid":"coordination-error",children:"Unable to load streams"}),!r&&!c&&d&&t.length===0&&i.jsx("div",{className:Yt.state,"data-testid":"coordination-empty",children:"No active streams"}),b.map(S=>i.jsxs("div",{className:Yt.group,children:[i.jsx("div",{className:Yt.groupHeader,children:S.taskId?k(S.taskId):"Unattached / external (CLI · MCP)"}),S.streams.map(j=>{const T=P1(j),w=j.id===m;return i.jsxs("button",{type:"button",className:`${Yt.row}${w?` ${Yt.selected}`:""}`,onClick:()=>g(j.id),"data-testid":`coordination-row-${j.id}`,"aria-current":w?"page":void 0,children:[i.jsxs("span",{className:`${Yt.kindBadge} ${_[T]}`,children:[i.jsx(B7,{kind:T})," ",O7[T]]}),i.jsx("span",{className:Yt.streamName,children:j.name}),i.jsxs("span",{className:Yt.meta,children:[j.subscriberCount," ",j.subscriberCount===1?"sub":"subs"," ","·"," ",j.messageBufferDepth," buffered"]})]},j.id)})]},S.taskId??"__orphans__"))]})}const z7="_panel_iibrt_1",$7="_header_iibrt_24",H7="_title_iibrt_33",P7="_closeButton_iibrt_43",U7="_body_iibrt_57",V7="_section_iibrt_63",q7="_sectionLabel_iibrt_67",G7="_metaRow_iibrt_76",F7="_metaKey_iibrt_84",K7="_metaValue_iibrt_90",Z7="_subscriberCard_iibrt_99",Y7="_subscriberHeader_iibrt_107",J7="_sessionLink_iibrt_114",W7="_badges_iibrt_132",X7="_badgeRw_iibrt_150 _badge_iibrt_132",Q7="_badgeR_iibrt_150 _badge_iibrt_132",ez="_badgeW_iibrt_162 _badge_iibrt_132",tz="_badgeAsync_iibrt_168 _badge_iibrt_132",nz="_badgeSync_iibrt_174 _badge_iibrt_132",sz="_badgeDetach_iibrt_178 _badge_iibrt_132",az="_spawnTag_iibrt_184 _badge_iibrt_132",iz="_fdNumber_iibrt_189",oz="_emptySubscribers_iibrt_195",rz="_metaValueMono_iibrt_201 _metaValue_iibrt_90",lz="_placeholder_iibrt_207",cz="_advanced_iibrt_216",dz="_advancedSummary_iibrt_220",Pe={panel:z7,header:$7,title:H7,closeButton:P7,body:U7,section:V7,sectionLabel:q7,metaRow:G7,metaKey:F7,metaValue:K7,subscriberCard:Z7,subscriberHeader:Y7,sessionLink:J7,badges:W7,badgeRw:X7,badgeR:Q7,badgeW:ez,badgeAsync:tz,badgeSync:nz,badgeDetach:sz,spawnTag:az,fdNumber:iz,emptySubscribers:oz,metaValueMono:rz,placeholder:lz,advanced:cz,advancedSummary:dz},uz={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function fz({permission:t}){const s=t==="rw"?Pe.badgeRw:t==="r"?Pe.badgeR:Pe.badgeW;return i.jsx("span",{className:s,children:t})}function pz({mode:t}){const s=t==="async"?Pe.badgeAsync:t==="detach"?Pe.badgeDetach:Pe.badgeSync;return i.jsx("span",{className:s,children:t})}function mz({stream:t,onClose:s}){const o=vt();return y.useEffect(()=>{const r=c=>{c.key==="Escape"&&s()};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[s]),i.jsxs("div",{className:Pe.panel,"data-testid":"stream-detail-panel",children:[i.jsxs("div",{className:Pe.header,children:[i.jsx("h3",{className:Pe.title,children:t.name}),i.jsx("button",{type:"button",className:Pe.closeButton,onClick:s,"aria-label":"Close stream details",children:"×"})]}),i.jsxs("div",{className:Pe.body,children:[i.jsxs("div",{className:Pe.section,children:[i.jsx("div",{className:Pe.sectionLabel,children:"Overview"}),i.jsxs("div",{className:Pe.metaRow,children:[i.jsx("span",{className:Pe.metaKey,children:"Kind"}),i.jsx("span",{className:Pe.metaValue,children:uz[P1(t)]})]}),i.jsxs("div",{className:Pe.metaRow,children:[i.jsx("span",{className:Pe.metaKey,children:"Participants"}),i.jsx("span",{className:Pe.metaValue,children:t.subscriberCount})]}),i.jsxs("div",{className:Pe.metaRow,children:[i.jsx("span",{className:Pe.metaKey,children:"Buffered"}),i.jsxs("span",{className:Pe.metaValue,children:[t.messageBufferDepth," msgs"]})]})]}),i.jsxs("div",{className:Pe.section,children:[i.jsx("div",{className:Pe.sectionLabel,children:"Participants"}),t.subscribers.length===0?i.jsx("div",{className:Pe.emptySubscribers,children:"No active subscribers"}):t.subscribers.map(r=>i.jsxs("div",{className:Pe.subscriberCard,"data-testid":`subscriber-card-${r.subscriptionId}`,children:[i.jsxs("button",{type:"button",className:Pe.sessionLink,onClick:()=>{o(xm(r.sessionId))},title:r.sessionId,children:[r.sessionId.slice(0,12),"…"]}),r.createdBySpawn&&i.jsx("span",{className:Pe.spawnTag,children:"spawn"})]},r.subscriptionId))]}),i.jsxs("div",{className:Pe.section,children:[i.jsx("div",{className:Pe.sectionLabel,children:"Conversation"}),i.jsx("div",{className:Pe.placeholder,"data-testid":"stream-conversation-placeholder",children:"Live conversation view — coming in V2."})]}),i.jsxs("details",{className:Pe.advanced,"data-testid":"stream-advanced",children:[i.jsx("summary",{className:Pe.advancedSummary,children:"Advanced"}),i.jsxs("div",{className:Pe.metaRow,children:[i.jsx("span",{className:Pe.metaKey,children:"Stream ID"}),i.jsx("span",{className:Pe.metaValueMono,children:t.id})]}),t.subscribers.map(r=>i.jsxs("div",{className:Pe.subscriberCard,children:[i.jsxs("div",{className:Pe.subscriberHeader,children:[i.jsxs("span",{className:Pe.fdNumber,children:["fd ",r.fd]}),i.jsxs("span",{className:Pe.metaValueMono,title:r.subscriptionId,children:[r.subscriptionId.slice(0,12),"…"]})]}),i.jsxs("div",{className:Pe.badges,children:[i.jsx(fz,{permission:r.permission}),i.jsx(pz,{mode:r.deliveryMode})]})]},r.subscriptionId))]})]})]})}function hz({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(fy.map(d=>[d,[]]));for(const d of t){const u=il(d.status),p=d.dependsOn.length>0&&d.dependsOn.some(S=>s.get(S)!=="complete"),m=r.get(d.id)??[],g=m.length,v=m.filter(S=>S.status==="complete").length;let b;if(u==="paused"&&o){const S=o.get(d.id);S==="idle"?b="Needs input":S==="completed"&&(b="Ready to complete")}const _={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:b},k=c.get(u);k?k.push(_):c.get("not_started").push(_)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return fy.map(d=>{const u=Fa(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const gz="_boardContainer_1c4y1_1",vz="_column_1c4y1_17",yz="_columnHeader_1c4y1_34",bz="_columnIcon_1c4y1_47",_z="_columnLabel_1c4y1_52",xz="_columnCount_1c4y1_57",kz="_cardList_1c4y1_67",Sz="_emptyPlaceholder_1c4y1_76",jz="_card_1c4y1_67",Tz="_cardHeader_1c4y1_107",wz="_cardStatusIcon_1c4y1_113",Nz="_cardTitle_1c4y1_119",Cz="_cardBadges_1c4y1_127",Ez="_badge_1c4y1_134",Az="_blockedBadge_1c4y1_146",Dz="_childBadge_1c4y1_151",Mz="_depBadge_1c4y1_155",Rz="_parentBadge_1c4y1_159",Iz="_pausedSubBadge_1c4y1_166",Oz="_personaBadge_1c4y1_170",Bz="_envBadge_1c4y1_174",Lz="_emptyCta_1c4y1_178",zz="_ctaButton_1c4y1_188",$z="_ctaDescription_1c4y1_204",lt={boardContainer:gz,column:vz,columnHeader:yz,columnIcon:bz,columnLabel:_z,columnCount:xz,cardList:kz,emptyPlaceholder:Sz,card:jz,cardHeader:Tz,cardStatusIcon:wz,cardTitle:Nz,cardBadges:Cz,badge:Ez,blockedBadge:Az,childBadge:Dz,depBadge:Mz,parentBadge:Rz,pausedSubBadge:Iz,personaBadge:Oz,envBadge:Bz,emptyCta:Lz,ctaButton:zz,ctaDescription:$z};function Hz({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=vt(),p=y.useMemo(()=>o.filter(_=>_.workspaceId===t),[o,t]),m=y.useMemo(()=>new Map(o.map(_=>[_.id,_.status])),[o]),g=y.useMemo(()=>new Map(p.map(_=>[_.id,_])),[p]),v=y.useMemo(()=>{const _=new Map(r.map(C=>[C.id,C])),k=new Map(c.map(C=>[C.id,C])),S=new Map(d.map(C=>[C.id,C])),j=new Map,T=new Map,w=new Map;for(const C of p)if(C.latestSessionId){const D=_.get(C.latestSessionId);if(D){if(j.set(C.id,D.endReason||D.status),D.personaId){const R=k.get(D.personaId);R&&T.set(C.id,R.name)}if(D.environmentId){const R=S.get(D.environmentId);R&&w.set(C.id,R.displayName)}}}return{sessionStatusByTaskId:j,personaNameByTaskId:T,environmentNameByTaskId:w}},[p,r,c,d]),b=y.useMemo(()=>hz({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?i.jsxs("div",{className:lt.emptyCta,"data-testid":"board-empty-cta",children:[i.jsx("button",{className:lt.ctaButton,onClick:()=>u(Ai(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:lt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):i.jsx("div",{className:lt.boardContainer,"data-testid":"board-container",children:b.map(_=>i.jsxs("section",{className:lt.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[i.jsxs("div",{className:lt.columnHeader,children:[i.jsx("span",{className:lt.columnIcon,style:{color:_.style.color},children:_.style.icon}),i.jsx("span",{className:lt.columnLabel,children:_.label}),i.jsx("span",{className:lt.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),i.jsx("div",{className:lt.cardList,children:_.tasks.length===0?i.jsx("div",{className:lt.emptyPlaceholder,children:"No tasks"}):i.jsx(as,{mode:"popLayout",children:_.tasks.map(k=>i.jsx($t.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:i.jsx(Pz,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>u(os(k.task.id,void 0,t,s))})},k.task.id))})})]},_.status))})}function Pz({boardTask:t,tasksById:s,personaName:o,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=Fa(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return i.jsxs("div",{className:lt.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[i.jsxs("div",{className:lt.cardHeader,children:[i.jsx("span",{className:lt.cardStatusIcon,style:{color:v.color},children:v.icon}),i.jsx("span",{className:lt.cardTitle,children:d.title})]}),i.jsxs("div",{className:lt.cardBadges,children:[b&&i.jsx("span",{className:`${lt.badge} ${lt.parentBadge}`,title:b.title,children:b.title}),p>0&&i.jsxs("span",{className:`${lt.badge} ${lt.childBadge}`,children:[m,"/",p]}),u&&i.jsx("span",{className:`${lt.badge} ${lt.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&i.jsx("span",{className:`${lt.badge} ${lt.depBadge}`,children:"dep"}),g&&i.jsx("span",{className:`${lt.badge} ${lt.pausedSubBadge}`,children:g}),o&&i.jsx("span",{className:`${lt.badge} ${lt.personaBadge}`,children:o}),r&&i.jsx("span",{className:`${lt.badge} ${lt.envBadge}`,children:r})]})]})}const Uz="_formContent_ymnez_1",Vz="_section_ymnez_13",qz="_label_ymnez_19",Gz="_titleInput_ymnez_26",Fz="_descriptionTextarea_ymnez_58",Kz="_selectField_ymnez_94",Zz="_checkboxRow_ymnez_128",Yz="_checkboxLabel_ymnez_141",Jz="_fieldError_ymnez_146",xt={formContent:Uz,section:Vz,label:qz,titleInput:Gz,descriptionTextarea:Fz,selectField:Kz,checkboxRow:Zz,checkboxLabel:Yz,fieldError:Jz};function Wz(t,s){return{name:(t==null?void 0:t.name)??"",description:(t==null?void 0:t.description)??"",repoUrl:(t==null?void 0:t.repoUrl)??"",environmentId:(t==null?void 0:t.linkedEnvironmentIds[0])??s??"",defaultPersonaId:(t==null?void 0:t.defaultPersonaId)??"",useWorktrees:(t==null?void 0:t.useWorktrees)??!0,workingDirectory:(t==null?void 0:t.workingDirectory)??""}}const Xz=100;function Qz({values:t,onChange:s,environments:o,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return i.jsxs("div",{className:xt.formContent,children:[i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-name",children:"Name"}),i.jsx("input",{id:"ws-name",className:xt.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:Xz,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-description",children:"Description"}),i.jsx("textarea",{id:"ws-description",className:xt.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-repo",children:"Repository URL"}),i.jsx("input",{id:"ws-repo",className:xt.titleInput,type:"text",value:t.repoUrl,onChange:m=>p("repoUrl",m.target.value),placeholder:"https://github.com/org/repo",disabled:d,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-environment",children:"Environment"}),i.jsxs("select",{id:"ws-environment",className:xt.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[i.jsx("option",{value:"",children:"Select environment…"}),o.map(m=>i.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-persona",children:"Default Persona"}),i.jsxs("select",{id:"ws-persona",className:xt.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>i.jsx("option",{value:m.id,children:m.name},m.id))]})]}),i.jsx("div",{className:xt.section,children:i.jsxs("label",{className:xt.checkboxRow,children:[i.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),i.jsx("span",{className:xt.checkboxLabel,children:"Enable worktree isolation"})]})}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-workdir",children:"Working Directory"}),i.jsx("input",{id:"ws-workdir",className:xt.titleInput,type:"text",value:t.workingDirectory,onChange:m=>p("workingDirectory",m.target.value),placeholder:"Default (server default)",disabled:d,"data-testid":"workspace-form-workdir"})]})]})}const U1=y.createContext(void 0),e$=4e3;function t$({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=e$)=>{const g=`toast-${++r.current}`;o(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return i.jsx(U1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function pn(){const t=y.useContext(U1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const am="grackle-theme",V1="grackle-prefer-system",q1="(prefers-color-scheme: dark)";let Vr=[],ed;function Sp(){ed=void 0;for(const t of Vr)t()}function im(){return typeof window>"u"?!1:window.matchMedia(q1).matches}function Yr(){if(typeof localStorage>"u")return Fb;try{const t=localStorage.getItem(am);if(t!==null&&L1.has(t))return t}catch{}return Fb}function fd(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(V1)==="true"}catch{return!1}}function om(t){return Nd.find(s=>s.variantLightId===t||s.variantDarkId===t)}function G1(t,s){const o=nm(t);if(o!=null&&o.variantDarkId)return s&&o.variantLightId?im()?o.variantDarkId:o.variantLightId:o.variantDarkId;if(o!=null&&o.hidden&&s){const r=om(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return im()?r.variantDarkId:r.variantLightId}return t}function wo(t,s,o=!1){o&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=G1(t,s),o&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&wo(Yr(),fd());function n$(){return ed===void 0&&(ed={themeId:Yr(),systemDark:im(),preferSystem:fd()}),ed}function s$(t){return Vr=[...Vr,t],()=>{Vr=Vr.filter(s=>s!==t)}}function a$(){const t=y.useSyncExternalStore(s$,n$),{themeId:s,preferSystem:o}=t,r=G1(s,o),c=y.useCallback(u=>{if(L1.has(u)){try{localStorage.setItem(am,u)}catch{}wo(u,fd(),!0),Sp()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(V1,u?"true":"false")}catch{}if(u){const p=Yr(),m=nm(p);if(m!=null&&m.hidden){const g=om(p);if(g)try{localStorage.setItem(am,g.id)}catch{}}}wo(Yr(),u,!0),Sp()},[]);return y.useEffect(()=>{wo(s,o)},[s,o]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(q1),p=()=>{const m=Yr(),g=fd();if(g){const v=nm(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&wo(m,g),v!=null&&v.hidden){const b=om(m);b!=null&&b.variantDarkId&&b.variantLightId&&wo(m,g)}}Sp()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:o,setPreferSystem:d}}const F1=y.createContext(void 0);function i$({children:t}){const s=a$();return i.jsx(F1.Provider,{value:s,children:t})}function K1(){const t=y.useContext(F1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const Z1=y.createContext(void 0),Y1=y.createContext(void 0);function o$({children:t}){const[s,o]=y.useState(void 0),r=y.useCallback(c=>{o(c)},[]);return i.jsx(Y1.Provider,{value:r,children:i.jsx(Z1.Provider,{value:s,children:t})})}function r$(){return y.useContext(Z1)}function l$(){const t=y.useContext(Y1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const ih=y.createContext(void 0);function ut(){const t=y.useContext(ih);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function J1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function W1(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function c$(t){return J1(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 d$=new Set(["off","subscription","api_key"]),Pc=new Set(["off","on"]);function u$(t){return J1(t)&&d$.has(t.claude)&&Pc.has(t.github)&&Pc.has(t.copilot)&&Pc.has(t.codex)&&Pc.has(t.goose)}function X1(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 Q1(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 jo=5e3;function f$(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 wi={label:"Home",url:Ho};function p$(t){return t?[wi,{label:"Settings",url:xi},{label:t,url:void 0}]:[wi,{label:"Settings",url:void 0}]}const ek={label:"Environments",url:Mo};function m$(){return[wi,{label:"Environments",url:void 0}]}function h$(){return[wi,{label:"New Chat",url:void 0}]}function g$(t){return[wi,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function v$(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[wi,ek,{label:(d==null?void 0:d.displayName)??"Environment",url:Ro(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function y$(t,s,o,r,c){const d=f$(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,m=p?o.find(k=>k.id===p):void 0,g=s??(m==null?void 0:m.linkedEnvironmentIds[0]),v=g?r.find(k=>k.id===g):void 0,b=[wi];v&&g&&(b.push(ek),b.push({label:v.displayName,url:Ro(g)})),m&&g&&b.push({label:m.name,url:ji(m.id,g)});for(let k=0;k<d.length-1;k++)b.push({label:d[k].title,url:os(d[k].id,void 0,p,g)});const _=d[d.length-1];return b.push({label:(_==null?void 0:_.title)??t,url:void 0}),b}function oh(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 Uc(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 b$(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 rh(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),_=b?Uc(b):void 0;if(_)try{const k=JSON.parse(v.content);o.set(_,{tool:k.tool,args:k.args})}catch{}}const r=new Set,c=new Set,d=t.map((v,b)=>{if(v.eventType!=="tool_result")return v;const _=s.get(v),k=_?b$(_):void 0;if(!k)return v;const S=o.get(k);if(!S)return v;r.add(k),c.add(b);let j;const T=v.content.trim();if(T.startsWith("{"))try{const w=JSON.parse(T);typeof w.detailedContent=="string"&&(j=w.detailedContent)}catch{}return{...v,toolUseCtx:{...S,detailedResult:j}}}),u=[];for(let v=0;v<d.length;v++){if(d[v].eventType!=="tool_use")continue;const b=s.get(d[v]),_=b?Uc(b):void 0;_&&r.has(_)||u.push(v)}const p=[];for(let v=0;v<d.length;v++)d[v].eventType!=="tool_result"||c.has(v)||p.push(v);let m=0;for(const v of u){for(;m<p.length&&p[m]<v;)m++;if(m>=p.length)break;const b=p[m];if(b!==v+1)continue;const _=d[v],k=d[b];let S;try{const j=JSON.parse(_.content);S={tool:j.tool,args:j.args}}catch{}if(S){let j;const T=k.content.trim();if(T.startsWith("{"))try{const D=JSON.parse(T);typeof D.detailedContent=="string"&&(j=D.detailedContent)}catch{}d[b]={...k,toolUseCtx:{...S,detailedResult:j}},c.add(b);const w=s.get(_),C=w?Uc(w):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(_,{...w??{},__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 _=Uc(b);if(_&&r.has(_))return!1;const k=b.__seqId;return!(k&&r.has(k))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let b=!1;for(let _=v+1;_<g.length;_++)if(g[_].eventType!=="tool_use"){b=!0;break}b&&(g[v]={...g[v],settled:!0})}return g}function _$(t,s,o){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=tk(s),d=s.filter(m=>rm(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||rm(m,c)).length,p=o.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function tk(t){const s=new Map;for(const o of t)s.set(o.id,o.status);return s}function rm(t,s){return t.dependsOn.some(o=>s.get(o)!=="complete")}function x$(t,s){var u;const o=new Map;for(const p of s)o.set(p.id,p);const r=tk(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}):rm(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 k$(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 S$(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 Cs=[{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
326
+ export function verifyToken(req: Request, res: Response, next: NextFunction): void {
327
+ const header = req.headers.authorization;
328
+ if (!header?.startsWith("Bearer ")) {
329
+ res.status(401).json({ error: "Missing token" });
330
+ return;
331
+ }
332
+ const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
333
+ req.user = decoded;
334
+ next();
335
+ }
336
+ \`\`\``,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
337
+ CREATE TABLE audit_log (
338
+ id BIGSERIAL PRIMARY KEY,
339
+ user_id UUID REFERENCES users(id),
340
+ action TEXT NOT NULL,
341
+ entity_type TEXT NOT NULL,
342
+ entity_id TEXT NOT NULL,
343
+ old_value JSONB,
344
+ new_value JSONB,
345
+ ip_address INET,
346
+ created_at TIMESTAMPTZ DEFAULT now()
347
+ );
348
+ \`\`\``,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}],Ua=[{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"}],j$=new Map(Cs.map(t=>[t.id,t]));function jp(t){const s=j$.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const Yb={"kn-auth-flow":{node:jp("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:jp("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:jp("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"}]}},Jb=[{id:"stream-planning",name:"jwt-planning-room",selfEcho:!0,subscriberCount:2,messageBufferDepth:3,subscribers:[{subscriptionId:"sub-p1",sessionId:"sess-001",fd:3,permission:"rw",deliveryMode:"async",createdBySpawn:!1},{subscriptionId:"sub-p2",sessionId:"sess-002",fd:4,permission:"r",deliveryMode:"async",createdBySpawn:!0}]},{id:"stream-metrics",name:"rate-limit-metrics",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-m1",sessionId:"sess-004",fd:3,permission:"r",deliveryMode:"sync",createdBySpawn:!1}]},{id:"stream-cli",name:"cli-inspector",selfEcho:!1,subscriberCount:1,messageBufferDepth:1,subscribers:[{subscriptionId:"sub-c1",sessionId:"external-cli-session",fd:5,permission:"rw",deliveryMode:"async",createdBySpawn:!1}]},{id:"stream-lifecycle",name:"lifecycle:sess-001-7f3a",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-l1",sessionId:"sess-001",fd:6,permission:"rw",deliveryMode:"detach",createdBySpawn:!0}]},{id:"stream-pipe",name:"pipe:sess-001-sess-004",selfEcho:!1,subscriberCount:2,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-pp1",sessionId:"sess-001",fd:7,permission:"rw",deliveryMode:"async",createdBySpawn:!1},{subscriptionId:"sub-pp2",sessionId:"sess-004",fd:8,permission:"rw",deliveryMode:"async",createdBySpawn:!0}]},{id:"stream-stdin",name:"stdin:sess-002-9c2e",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-s1",sessionId:"sess-002",fd:9,permission:"w",deliveryMode:"detach",createdBySpawn:!0}]}],T$=[{id:"env-local-01",displayName:"Local Dev",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0,githubAccountId:""},{id:"env-docker-01",displayName:"Docker Sandbox",adapterType:"docker",adapterConfig:'{"image":"node:20"}',status:"connected",bootstrapped:!0,githubAccountId:""},{id:"env-cs-01",displayName:"GitHub Codespace",adapterType:"codespace",adapterConfig:'{"codespaceName":"my-codespace"}',status:"connected",bootstrapped:!0,githubAccountId:""},{id:"env-remote-01",displayName:"Staging (SSH)",adapterType:"ssh",adapterConfig:'{"host":"192.168.1.10","user":"deploy","sshPort":22}',status:"disconnected",bootstrapped:!1,githubAccountId:""},{id:"error-env",displayName:"Error Test",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0,githubAccountId:""}],w$=[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z",endedAt:"2026-02-26T15:12:00Z",error:"Context window exceeded before completing implementation",inputTokens:84200,outputTokens:12750,costMillicents:41e3},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Refactor the authentication middleware to use JWT tokens",startedAt:"2026-02-27T08:15:00Z",taskId:"task-001",inputTokens:42600,outputTokens:8100,costMillicents:22e3},{id:"sess-002",environmentId:"env-docker-01",runtime:"copilot",status:"stopped",endReason:"completed",prompt:"Write unit tests for the user registration endpoint",startedAt:"2026-02-27T07:30:00Z",endedAt:"2026-02-27T07:33:00Z",taskId:"task-003",inputTokens:31400,outputTokens:9800,costMillicents:18e3},{id:"sess-003",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Migrate database schema to add audit_log table",startedAt:"2026-02-26T22:45:00Z",endedAt:"2026-02-26T23:10:00Z",inputTokens:56300,outputTokens:14200,costMillicents:31e3},{id:"sess-004",environmentId:"env-docker-01",runtime:"codex",status:"running",prompt:"Implement rate limiting for the public API",startedAt:"2026-02-27T09:00:00Z",taskId:"task-006c",inputTokens:18900,outputTokens:4500,costMillicents:1e4},{id:"sess-005",environmentId:"env-cs-01",runtime:"claude-code",status:"suspended",prompt:"Refactor database connection pooling for multi-tenant isolation",startedAt:"2026-02-27T06:00:00Z",inputTokens:67800,outputTokens:19300,costMillicents:38e3}],N$=[{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.
349
+ Project: acme/alpha — Node.js + Express REST API
350
+ 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";
351
+ import type { Request, Response, NextFunction } from "express";
352
+
353
+ export function requireAuth(req: Request, res: Response, next: NextFunction): void {
354
+ if (!req.session?.userId) {
355
+ res.status(401).json({ error: "Not authenticated" });
356
+ return;
357
+ }
358
+ next();
359
+ }`,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) {
360
+ src/routes/login.ts:18: req.session.userId = user.id;
361
+ src/routes/login.ts:19: req.session.role = user.role;
362
+ src/routes/protected.ts:7: const userId = req.session.userId;`,raw:JSON.stringify({tool_use_id:"tu-prev-002"})},{sessionId:"sess-001-prev",eventType:"usage",timestamp:"2026-02-26T14:30:00Z",content:JSON.stringify({input_tokens:42100,output_tokens:6350,cost_millicents:21e3})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:30:02Z",content:"Found 3 files using session-based auth. Now let me read the login route and the protected route to understand the full flow before making changes."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:30:03Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/login.ts"}}),raw:JSON.stringify({id:"tu-prev-003",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:30:04Z",content:`import { Router } from "express";
363
+ import bcrypt from "bcrypt";
364
+ import { db } from "../db.js";
365
+
366
+ const router = Router();
367
+
368
+ router.post("/login", async (req, res) => {
369
+ const { email, password } = req.body;
370
+ const user = await db.users.findByEmail(email);
371
+ if (!user || !await bcrypt.compare(password, user.passwordHash)) {
372
+ return res.status(401).json({ error: "Invalid credentials" });
373
+ }
374
+ req.session.userId = user.id;
375
+ req.session.role = user.role;
376
+ res.json({ ok: true });
377
+ });
378
+
379
+ 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.
380
+ Project: acme/alpha — Node.js + Express REST API
381
+ Task: Implement auth middleware using JWT tokens
382
+
383
+ 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:"user_input",timestamp:"2026-02-27T08:15:03Z",content:"Pick up the **JWT auth migration** from the previous session. A few requirements:\n\n- use `jsonwebtoken`, not `jose`\n- access tokens expire in `24h`\n- store refresh tokens in the DB\n\nMake sure the existing tests still pass."},{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
384
+ src/routes/login.ts
385
+ 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
386
+
387
+ 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";
388
+ import type { Request, Response, NextFunction } from "express";
389
+
390
+ const JWT_SECRET = process.env.JWT_SECRET || "change-me";
391
+
392
+ export interface JwtPayload {
393
+ userId: string;
394
+ role: string;
395
+ iat: number;
396
+ exp: number;
397
+ }
398
+
399
+ export function verifyToken(req: Request, res: Response, next: NextFunction): void {
400
+ const header = req.headers.authorization;
401
+ if (!header?.startsWith("Bearer ")) {
402
+ res.status(401).json({ error: "Missing or malformed token" });
403
+ return;
404
+ }
405
+ try {
406
+ const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
407
+ req.user = decoded;
408
+ next();
409
+ } catch (err) {
410
+ if (err instanceof jwt.TokenExpiredError) {
411
+ res.status(401).json({ error: "Token expired" });
412
+ } else {
413
+ res.status(403).json({ error: "Invalid token" });
414
+ }
415
+ }
416
+ }
417
+ `}}),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.
418
+
419
+ The new login flow will:
420
+ 1. Validate credentials (unchanged)
421
+ 2. Generate a JWT with \`userId\` and \`role\` claims
422
+ 3. Return the token in the response body
423
+ 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";
424
+ import bcrypt from "bcrypt";
425
+ import jwt from "jsonwebtoken";
426
+ import crypto from "node:crypto";
427
+ import { db } from "../db.js";
428
+
429
+ const JWT_SECRET = process.env.JWT_SECRET || "change-me";
430
+ const ACCESS_TOKEN_EXPIRY = "24h";
431
+ const REFRESH_TOKEN_BYTES = 48;
432
+
433
+ const router = Router();
434
+
435
+ router.post("/login", async (req, res) => {
436
+ const { email, password } = req.body;
437
+ const user = await db.users.findByEmail(email);
438
+ if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
439
+ return res.status(401).json({ error: "Invalid credentials" });
440
+ }
441
+
442
+ const accessToken = jwt.sign(
443
+ { userId: user.id, role: user.role },
444
+ JWT_SECRET,
445
+ { expiresIn: ACCESS_TOKEN_EXPIRY },
446
+ );
447
+
448
+ const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
449
+ await db.refreshTokens.create({ userId: user.id, token: refreshToken });
450
+
451
+ res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
452
+ });
453
+
454
+ export default router;
455
+ `}}),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
456
+ PASS src/routes/__tests__/protected.test.ts
457
+ FAIL src/middleware/__tests__/auth.test.ts
458
+ x should reject missing session (12ms)
459
+ x should allow valid session (8ms)
460
+
461
+ 2 failed, 12 passed, 14 total
462
+
463
+ 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.
464
+
465
+ 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";
466
+ import jwt from "jsonwebtoken";
467
+ import { verifyToken } from "../auth.js";
468
+ import { createMockReqRes } from "../../test-utils/mock-express.js";
469
+
470
+ const SECRET = "test-secret";
471
+ process.env.JWT_SECRET = SECRET;
472
+
473
+ describe("verifyToken", () => {
474
+ it("should reject requests without Authorization header", () => {
475
+ const { req, res, next } = createMockReqRes();
476
+ verifyToken(req, res, next);
477
+ expect(res.status).toHaveBeenCalledWith(401);
478
+ });
479
+
480
+ it("should reject expired tokens", () => {
481
+ const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
482
+ const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
483
+ verifyToken(req, res, next);
484
+ expect(res.status).toHaveBeenCalledWith(401);
485
+ });
486
+
487
+ it("should accept valid tokens and attach user to request", () => {
488
+ const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
489
+ const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
490
+ verifyToken(req, res, next);
491
+ expect(next).toHaveBeenCalled();
492
+ expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
493
+ });
494
+ });
495
+ `}}),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
496
+ PASS src/routes/__tests__/protected.test.ts
497
+ PASS src/middleware/__tests__/auth.test.ts
498
+
499
+ Test Suites: 3 passed, 3 total
500
+ Tests: 14 passed, 14 total`,raw:JSON.stringify({tool_use_id:"tu-001-08"})},{sessionId:"sess-001",eventType:"usage",timestamp:"2026-02-27T08:15:41Z",content:JSON.stringify({input_tokens:42600,output_tokens:8100,cost_millicents:22e3})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:42Z",content:`All 14 tests pass. Here's a summary of the changes:
501
+
502
+ ### Changes made
503
+
504
+ | File | Action |
505
+ |------|--------|
506
+ | \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
507
+ | \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
508
+ | \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
509
+ | \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
510
+
511
+ ### Key decisions
512
+ - **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
513
+ - **Refresh tokens**: 48-byte random hex, stored in DB
514
+ - **Error handling**: Distinguishes expired tokens (401) from invalid tokens (403)`},{sessionId:"sess-001",eventType:"user_input",timestamp:"2026-02-27T08:15:50Z",content:"Looks great! Two follow-ups:\n\n1. add a `/refresh` endpoint that swaps a refresh token for a new access token\n2. note the token flow in `README.md`"},{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.
515
+ Project: acme/alpha — Node.js + Express REST API
516
+ 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";
517
+ import bcrypt from "bcrypt";
518
+ import { db } from "../db.js";
519
+ import { validateEmail, validatePassword } from "../utils/validators.js";
520
+
521
+ const SALT_ROUNDS = 12;
522
+ const router = Router();
523
+
524
+ router.post("/register", async (req, res) => {
525
+ const { name, email, password } = req.body;
526
+
527
+ if (!name || !email || !password) {
528
+ return res.status(400).json({ error: "Missing required fields" });
529
+ }
530
+ if (!validateEmail(email)) {
531
+ return res.status(400).json({ error: "Invalid email format" });
532
+ }
533
+ if (!validatePassword(password)) {
534
+ return res.status(400).json({ error: "Password too weak" });
535
+ }
536
+
537
+ const existing = await db.users.findByEmail(email);
538
+ if (existing) {
539
+ return res.status(409).json({ error: "Email already registered" });
540
+ }
541
+
542
+ const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
543
+ const user = await db.users.create({ name, email, passwordHash });
544
+ res.status(201).json({ id: user.id, name: user.name, email: user.email });
545
+ });
546
+
547
+ 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:
548
+
549
+ 1. **Happy path** - valid registration
550
+ 2. **Missing fields** - each required field missing
551
+ 3. **Invalid email** - malformed email format
552
+ 4. **Weak password** - password validation failure
553
+ 5. **Duplicate email** - conflict with existing user
554
+ 6. **SQL injection** - malicious email input
555
+ 7. **XSS payload** - HTML in the name field
556
+ 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
557
+ POST /api/register
558
+ ✓ should register a valid user (28ms)
559
+ ✓ should reject missing name (4ms)
560
+ ✓ should reject missing email (3ms)
561
+ ✓ should reject missing password (3ms)
562
+ ✓ should reject invalid email format (5ms)
563
+ ✓ should reject weak password (4ms)
564
+ ✓ should reject duplicate email (12ms)
565
+ ✓ should sanitize HTML in name field (6ms)
566
+
567
+ Tests: 8 passed, 8 total`,raw:JSON.stringify({tool_use_id:"tu-002-03"})},{sessionId:"sess-002",eventType:"usage",timestamp:"2026-02-27T07:32:00Z",content:JSON.stringify({input_tokens:31400,output_tokens:9800,cost_millicents:18e3})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:32:30Z",content:"All 8 test cases pass. Created `src/routes/__tests__/register.test.ts` with comprehensive coverage for the registration endpoint including input validation, duplicate detection, and security edge cases."},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:33:00Z",content:"completed"},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T22:45:01Z",content:"running"},{sessionId:"sess-003",eventType:"system",timestamp:"2026-02-26T22:45:02Z",content:`You are a database engineer. Focus on safe migrations, zero-downtime deployments, and data integrity.
568
+ Project: acme/alpha — Node.js + Express + PostgreSQL
569
+ 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 (
570
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
571
+ name TEXT NOT NULL,
572
+ email TEXT UNIQUE NOT NULL,
573
+ password_hash TEXT NOT NULL,
574
+ role TEXT DEFAULT 'user',
575
+ created_at TIMESTAMPTZ DEFAULT now(),
576
+ updated_at TIMESTAMPTZ DEFAULT now()
577
+ );
578
+
579
+ CREATE TABLE sessions (
580
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
581
+ user_id UUID REFERENCES users(id),
582
+ expires_at TIMESTAMPTZ NOT NULL,
583
+ created_at TIMESTAMPTZ DEFAULT now()
584
+ );`,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
585
+ -- Add audit logging and user activity tracking
586
+
587
+ BEGIN;
588
+
589
+ -- 1. Add last_login_at to users
590
+ ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
591
+
592
+ -- 2. Index for session cleanup queries
593
+ CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
594
+
595
+ -- 3. Audit log table
596
+ CREATE TABLE audit_log (
597
+ id BIGSERIAL PRIMARY KEY,
598
+ user_id UUID REFERENCES users(id),
599
+ action TEXT NOT NULL,
600
+ entity_type TEXT NOT NULL,
601
+ entity_id TEXT NOT NULL,
602
+ old_value JSONB,
603
+ new_value JSONB,
604
+ ip_address INET,
605
+ created_at TIMESTAMPTZ DEFAULT now()
606
+ );
607
+
608
+ CREATE INDEX idx_audit_log_user ON audit_log (user_id);
609
+ CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
610
+ CREATE INDEX idx_audit_log_created ON audit_log (created_at);
611
+
612
+ COMMIT;
613
+ `}}),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
614
+ - ALTER TABLE users ADD COLUMN last_login_at
615
+ - CREATE INDEX CONCURRENTLY idx_sessions_expires_at
616
+ - CREATE TABLE audit_log
617
+ - 3 indexes on audit_log
618
+
619
+ WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
620
+ Please split this into a separate migration step.`,raw:JSON.stringify({tool_use_id:"tu-003-03",is_error:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:15Z",content:"Good catch from the dry run! `CREATE INDEX CONCURRENTLY` can't run inside a transaction. I need to split the migration into two files: one for the transactional DDL and another for the concurrent index creation."},{sessionId:"sess-003",eventType:"usage",timestamp:"2026-02-26T23:00:00Z",content:JSON.stringify({input_tokens:56300,output_tokens:14200,cost_millicents:31e3})},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T23:10:00Z",content:"interrupted"},{sessionId:"sess-004",eventType:"status",timestamp:"2026-02-27T09:00:01Z",content:"running"},{sessionId:"sess-004",eventType:"system",timestamp:"2026-02-27T09:00:02Z",content:`You are a backend engineer specializing in API infrastructure.
621
+ Project: acme/data-pipeline — ETL pipelines for analytics
622
+ 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
623
+ src/middleware/error-handler.ts
624
+ src/middleware/logger.ts
625
+ 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:
626
+
627
+ - Uses an **in-memory token bucket** per client IP
628
+ - Supports configurable rate (requests/second) and burst size
629
+ - Returns \`429 Too Many Requests\` with \`Retry-After\` header
630
+ - Has a Redis adapter option for multi-instance deployments
631
+
632
+ 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.
633
+ Project: acme/alpha — Node.js + Express + PostgreSQL
634
+ 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";
635
+
636
+ const pool = new pg.Pool({
637
+ connectionString: process.env.DATABASE_URL,
638
+ max: 20,
639
+ idleTimeoutMillis: 30000,
640
+ });
641
+
642
+ 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:
643
+
644
+ 1. **A \`PoolManager\` class** that creates and caches per-tenant pools
645
+ 2. **Configurable limits** per tenant (max connections, idle timeout)
646
+ 3. **Health checks** with automatic pool eviction for unhealthy connections
647
+ 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";
648
+ src/routes/users.ts:2:import { pool } from "../db/pool.js";
649
+ src/routes/register.ts:3:import { pool } from "../db/pool.js";
650
+ src/routes/admin.ts:4:import { pool } from "../db/pool.js";
651
+ src/services/billing.ts:2:import { pool } from "../db/pool.js";
652
+ 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:
653
+ 1. Create a new \`PoolManager\` abstraction
654
+ 2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
655
+ 3. Add middleware to extract tenant ID from the request
656
+
657
+ This is a significant refactor. Let me start with the PoolManager class.`},{sessionId:"sess-005",eventType:"usage",timestamp:"2026-02-27T06:30:00Z",content:JSON.stringify({input_tokens:67800,output_tokens:19300,cost_millicents:38e3})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],C$=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",linkedEnvironmentIds:["env-local-01","env-docker-01"],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-01-15T10:00:00Z",updatedAt:"2026-01-15T10:00:00Z"},{id:"proj-beta",name:"Data Pipeline",description:"ETL pipelines for analytics and reporting",repoUrl:"https://github.com/acme/data-pipeline",linkedEnvironmentIds:["env-docker-01"],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-02-01T14:30:00Z",updatedAt:"2026-02-01T14:30:00Z"},{id:"proj-gamma",name:"Mobile App",description:"React Native cross-platform mobile application",repoUrl:"",linkedEnvironmentIds:["env-local-01"],status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],E$=[{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}],A$=[{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:""}],D$=[{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","knowledge_search","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. Reports issues discovered.",systemPrompt:"You are a meticulous code reviewer. Check for security vulnerabilities, performance issues, and style consistency. Report 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:["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 logs a 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));\nfor (const f of files) {\n const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);\n if (eslintResult.exitCode !== 0) {\n console.log(`Lint issues in ${f.filename}: ${eslintResult.stderr}`);\n }\n const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);\n if (prettierResult.exitCode !== 0) {\n console.log(`Prettier issues in ${f.filename}: ${prettierResult.stderr}`);\n }\n}\nconsole.log(`Ran ESLint and Prettier on ${files.length} files`);',allowedMcpTools:[]}],M$={"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 Le(t){return new Date(Date.now()+t).toISOString()}const Wb=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(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:Le(1600),content:`src/routes/users.ts
658
+ src/routes/auth.ts
659
+ src/routes/billing.ts
660
+ src/routes/admin.ts
661
+ src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Le(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
662
+
663
+ \`\`\`typescript
664
+ const router = Router();
665
+ router.use(authenticate);
666
+ router.use(validateBody);
667
+
668
+ router.get("/", listUsers);
669
+ router.post("/", createUser);
670
+ router.get("/:id", getUser);
671
+ router.put("/:id", updateUser);
672
+ router.delete("/:id", deleteUser);
673
+ \`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Le(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:Le(4e3),content:` PASS src/routes/__tests__/users.test.ts
674
+ PASS src/routes/__tests__/auth.test.ts
675
+ PASS src/routes/__tests__/billing.test.ts
676
+
677
+ Test Suites: 3 passed, 3 total
678
+ Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Le(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_millicents:15e3})}},{delayMs:5e3,event:{eventType:"text",timestamp:Le(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Le(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(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:Le(1800),content:`CREATE TABLE users (
679
+ id UUID PRIMARY KEY,
680
+ name TEXT NOT NULL,
681
+ email TEXT UNIQUE NOT NULL,
682
+ created_at TIMESTAMPTZ DEFAULT now()
683
+ );
684
+
685
+ CREATE TABLE sessions (
686
+ id UUID PRIMARY KEY,
687
+ user_id UUID REFERENCES users(id),
688
+ expires_at TIMESTAMPTZ NOT NULL
689
+ );`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Le(2600),content:`I found the tables to modify:
690
+ - **users**: add column \`last_login_at\`
691
+ - **sessions**: add index on \`expires_at\`
692
+ - **audit_log**: new table
693
+
694
+ This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
695
+
696
+ Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Le(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(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:Le(1700),content:`Applying 002_add_last_login.sql... done
697
+ Applying 003_sessions_index.sql... done
698
+ Applying 004_audit_log.sql... done
699
+
700
+ 3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Le(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Le(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(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:Le(1800),content:`import { StripeClient } from "./stripe-client.js";
701
+ import type { Invoice, LineItem } from "../types/billing.js";
702
+
703
+ export class BillingService {
704
+ constructor(private stripe: StripeClient) {}
705
+
706
+ async calculateMonthlyTotal(userId: string): Promise<number> {
707
+ const invoices = await this.stripe.listInvoices(userId);
708
+ return invoices.reduce((sum, inv) => sum + inv.total, 0);
709
+ }
710
+ }`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Le(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Le(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:Le(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:Le(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:Le(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(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:Le(1800),content:`import jwt from "jsonwebtoken";
711
+ import type { Request, Response, NextFunction } from "express";
712
+
713
+ const JWT_SECRET = process.env.JWT_SECRET || "change-me";
714
+
715
+ export function verifyToken(req: Request, res: Response, next: NextFunction): void {
716
+ const header = req.headers.authorization;
717
+ if (!header?.startsWith("Bearer ")) {
718
+ res.status(401).json({ error: "Missing token" });
719
+ return;
720
+ }
721
+ try {
722
+ const decoded = jwt.verify(header.slice(7), JWT_SECRET);
723
+ if (decoded.exp > Date.now() / 1000) {
724
+ res.status(403).json({ error: "Token expired" });
725
+ return;
726
+ }
727
+ req.user = decoded;
728
+ next();
729
+ } catch {
730
+ res.status(403).json({ error: "Invalid token" });
731
+ }
732
+ }`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Le(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:Le(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:Le(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Le(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:Le(5800),content:`[exit 0] > jest --grep auth
733
+
734
+ PASS src/auth.test.ts
735
+ ✓ validates JWT token (12ms)
736
+ ✓ rejects expired token (3ms)
737
+ ✓ handles missing header (1ms)
738
+
739
+ Tests: 3 passed, 3 total
740
+ Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Le(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:Le(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
741
+ 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:Le(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:Le(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_millicents:12e3})}},{delayMs:8800,event:{eventType:"status",timestamp:Le(8800),content:"completed"}}]}],ns={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1};function Xb(t){return t?Jb:Jb.filter(s=>!h7.some(o=>s.name.startsWith(o)))}const Qb=400;function R$({children:t}){const[s,o]=y.useState(T$),[r,c]=y.useState(w$),[d,u]=y.useState(()=>Xb(!1)),[p,m]=y.useState(N$),[g,v]=y.useState(void 0),[b,_]=y.useState(C$),[k,S]=y.useState(""),[j,T]=y.useState(E$),[w,C]=y.useState(A$),[D,R]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[E,M]=y.useState(D$),[O,A]=y.useState([]),[$]=y.useState(M$),[Y,V]=y.useState(""),[ee,le]=y.useState(Cs),[Z,ae]=y.useState(Ua),[H,B]=y.useState(void 0),[F,ge]=y.useState(void 0),[ne,ce]=y.useState(""),me=y.useRef(void 0),ke=y.useRef(0),De=y.useRef(0),ot=y.useRef(new Set),yt=y.useRef(new Map),_e=y.useRef(j);_e.current=j;const Oe=y.useRef(new Map),Ht=y.useRef(new Map),Nt=y.useCallback(U=>(ke.current+=1,`mock-${U}-${String(ke.current).padStart(3,"0")}`),[]),ue=y.useCallback(()=>{const U=Wb[De.current%Wb.length];return De.current+=1,U},[]),Re=y.useCallback((U,se,de)=>{const pe=setTimeout(()=>{var ye;ot.current.delete(pe),de&&((ye=yt.current.get(de))==null||ye.delete(pe)),U()},se);ot.current.add(pe),de&&(yt.current.has(de)||yt.current.set(de,new Set),yt.current.get(de).add(pe))},[]),Q=y.useCallback(U=>{const se=yt.current.get(U);se&&(se.forEach(de=>{clearTimeout(de),ot.current.delete(de)}),yt.current.delete(U))},[]),et=y.useCallback((U,se,de)=>{c(pe=>pe.map(ye=>ye.id===U?{...ye,status:se,...de!==void 0?{endReason:de}:{}}:ye))},[]),re=y.useCallback(U=>{m(se=>[...se,U])},[]),ve=y.useCallback((U,se,de)=>{se.forEach((pe,ye)=>{Re(()=>{const Qe={sessionId:U,...pe.event,timestamp:new Date().toISOString()};if(re(Qe),pe.event.eventType==="status"){const je=X1(pe.event.content),Be=Q1(pe.event.content);et(U,je,Be)}ye===se.length-1&&de&&de()},pe.delayMs,U)})},[Re,re,et]),Xe=y.useCallback(async(U,se,de,pe)=>{console.log("[MockGrackle] spawn",{environmentId:U,prompt:se,runtime:pe});const ye=Nt("sess"),Qe={id:ye,environmentId:U,runtime:pe||"claude-code",status:"running",prompt:se,startedAt:new Date().toISOString()};c(Be=>[...Be,Qe]),v(ye);const je=ue();if(console.log(`[MockGrackle] Playing scenario: ${je.label}`),je.pauseForInput){const Be=je.pauseAfterStep??je.steps.length-1,Ge=je.steps.slice(0,Be+1),ht=Ge.length>0?Ge[Ge.length-1].delayMs:0;ve(ye,Ge),Re(()=>{et(ye,"idle"),re({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ht+Qb,ye),je.resumeSteps&&Oe.current.set(ye,je.resumeSteps)}else ve(ye,je.steps)},[Nt,ue,ve,Re,et,re]),an=y.useCallback(async U=>{console.log("[MockGrackle] kill",U),Q(U),Oe.current.delete(U),et(U,"stopped","killed"),re({sessionId:U,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),T(se=>se.map(de=>de.latestSessionId===U&&de.status==="working"?{...de,status:"not_started"}:de))},[Q,et,re]),_s=y.useCallback(async U=>{console.log("[MockGrackle] stopGraceful",U),Q(U),Oe.current.delete(U),et(U,"stopped","terminated"),re({sessionId:U,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),T(se=>se.map(de=>de.latestSessionId===U&&de.status==="working"?{...de,status:"not_started"}:de))},[Q,et,re]),ls=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Os=y.useCallback(async U=>{console.log("[MockGrackle] loadSessionEvents",U)},[]),pa=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),m([])},[]),Mi=y.useCallback(async(U,se,de,pe,ye,Qe,je,Be,Ge)=>{console.log("[MockGrackle] createWorkspace",{name:U,description:se});const ht={id:Nt("proj"),name:U,description:se||"",repoUrl:de||"",linkedEnvironmentIds:pe?[pe]:[],status:"active",workingDirectory:je||"",useWorktrees:Qe??!0,defaultPersonaId:ye||"",tokenBudget:0,costBudgetMillicents:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};_(tt=>[...tt,ht]),Be&&Be(ht)},[Nt]),Wt=y.useCallback(async U=>{console.log("[MockGrackle] archiveWorkspace",U),_(se=>se.map(de=>de.id===U?{...de,status:"archived"}:de))},[]),Ja=y.useCallback(async U=>{console.log("[MockGrackle] loadTasks",U)},[]),Wa=y.useCallback(async(U,se,de,pe,ye,Qe,je,Be,Ge)=>{console.log("[MockGrackle] createTask",{workspaceId:U,title:se,parentTaskId:ye}),T(ht=>{const Qt=ht.filter(Ss=>Ss.workspaceId===U).reduce((Ss,Bi)=>Math.max(Ss,Bi.sortOrder),0),on=ye?ht.find(Ss=>Ss.id===ye):void 0;if(ye&&!on)return console.warn("[MockGrackle] Parent task not found:",ye),ht;if(on&&!on.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ye),ht;const Et=on?on.depth+1:0,ks={id:Nt("task"),workspaceId:U,title:se,description:de||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:pe||[],reviewNotes:void 0,sortOrder:Qt+1,createdAt:new Date().toISOString(),parentTaskId:ye||"",depth:Et,childTaskIds:[],canDecompose:je??!ye,defaultPersonaId:Qe||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[...ht,ks]}),Be&&Be()},[Nt]),ma=y.useCallback(async(U,se,de,pe)=>{var ht;console.log("[MockGrackle] startTask",{taskId:U});const ye=_e.current.find(tt=>tt.id===U),Qe=(ye==null?void 0:ye.title)??"",je=Nt("sess"),Be={id:je,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:Qe||U,startedAt:new Date().toISOString()};c(tt=>[...tt,Be]),T(tt=>tt.map(Qt=>Qt.id===U?{...Qt,status:"working",latestSessionId:je,branch:`mock/${U.slice(0,8)}`}:Qt));const Ge=ue();if(console.log(`[MockGrackle] Playing task scenario: ${Ge.label}`),Ge.pauseForInput){const tt=Ge.pauseAfterStep??Ge.steps.length-1,Qt=Ge.steps.slice(0,tt+1),on=Qt.length>0?Qt[Qt.length-1].delayMs:0;if(ve(je,Qt),Re(()=>{et(je,"idle"),re({sessionId:je,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},on+Qb,je),Ge.resumeSteps){const Et=[...Ge.resumeSteps];Oe.current.set(je,Et);const ks=Et.reduce((Ss,Bi)=>Math.max(Ss,Bi.delayMs),0);Ht.current.set(je,{taskId:U,delayAfterResume:ks+200})}}else{const tt=Ge.steps.length>0?Ge.steps[Ge.steps.length-1].delayMs:0;ve(je,Ge.steps);const Qt=(ht=Ge.steps[Ge.steps.length-1])==null?void 0:ht.event.content;Re(()=>{Qt==="completed"?T(on=>on.map(Et=>Et.id===U&&Et.status==="working"?{...Et,status:"paused"}:Et)):Qt==="failed"&&T(on=>on.map(Et=>Et.id===U&&Et.status==="working"?{...Et,status:"failed"}:Et))},tt+100,je)}},[Nt,ue,ve,Re,et,re]),Bs=y.useCallback(async(U,se)=>{console.log("[MockGrackle] sendInput",{sessionId:U,text:se}),re({sessionId:U,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${se}`}),et(U,"running"),re({sessionId:U,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const de=Oe.current.get(U);if(de)Oe.current.delete(U),ve(U,de);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"}}];ve(U,ye)}const pe=Ht.current.get(U);pe&&(Ht.current.delete(U),Re(()=>{T(ye=>ye.map(Qe=>Qe.id===pe.taskId&&Qe.status==="working"?{...Qe,status:"paused"}:Qe))},pe.delayAfterResume,U))},[re,et,ve,Re]),xs=y.useCallback(async U=>{console.log("[MockGrackle] completeTask",U),T(se=>se.map(de=>de.id===U?{...de,status:"complete"}:de))},[]),Ne=y.useCallback(async U=>{console.log("[MockGrackle] resumeTask",U)},[]),Ue=y.useCallback(async(U,se,de,pe,ye)=>{console.log("[MockGrackle] updateTask",{taskId:U,title:se}),T(Qe=>Qe.map(je=>je.id===U?{...je,title:se.trim()||je.title,description:de,dependsOn:pe,...ye!==void 0?{defaultPersonaId:ye}:{}}:je))},[]),_n=y.useCallback(async U=>{console.log("[MockGrackle] deleteTask",U),T(se=>se.filter(de=>de.id!==U))},[]),mn=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),Pt=y.useCallback(async(U,se,de)=>{console.log("[MockGrackle] addEnvironment",{displayName:U,adapterType:se,adapterConfig:de})},[]),Cn=y.useCallback(async(U,se)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:U,...se}),o(de=>de.map(pe=>pe.id!==U?pe:{...pe,...se.displayName!==void 0?{displayName:se.displayName}:{},...se.adapterConfig!==void 0?{adapterConfig:JSON.stringify(se.adapterConfig)}:{}}))},[]),Xt=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Ri=y.useCallback(async(U,se,de,pe,ye)=>{console.log("[MockGrackle] setToken",{name:U,tokenType:de}),C(Qe=>[...Qe.filter(Be=>Be.name!==U),{name:U,tokenType:de,envVar:pe,filePath:ye,expiresAt:""}])},[]),Ii=y.useCallback(async U=>{console.log("[MockGrackle] deleteToken",U),C(se=>se.filter(de=>de.name!==U))},[]),pl=y.useCallback(async U=>{console.log("[MockGrackle] updateCredentialProviders",U),R(U)},[]);y.useEffect(()=>()=>{ot.current.forEach(clearTimeout),ot.current.clear()},[]);const Oi=y.useMemo(()=>({connectionStatus:"connected",environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:mn,addEnvironment:Pt,updateEnvironment:Cn,provisionEnvironment:async(U,se)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:ns},sessions:{sessions:r,sessionsLoading:!1,events:p,eventsDropped:0,lastSpawnedId:g,taskSessions:$,spawn:Xe,sendInput:Bs,kill:an,stopGraceful:_s,loadSessionEvents:Os,clearEvents:pa,loadTaskSessions:async U=>{console.log("[MockGrackle] loadTaskSessions",U)},domainHook:ns},workspaces:{workspaces:b,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Mi,archiveWorkspace:Wt,updateWorkspace:async(U,se)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:U,...se}),_(de=>de.map(pe=>pe.id!==U?pe:{...pe,...se.name!==void 0?{name:se.name}:{},...se.description!==void 0?{description:se.description}:{},...se.repoUrl!==void 0?{repoUrl:se.repoUrl}:{},...se.environmentId!==void 0?{environmentId:se.environmentId}:{},...se.workingDirectory!==void 0?{workingDirectory:se.workingDirectory}:{},...se.useWorktrees!==void 0?{useWorktrees:se.useWorktrees}:{},...se.defaultPersonaId!==void 0?{defaultPersonaId:se.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},linkEnvironment:async(U,se)=>{if(console.log("[MockGrackle] linkEnvironment",{workspaceId:U,environmentId:se}),se==="error-env"){S("Failed to link environment");return}S(""),_(de=>de.map(pe=>pe.id!==U||pe.linkedEnvironmentIds.includes(se)?pe:{...pe,linkedEnvironmentIds:[...pe.linkedEnvironmentIds,se]}))},unlinkEnvironment:async(U,se)=>{if(console.log("[MockGrackle] unlinkEnvironment",{workspaceId:U,environmentId:se}),se==="error-env"){S("Failed to unlink environment");return}S(""),_(de=>de.map(pe=>pe.id!==U?pe:{...pe,linkedEnvironmentIds:pe.linkedEnvironmentIds.filter(ye=>ye!==se)}))},linkOperationError:k,clearLinkOperationError:()=>{S("")},domainHook:ns},tasks:{tasks:j,tasksLoading:!1,taskStartingId:void 0,loadTasks:Ja,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Wa,startTask:ma,stopTask:async U=>{console.log("[MockGrackle] stopTask",{taskId:U}),await xs(U)},completeTask:xs,resumeTask:Ne,updateTask:Ue,deleteTask:_n,domainHook:ns},tokens:{tokens:w,tokensLoading:!1,loadTokens:Xt,setToken:Ri,deleteToken:Ii,domainHook:ns},credentials:{credentialProviders:D,credentialsLoading:!1,updateCredentialProviders:pl,domainHook:ns},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:ns},dockerContainers:{dockerContainers:[],dockerContainersError:"",listDockerContainers:async()=>{},domainHook:ns},personas:{personas:E,personasLoading:!1,createPersona:async(U,se,de,pe,ye,Qe,je,Be,Ge)=>{console.log("[MockGrackle] createPersona",{name:U});const ht={id:`mock-persona-${Date.now()}`,name:U,description:se,systemPrompt:de,toolConfig:"{}",runtime:pe??"claude-code",model:ye||"",maxTurns:Qe||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:je||"agent",script:Be||"",allowedMcpTools:Ge||[]};return M(tt=>[...tt,ht]),ht},updatePersona:async(U,se,de,pe,ye,Qe,je,Be,Ge,ht)=>{console.log("[MockGrackle] updatePersona",{personaId:U,name:se});const tt=E.find(Et=>Et.id===U);if(!tt)throw new Error(`Persona not found: ${U}`);const Qt=new Date().toISOString(),on={...tt,...se!==void 0?{name:se}:{},...de!==void 0?{description:de}:{},...pe!==void 0?{systemPrompt:pe}:{},...ye!==void 0?{runtime:ye}:{},...Qe!==void 0?{model:Qe}:{},...je!==void 0?{maxTurns:je}:{},...Be!==void 0?{type:Be}:{},...Ge!==void 0?{script:Ge}:{},...ht!==void 0?{allowedMcpTools:ht}:{},updatedAt:Qt};return M(Et=>Et.map(ks=>ks.id===U?on:ks)),on},deletePersona:async U=>{console.log("[MockGrackle] deletePersona",U),M(se=>se.filter(de=>de.id!==U))},domainHook:ns},schedules:{schedules:O,schedulesLoading:!1,createSchedule:async(U,se,de,pe,ye)=>{console.log("[MockGrackle] createSchedule",{title:U});const Qe={id:`mock-schedule-${Date.now()}`,title:U,description:se,scheduleExpression:de,personaId:pe,workspaceId:ye??"",parentTaskId:"",enabled:!0,lastRunAt:"",nextRunAt:new Date(Date.now()+6e4).toISOString(),runCount:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};return A(je=>[...je,Qe]),Qe},updateSchedule:async(U,se)=>{console.log("[MockGrackle] updateSchedule",{scheduleId:U,fields:se});let de;if(A(pe=>pe.map(ye=>ye.id!==U?ye:(de={...ye,...se,updatedAt:new Date().toISOString()},de))),!de)throw new Error(`Schedule not found: ${U}`);return de},deleteSchedule:async U=>{console.log("[MockGrackle] deleteSchedule",U),A(se=>se.filter(de=>de.id!==U))},domainHook:ns},streams:{streams:d,streamsLoading:!1,streamsLoadedOnce:!0,streamsLoadError:!1,loadStreams:async(U=!1)=>{u(Xb(U))},domainHook:ns},knowledge:{graphData:{nodes:ee,links:Z},selectedNode:H,loading:!1,selectedId:F,searchQuery:ne,search:async U=>{if(console.log("[MockGrackle] knowledge.search",U),!U.trim()){ce(U);return}ce(U);const se=me.current,de=se?Cs.filter(je=>!je.workspaceId||je.workspaceId===se):Cs,pe=U.toLowerCase(),ye=de.filter(je=>{var Be,Ge,ht;return je.label.toLowerCase().includes(pe)||((Be=je.content)==null?void 0:Be.toLowerCase().includes(pe))||((Ge=je.tags)==null?void 0:Ge.some(tt=>tt.toLowerCase().includes(pe)))||((ht=je.category)==null?void 0:ht.toLowerCase().includes(pe))});le(ye);const Qe=new Set(ye.map(je=>je.id));ae(Ua.filter(je=>Qe.has(je.source)&&Qe.has(je.target))),ge(void 0),B(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),ce("");const U=me.current,se=U?Cs.filter(pe=>!pe.workspaceId||pe.workspaceId===U):Cs;le(se);const de=new Set(se.map(pe=>pe.id));ae(Ua.filter(pe=>de.has(pe.source)&&de.has(pe.target)))},selectNode:async U=>{console.log("[MockGrackle] knowledge.selectNode",U),ge(U);const se=U in Yb?Yb[U]:void 0;if(se)B(se);else{const de=Cs.find(pe=>pe.id===U);if(de){const pe=Ua.filter(ye=>ye.source===U||ye.target===U).map(ye=>({fromId:ye.source,toId:ye.target,type:ye.type}));B({node:de,edges:pe})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),ge(void 0),B(void 0)},expandNode:async U=>{console.log("[MockGrackle] knowledge.expandNode",U),le(se=>{const de=new Set(se.map(Be=>Be.id)),pe=Ua.filter(Be=>Be.source===U||Be.target===U),ye=new Set;for(const Be of pe)de.has(Be.source)||ye.add(Be.source),de.has(Be.target)||ye.add(Be.target);if(ye.size===0)return se;const Qe=Cs.filter(Be=>ye.has(Be.id)),je=new Set([...de,...ye]);return ae(Be=>{const Ge=new Set(Be.map(tt=>`${tt.source}|${tt.target}|${tt.type}`)),ht=Ua.filter(tt=>je.has(tt.source)&&je.has(tt.target)&&!Ge.has(`${tt.source}|${tt.target}|${tt.type}`));return ht.length>0?[...Be,...ht]:Be}),[...se,...Qe]})},loadRecent:async U=>{if(console.log("[MockGrackle] knowledge.loadRecent",U),me.current=U,U){const se=Cs.filter(pe=>!pe.workspaceId||pe.workspaceId===U);le(se);const de=new Set(se.map(pe=>pe.id));ae(Ua.filter(pe=>de.has(pe.source)&&de.has(pe.target)))}else le(Cs),ae(Ua);ce("")},handleEvent:()=>!1,domainHook:ns},githubAccounts:{githubAccounts:[],githubAccountsLoading:!1,loadGitHubAccounts:async()=>{console.log("[MockGrackle] loadGitHubAccounts")},addGitHubAccount:async(U,se,de,pe)=>{console.log("[MockGrackle] addGitHubAccount",U)},updateGitHubAccount:async(U,se)=>{console.log("[MockGrackle] updateGitHubAccount",U,se)},removeGitHubAccount:async U=>{console.log("[MockGrackle] removeGitHubAccount",U)},importGitHubAccounts:async()=>(console.log("[MockGrackle] importGitHubAccounts"),{imported:0,usernames:[]})},plugins:{plugins:[{name:"core",description:"Core infrastructure",enabled:!0,required:!0,loaded:!0},{name:"orchestration",description:"Task orchestration",enabled:!0,required:!1,loaded:!0},{name:"scheduling",description:"Scheduled triggers",enabled:!0,required:!1,loaded:!0},{name:"knowledge",description:"Knowledge graph",enabled:!1,required:!1,loaded:!1}],pluginsLoading:!1,loadPlugins:async()=>{console.log("[MockGrackle] loadPlugins")},setPluginEnabled:async(U,se)=>{console.log("[MockGrackle] setPluginEnabled",U,se)}},appDefaultPersonaId:Y,setAppDefaultPersonaId:async U=>{console.log("[MockGrackle] setAppDefaultPersonaId",U),V(U)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costMillicents:112e3,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costMillicents:48e3,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1}},loadUsage:async(U,se)=>{console.log(`[MockGrackle] loadUsage(${U}, ${se})`)},refresh:ls}),[s,r,d,p,g,$,b,k,j,w,D,E,O,Y,ee,Z,H,F,ne,Xe,Bs,an,_s,Os,pa,Mi,Wt,Ja,Wa,ma,xs,Ne,Ue,_n,mn,Pt,Cn,Xt,Ri,Ii,pl,ls]);return i.jsx(ih.Provider,{value:Oi,children:t})}const nk=3e3,I$=nk;function O$(t){const[s,o]=y.useState("connecting"),r=y.useRef(t.onSessionEvent);r.current=t.onSessionEvent;const c=y.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const d=y.useRef(t.onConnect);d.current=t.onConnect;const u=y.useRef(t.onDisconnect);return u.current=t.onDisconnect,y.useEffect(()=>{let p=!1,m,g;async function v(){var k,S;if(p)return;Promise.resolve((k=d.current)==null?void 0:k.call(d)).catch(()=>{});let b=!1;const _=()=>{!b&&!p&&(b=!0,o("connected"))};g=setTimeout(_,I$);try{const j=$e.streamEvents({});for await(const T of j){if(_(),p)break;const w=T.event;if(w.case==="sessionEvent"){const C=w.value;r.current({sessionId:C.sessionId,type:C.type,timestamp:C.timestamp,content:C.content,raw:C.raw})}else if(w.case==="domainEvent"){const C=w.value;c.current({id:C.id,type:C.type,timestamp:C.timestamp,payloadJson:C.payloadJson})}}}catch(j){if(clearTimeout(g),j instanceof ra&&j.code===v_.Unauthenticated){window.location.href=PN;return}}clearTimeout(g),p||(o("connecting"),(S=u.current)==null||S.call(u),m=setTimeout(()=>{v().catch(()=>{})},nk))}return v().catch(()=>{}),()=>{p=!0,clearTimeout(m),clearTimeout(g)}},[]),{connectionStatus:s}}const lm=["core","orchestration","scheduling"],sk=y.createContext({pluginNames:[...lm],sandboxPort:void 0,sandboxOrigin:void 0,loading:!1,error:void 0});function B$({children:t}){const[s,o]=y.useState([...lm]),[r,c]=y.useState(void 0),[d,u]=y.useState(void 0),[p,m]=y.useState(!0),[g,v]=y.useState(void 0);return y.useEffect(()=>{let b=!1;return fetch("/api/manifest").then(async _=>{if(!_.ok)throw new Error(`Manifest fetch returned ${_.status}`);return _.json()}).then(_=>{b||(o(_.plugins.map(k=>k.name)),c(_.sandboxPort),u(_.sandboxOrigin),m(!1))}).catch(_=>{b||(o([...lm]),v(_ instanceof Error?_:new Error(String(_))),m(!1))}),()=>{b=!0}},[]),i.jsx(sk.Provider,{value:{pluginNames:s,sandboxPort:r,sandboxOrigin:d,loading:p,error:g},children:t})}function Cd(){return y.useContext(sk)}function lh(){const{sandboxPort:t,sandboxOrigin:s}=Cd();if(typeof window>"u")return;if(s!==void 0&&s!=="")try{return new URL("/sandbox.html",s).toString()}catch{}if(t===void 0)return;const o=new URL(window.location.origin);return o.port=String(t),o.pathname="/sandbox.html",o.toString()}const L$=new Set(["dashboard","chat","environments","coordination","settings"]),z$=new Set(["tasks"]),$$=new Set(["knowledge"]),ak={core:{navItems:Wc.filter(t=>L$.has(t.view)),domainHookKeys:["environments","sessions","workspaces","tokens","credentials","codespaces","dockerContainers","streams","plugins"]},orchestration:{navItems:Wc.filter(t=>z$.has(t.view)),domainHookKeys:["tasks","personas","notifications"]},scheduling:{navItems:[],domainHookKeys:["schedules"]},knowledge:{navItems:Wc.filter(t=>$$.has(t.view)),domainHookKeys:["knowledge"]}};function H$(t){return t.flatMap(s=>{var o;return((o=ak[s])==null?void 0:o.navItems)??[]})}function P$(t){return new Set(t.flatMap(s=>{var o;return((o=ak[s])==null?void 0:o.domainHookKeys)??[]}))}function U$(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped,githubAccountId:t.githubAccountId||""}}function e_(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,taskId:t.taskId||void 0,inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents}}function V$(t){return{sessionId:t.sessionId,eventType:y_(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function t_(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,linkedEnvironmentIds:[...t.linkedEnvironmentIds],status:O2(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents,createdAt:t.createdAt,updatedAt:t.updatedAt}}function n_(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:B2(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 q$(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function G$(t){return{claude:L2(t.claude),github:wc(t.github),copilot:wc(t.copilot),codex:wc(t.codex),goose:wc(t.goose)}}function F$(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function K$(t){return{id:t.id,name:t.name,image:t.image,state:t.state,status:t.status}}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 Z$(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents,sessionCount:t.sessionCount}}function wp(t){return{id:t.id,title:t.title,description:t.description,scheduleExpression:t.scheduleExpression,personaId:t.personaId,workspaceId:t.workspaceId,parentTaskId:t.parentTaskId,enabled:t.enabled,lastRunAt:t.lastRunAt,nextRunAt:t.nextRunAt,runCount:t.runCount,createdAt:t.createdAt,updatedAt:t.updatedAt}}function 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 Np(t){return{source:t.fromId,target:t.toId,type:t.type}}function Y$(t){return{subscriptionId:t.subscriptionId,sessionId:t.sessionId,fd:t.fd,permission:t.permission,deliveryMode:t.deliveryMode,createdBySpawn:t.createdBySpawn}}function J$(t){return{id:t.id,name:t.name,subscriberCount:t.subscriberCount,messageBufferDepth:t.messageBufferDepth,subscribers:t.subscribers.map(Y$),selfEcho:t.selfEcho}}function bs(){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 s_=5e3;function $r(t){return t instanceof ra?t.message:"Operation failed"}function W$(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState({}),[u,p]=y.useState(""),m=y.useCallback(()=>{p("")},[]),g=y.useCallback(async()=>{try{const C=await r($e.listEnvironments({}));s(C.environments.map(U$))}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(R=>R.filter(E=>E.id!==D)),d(R=>{const E={...R};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 W1("environment.provision_progress","invalid payload"),!0;if(d(R=>({...R,[D.environmentId]:{stage:D.stage,message:D.message,progress:D.progress}})),D.stage==="ready"){const R=D.environmentId;setTimeout(()=>{d(E=>{const M={...E};return delete M[R],M})},s_)}return!0}default:return!1}},[g]),b=y.useCallback(C=>{var D;if(C.type==="environments"){const R=Array.isArray((D=C.payload)==null?void 0:D.environments)?C.payload.environments:[];return s(R),!0}return!1},[]),_=y.useCallback(async(C,D,R,E)=>{p("");try{await $e.addEnvironment({displayName:C,adapterType:D,adapterConfig:JSON.stringify(R??{}),githubAccountId:E??""})}catch(M){p($r(M))}},[]),k=y.useCallback(async(C,D)=>{p("");try{await $e.updateEnvironment({id:C,displayName:D.displayName,adapterConfig:D.adapterConfig?JSON.stringify(D.adapterConfig):void 0,githubAccountId:D.githubAccountId})}catch(R){p($r(R))}},[]),S=y.useCallback(async(C,D)=>{p("");try{const R=$e.provisionEnvironment({id:C,force:D??!1});for await(const E of R)d(M=>({...M,[C]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"&&setTimeout(()=>{d(M=>{const O={...M};return delete O[C],O})},s_)}catch(R){d(E=>{const M={...E};return delete M[C],M}),p($r(R))}},[]),j=y.useCallback(async C=>{p("");try{await $e.stopEnvironment({id:C})}catch(D){p($r(D))}},[]),T=y.useCallback(async C=>{p("");try{await $e.removeEnvironment({id:C})}catch(D){p($r(D))}},[]);return{environments:t,environmentsLoading:o,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:g,addEnvironment:_,updateEnvironment:k,provisionEnvironment:S,stopEnvironment:j,removeEnvironment:T,handleEvent:v,handleLegacyMessage:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const Cp=new Set(["pending","running","idle"]),X$=new Set(["completed","failed","interrupted","hibernating","suspended"]),a_=["pending","running","idle"];function Q$(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState([]),[u,p]=y.useState(0),[m,g]=y.useState(void 0),[v,b]=y.useState({}),_=y.useCallback(async()=>{try{const $=(await r($e.listSessions({}))).sessions.map(e_);s(Y=>{const V=new Map(Y.map(ee=>[ee.id,ee]));return $.map(ee=>{const le=V.get(ee.id),Z=le==null?void 0:le.status;return!Z||Z===ee.status?ee:X$.has(Z)&&Cp.has(ee.status)?{...ee,status:Z,...le.endReason!==void 0?{endReason:le.endReason}:{}}:Cp.has(Z)&&Cp.has(ee.status)&&a_.indexOf(Z)>a_.indexOf(ee.status)?{...ee,status:Z}:ee})})}catch{}},[r]),k=y.useCallback(A=>{if(A.type!=="session_event")return!1;if(!c$(A.payload))return W1("session_event","payload is not a valid SessionEvent"),!0;const $=A.payload;let Y=0;if(d(V=>{const ee=[...V,$];return ee.length>jo?(Y=ee.length-jo,ee.slice(-jo)):ee}),Y>0&&p(V=>V+Y),$.eventType==="usage")try{const V=JSON.parse($.content),ee=Number(V.input_tokens)||0,le=Number(V.output_tokens)||0,Z=Number(V.cost_millicents)||0;(ee>0||le>0||Z>0)&&s(ae=>ae.map(H=>H.id===$.sessionId?{...H,inputTokens:(H.inputTokens??0)+ee,outputTokens:(H.outputTokens??0)+le,costMillicents:(H.costMillicents??0)+Z}:H))}catch{}if($.eventType==="status"){const V=X1($.content),ee=Q1($.content);s(le=>le.some(ae=>ae.id===$.sessionId)?le.map(ae=>ae.id===$.sessionId?{...ae,status:V,...ee!==void 0?{endReason:ee}:{}}:ae):[...le,{id:$.sessionId,environmentId:"",runtime:"",status:V,prompt:"",startedAt:$.timestamp,...ee!==void 0?{endReason:ee}:{}}])}return!0},[]),S=y.useCallback(A=>{k({type:"session_event",payload:A})},[k]),j=y.useCallback(A=>{var $,Y,V,ee,le;switch(A.type){case"sessions":{const Z=Array.isArray(($=A.payload)==null?void 0:$.sessions)?A.payload.sessions:[];return s(Z),!0}case"spawned":{const Z=(Y=A.payload)==null?void 0:Y.sessionId;return typeof Z=="string"&&Z&&g(Z),_().catch(()=>{}),!0}case"session_events":{const Z=Array.isArray((V=A.payload)==null?void 0:V.events)?A.payload.events:[];return Z.length>0&&d(Z),!0}case"task_sessions":{const Z=(ee=A.payload)==null?void 0:ee.taskId;if(typeof Z=="string"&&Z){const ae=Array.isArray((le=A.payload)==null?void 0:le.sessions)?A.payload.sessions:[];b(H=>({...H,[Z]:ae}))}return!0}default:return!1}},[_]),T=y.useCallback(async(A,$,Y,V,ee)=>{try{const le=await $e.spawnAgent({environmentId:A,prompt:$,personaId:Y||"",workingDirectory:V||"",workspaceId:ee||""});g(le.id),await _()}catch{}},[_]),w=y.useCallback(async(A,$)=>{await $e.sendInput({sessionId:A,text:$})},[]),C=y.useCallback(async A=>{try{await $e.killAgent({id:A,graceful:!1})}catch{}},[]),D=y.useCallback(async A=>{try{await $e.killAgent({id:A,graceful:!0})}catch{}},[]),R=y.useCallback(async A=>{try{const Y=(await $e.getSessionEvents({id:A})).events.map(V$);if(Y.length>0){let V=0;d(ee=>{const le=new Set;for(const H of ee)H.sessionId===A&&le.add(`${H.timestamp}|${H.eventType}`);const Z=Y.filter(H=>!le.has(`${H.timestamp}|${H.eventType}`)),ae=[...ee,...Z].sort((H,B)=>H.sessionId!==B.sessionId?0:H.timestamp.localeCompare(B.timestamp));return ae.length>jo?(V=ae.length-jo,ae.slice(-jo)):ae}),V>0&&p(ee=>ee+V)}}catch{}},[]),E=y.useCallback(()=>{d([]),p(0)},[]),M=y.useCallback(async A=>{try{const Y=(await $e.getTaskSessions({id:A})).sessions.map(e_);b(V=>({...V,[A]:Y}))}catch{}},[]);return{sessions:t,sessionsLoading:o,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:_,spawn:T,sendInput:w,kill:C,stopGraceful:D,loadSessionEvents:R,clearEvents:E,loadTaskSessions:M,handleMessage:k,handleSessionEvent:S,handleLegacyMessage:j,domainHook:{onConnect:()=>_(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function i_(t){return t instanceof ra?t.message:"Operation failed"}function e9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState(!1),[u,p]=y.useState(""),m=y.useCallback(async()=>{try{const C=await r($e.listWorkspaces({}));s(C.workspaces.map(t_))}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,R,E,M,O,A,$,Y)=>{d(!0);try{const V=await $e.createWorkspace({name:C,description:D||"",repoUrl:R||"",environmentId:E||"",defaultPersonaId:M||void 0,useWorktrees:O??!0,workingDirectory:A||void 0}),ee=t_(V);s(le=>le.some(Z=>Z.id===ee.id)?le:[...le,ee]),d(!1),$==null||$(ee)}catch(V){d(!1);const ee=V instanceof ra?V.message:"Failed to create workspace";Y==null||Y(ee)}},[]),_=y.useCallback(async C=>{try{await $e.archiveWorkspace({id:C})}catch{}},[]),k=y.useCallback(async(C,D)=>{try{await $e.updateWorkspace({id:C,...D})}catch{}},[]),S=y.useCallback(()=>{p("")},[]),j=y.useCallback(async(C,D)=>{try{p(""),await $e.linkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(R){p(i_(R))}},[m]),T=y.useCallback(async(C,D)=>{try{p(""),await $e.unlinkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(R){p(i_(R))}},[m]);return{workspaces:t,workspacesLoading:o,workspaceCreating:c,loadWorkspaces:m,createWorkspace:b,archiveWorkspace:_,updateWorkspace:k,linkEnvironment:j,unlinkEnvironment:T,linkOperationError:u,clearLinkOperationError:S,handleEvent:g,onDisconnect:v,domainHook:{onConnect:()=>m(),onDisconnect:v,handleEvent:g}}}function t9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState(void 0),u=y.useRef({}),p=y.useCallback(async E=>{try{const O=(await Ln.listTasks({workspaceId:E})).tasks.map(n_);s(A=>[...A.filter($=>$.workspaceId!==E),...O])}catch{}},[]),m=y.useCallback(async()=>{try{const M=(await r(Ln.listTasks({}))).tasks.map(n_);s(O=>{const A=new Set(M.map($=>$.id));return[...O.filter($=>!A.has($.id)),...M]})}catch{}},[r]),g=y.useCallback((E,M)=>{const O=A=>{clearTimeout(u.current[A]),u.current[A]=setTimeout(()=>{delete u.current[A],p(A).catch(()=>{})},200)};E?O(E):M&&s(A=>{const $=A.find(Y=>Y.id===M);return $!=null&&$.workspaceId?O($.workspaceId):m().catch(()=>{}),A})},[p,m]),v=y.useCallback(E=>{const M=E.payload;switch(E.type){case"task.created":{const O=typeof M.workspaceId=="string"?M.workspaceId:"";return O&&p(O).catch(()=>{}),!0}case"task.started":{const O=typeof M.taskId=="string"?M.taskId:"",A=typeof M.sessionId=="string"?M.sessionId:"",$=typeof M.workspaceId=="string"?M.workspaceId:"";return d(Y=>O&&Y===O?void 0:Y),A&&O&&s(Y=>Y.map(V=>V.id===O?{...V,latestSessionId:A}:V)),g($,O),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const O=typeof M.workspaceId=="string"?M.workspaceId:"",A=typeof M.taskId=="string"?M.taskId:"";return d($=>A&&$===A?void 0:$),g(O,A),!0}default:return!1}},[p,g]),b=y.useCallback(()=>{d(void 0)},[]),_=y.useCallback(E=>{var M,O;if(E.type==="tasks"){const A=Array.isArray((M=E.payload)==null?void 0:M.tasks)?E.payload.tasks:[],$=typeof((O=E.payload)==null?void 0:O.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s($?Y=>[...Y.filter(V=>V.workspaceId!==$),...A]:Y=>{const V=new Set(A.map(ee=>ee.id));return[...Y.filter(ee=>!V.has(ee.id)),...A]}),!0}return!1},[]),k=y.useCallback(async(E,M,O,A,$,Y,V,ee,le)=>{try{await Ln.createTask({workspaceId:E,title:M,description:O||"",dependsOn:A||[],parentTaskId:$||"",defaultPersonaId:Y||void 0,canDecompose:V??void 0}),ee==null||ee()}catch(Z){const ae=Z instanceof ra?Z.message:"Failed to create task";le==null||le(ae)}},[]),S=y.useCallback(async(E,M,O,A)=>{d(E);try{await Ln.startTask({taskId:E,personaId:M||"",environmentId:O||"",notes:A||""})}catch($){if($ instanceof ra&&$.code===v_.ResourceExhausted)return;throw d(void 0),$}},[]),j=y.useCallback(async E=>{try{await Ln.stopTask({id:E})}catch{}},[]),T=y.useCallback(async E=>{try{await Ln.completeTask({id:E})}catch{}},[]),w=y.useCallback(async E=>{try{await Ln.resumeTask({id:E})}catch{}},[]),C=y.useCallback(async(E,M,O,A,$)=>{try{await Ln.updateTask({id:E,title:M,description:O,dependsOn:A,...$!==void 0?{defaultPersonaId:$}:{}})}catch{}},[]),D=y.useCallback(async E=>{try{await Ln.deleteTask({id:E})}catch{}},[]);return{tasks:t,tasksLoading:o,taskStartingId:c,loadTasks:p,loadAllTasks:m,createTask:k,startTask:S,stopTask:j,completeTask:T,resumeTask:w,updateTask:C,deleteTask:D,handleEvent:v,onDisconnect:b,handleLegacyMessage:_,domainHook:{onConnect:()=>m(),onDisconnect:b,handleEvent:v}}}function n9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const g=await r($e.listTokens({}));s(g.tokens.map(q$))}catch{}},[r]),d=y.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(g,v,b,_,k)=>{try{await $e.setToken({name:g,value:v,type:b,envVar:_,filePath:k})}catch{}},[]),p=y.useCallback(async g=>{try{await $e.deleteToken({name:g})}catch{}},[]);return{tokens:t,tokensLoading:o,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function s9(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const m=await r($e.getCredentialProviders({}));s(G$(m))}catch{}},[r]),d=y.useCallback(m=>m.type==="credential.providers_changed"?(u$(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})=>$e.setCredentialProvider({provider:v,value:b})))},[]);return{credentialProviders:t,credentialsLoading:o,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function a9(){const[t,s]=y.useState([]),[o,r]=y.useState(""),[c,d]=y.useState(""),[u,p]=y.useState(!1),m=y.useCallback(async b=>{try{const _=await $e.listCodespaces({githubAccountId:b??""});s(_.codespaces.map(F$)),d(_.error)}catch{}},[]),g=y.useCallback(async(b,_)=>{p(!0),r("");try{await $e.createCodespace({repo:b,machine:_??""}),p(!1),await m()}catch(k){p(!1);const S=k instanceof ra?k.message:"Failed to create codespace";r(S)}},[m]);return{codespaces:t,codespaceError:o,codespaceListError:c,codespaceCreating:u,listCodespaces:m,createCodespace:g,domainHook:{onConnect:()=>m(),onDisconnect:()=>{},handleEvent:()=>!1}}}function i9(){const[t,s]=y.useState([]),[o,r]=y.useState(""),c=y.useCallback(async()=>{try{const u=await $e.listDockerContainers({});s(u.containers.map(K$)),r(u.error)}catch(u){s([]),r(u instanceof Error?u.message:"Failed to list Docker containers")}},[]);return{dockerContainers:t,dockerContainersError:o,listDockerContainers:c,domainHook:{onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1}}}function o9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const v=await r(Ln.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,_,k,S,j,T,w,C)=>{const D=await Ln.createPersona({name:v,description:b,systemPrompt:_,runtime:k||"",model:S||"",maxTurns:j||0,type:T||"agent",script:w||"",allowedMcpTools:C||[]}),R=Tp(D);return s(E=>[...E.filter(M=>M.id!==R.id),R]),R},[]),p=y.useCallback(async(v,b,_,k,S,j,T,w,C,D)=>{const R={id:v};b!==void 0&&(R.name=b),_!==void 0&&(R.description=_),k!==void 0&&(R.systemPrompt=k),S!==void 0&&(R.runtime=S),j!==void 0&&(R.model=j),T!==void 0&&(R.maxTurns=T),w!==void 0&&(R.type=w),C!==void 0&&(R.script=C),D!==void 0&&(R.allowedMcpTools={tools:D});const E=await Ln.updatePersona(R),M=Tp(E);return s(O=>O.map(A=>A.id===M.id?M:A)),M},[]),m=y.useCallback(async v=>{await Ln.deletePersona({id:v}),s(b=>b.filter(_=>_.id!==v))},[]);return{personas:t,personasLoading:o,loadPersonas:c,createPersona:u,updatePersona:p,deletePersona:m,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function r9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useRef(void 0),d=y.useCallback(async()=>{try{const b=await r(Ec.listSchedules({}));s(b.schedules.map(wp))}catch{}},[r]),u=y.useCallback(b=>{switch(b.type){case"schedule.created":case"schedule.updated":case"schedule.deleted":return d().catch(()=>{}),!0;case"schedule.fired":return clearTimeout(c.current),c.current=setTimeout(()=>{d().catch(()=>{})},500),!0;default:return!1}},[d]),p=y.useCallback(async(b,_,k,S,j,T)=>{const w=await Ec.createSchedule({title:b,description:_,scheduleExpression:k,personaId:S,workspaceId:j||"",parentTaskId:T||""}),C=wp(w);return s(D=>[...D.filter(R=>R.id!==C.id),C]),C},[]),m=y.useCallback(async(b,_)=>{const k={id:b};_.title!==void 0&&(k.title=_.title),_.description!==void 0&&(k.description=_.description),_.scheduleExpression!==void 0&&(k.scheduleExpression=_.scheduleExpression),_.personaId!==void 0&&(k.personaId=_.personaId),_.enabled!==void 0&&(k.enabled=_.enabled);const S=await Ec.updateSchedule(k),j=wp(S);return s(T=>T.map(w=>w.id===j.id?j:w)),j},[]),g=y.useCallback(async b=>{await Ec.deleteSchedule({id:b}),s(_=>_.filter(k=>k.id!==b))},[]);return{schedules:t,schedulesLoading:o,loadSchedules:d,createSchedule:p,updateSchedule:m,deleteSchedule:g,handleEvent:u,domainHook:{onConnect:()=>d(),onDisconnect:()=>{clearTimeout(c.current)},handleEvent:u}}}function l9(t){if(t)try{return JSON.parse(t)}catch{return}}function c9(){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(""),_=y.useRef(""),k=y.useCallback(async E=>{const M=E??"";_.current=M,b(""),g(!0);try{const O=await Ac.listRecentKnowledgeNodes({limit:30,workspaceId:M}),A=new Map,$=[];for(const Y of O.nodes)A.set(Y.id,Vc(Y));for(const Y of O.edges)$.push(Np(Y));for(const Y of $){const V=A.get(Y.source);V&&(V.val+=1);const ee=A.get(Y.target);ee&&(ee.val+=1)}s(A),r($)}catch{}finally{g(!1)}},[]),S=y.useCallback(async E=>{if(E.trim()){b(E),p(void 0),d(void 0),g(!0);try{const M=await Ac.searchKnowledge({query:E,limit:20,workspaceId:_.current}),O=new Map,A=[];for(const $ of M.results){$.node&&O.set($.node.id,Vc($.node,$.edges.length));for(const Y of $.edges)A.push(Np(Y))}s(O),r(A)}catch{}finally{g(!1)}}},[]),j=y.useCallback(()=>{k(_.current).catch(()=>{})},[k]),T=y.useCallback(async E=>{p(E);try{const M=await Ac.getKnowledgeNode({id:E});if(!M.node){d(void 0);return}d({node:Vc(M.node,M.edges.length),edges:M.edges.map(O=>({fromId:O.fromId,toId:O.toId,type:O.type,metadata:l9(O.metadataJson)}))})}catch{d(void 0)}},[]),w=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async E=>{try{const M=await Ac.expandKnowledgeNode({id:E,depth:1});s(O=>{const A=new Map(O);for(const $ of M.nodes)A.has($.id)||A.set($.id,Vc($));return A}),r(O=>{const A=new Set(O.map(Y=>`${Y.source}:${Y.target}:${Y.type}`)),$=[];for(const Y of M.edges){const V=Np(Y),ee=`${V.source}:${V.target}:${V.type}`;A.has(ee)||$.push(V)}return[...O,...$]})}catch{}},[]),D=y.useCallback(E=>!1,[]),R={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:D};return{graphData:{nodes:[...t.values()],links:o},selectedNode:c,selectedId:u,loading:m,searchQuery:v,search:S,clearSearch:j,selectNode:T,clearSelection:w,expandNode:C,loadRecent:k,handleEvent:D,domainHook:R}}function d9(){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:wd("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 u9(){const[t,s]=y.useState([]),[o,r]=y.useState(!1),[c,d]=y.useState(!1),{loading:u,track:p}=bs(),m=y.useRef(0),g=y.useCallback(async(_=!1)=>{const k=m.current;try{const S=await p($e.listStreams({includeInternal:_}));m.current===k&&(s(S.streams.map(J$)),d(!1))}catch{m.current===k&&d(!0)}finally{m.current===k&&r(!0)}},[p]),v=y.useCallback(_=>!1,[]);return{streams:t,streamsLoading:u,streamsLoadedOnce:o,streamsLoadError:c,loadStreams:g,handleEvent:v,domainHook:{onConnect:g,onDisconnect:()=>{m.current+=1,s([]),r(!1),d(!1)},handleEvent:v}}}function f9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const m=await r($e.listPlugins({}));s(m.plugins.map(g=>({name:g.name,description:g.description,enabled:g.enabled,required:g.required,loaded:g.loaded})))}catch{}},[r]),d=y.useCallback(m=>m.type==="plugin.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(m,g)=>{try{const v=await $e.setPluginEnabled({name:m,enabled:g});s(b=>b.map(_=>_.name===v.name?{..._,enabled:v.enabled}:_))}catch{}},[]);return{plugins:t,pluginsLoading:o,loadPlugins:c,setPluginEnabled:u,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function p9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const b=await r($e.listGitHubAccounts({}));s(b.accounts.map(_=>({id:_.id,label:_.label,username:_.username,isDefault:_.isDefault,createdAt:_.createdAt})))}catch{}},[r]),d=y.useCallback(b=>b.type==="github_account.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(b,_,k,S)=>{const j=await $e.addGitHubAccount({label:b,token:_,username:k,isDefault:S});s(T=>[...j.isDefault?T.map(C=>({...C,isDefault:!1})):T,{id:j.id,label:j.label,username:j.username,isDefault:j.isDefault,createdAt:j.createdAt}])},[]),p=y.useCallback(async(b,_)=>{const k=await $e.updateGitHubAccount({id:b,..._});s(S=>S.map(j=>j.id===k.id?{...j,label:k.label,username:k.username,isDefault:k.isDefault}:_.isDefault?{...j,isDefault:!1}:j))},[]),m=y.useCallback(async b=>{await $e.removeGitHubAccount({id:b}),s(_=>_.filter(k=>k.id!==b))},[]),g=y.useCallback(async()=>{const b=await $e.importGitHubAccounts({});return b.imported>0&&await c(),{imported:b.imported,usernames:b.usernames}},[c]);return{githubAccounts:t,githubAccountsLoading:o,loadGitHubAccounts:c,addGitHubAccount:u,updateGitHubAccount:p,removeGitHubAccount:m,importGitHubAccounts:g,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function m9(){const[t,s]=y.useState(""),[o,r]=y.useState(void 0),[c,d]=y.useState({}),{pluginNames:u}=Cd(),p=P$(u),m=W$(),g=Q$(),v=e9(),b=t9(),_=n9(),k=s9(),S=a9(),j=i9(),T=o9(),w=r9(),C=c9(),D=d9(),R=u9(),E=f9(),M=p9(),O=[...p.has("environments")?[m.domainHook]:[],...p.has("sessions")?[g.domainHook]:[],...p.has("workspaces")?[v.domainHook]:[],...p.has("tasks")?[b.domainHook]:[],...p.has("tokens")?[_.domainHook]:[],...p.has("credentials")?[k.domainHook]:[],...p.has("codespaces")?[S.domainHook]:[],...p.has("dockerContainers")?[j.domainHook]:[],...p.has("personas")?[T.domainHook]:[],...p.has("schedules")?[w.domainHook]:[],...p.has("knowledge")?[C.domainHook]:[],...p.has("notifications")?[D.domainHook]:[],...p.has("streams")?[R.domainHook]:[],...p.has("plugins")?[E.domainHook]:[],M.domainHook],{connectionStatus:A}=O$({onSessionEvent:F=>{g.handleSessionEvent({sessionId:F.sessionId,eventType:y_(F.type),timestamp:F.timestamp,content:F.content,raw:F.raw||void 0})},onDomainEvent:F=>{try{const ge=JSON.parse(F.payloadJson);Z({id:F.id,type:F.type,timestamp:F.timestamp,payload:ge})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",F.payloadJson)}},onConnect:ae,onDisconnect:H}),$="default_persona_id",Y="onboarding_completed",V=y.useCallback(async F=>{const ge=await $e.setSetting({key:$,value:F});s(ge.value)},[]),ee=y.useCallback(async()=>{r(!0);try{await $e.setSetting({key:Y,value:"true"})}catch{}},[]),le=y.useCallback(async(F,ge)=>{try{const ne=await $e.getUsage({scope:F,id:ge}),ce=`${F}:${ge}`;d(me=>({...me,[ce]:Z$(ne)}))}catch{}},[]);function Z(F){const ge=F.payload.key,ne=F.payload.value;if(F.type==="setting.changed"){ge===$&&s(ne??""),ge===Y&&r(ne==="true");return}for(const ce of O)if(ce.handleEvent(F))break;(F.type==="environment.removed"||F.type==="task.started")&&g.loadSessions().catch(()=>{}),(F.type==="session.started"||F.type==="session.stopped")&&R.loadStreams().catch(()=>{})}async function ae(){for(const F of O)F.onConnect().catch(()=>{});try{const F=await $e.getSetting({key:$});s(F.value)}catch{}try{const F=await $e.getSetting({key:Y});r(F.value==="true")}catch{}}function H(){O.forEach(F=>F.onDisconnect())}const B=y.useCallback(()=>{m.loadEnvironments().catch(()=>{}),g.loadSessions().catch(()=>{}),v.loadWorkspaces().catch(()=>{}),_.loadTokens().catch(()=>{})},[m.loadEnvironments,g.loadSessions,v.loadWorkspaces,_.loadTokens]);return{connectionStatus:A,environments:{environments:m.environments,environmentsLoading:m.environmentsLoading,provisionStatus:m.provisionStatus,operationError:m.operationError,clearOperationError:m.clearOperationError,loadEnvironments:m.loadEnvironments,addEnvironment:m.addEnvironment,updateEnvironment:m.updateEnvironment,provisionEnvironment:m.provisionEnvironment,stopEnvironment:m.stopEnvironment,removeEnvironment:m.removeEnvironment,domainHook:m.domainHook},sessions:{sessions:g.sessions,sessionsLoading:g.sessionsLoading,events:g.events,eventsDropped:g.eventsDropped,lastSpawnedId:g.lastSpawnedId,taskSessions:g.taskSessions,spawn:g.spawn,sendInput:g.sendInput,kill:g.kill,stopGraceful:g.stopGraceful,loadSessionEvents:g.loadSessionEvents,clearEvents:g.clearEvents,loadTaskSessions:g.loadTaskSessions,domainHook:g.domainHook},workspaces:{workspaces:v.workspaces,workspacesLoading:v.workspacesLoading,workspaceCreating:v.workspaceCreating,loadWorkspaces:v.loadWorkspaces,createWorkspace:v.createWorkspace,archiveWorkspace:v.archiveWorkspace,updateWorkspace:v.updateWorkspace,linkEnvironment:v.linkEnvironment,unlinkEnvironment:v.unlinkEnvironment,linkOperationError:v.linkOperationError,clearLinkOperationError:v.clearLinkOperationError,domainHook:v.domainHook},tasks:{tasks:b.tasks,tasksLoading:b.tasksLoading,taskStartingId:b.taskStartingId,loadTasks:b.loadTasks,loadAllTasks:b.loadAllTasks,createTask:b.createTask,startTask:b.startTask,stopTask:b.stopTask,completeTask:b.completeTask,resumeTask:b.resumeTask,updateTask:b.updateTask,deleteTask:b.deleteTask,domainHook:b.domainHook},tokens:{tokens:_.tokens,tokensLoading:_.tokensLoading,loadTokens:_.loadTokens,setToken:_.setToken,deleteToken:_.deleteToken,domainHook:_.domainHook},credentials:{credentialProviders:k.credentialProviders,credentialsLoading:k.credentialsLoading,updateCredentialProviders:k.updateCredentialProviders,domainHook:k.domainHook},codespaces:{codespaces:S.codespaces,codespaceError:S.codespaceError,codespaceListError:S.codespaceListError,codespaceCreating:S.codespaceCreating,listCodespaces:S.listCodespaces,createCodespace:S.createCodespace,domainHook:S.domainHook},dockerContainers:{dockerContainers:j.dockerContainers,dockerContainersError:j.dockerContainersError,listDockerContainers:j.listDockerContainers,domainHook:j.domainHook},personas:{personas:T.personas,personasLoading:T.personasLoading,createPersona:T.createPersona,updatePersona:T.updatePersona,deletePersona:T.deletePersona,domainHook:T.domainHook},schedules:{schedules:w.schedules,schedulesLoading:w.schedulesLoading,createSchedule:w.createSchedule,updateSchedule:w.updateSchedule,deleteSchedule:w.deleteSchedule,domainHook:w.domainHook},streams:{streams:R.streams,streamsLoading:R.streamsLoading,streamsLoadedOnce:R.streamsLoadedOnce,streamsLoadError:R.streamsLoadError,loadStreams:R.loadStreams,domainHook:R.domainHook},knowledge:C,plugins:{plugins:E.plugins,pluginsLoading:E.pluginsLoading,loadPlugins:E.loadPlugins,setPluginEnabled:E.setPluginEnabled},githubAccounts:{githubAccounts:M.githubAccounts,githubAccountsLoading:M.githubAccountsLoading,loadGitHubAccounts:M.loadGitHubAccounts,addGitHubAccount:M.addGitHubAccount,updateGitHubAccount:M.updateGitHubAccount,removeGitHubAccount:M.removeGitHubAccount,importGitHubAccounts:M.importGitHubAccounts},appDefaultPersonaId:t,setAppDefaultPersonaId:V,onboardingCompleted:o,completeOnboarding:ee,usageCache:c,loadUsage:le,refresh:B}}function h9({children:t}){const s=m9();return i.jsx(ih.Provider,{value:s,children:t})}function g9(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);p&&p.status!==u.status&&(u.status==="sleeping"||u.status==="connecting"||(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")))}for(const u of r)d.has(u.id)||s("Environment removed","info")},[t,s])}function v9(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 y9={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 b9(t){return y9[t]}function _9(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=b9(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 x9(t,s){const o=y.useRef(void 0);y.useEffect(()=>{const r=o.current;o.current=t;const c=_9(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const k9="_dashboard_16pzm_1",S9="_kpiStrip_16pzm_11",j9="_kpiCard_16pzm_23",T9="_kpiValue_16pzm_68",w9="_kpiLabel_16pzm_76",N9="_bodyGrid_16pzm_84",C9="_section_16pzm_96",E9="_sectionHeader_16pzm_109",A9="_sectionIcon_16pzm_118",D9="_sectionTitle_16pzm_123",M9="_sectionCount_16pzm_131",R9="_sectionBody_16pzm_138",I9="_emptyHint_16pzm_143",O9="_sessionRow_16pzm_150",B9="_sessionPrompt_16pzm_177",L9="_sessionEnv_16pzm_186",z9="_sessionRuntime_16pzm_192",$9="_sessionStatus_16pzm_198",H9="_statusDot_16pzm_207",P9="_attentionRow_16pzm_233",U9="_attentionTitle_16pzm_259",V9="_attentionMeta_16pzm_267",q9="_reasonBadge_16pzm_274",G9="_bottomGrid_16pzm_301",F9="_envRow_16pzm_312",K9="_envName_16pzm_323",Z9="_envStatusBadge_16pzm_333",Y9="_workspaceRow_16pzm_369",J9="_workspaceTop_16pzm_395",W9="_workspaceName_16pzm_401",X9="_workspaceCounts_16pzm_407",Q9="_progressBar_16pzm_415",eH="_progressFill_16pzm_422",he={dashboard:k9,kpiStrip:S9,kpiCard:j9,kpiValue:T9,kpiLabel:w9,bodyGrid:N9,section:C9,sectionHeader:E9,sectionIcon:A9,sectionTitle:D9,sectionCount:M9,sectionBody:R9,emptyHint:I9,sessionRow:O9,sessionPrompt:B9,sessionEnv:L9,sessionRuntime:z9,sessionStatus:$9,statusDot:H9,attentionRow:P9,attentionTitle:U9,attentionMeta:V9,reasonBadge:q9,bottomGrid:G9,envRow:F9,envName:K9,envStatusBadge:Z9,workspaceRow:Y9,workspaceTop:J9,workspaceName:W9,workspaceCounts:X9,progressBar:Q9,progressFill:eH};function tH(){return i.jsxs("div",{className:he.dashboard,"aria-hidden":"true",children:[i.jsx("div",{className:he.kpiStrip,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:he.kpiCard,children:[i.jsx(Te,{width:"3rem",height:"2rem"}),i.jsx(Te,{width:"80%",height:"0.75rem"})]},s))}),i.jsxs("div",{className:he.bodyGrid,children:[i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:3},(t,s)=>i.jsxs("div",{className:he.sessionRow,style:{cursor:"default"},children:[i.jsx(Te,{width:"60%",height:"0.875rem"}),i.jsx(Te,{width:"4rem",height:"0.75rem"}),i.jsx(Te,{width:"3rem",height:"0.75rem"}),i.jsx(Te,{width:"3rem",height:"0.75rem"})]},s))})]}),i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:he.attentionRow,style:{cursor:"default"},children:[i.jsxs("div",{className:he.attentionTitle,children:[i.jsx(Te,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"70%",height:"0.875rem"})]}),i.jsx("div",{className:he.attentionMeta,children:i.jsx(Te,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),i.jsxs("div",{className:he.bottomGrid,children:[i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"9rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:he.envRow,children:[i.jsx(Te,{width:"60%",height:"0.875rem"}),i.jsx(Te,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"6rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:he.workspaceRow,style:{cursor:"default"},children:[i.jsxs("div",{className:he.workspaceTop,children:[i.jsx(Te,{width:"50%",height:"0.875rem"}),i.jsx(Te,{width:"2rem",height:"0.75rem"})]}),i.jsx("div",{className:he.progressBar,children:i.jsx("div",{className:he.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const nH={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 sH(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($t.div,{className:he.kpiCard,"data-accent":o,"data-testid":c,variants:nH,initial:"hidden",animate:"visible",custom:r,children:[i.jsx("span",{className:he.kpiValue,children:t}),i.jsx("span",{className:he.kpiLabel,children:s})]})}function aH(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:o,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:p,environmentsLoading:m}}=ut(),g=vt(),v=y.useRef(new Set);y.useEffect(()=>{for(const T of t)v.current.has(T.id)||(v.current.add(T.id),c(T.id).catch(()=>{}))},[t,c]);const b=y.useMemo(()=>_$(d,o,p),[d,o,p]),_=y.useMemo(()=>k$(d,p),[d,p]),k=y.useMemo(()=>x$(o,t),[o,t]),S=y.useMemo(()=>S$(t,o),[t,o,p]);return d.length===0&&o.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?i.jsx(tH,{}):i.jsxs("div",{className:he.dashboard,"data-testid":"dashboard",children:[i.jsxs("div",{className:he.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:he.bodyGrid,children:[i.jsxs($t.div,{className:he.section,variants:qc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"●"}),i.jsx("span",{className:he.sectionTitle,children:"Active Sessions"}),i.jsx("span",{className:he.sectionCount,children:_.length})]}),i.jsx("div",{className:he.sectionBody,children:_.length===0?i.jsx("div",{className:he.emptyHint,children:"No active sessions"}):_.map(({session:T,environmentName:w})=>i.jsxs("button",{type:"button",className:he.sessionRow,onClick:()=>g(xm(T.id)),"data-testid":"session-row",children:[i.jsx("span",{className:he.sessionPrompt,title:T.prompt,children:T.prompt||"—"}),i.jsx("span",{className:he.sessionEnv,children:w}),i.jsx("span",{className:he.sessionRuntime,children:T.runtime}),i.jsxs("span",{className:he.sessionStatus,children:[i.jsx("span",{className:he.statusDot,"data-status":T.status}),T.status]})]},T.id))})]}),i.jsxs($t.div,{className:he.section,variants:qc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"⚑"}),i.jsx("span",{className:he.sectionTitle,children:"Needs Attention"}),i.jsx("span",{className:he.sectionCount,children:k.length})]}),i.jsx("div",{className:he.sectionBody,children:k.length===0?i.jsx("div",{className:he.emptyHint,children:"All clear"}):k.map(({task:T,reason:w,workspaceName:C})=>i.jsxs("button",{type:"button",className:he.attentionRow,onClick:()=>g(os(T.id)),"data-testid":"attention-row",children:[i.jsxs("div",{className:he.attentionTitle,children:[i.jsx("span",{className:he.reasonBadge,"data-reason":w,children:w}),T.title]}),i.jsx("div",{className:he.attentionMeta,children:i.jsx("span",{children:C})})]},T.id))})]})]}),i.jsxs("div",{className:he.bottomGrid,children:[i.jsxs($t.div,{className:he.section,variants:qc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"◈"}),i.jsx("span",{className:he.sectionTitle,children:"Environment Health"}),i.jsx("span",{className:he.sectionCount,children:p.length})]}),i.jsx("div",{className:he.sectionBody,children:p.length===0?i.jsx("div",{className:he.emptyHint,children:"No environments configured"}):p.map(T=>i.jsxs("div",{className:he.envRow,"data-testid":"dashboard-env-row",children:[i.jsx("span",{className:he.envName,children:T.displayName}),i.jsx("span",{className:he.envStatusBadge,"data-status":T.status,children:T.status})]},T.id))})]}),i.jsxs($t.div,{className:he.section,variants:qc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"▦"}),i.jsx("span",{className:he.sectionTitle,children:"Workspaces"}),i.jsx("span",{className:he.sectionCount,children:t.length})]}),i.jsx("div",{className:he.sectionBody,children:S.length===0?i.jsx("div",{className:he.emptyHint,children:"No workspaces yet"}):S.map(({workspace:T,totalTasks:w,completedTasks:C,workingTasks:D,failedTasks:R})=>{const E=w>0?Math.round(C/w*100):0;return i.jsxs("button",{type:"button",className:he.workspaceRow,onClick:()=>g(ji(T.id,T.linkedEnvironmentIds[0])),"data-testid":"workspace-row",children:[i.jsxs("div",{className:he.workspaceTop,children:[i.jsx("span",{className:he.workspaceName,children:T.name}),i.jsxs("span",{className:he.workspaceCounts,"aria-label":sH(C,w,D,R),children:[C,"/",w,D>0&&i.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",D]}),R>0&&i.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",R]})]})]}),w>0&&i.jsx("div",{className:he.progressBar,children:i.jsx("div",{className:he.progressFill,style:{width:`${E}%`}})})]},T.id)})})]})]})]})}const iH="_panelContainer_1udy7_1",oH="_emptyState_1udy7_8",rH="_workspaceSummary_1udy7_17",lH="_workspaceSummaryTitle_1udy7_28",cH="_workspaceSummarySubtitle_1udy7_32",dH="_header_1udy7_36",uH="_headerInfo_1udy7_71",fH="_headerTitle_1udy7_106",pH="_taskStatusBadge_1udy7_128",mH="_taskBranch_1udy7_137",hH="_taskBlockedBadge_1udy7_143",gH="_tabBar_1udy7_277",vH="_tab_1udy7_277",yH="_active_1udy7_303",bH="_eventScroll_1udy7_308",_H="_overviewContent_1udy7_325",xH="_overviewDashboard_1udy7_334",kH="_overviewHero_1udy7_340",SH="_overviewSection_1udy7_347",jH="_overviewLabel_1udy7_353",TH="_envRow_1udy7_360",wH="_timeline_1udy7_366",NH="_timelineRow_1udy7_372",CH="_waitingMessage_1udy7_379",EH="_errorMessage_1udy7_383",AH="_emptyCta_1udy7_387",DH="_ctaTitle_1udy7_399",MH="_ctaDescription_1udy7_405",RH="_ctaButton_1udy7_412",IH="_workspaceHeader_1udy7_533",OH="_workspaceName_1udy7_558",BH="_workspaceMeta_1udy7_571",LH="_metaRow_1udy7_579",zH="_metaLabel_1udy7_592",$H="_metaValue_1udy7_607",HH="_archiveButton_1udy7_617",PH="_repoLink_1udy7_647",UH="_metaToggle_1udy7_657",VH="_metaToggleArrow_1udy7_678",qH="_metaToggleArrowOpen_1udy7_683",GH="_progressBarContainer_1udy7_687",FH="_progressBar_1udy7_687",KH="_progressFill_1udy7_703",ZH="_progressLabel_1udy7_710",YH="_metaTimestamps_1udy7_717",JH="_metaTimestamp_1udy7_717",WH="_metaPlaceholder_1udy7_739",XH="_linkedEnvList_1udy7_744",QH="_linkedEnvChip_1udy7_750",eP="_chipDismiss_1udy7_762",tP="_linkError_1udy7_777",nP="_linkEnvSelect_1udy7_782",W={panelContainer:iH,emptyState:oH,workspaceSummary:rH,workspaceSummaryTitle:lH,workspaceSummarySubtitle:cH,header:dH,headerInfo:uH,headerTitle:fH,taskStatusBadge:pH,taskBranch:mH,taskBlockedBadge:hH,tabBar:gH,tab:vH,active:yH,eventScroll:bH,overviewContent:_H,overviewDashboard:xH,overviewHero:kH,overviewSection:SH,overviewLabel:jH,envRow:TH,timeline:wH,timelineRow:NH,waitingMessage:CH,errorMessage:EH,emptyCta:AH,ctaTitle:DH,ctaDescription:MH,ctaButton:RH,workspaceHeader:IH,workspaceName:OH,workspaceMeta:BH,metaRow:LH,metaLabel:zH,metaValue:$H,archiveButton:HH,repoLink:PH,metaToggle:UH,metaToggleArrow:VH,metaToggleArrowOpen:qH,progressBarContainer:GH,progressBar:FH,progressFill:KH,progressLabel:ZH,metaTimestamps:YH,metaTimestamp:JH,metaPlaceholder:WH,linkedEnvList:XH,linkedEnvChip:QH,chipDismiss:eP,linkError:tP,linkEnvSelect:nP};function sP(){return i.jsx("div",{className:W.emptyState,children:"Select a task or click + to create one"})}function aP(){return i.jsx("div",{className:W.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function iP(){const{workspaces:{workspaces:t},environments:{environments:s}}=ut(),o=vt(),r=s.length>0;return t.length>0?i.jsx(aH,{}):i.jsxs("div",{className:W.emptyCta,"data-testid":"welcome-cta",children:[i.jsx("div",{className:W.ctaTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:W.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),i.jsx("button",{className:W.ctaButton,onClick:()=>o(F_),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&i.jsx("div",{className:W.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const oP="_panelContainer_1rih4_1",rP="_chatHeader_1rih4_9",lP="_chatHeaderInfo_1rih4_38",cP="_chatHeaderActions_1rih4_44",dP="_emptyState_1rih4_64",uP="_emptyTitle_1rih4_76",fP="_emptyDescription_1rih4_82",pP="_emptyHint_1rih4_88",aa={panelContainer:oP,chatHeader:rP,chatHeaderInfo:lP,chatHeaderActions:cP,emptyState:dP,emptyTitle:uP,emptyDescription:fP,emptyHint:pP};function o_(){return i.jsx("div",{className:aa.panelContainer,"aria-hidden":"true",children:i.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(Te,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function mP({hasLocalEnvironment:t}){return i.jsxs("div",{className:aa.emptyState,"data-testid":"chat-empty-state",children:[i.jsx("div",{className:aa.emptyTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:aa.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:aa.emptyHint,children:"Go to Settings → Environments to add one."})]})}function hP(){const t=lh(),{tasks:{tasks:s,tasksLoading:o,startTask:r},sessions:{sessions:c,sessionsLoading:d,events:u,eventsDropped:p,taskSessions:m,loadTaskSessions:g,loadSessionEvents:v,kill:b,stopGraceful:_,sendInput:k,spawn:S},environments:{environments:j,provisionEnvironment:T},personas:{personas:w}}=ut(),{showToast:C}=pn(),D=y.useRef(void 0),[R,E]=y.useState(),M=s.find(le=>le.id===Nc),O=M!=null&&M.latestSessionId?c.find(le=>le.id===M.latestSessionId)??(m[Nc]??[]).find(le=>le.id===M.latestSessionId):void 0;y.useEffect(()=>{g(Nc).catch(()=>{})},[M==null?void 0:M.latestSessionId,g]),y.useEffect(()=>{O&&O.id!==D.current&&(D.current=O.id,v(O.id).catch(()=>{}))},[O==null?void 0:O.id,v]);const A=y.useMemo(()=>{if(!O)return[];const le=u.filter(Z=>Z.sessionId===O.id);return rh(oh(le))},[u,O==null?void 0:O.id]),$=j.find(le=>le.adapterType==="local"&&le.status==="connected"),Y=O!==void 0&&O.status!=="stopped"&&O.status!=="suspended",V=(O==null?void 0:O.status)==="idle";y.useEffect(()=>{R&&O&&V&&(k(O.id,R).catch(()=>{C("Failed to send message","error")}),E(void 0))},[R,V,O==null?void 0:O.id,k,C]);const ee=y.useCallback((le,Z,ae,H)=>{H&&E(H),r(le,Z,ae).catch(()=>{})},[r]);return!M&&(d||o)?i.jsx(o_,{}):M!=null&&M.latestSessionId&&!O?i.jsx(o_,{}):i.jsxs("div",{className:aa.panelContainer,"data-testid":"chat-page",children:[Y&&i.jsxs("div",{className:aa.chatHeader,children:[i.jsxs("span",{className:aa.chatHeaderInfo,children:["Session: ",O.id.slice(0,8)," | ",O.runtime," | ",O.status]}),i.jsx("div",{className:aa.chatHeaderActions,children:i.jsx(Z_,{label:"Stop",onClick:()=>{_(O.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{_(O.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{b(O.id).catch(()=>{})}}]})})]}),i.jsx(sh,{events:A,eventsDropped:p,sandboxProxyUrl:t,emptyState:i.jsx(mP,{hasLocalEnvironment:!!$}),onShowToast:C}),$&&i.jsx(hd,{mode:Y?"send":"start",sessionId:Y?O.id:void 0,taskId:Nc,environmentId:Y?O.environmentId:$.id,personas:w,environments:j,onSendInput:(le,Z)=>{k(le,Z).catch(()=>{C("Failed to send message","error")})},onSpawn:(le,Z,ae)=>{S(le,Z,ae).catch(()=>{})},onStartTask:ee,onProvisionEnvironment:le=>{T(le).catch(()=>{})},onShowToast:C})]})}const gP="_container_1jtgv_1",vP={container:gP};function yP(){const{streams:{streams:t,streamsLoading:s,streamsLoadedOnce:o,streamsLoadError:r,loadStreams:c},sessions:{sessions:d},tasks:{tasks:u}}=ut(),[p,m]=y.useState(!1),[g,v]=y.useState(void 0),b=y.useRef(!1);y.useEffect(()=>{if(!b.current){b.current=!0;return}c(p).catch(()=>{})},[p,c]);const _=y.useCallback(()=>{c(p).catch(()=>{})},[c,p]),k=g!==void 0?t.find(S=>S.id===g):void 0;return i.jsxs("div",{className:vP.container,"data-testid":"coordination-page",children:[i.jsx(L7,{streams:t,sessions:d,tasks:u,loading:s,loadError:r,loadedOnce:o,showInternals:p,onToggleInternals:m,selectedStreamId:g,onSelectStream:v,onRefresh:_}),k&&i.jsx(mz,{stream:k,onClose:()=>v(void 0)})]})}function bP(){const t=h$(),[s]=_m(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=ut(),{showToast:g}=pn();return i.jsxs("div",{className:W.panelContainer,children:[i.jsx(fa,{segments:t}),i.jsx("div",{className:W.emptyState,children:"Enter a prompt below to start a new session"}),i.jsx(hd,{mode:"spawn",environmentId:o,showPersonaSelect:!0,personas:u,environments:p,onSendInput:(v,b)=>{r(v,b).catch(()=>{g("Failed to send message","error")})},onSpawn:(v,b,_)=>{c(v,b,_).catch(()=>{})},onStartTask:(v,b,_)=>{d(v,b,_).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:g})]})}function _P(){return i.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[i.jsxs("div",{className:W.header,children:[i.jsx("span",{children:i.jsx(Te,{width:"10rem",height:"0.875rem"})}),i.jsx("span",{className:W.headerInfo,children:i.jsx(Te,{width:"16rem",height:"0.875rem"})})]}),i.jsx("div",{className:W.eventScroll,children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(Te,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function xP({sessionId:t,session:s,isActive:o,onStop:r,onKill:c}){return i.jsxs("div",{className:W.header,children:[i.jsxs("span",{children:["Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costMillicents?` | ${Io((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${As(s.costMillicents??0)}`:""]}),i.jsxs("span",{className:W.headerInfo,children:[s&&i.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),o&&i.jsx(Z_,{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 kP({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?W.errorMessage:W.waitingMessage,children:o})}function SP(){const{sessionId:t}=ua(),s=lh(),{sessions:{events:o,eventsDropped:r,sessions:c,sessionsLoading:d,kill:u,stopGraceful:p,loadSessionEvents:m,sendInput:g,spawn:v},tasks:{startTask:b},personas:{personas:_},environments:{environments:k,provisionEnvironment:S}}=ut(),{showToast:j}=pn(),T=y.useRef(void 0),w=g$(t),C=c.find(E=>E.id===t)??void 0,D=y.useMemo(()=>{const E=t?o.filter(M=>M.sessionId===t):[];return rh(oh(E))},[o,t]);if(y.useEffect(()=>{t&&t!==T.current&&(T.current=t,m(t).catch(()=>{}))},[t,m]),!C&&d)return i.jsx(_P,{});if(!t)return i.jsx("div",{className:W.emptyState,children:"No session selected"});const R=(C==null?void 0:C.status)==="running"||(C==null?void 0:C.status)==="idle";return i.jsxs("div",{className:W.panelContainer,children:[i.jsx(fa,{segments:w}),i.jsx(xP,{sessionId:t,session:C,isActive:R,onStop:()=>{p(t).catch(()=>{})},onKill:()=>{u(t).catch(()=>{})}}),i.jsx(sh,{events:D,eventsDropped:r,emptyState:i.jsx(kP,{session:C}),onShowToast:j,sandboxProxyUrl:s,sessions:c,currentSessionId:t,environments:k,personas:_,onForward:(E,M)=>g(E,M)}),R&&i.jsx(hd,{mode:"send",sessionId:t,environmentId:C.environmentId,personas:_,environments:k,onSendInput:(E,M)=>{g(E,M).catch(()=>{j("Failed to send message","error")})},onSpawn:(E,M,O)=>{v(E,M,O).catch(()=>{})},onStartTask:(E,M,O)=>{b(E,M,O).catch(()=>{})},onProvisionEnvironment:E=>{S(E).catch(()=>{})},onShowToast:j})]})}function jP(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Ga(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&&jP(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 TP(){return i.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:W.workspaceHeader,children:i.jsx("span",{className:W.workspaceName,children:i.jsx(Te,{width:"12rem",height:"1.25rem"})})}),i.jsx("div",{className:W.metaToggle,style:{cursor:"default"},children:i.jsx(Te,{width:"4rem",height:"0.625rem"})}),i.jsxs("div",{className:W.progressBarContainer,children:[i.jsx("div",{className:W.progressBar,children:i.jsx("div",{className:W.progressFill,style:{width:"0%"}})}),i.jsx(Te,{width:"2rem",height:"0.625rem"})]}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("span",{className:`${W.tab} ${W.active}`,children:"Graph"}),i.jsx("span",{className:W.tab,children:"Board"}),i.jsx("span",{className:W.tab,children:"Tasks"})]}),i.jsx("div",{className:W.overviewContent,children:Array.from({length:3},(t,s)=>i.jsx(em,{lines:2},s))})]})}function r_(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 Ep=100;function wP(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function NP(){const{workspaceId:t,environmentId:s}=ua(),o=vt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:p,updateWorkspace:m,linkEnvironment:g,unlinkEnvironment:v,linkOperationError:b,clearLinkOperationError:_},personas:{personas:k},sessions:{sessions:S},usageCache:j,loadUsage:T}=ut(),{resolvedThemeId:w}=K1(),[C,D]=y.useState("tasks"),[R,E]=y.useState(!1),[M,O]=y.useState(null),[A,$]=y.useState(!1),Y=y.useRef(void 0),V=d.find(ne=>ne.id===t),ee=s??(V==null?void 0:V.linkedEnvironmentIds[0])??"",le=v$(t,ee,d,c);Ga({key:"1"},()=>D("graph")),Ga({key:"2"},()=>D("board")),Ga({key:"3"},()=>D("tasks")),y.useEffect(()=>{const ne=Y.current;Y.current=t,!(ne===void 0||ne===t)&&M!==null&&O(null)},[t,M]);const Z=S.reduce((ne,ce)=>ne+(ce.costMillicents??0),0);y.useEffect(()=>{t&&T("workspace",t).catch(()=>{})},[t,T,Z]);const ae=t?j[`workspace:${t}`]:void 0,H=r.filter(ne=>ne.workspaceId===t),B=H.filter(ne=>ne.status==="complete").length,F=H.length,ge=F>0?Math.round(B/F*100):0;return!V&&u?i.jsx(TP,{}):i.jsxs("div",{className:W.panelContainer,children:[i.jsx(fa,{segments:le}),i.jsxs("div",{className:W.workspaceHeader,children:[i.jsx("span",{className:W.workspaceName,"data-testid":"workspace-name",children:i.jsx(Bt,{value:(V==null?void 0:V.name)||"",onSave:ne=>{V&&m(V.id,{name:ne}).catch(()=>{})},validate:ne=>{const ce=ne.trim();if(!ce)return"Name is required";if(ce.length>Ep)return`Max ${Ep} characters`},maxLength:Ep,fieldId:"name",activeFieldId:M,onActivate:O,ariaLabel:"Workspace name",renderDisplay:ne=>ne||t||void 0,"data-testid":"edit-name"})}),i.jsx("button",{className:W.archiveButton,onClick:()=>E(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),i.jsxs("button",{className:W.metaToggle,onClick:()=>$(!A),"aria-expanded":!A,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[i.jsx("span",{className:`${W.metaToggleArrow} ${A?"":W.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!A&&i.jsxs("div",{className:W.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Description"}),i.jsx("div",{className:W.metaValue,children:i.jsx(tm,{value:(V==null?void 0:V.description)||"",onSave:ne=>{V&&m(V.id,{description:ne}).catch(()=>{})},fieldId:"description",activeFieldId:M,onActivate:O,renderDisplay:ne=>ne?i.jsx("span",{className:W.overviewMarkdown,children:i.jsx(cm,{remarkPlugins:[dm],children:ne})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Repository"}),i.jsx("div",{className:W.metaValue,children:i.jsx(Bt,{value:(V==null?void 0:V.repoUrl)||"",onSave:ne=>{V&&m(V.id,{repoUrl:ne}).catch(()=>{})},validate:ne=>{const ce=ne.trim();if(ce&&!/^https?:\/\/.+/.test(ce))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:M,onActivate:O,renderDisplay:ne=>{const ce=wP(ne);return ce?i.jsx("a",{className:W.repoLink,href:ce,target:"_blank",rel:"noopener noreferrer",onClick:me=>me.stopPropagation(),children:ne}):ne?i.jsx("span",{children:ne}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Environments"}),i.jsx("div",{className:W.metaValue,"data-testid":"linked-environments",children:V?i.jsxs("span",{className:W.linkedEnvList,children:[(()=>{const ne=[...new Set(V.linkedEnvironmentIds)];return ne.length===0?i.jsx("span",{className:W.metaPlaceholder,children:"None"}):ne.map(ce=>{const me=c.find(ke=>ke.id===ce);return i.jsxs("span",{className:W.linkedEnvChip,"data-testid":`linked-env-${ce}`,children:[(me==null?void 0:me.displayName)||ce,i.jsx("button",{className:W.chipDismiss,onClick:()=>{v(V.id,ce).catch(()=>{})},title:`Unlink ${(me==null?void 0:me.displayName)||ce}`,"aria-label":`Unlink ${(me==null?void 0:me.displayName)||ce}`,"data-testid":`unlink-env-${ce}`,disabled:ne.length<=1,children:"x"})]},ce)})})(),(()=>{const ne=new Set(V.linkedEnvironmentIds),ce=c.filter(me=>!ne.has(me.id));return ce.length===0?null:i.jsxs("select",{className:W.linkEnvSelect,value:"",onChange:me=>{me.target.value&&g(V.id,me.target.value).catch(()=>{})},"aria-label":"Link environment","data-testid":"link-env-select",children:[i.jsx("option",{value:"",children:"+ Link"}),ce.map(me=>i.jsx("option",{value:me.id,children:me.displayName||me.id},me.id))]})})(),b&&i.jsxs("span",{className:W.linkError,"data-testid":"link-operation-error",role:"alert",children:[b,i.jsx("button",{className:W.chipDismiss,onClick:_,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"x"})]})]}):i.jsx("span",{className:W.metaPlaceholder,children:"None"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Persona"}),i.jsx("div",{className:W.metaValue,children:i.jsx(ud,{value:(V==null?void 0:V.defaultPersonaId)||"",onSave:ne=>{V&&m(V.id,{defaultPersonaId:ne}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...k.map(ne=>({value:ne.id,label:ne.name}))],fieldId:"defaultPersonaId",activeFieldId:M,onActivate:O,renderDisplay:ne=>{const ce=k.find(me=>me.id===ne);if(ce)return i.jsx("span",{children:ce.name})},placeholder:(V==null?void 0:V.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Worktrees"}),i.jsx("div",{className:W.metaValue,children:i.jsx(A5,{checked:(V==null?void 0:V.useWorktrees)??!0,onChange:ne=>{V&&m(V.id,{useWorktrees:ne}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Working Dir"}),i.jsx("div",{className:W.metaValue,children:i.jsx(Bt,{value:(V==null?void 0:V.workingDirectory)||"",onSave:ne=>{V&&m(V.id,{workingDirectory:ne}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:M,onActivate:O,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),V&&i.jsxs("div",{className:W.metaTimestamps,children:[i.jsxs("span",{className:W.metaTimestamp,children:["Created ",r_(V.createdAt)]}),V.updatedAt&&V.updatedAt!==V.createdAt&&i.jsxs("span",{className:W.metaTimestamp,children:["· Updated ",r_(V.updatedAt)]})]})]}),F>0&&i.jsxs("div",{className:W.progressBarContainer,"data-testid":"progress-bar",children:[i.jsx("div",{className:W.progressBar,children:i.jsx("div",{className:W.progressFill,style:{width:`${ge}%`}})}),i.jsxs("span",{className:W.progressLabel,children:[B,"/",F]})]}),ae&&ae.costMillicents>0&&i.jsx("div",{className:W.progressBarContainer,children:i.jsxs("span",{className:W.progressLabel,children:["Usage: ",As(ae.costMillicents)," (",ae.sessionCount," session",ae.sessionCount!==1?"s":"",")"]})}),V&&(V.tokenBudget>0||V.costBudgetMillicents>0)&&i.jsx("div",{className:W.progressBarContainer,children:i.jsxs("span",{className:W.progressLabel,children:["Budget:"," ",V.tokenBudget>0&&i.jsxs(i.Fragment,{children:["Tokens: ",Io(((ae==null?void 0:ae.inputTokens)??0)+((ae==null?void 0:ae.outputTokens)??0))," / ",Io(V.tokenBudget)]}),V.tokenBudget>0&&V.costBudgetMillicents>0&&" | ",V.costBudgetMillicents>0&&i.jsxs(i.Fragment,{children:["Cost: ",As((ae==null?void 0:ae.costMillicents)??0)," / ",As(V.costBudgetMillicents)]})]})}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("button",{role:"tab","aria-selected":C==="graph",className:`${W.tab} ${C==="graph"?W.active:""}`,onClick:()=>D("graph"),children:"Graph"}),i.jsx("button",{role:"tab","aria-selected":C==="board",className:`${W.tab} ${C==="board"?W.active:""}`,onClick:()=>D("board"),"data-testid":"board-tab",children:"Board"}),i.jsx("button",{role:"tab","aria-selected":C==="tasks",className:`${W.tab} ${C==="tasks"?W.active:""}`,onClick:()=>D("tasks"),children:"Tasks"})]}),C==="tasks"&&F>0&&i.jsxs("div",{className:W.workspaceSummary,children:[i.jsx("span",{className:W.workspaceSummaryTitle,children:`${B}/${F} tasks complete`}),i.jsx("span",{className:W.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),C==="tasks"&&F===0&&i.jsxs("div",{className:W.emptyCta,children:[i.jsx("button",{className:W.ctaButton,onClick:()=>o(Ai(t,void 0,ee)),children:"Create Task"}),i.jsx("div",{className:W.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),C==="board"&&i.jsx(Hz,{workspaceId:t,environmentId:ee,tasks:r,sessions:S,personas:k,environments:c}),C==="graph"&&i.jsx(FN,{workspaceId:t,environmentId:ee,tasks:r,resolvedThemeId:w}),i.jsx(ys,{isOpen:R,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{V&&(p(V.id).catch(()=>{}),o("/",{replace:!0})),E(!1)},onCancel:()=>E(!1)})]})}const CP="_container_3pgew_1",EP="_header_3pgew_8",AP="_headerTitle_3pgew_35",DP="_headerActions_3pgew_44",MP="_body_3pgew_51",RP="_btnPrimary_3pgew_63",IP="_btnGhost_3pgew_94",OP="_error_3pgew_116",Va={container:CP,header:EP,headerTitle:AP,headerActions:DP,body:MP,btnPrimary:RP,btnGhost:IP,error:OP};function BP(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 LP=[{label:"Home",url:Ho},{label:"New Workspace",url:void 0}];function zP(){const[t]=_m(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=ut(),{showToast:u}=pn(),p=vt(),[m,g]=y.useState(()=>{var T;return Wz(void 0,s||((T=o[0])==null?void 0:T.id))}),[v,b]=y.useState(),[_,k]=y.useState();y.useEffect(()=>{s||m.environmentId||o.length===0||g(T=>{var w;return T.environmentId?T:{...T,environmentId:((w=o[0])==null?void 0:w.id)??""}})},[o,s,m.environmentId]);const S=()=>{const T=BP(m);if(T){b(T),k(void 0);return}b(void 0),k(void 0),c(m.name.trim(),m.description,m.repoUrl.trim(),m.environmentId,m.defaultPersonaId,m.useWorktrees,m.workingDirectory,w=>{u("Workspace created","success"),p(ji(w.id,w.linkedEnvironmentIds[0]??m.environmentId),{replace:!0})},w=>{k(w)}).catch(()=>{})},j=()=>{p(s?Ro(s):Ho,{replace:!0})};return i.jsxs("div",{className:Va.container,children:[i.jsxs("div",{className:Va.header,children:[i.jsx("div",{className:Va.headerTitle,children:i.jsx(fa,{segments:LP})}),i.jsxs("div",{className:Va.headerActions,children:[i.jsx("button",{className:Va.btnGhost,onClick:j,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),i.jsx("button",{className:Va.btnPrimary,onClick:S,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?i.jsx(T1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),i.jsxs("div",{className:Va.body,children:[i.jsx(Qz,{values:m,onChange:T=>{g(T),b(void 0),k(void 0)},environments:o,personas:r,errors:v,disabled:d,autoFocusName:!0}),_&&i.jsx("div",{className:Va.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function l_(){const{workspaceId:t,environmentId:s}=ua(),[o]=_m(),r=t??o.get("workspace")??"",c=o.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:p},workspaces:{workspaces:m},personas:{personas:g}}=ut(),{showToast:v}=pn();return i.jsx(z1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(b,_,k,S,j,T,w,C,D)=>{u(b,_,k,S,j,T,w,C,D).catch(()=>{})},onUpdateTask:(b,_,k,S,j)=>{p(b,_,k,S,j).catch(()=>{})},onShowToast:v})}function $P(){return i.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:W.header,children:i.jsxs("span",{className:W.headerTitle,children:[i.jsx(Te,{width:"12rem",height:"1rem"}),i.jsx(Te,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("span",{className:`${W.tab} ${W.active}`,children:"Overview"}),i.jsx("span",{className:W.tab,children:"Stream"})]}),i.jsx("div",{className:W.overviewContent,children:i.jsxs("div",{className:W.overviewDashboard,children:[i.jsx("div",{className:W.overviewHero,children:i.jsx(Te,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Description"}),i.jsx(Qp,{lines:2})]}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Environment"}),i.jsxs("div",{className:W.envRow,children:[i.jsx(Te,{width:"0.5rem",height:"0.5rem",variant:"circular"}),i.jsx(Te,{width:"8rem",height:"0.875rem"})]})]}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Dependencies"}),i.jsx(Qp,{lines:2})]}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Timeline"}),i.jsx("div",{className:W.timeline,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:W.timelineRow,children:[i.jsx(Te,{width:"4rem",height:"0.75rem"}),i.jsx(Te,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function To(){const{taskId:t,workspaceId:s,environmentId:o}=ua(),r=lh(),c=Jt(),d=vt(),{showToast:u}=pn(),{sessions:{events:p,eventsDropped:m,sessions:g,loadSessionEvents:v,taskSessions:b,loadTaskSessions:_,sendInput:k,spawn:S,kill:j},tasks:{tasks:T,tasksLoading:w,startTask:C,stopTask:D,resumeTask:R,deleteTask:E,createTask:M,updateTask:O},environments:{environments:A,provisionEnvironment:$},workspaces:{workspaces:Y},personas:{personas:V},usageCache:ee,loadUsage:le}=ut(),Z=y.useRef(void 0),ae=y.useRef(void 0),H=y.useRef(void 0),B=y.useRef(void 0),F=y.useRef(void 0),ge=c.pathname.endsWith("/stream")?"stream":"overview",ne=c.pathname.endsWith("/edit"),[ce,me]=y.useState(ge),[ke,De]=y.useState(!1),[ot,yt]=y.useState(void 0),[_e,Oe]=y.useState(""),[Ht,Nt]=y.useState(ne),ue=y.useRef(ge),Re=y.useRef(ne),Q=T.find(Ne=>Ne.id===t),et=(Q==null?void 0:Q.workspaceId)||void 0,re=Y.find(Ne=>Ne.id===et);y.useEffect(()=>{ge!==ue.current&&(ue.current=ge,ge!==ce&&me(ge))},[ge,ce]),y.useEffect(()=>{ne!==Re.current&&(Re.current=ne,ne!==Ht&&Nt(ne))},[ne,Ht]),y.useEffect(()=>{if(_e===""){if(re!=null&&re.linkedEnvironmentIds[0])Oe(re.linkedEnvironmentIds[0]);else if(A.length>0){const Ne=A.find(Ue=>Ue.status==="connected");Oe((Ne==null?void 0:Ne.id)??A[0].id)}}},[_e,re==null?void 0:re.linkedEnvironmentIds[0],A]);const ve=Q?b[Q.id]??[]:[];let Xe;ot&&ve.some(Ne=>Ne.id===ot)?Xe=ot:Xe=(Q==null?void 0:Q.latestSessionId)||void 0;const an=()=>{De(!0)},_s=()=>{if(!Q)return;E(Q.id).catch(()=>{}),De(!1);const Ne=o??(re==null?void 0:re.linkedEnvironmentIds[0]);d(Q.workspaceId&&Ne?ji(Q.workspaceId,Ne):"/",{replace:!0})};y.useEffect(()=>{(Q==null?void 0:Q.id)!==ae.current&&(ae.current=Q==null?void 0:Q.id,yt(void 0),Oe(""),Nt(ne))},[Q==null?void 0:Q.id,ne]),y.useEffect(()=>{if(!(Q!=null&&Q.id))return;const Ne=Q.id!==B.current,Ue=Q.latestSessionId!==F.current;(Ne||Ue)&&(B.current=Q.id,F.current=Q.latestSessionId,_(Q.id).catch(()=>{}))},[Q==null?void 0:Q.id,Q==null?void 0:Q.latestSessionId,_]),y.useEffect(()=>{if((Q==null?void 0:Q.status)!==H.current){const Ne=H.current===void 0;H.current=Q==null?void 0:Q.status;const Ue=(Q==null?void 0:Q.status)==="not_started"?"overview":(Q==null?void 0:Q.status)==="working"||(Q==null?void 0:Q.status)==="paused"?"stream":(Q==null?void 0:Q.status)==="complete"?"overview":void 0;Ue&&Ue!==ce&&!(Ne&&ge!=="overview")&&me(Ue)}},[Q==null?void 0:Q.status,ce,ge]);const ls=y.useMemo(()=>new Map(T.map(Ne=>[Ne.id,Ne])),[T]),Os=y.useMemo(()=>{const Ne=Xe?p.filter(Ue=>Ue.sessionId===Xe):[];return rh(oh(Ne))},[p,Xe]),pa=Q?Q.dependsOn.some(Ne=>{const Ue=ls.get(Ne);return Ue!==void 0&&Ue.status!=="complete"}):!1,Mi=y.useMemo(()=>y$(t,o,Y,A,ls),[t,o,Y,A,ls]);y.useEffect(()=>{Xe&&Xe!==Z.current&&(Z.current=Xe,v(Xe).catch(()=>{}))},[Xe,v]);const Wt=ve.reduce((Ne,Ue)=>Ne+(Ue.costMillicents??0),0);y.useEffect(()=>{Q&&(le("task",Q.id).catch(()=>{}),Q.childTaskIds.length>0&&le("task_tree",Q.id).catch(()=>{}))},[Q==null?void 0:Q.id,Q==null?void 0:Q.childTaskIds.length,le,Wt]);const Ja=Q?`task:${Q.id}`:"",Wa=Ja in ee?ee[Ja]:void 0,ma=Q?`task_tree:${Q.id}`:"",Bs=Q&&Q.childTaskIds.length>0&&ma in ee?ee[ma]:void 0,xs=Ne=>{me(Ne),d(os(t,Ne==="overview"?void 0:Ne,s,o))};return Ga({key:"1"},()=>xs("overview")),Ga({key:"2"},()=>xs("stream")),!Q&&w?i.jsx($P,{}):i.jsxs("div",{className:W.panelContainer,children:[i.jsx(fa,{segments:Mi}),i.jsxs("div",{className:W.header,children:[i.jsxs("span",{className:W.headerTitle,children:[i.jsx("span",{"data-testid":"task-title",children:(Q==null?void 0:Q.title)||t}),Q&&i.jsx("span",{className:W.taskStatusBadge,"data-testid":"task-status",children:Q.status}),(Q==null?void 0:Q.branch)&&i.jsx("span",{className:W.taskBranch,children:Q.branch}),pa&&i.jsx("span",{className:W.taskBlockedBadge,children:"blocked"})]}),Q&&i.jsx(tL,{task:Q,sessionId:Xe,isBlocked:pa,onStart:()=>{C(Q.id,void 0,_e).catch(Ne=>{const Ue=Ne instanceof ra?Ne.message:"Failed to start task";u(Ue,"error")})},onResume:()=>{R(Q.id).catch(()=>{})},onStop:()=>{D(Q.id).catch(()=>{})},onPause:()=>{Xe&&j(Xe).catch(()=>{})},onDelete:an,onEdit:()=>Nt(!0)})]}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("button",{role:"tab","aria-selected":ce==="overview",className:`${W.tab} ${ce==="overview"?W.active:""}`,onClick:()=>xs("overview"),children:"Overview"}),i.jsx("button",{role:"tab","aria-selected":ce==="stream",className:`${W.tab} ${ce==="stream"?W.active:""}`,onClick:()=>xs("stream"),children:"Stream"})]}),i.jsxs(as,{mode:"wait",children:[ce==="overview"&&i.jsx($t.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:W.overviewContent,"data-testid":"task-overview",children:Ht&&Q?i.jsx(z1,{mode:"edit",taskId:Q.id,workspaceId:et,environmentId:o,tasks:T,workspaces:Y,personas:V,onCreateTask:(Ne,Ue,_n,mn,Pt,Cn,Xt,Ri,Ii)=>{M(Ne,Ue,_n,mn,Pt,Cn,Xt,Ri,Ii).catch(()=>{})},onUpdateTask:(Ne,Ue,_n,mn,Pt)=>{O(Ne,Ue,_n,mn,Pt).catch(()=>{})},onEditDone:()=>{ne?d(os(Q.id,void 0,s,o),{replace:!0}):Nt(!1)},onShowToast:u}):Q?i.jsx(UL,{task:Q,tasksById:ls,environments:A,workspaces:Y,taskSessions:ve,selectedEnvId:_e,taskUsage:Wa,treeUsage:Bs}):i.jsx("div",{className:W.waitingMessage,children:"No additional details"})},"overview"),ce==="stream"&&i.jsxs($t.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(c6,{taskSessions:ve,selectedSessionId:Xe,onSelect:Ne=>yt(Ne)}),i.jsx(sh,{events:Os,eventsDropped:m,sandboxProxyUrl:r,emptyState:!Xe&&Q?pa?i.jsx("div",{className:W.emptyCta,"data-testid":"stream-blocked-message",children:i.jsx("div",{className:W.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):i.jsxs("div",{className:W.emptyCta,children:[i.jsx("button",{"data-testid":"stream-start-cta",className:W.ctaButton,onClick:()=>{C(Q.id,void 0,_e).catch(Ne=>{const Ue=Ne instanceof ra?Ne.message:"Failed to start task";u(Ue,"error")})},children:"Start Task"}),i.jsx("div",{className:W.ctaDescription,children:"Click to begin agent execution"})]}):Xe&&Os.length===0?i.jsx("div",{className:W.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:u})]},"stream")]}),(()=>{if(!Q||Q.status!=="working"&&Q.status!=="paused")return;const Ne=Xe?g.find(Ue=>Ue.id===Xe):void 0;if(!(!Ne||Ne.status==="stopped"))return i.jsx(hd,{mode:"send",sessionId:Ne.id,environmentId:Ne.environmentId,personas:V,environments:A,onSendInput:(Ue,_n)=>{k(Ue,_n).catch(()=>{u("Failed to send message","error")})},onSpawn:(Ue,_n,mn)=>{S(Ue,_n,mn,void 0,et).catch(()=>{})},onStartTask:(Ue,_n,mn)=>{C(Ue,_n,mn).catch(()=>{})},onProvisionEnvironment:Ue=>{$(Ue).catch(()=>{})},onShowToast:u})})(),Q&&i.jsx(ys,{isOpen:ke,title:"Delete Task?",description:`"${Q.title}" will be permanently removed.`,onConfirm:_s,onCancel:()=>De(!1)})]})}function HP(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:o},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:p,createCodespace:m},dockerContainers:{dockerContainers:g,dockerContainersError:v,listDockerContainers:b},githubAccounts:{githubAccounts:_}}=ut(),{showToast:k}=pn();return i.jsx($1,{mode:"new",environments:t,githubAccounts:_,onAddEnvironment:(S,j,T,w)=>{s(S,j,T,w).catch(()=>{})},onUpdateEnvironment:(S,j)=>{o(S,j).catch(()=>{})},onListCodespaces:S=>{p(S).catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(S,j)=>{m(S,j).catch(()=>{})},onListDockerContainers:()=>{b().catch(()=>{})},dockerContainers:g,dockerContainersError:v,onShowToast:k})}function PP(){const{environmentId:t}=ua(),{environments:{environments:s,addEnvironment:o,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,listCodespaces:m,createCodespace:g},dockerContainers:{dockerContainers:v,dockerContainersError:b,listDockerContainers:_},githubAccounts:{githubAccounts:k}}=ut(),{showToast:S}=pn();return i.jsx($1,{mode:"edit",environmentId:t,environments:s,githubAccounts:k,onAddEnvironment:(j,T,w,C)=>{o(j,T,w,C).catch(()=>{})},onUpdateEnvironment:(j,T)=>{r(j,T).catch(()=>{})},onListCodespaces:j=>{m(j).catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(j,T)=>{g(j,T).catch(()=>{})},onListDockerContainers:()=>{_().catch(()=>{})},dockerContainers:v,dockerContainersError:b,onShowToast:S})}const UP="_layout_11u79_1",VP="_content_11u79_8",qP="_tabPanel_11u79_14",Jr={layout:UP,content:VP,tabPanel:qP};function GP(){const t=m$();return i.jsxs("div",{className:Jr.layout,children:[i.jsx(fa,{segments:t}),i.jsx("div",{className:Jr.content,children:i.jsx(Ei,{})})]})}const FP="_container_144a4_1",KP="_envHeader_144a4_6",ZP="_envTitleRow_144a4_10",YP="_statusDot_144a4_16",JP="_envName_144a4_21",WP="_statusBadge_144a4_27",XP="_envMeta_144a4_33",QP="_metaTag_144a4_39",eU="_actions_144a4_51",tU="_provisionMessage_144a4_59",nU="_errorMessage_144a4_64",sU="_section_144a4_69",aU="_sectionHeader_144a4_73",iU="_cardList_144a4_121",oU="_card_144a4_121",rU="_cardHeader_144a4_138",lU="_cardName_144a4_144",cU="_cardActions_144a4_149",dU="_cardDescription_144a4_154",uU="_cardMeta_144a4_160",fU="_repoLink_144a4_166",pU="_empty_144a4_174",mU="_errorHint_144a4_180",hU="_btnPrimary_144a4_186",gU="_btnOutline_144a4_220",vU="_btnSmall_144a4_247",yU="_btnDanger_144a4_273",Me={container:FP,envHeader:KP,envTitleRow:ZP,statusDot:YP,envName:JP,statusBadge:WP,envMeta:XP,metaTag:QP,actions:eU,provisionMessage:tU,errorMessage:nU,section:sU,sectionHeader:aU,cardList:iU,card:oU,cardHeader:rU,cardName:lU,cardActions:cU,cardDescription:dU,cardMeta:uU,repoLink:fU,empty:pU,errorHint:mU,btnPrimary:hU,btnOutline:gU,btnSmall:vU,btnDanger:yU};function bU(){return i.jsxs("div",{className:Me.container,"aria-hidden":"true",children:[i.jsxs("div",{className:Me.envHeader,children:[i.jsxs("div",{className:Me.envTitleRow,children:[i.jsx(Te,{width:"0.875rem",height:"0.875rem",variant:"circular"}),i.jsx(Te,{width:"12rem",height:"1.5rem"}),i.jsx(Te,{width:"4rem",height:"0.875rem"})]}),i.jsxs("div",{className:Me.envMeta,children:[i.jsx(Te,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),i.jsxs("div",{className:Me.actions,children:[i.jsx(Te,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),i.jsxs("div",{className:Me.section,children:[i.jsx("div",{className:Me.sectionHeader,children:i.jsx("h3",{style:{margin:0},children:"Workspaces"})}),i.jsxs("div",{className:Me.cardList,children:[i.jsx(em,{lines:2}),i.jsx(em,{lines:2})]})]})]})}const _U={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function xU(){const{environmentId:t}=ua(),s=vt(),{environments:{environments:o,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:p},workspaces:{workspaces:m,archiveWorkspace:g,linkEnvironment:v,unlinkEnvironment:b,linkOperationError:_,clearLinkOperationError:k},sessions:{sessions:S}}=ut(),[j,T]=y.useState(!1),[w,C]=y.useState(!1),[D,R]=y.useState(void 0),E=o.find(B=>B.id===t);if(!E&&r)return i.jsx(bU,{});if(!t||!E)return i.jsx(zn,{to:Mo,replace:!0});const M=m.filter(B=>B.linkedEnvironmentIds.includes(E.id)),O=S.filter(B=>B.environmentId===E.id),A=O.reduce((B,F)=>B+(F.costMillicents??0),0),$=_U[E.status]||"var(--text-tertiary)",Y=E.status==="connected",V=E.status==="connecting",ee=E.status==="disconnected"||E.status==="error"||E.status==="sleeping",le=E.id in c?c[E.id]:void 0,Z=()=>{p(E.id).catch(()=>{}),T(!1),s(Mo,{replace:!0})},ae=()=>{C(!1),d(E.id,!0).catch(()=>{})},H=B=>{g(B).catch(()=>{}),R(void 0)};return i.jsxs("div",{className:Me.container,children:[i.jsx(ys,{isOpen:j,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:Z,onCancel:()=>T(!1)}),i.jsx(ys,{isOpen:w,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:ae,onCancel:()=>C(!1)}),i.jsxs("div",{className:Me.envHeader,children:[i.jsxs("div",{className:Me.envTitleRow,children:[i.jsx("span",{className:Me.statusDot,style:{color:$},children:"●"}),i.jsx("h2",{className:Me.envName,children:E.displayName||E.id}),i.jsx("span",{className:Me.statusBadge,style:{color:$},children:E.status})]}),i.jsxs("div",{className:Me.envMeta,children:[i.jsxs("span",{className:Me.metaTag,children:["Adapter: ",E.adapterType]}),O.length>0&&i.jsxs("span",{className:Me.metaTag,children:[O.length," session",O.length!==1?"s":""]}),A>0&&i.jsxs("span",{className:Me.metaTag,children:["Cost: ",As(A)]})]})]}),i.jsxs("div",{className:Me.actions,children:[Y&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:Me.btnPrimary,onClick:()=>s(U_(E.id)),children:"New Chat"}),i.jsx("button",{className:Me.btnOutline,onClick:()=>{u(E.id).catch(()=>{})},children:"Stop"}),i.jsx("button",{className:Me.btnOutline,onClick:()=>C(!0),disabled:le!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),ee&&i.jsx("button",{className:Me.btnPrimary,onClick:()=>{d(E.id).catch(()=>{})},children:E.status==="error"?"Retry":E.status==="sleeping"?"Wake":"Connect"}),V&&le!==void 0&&i.jsx("span",{className:Me.provisionMessage,children:le.message}),E.status==="error"&&(le==null?void 0:le.stage)==="error"&&i.jsx("span",{className:Me.errorMessage,children:le.message}),i.jsx("button",{className:Me.btnOutline,onClick:()=>s(BN(E.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),i.jsx("button",{className:Me.btnDanger,onClick:()=>T(!0),children:"Delete"})]}),i.jsxs("div",{className:Me.section,children:[i.jsxs("div",{className:Me.sectionHeader,children:[i.jsx("h3",{children:"Workspaces"}),i.jsx("button",{className:Me.btnPrimary,onClick:()=>s(`${F_}?environment=${encodeURIComponent(E.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"}),(()=>{const B=m.filter(F=>!F.linkedEnvironmentIds.includes(E.id)&&F.status==="active");return B.length===0?null:i.jsxs("select",{className:Me.btnPrimary,value:"",onChange:F=>{F.target.value&&v(F.target.value,E.id).catch(()=>{})},"aria-label":"Link a workspace","data-testid":"link-workspace-select",children:[i.jsx("option",{value:"",children:"+ Link Workspace"}),B.map(F=>i.jsx("option",{value:F.id,children:F.name},F.id))]})})()]}),_&&i.jsxs("p",{className:Me.errorHint,"data-testid":"link-operation-error",role:"alert",children:[_,i.jsx("button",{className:Me.btnSmall,onClick:k,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"Dismiss"})]}),M.length===0&&i.jsx("p",{className:Me.empty,"data-testid":"linked-workspaces-empty",children:"No workspaces yet. Create one to get started."}),i.jsx("div",{className:Me.cardList,"data-testid":"linked-workspaces-list",children:M.map(B=>i.jsx(kU,{workspace:B,confirmArchiveId:D,onOpen:()=>s(ji(B.id,E.id)),onArchive:()=>R(B.id),onConfirmArchive:()=>H(B.id),onCancelArchive:()=>R(void 0),onUnlink:()=>{b(B.id,E.id).catch(()=>{})}},B.id))})]})]})}function kU({workspace:t,confirmArchiveId:s,onOpen:o,onArchive:r,onConfirmArchive:c,onCancelArchive:d,onUnlink:u}){const p=s===t.id,m=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return i.jsxs("div",{className:Me.card,"data-testid":"workspace-card","data-workspace-id":t.id,children:[i.jsxs("div",{className:Me.cardHeader,children:[i.jsx("strong",{className:Me.cardName,children:t.name}),i.jsxs("div",{className:Me.cardActions,children:[i.jsx("button",{className:Me.btnSmall,onClick:o,children:"Open"}),i.jsx("button",{className:Me.btnSmall,onClick:u,disabled:t.linkedEnvironmentIds.length<=1,"data-testid":`unlink-workspace-${t.id}`,children:"Unlink"}),p?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:Me.btnDanger,onClick:c,children:"Confirm"}),i.jsx("button",{className:Me.btnSmall,onClick:d,children:"Cancel"})]}):i.jsx("button",{className:Me.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&i.jsx("p",{className:Me.cardDescription,children:t.description}),t.repoUrl&&i.jsx("div",{className:Me.cardMeta,children:m?i.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Me.repoLink,children:t.repoUrl}):i.jsx("span",{children:t.repoUrl})})]})}const SU={credentials:"Credentials","github-accounts":"GitHub Accounts",personas:"Personas",schedules:"Schedules",appearance:"Appearance",about:"About",shortcuts:"Shortcuts",plugins:"Plugins"};function jU(){const s=Jt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=SU[s],r=p$(o);return i.jsxs("div",{className:Jr.layout,children:[i.jsx(fa,{segments:r}),i.jsx("div",{className:Jr.content,children:i.jsx("div",{className:Jr.tabPanel,children:i.jsx(Ei,{})},s)})]})}function TU(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=ut(),{showToast:d}=pn();return i.jsxs(i.Fragment,{children:[i.jsx(x8,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),i.jsx(TB,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function wU(){const{githubAccounts:{githubAccounts:t,githubAccountsLoading:s,addGitHubAccount:o,updateGitHubAccount:r,removeGitHubAccount:c,importGitHubAccounts:d}}=ut(),{showToast:u}=pn();return i.jsx(qL,{githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u})}function NU(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=ut(),{showToast:c}=pn(),d=vt();return i.jsx(I8,{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(zN),onNavigateToPersona:u=>d(V_(u))})}const CU="_container_1ooin_1",EU="_form_1ooin_7",AU="_formActions_1ooin_75",DU="_editableSection_1ooin_82",MU="_defaultBadge_1ooin_93",RU="_typeToggle_1ooin_107",IU="_scriptEditor_1ooin_121",OU="_optional_1ooin_128",hs={container:CU,form:EU,formActions:AU,editableSection:DU,defaultBadge:MU,typeToggle:RU,scriptEditor:IU,optional:OU},c_=[{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)"}],d_=[{value:"genaiscript",label:"genaiscript"}],BU="0";function u_(){const{personaId:t}=ua(),s=vt(),{showToast:o}=pn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:p,setAppDefaultPersonaId:m}=ut(),g=t===void 0,v=g?void 0:r.find(_=>_.id===t);if(!g&&r.length>0&&!v)return i.jsx(zn,{to:Kf,replace:!0});const b=[{label:"Settings",url:xi},{label:"Personas",url:Kf},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return i.jsxs("div",{className:hs.container,children:[i.jsx(fa,{segments:b}),i.jsx(LU,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(Kf)},showToast:o})]})}function LU({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=vt(),[v,b]=y.useState((t==null?void 0:t.name)??""),[_,k]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.systemPrompt)??""),[T,w]=y.useState((t==null?void 0:t.runtime)??"claude-code"),[C,D]=y.useState((t==null?void 0:t.model)??"sonnet"),[R,E]=y.useState((t==null?void 0:t.maxTurns)??0),[M,O]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[A,$]=y.useState((t==null?void 0:t.script)??""),[Y,V]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[ee,le]=y.useState(!1),[Z,ae]=y.useState(null),[H,B]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!H){B(!0),b(t.name),k(t.description),j(t.systemPrompt);const ue=t.type==="script"?"script":"agent";w(ue==="script"?t.runtime||"genaiscript":t.runtime),D(t.model),E(t.maxTurns),O(ue),$(t.script||""),V(t.allowedMcpTools)}},[s,t,H]);const F=ue=>{O(ue),ue==="script"?w("genaiscript"):T==="genaiscript"&&w("claude-code")},ge=!s&&t===void 0,ne=v.trim().length>0&&!ge&&S.trim().length>0&&(M==="script"?A.trim().length>0:!!T&&!!C),ce=s&&ne,me=!s&&o===(t==null?void 0:t.id),ke=!s&&t&&!me&&M==="agent"&&!!T&&!!C,De=(ue,Re)=>{if(!ue.trim())return`${Re} is required`},ot=ue=>{if(ue.preventDefault(),!(ge||!ne)){if(t){c(t.id,v,_,S,T,C,R,M,A).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,_,S,T,C,R,M,A,Y).then(Re=>{m("Persona created","success"),g(V_(Re.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},yt=()=>{t&&d(t.id).then(()=>{m("Persona deleted","success"),p()},()=>{m("Failed to delete persona","error")})},_e=async(ue,Re,Q,et)=>ue().then(()=>{Re(),m(Q,"success")},()=>{m(et,"error")}),Oe=(ue,Re)=>{if(!t)return;const Q=ue==="type"?String(Re):M,et=ue==="runtime"?String(Re):ue==="type"?String(Re)==="script"?"genaiscript":T==="genaiscript"?"claude-code":T:T,re=ue==="model"?String(Re):C,ve=ue==="maxTurns"?Number(Re):R,Xe=ue==="systemPrompt"?String(Re):S,an=ue==="script"?String(Re):A;_e(()=>c(t.id,ue==="name"?String(Re):v,ue==="description"?String(Re):_,Xe,et,re,ve,Q,an),()=>{if(ue==="type"){const _s=String(Re)==="script"?"script":"agent";O(_s),w(et)}ue==="runtime"&&w(String(Re)),ue==="name"&&b(String(Re)),ue==="description"&&k(String(Re)),ue==="systemPrompt"&&j(String(Re)),ue==="model"&&D(String(Re)),ue==="maxTurns"&&E(Number(Re)),ue==="script"&&$(String(Re))},"Persona updated","Failed to update persona").catch(()=>{})},Ht=ue=>{ot(ue)},Nt=()=>{t&&u(t.id).then(()=>{m("Set as app default","success")},()=>{m("Failed to set app default","error")})};return i.jsxs(i.Fragment,{children:[ge?i.jsxs("div",{className:hs.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsx("p",{children:"Loading persona..."})]}):s?i.jsxs("form",{onSubmit:Ht,className:hs.form,children:[i.jsx("h3",{children:"Create Persona"}),i.jsxs("div",{className:hs.typeToggle,"data-testid":"persona-type-toggle",children:[i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:M==="agent",onChange:()=>F("agent")}),"Agent"]}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"script",checked:M==="script",onChange:()=>F("script")}),"Script"]})]}),i.jsxs("label",{children:["Name",i.jsx("input",{type:"text",value:v,onChange:ue=>b(ue.target.value),placeholder:M==="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:_,onChange:ue=>k(ue.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Runtime",i.jsx("select",{value:T,onChange:ue=>w(ue.target.value),"data-testid":"persona-runtime-select",children:(M==="script"?d_:c_).map(ue=>i.jsx("option",{value:ue.value,children:ue.label},ue.value))})]}),M==="agent"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model",i.jsx("input",{type:"text",value:C,onChange:ue=>D(ue.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx("input",{type:"number",value:R,onChange:ue=>E(parseInt(ue.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:S,onChange:ue=>j(ue.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),M==="script"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model ",i.jsx("span",{className:hs.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:C,onChange:ue=>D(ue.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:S,onChange:ue=>j(ue.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:A,onChange:ue=>$(ue.target.value),placeholder:`script({ model: "openai:gpt-4o" });
742
+
743
+ const grackle = await host.mcpServer({
744
+ id: "grackle",
745
+ url: env.vars.GRACKLE_MCP_URL,
746
+ });
747
+
748
+ $\`Summarize the current tasks.\`;`,rows:20,className:hs.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),M==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(Zb,{selectedTools:Y,onChange:V})]}),i.jsxs("div",{className:hs.formActions,children:[i.jsx(sn,{type:"submit",variant:"primary",size:"md",disabled:!ce,"data-testid":"persona-detail-save",children:"Create"}),i.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:hs.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsxs("div",{className:hs.formActions,children:[i.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),ke&&i.jsx(sn,{type:"button",variant:"ghost",size:"md",onClick:Nt,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),me&&i.jsx("span",{className:hs.defaultBadge,children:"App Default"}),i.jsx(sn,{type:"button",variant:"danger",size:"md",onClick:()=>le(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:hs.editableSection,children:[i.jsxs("label",{children:["Name",i.jsx(Bt,{value:v,onSave:ue=>{Oe("name",ue)},validate:ue=>De(ue,"Name"),fieldId:"persona-name",activeFieldId:Z,onActivate:ae,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx(Bt,{value:_,onSave:ue=>{Oe("description",ue)},fieldId:"persona-description",activeFieldId:Z,onActivate:ae,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Type",i.jsx(ud,{value:M,onSave:ue=>{Oe("type",ue)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:Z,onActivate:ae,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),i.jsxs("label",{children:["Runtime",i.jsx(ud,{value:T,onSave:ue=>{Oe("runtime",ue)},options:M==="script"?d_:c_,fieldId:"persona-runtime",activeFieldId:Z,onActivate:ae,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),i.jsxs("label",{children:["Model",M==="script"?" (optional)":"",i.jsx(Bt,{value:C,onSave:ue=>{Oe("model",ue)},validate:M==="agent"?ue=>De(ue,"Model"):void 0,fieldId:"persona-model",activeFieldId:Z,onActivate:ae,placeholder:M==="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(Bt,{value:String(R),onSave:ue=>{Oe("maxTurns",parseInt(ue,10)||0)},validate:ue=>/^\d+$/.test(ue.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:Z,onActivate:ae,placeholder:BU,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx(tm,{value:S,onSave:ue=>{Oe("systemPrompt",ue)},validate:ue=>De(ue,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:Z,onActivate:ae,placeholder:M==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),M==="script"&&i.jsxs("label",{children:["Script",i.jsx(tm,{value:A,onSave:ue=>{Oe("script",ue)},validate:ue=>De(ue,"Script"),fieldId:"persona-script",activeFieldId:Z,onActivate:ae,placeholder:`script({ model: "openai:gpt-4o" });
749
+
750
+ const grackle = await host.mcpServer({
751
+ id: "grackle",
752
+ url: env.vars.GRACKLE_MCP_URL,
753
+ });
754
+
755
+ $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),M==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(Zb,{selectedTools:Y,onChange:ue=>{V(ue),_e(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,ue),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!ke&&!me&&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(ys,{isOpen:ee,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:yt,onCancel:()=>le(!1)})]})}function zU(){const{schedules:{schedules:t,deleteSchedule:s,updateSchedule:o},personas:{personas:r}}=ut(),{showToast:c}=pn(),d=vt();return i.jsx(c7,{schedules:t,personas:r,onDeleteSchedule:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete schedule",{scheduleId:u,error:p}),c("Failed to delete schedule","error"),p}},onToggleEnabled:async(u,p)=>{try{return await o(u,p)}catch(m){throw console.error("Failed to update schedule",{scheduleId:u,error:m}),c("Failed to update schedule","error"),m}},onNavigateToNew:()=>d($N),onNavigateToSchedule:u=>d(q_(u))})}const $U="_container_1g4qh_1",HU="_form_1g4qh_7",PU="_formActions_1g4qh_66",UU="_editableSection_1g4qh_73",VU="_helperText_1g4qh_84",qU="_metaSection_1g4qh_90",GU="_optional_1g4qh_108",FU="_readonlyValue_1g4qh_113",Bn={container:$U,form:HU,formActions:PU,editableSection:UU,helperText:VU,metaSection:qU,optional:GU,readonlyValue:FU};function f_(){const{scheduleId:t}=ua(),s=vt(),{showToast:o}=pn(),{schedules:{schedules:r,schedulesLoading:c,createSchedule:d,updateSchedule:u,deleteSchedule:p},personas:{personas:m},workspaces:{workspaces:g}}=ut(),v=t===void 0,b=v?void 0:r.find(k=>k.id===t);if(!v&&!c&&r.length>0&&!b)return i.jsx(zn,{to:Zf,replace:!0});const _=[{label:"Settings",url:xi},{label:"Schedules",url:Zf},{label:v?"New Schedule":(b==null?void 0:b.title)??"Schedule",url:void 0}];return i.jsxs("div",{className:Bn.container,children:[i.jsx(fa,{segments:_}),i.jsx(KU,{existing:b,isNew:v,personas:m,workspaces:g,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:p,onDone:()=>{s(Zf)},showToast:o})]})}function KU({existing:t,isNew:s,personas:o,workspaces:r,onCreateSchedule:c,onUpdateSchedule:d,onDeleteSchedule:u,onDone:p,showToast:m}){var H;const g=vt(),[v,b]=y.useState((t==null?void 0:t.title)??""),[_,k]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.scheduleExpression)??""),[T,w]=y.useState((t==null?void 0:t.personaId)??""),[C,D]=y.useState((t==null?void 0:t.workspaceId)??""),[R,E]=y.useState(!1),[M,O]=y.useState(null);y.useEffect(()=>{s||t&&M===null&&(b(t.title),k(t.description),j(t.scheduleExpression),w(t.personaId),D(t.workspaceId))},[s,t,M]);const A=!s&&t===void 0,$=s&&v.trim().length>0&&S.trim().length>0&&T.length>0,Y=o.map(B=>({value:B.id,label:B.name})),V=[{value:"",label:"System-level (no workspace)"},...r.map(B=>({value:B.id,label:B.name}))],ee=B=>{B.preventDefault(),$&&c(v,_,S,T,C||void 0).then(F=>{m("Schedule created","success"),g(q_(F.id),{replace:!0})},()=>{m("Failed to create schedule","error")})},le=(B,F)=>{t&&d(t.id,{[B]:F}).then(()=>{m("Schedule updated","success"),B==="title"&&b(String(F)),B==="description"&&k(String(F)),B==="scheduleExpression"&&j(String(F)),B==="personaId"&&w(String(F))},()=>{m("Failed to update schedule","error")})},Z=()=>{if(!t)return;const B=!t.enabled;d(t.id,{enabled:B}).then(()=>{m(B?"Schedule enabled":"Schedule disabled","success")},()=>{m("Failed to update schedule","error")})},ae=()=>{t&&u(t.id).then(()=>{m("Schedule deleted","success"),p()},()=>{m("Failed to delete schedule","error")})};return i.jsxs(i.Fragment,{children:[A?i.jsxs("div",{className:Bn.form,children:[i.jsx("h3",{children:"Edit Schedule"}),i.jsx("p",{children:"Loading schedule..."})]}):s?i.jsxs("form",{onSubmit:ee,className:Bn.form,children:[i.jsx("h3",{children:"Create Schedule"}),i.jsxs("label",{children:["Title",i.jsx("input",{type:"text",value:v,onChange:B=>b(B.target.value),placeholder:"e.g. Nightly Review",required:!0,"data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description ",i.jsx("span",{className:Bn.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:_,onChange:B=>k(B.target.value),placeholder:"Brief description...","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx("input",{type:"text",value:S,onChange:B=>j(B.target.value),placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",required:!0,"data-testid":"schedule-detail-expression"}),i.jsxs("p",{className:Bn.helperText,children:["Interval: ",i.jsx("code",{children:"30s"}),", ",i.jsx("code",{children:"5m"}),", ",i.jsx("code",{children:"1h"}),", ",i.jsx("code",{children:"1d"})," (min 10s)  |  Cron: ",i.jsx("code",{children:"0 9 * * MON"})," (standard 5-field cron syntax)"]})]}),i.jsxs("label",{children:["Persona",i.jsxs("select",{value:T,onChange:B=>w(B.target.value),required:!0,"data-testid":"schedule-detail-persona",children:[i.jsx("option",{value:"",children:"Select a persona..."}),Y.map(B=>i.jsx("option",{value:B.value,children:B.label},B.value))]})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:Bn.optional,children:"(optional)"}),i.jsx("select",{value:C,onChange:B=>D(B.target.value),"data-testid":"schedule-detail-workspace",children:V.map(B=>i.jsx("option",{value:B.value,children:B.label},B.value))})]}),i.jsxs("div",{className:Bn.formActions,children:[i.jsx(sn,{type:"submit",variant:"primary",size:"md",disabled:!$,"data-testid":"schedule-detail-save",children:"Create"}),i.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:Bn.form,children:[i.jsx("h3",{children:"Edit Schedule"}),i.jsxs("div",{className:Bn.formActions,children:[i.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Back to Schedules"}),i.jsx(sn,{type:"button",variant:t.enabled?"ghost":"primary",size:"md",onClick:Z,"data-testid":"schedule-detail-toggle",children:t.enabled?"Disable":"Enable"}),i.jsx(sn,{type:"button",variant:"danger",size:"md",onClick:()=>E(!0),"data-testid":"schedule-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:Bn.editableSection,children:[i.jsxs("label",{children:["Title",i.jsx(Bt,{value:v,onSave:B=>{le("title",B)},validate:B=>B.trim()?void 0:"Title is required",fieldId:"schedule-title",activeFieldId:M,onActivate:O,ariaLabel:"Schedule title","data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description",i.jsx(Bt,{value:_,onSave:B=>{le("description",B)},fieldId:"schedule-description",activeFieldId:M,onActivate:O,placeholder:"Brief description...",ariaLabel:"Schedule description","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx(Bt,{value:S,onSave:B=>{le("scheduleExpression",B)},validate:B=>B.trim()?void 0:"Schedule expression is required",fieldId:"schedule-expression",activeFieldId:M,onActivate:O,placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",ariaLabel:"Schedule expression","data-testid":"schedule-detail-expression"})]}),i.jsxs("label",{children:["Persona",i.jsx(ud,{value:T,onSave:B=>{le("personaId",B)},options:Y,fieldId:"schedule-persona",activeFieldId:M,onActivate:O,ariaLabel:"Schedule persona","data-testid":"schedule-detail-persona"})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:Bn.optional,children:"(optional — set at creation)"}),i.jsx("span",{className:Bn.readonlyValue,"data-testid":"schedule-detail-workspace",children:((H=r.find(B=>B.id===t.workspaceId))==null?void 0:H.name)??"System-level (no workspace)"})]})]}),i.jsxs("div",{className:Bn.metaSection,children:[t.lastRunAt?i.jsxs("span",{children:["Last run: ",sm(t.lastRunAt)]}):i.jsx("span",{children:"Last run: Never"}),t.enabled&&t.nextRunAt?i.jsxs("span",{children:["Next run: ",H1(t.nextRunAt)]}):null,t.runCount>0&&i.jsxs("span",{children:["Total runs: ",t.runCount]}),i.jsxs("span",{children:["Created: ",sm(t.createdAt)]})]})]}):null,i.jsx(ys,{isOpen:R,title:"Delete Schedule?",description:`"${t==null?void 0:t.title}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:ae,onCancel:()=>E(!1)})]})}function ZU(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=K1();return i.jsx(wB,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function YU(){const[t,s]=y.useState(void 0);return y.useEffect(()=>{let o=!1;return(async()=>{try{const c=await $e.getVersionStatus({});o||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{o=!0}},[]),t}function JU(){const{connectionStatus:t,environments:{environments:s},sessions:{sessions:o}}=ut(),r=YU();return i.jsxs(i.Fragment,{children:[r&&i.jsx(LO,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),i.jsx(EB,{connectionStatus:t,environments:s,sessions:o})]})}function WU(){return i.jsx(b8,{})}function XU(){const{plugins:{plugins:t,pluginsLoading:s,setPluginEnabled:o}}=ut();return i.jsx(VL,{plugins:t,loading:s,onSetPluginEnabled:(r,c)=>{o(r,c).catch(()=>{})}})}const p_=Ai();function QU(){const t=vt();return Ga({key:"?"},()=>{t(HN)}),Ga({key:"n"},()=>{t(p_)}),Ga({key:"N"},()=>{t(p_)}),i.jsx(i.Fragment,{})}function Ed(t){const s=l$();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function eV(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=ut(),o=y.useMemo(()=>i.jsx(pO,{workspaces:t,tasks:s}),[t,s]);return Ed(o),i.jsx(Ei,{})}function tV(){const{environments:{environments:t}}=ut(),s=y.useMemo(()=>i.jsx(II,{environments:t}),[t]);return Ed(s),i.jsx(Ei,{})}function nV(){const t=y.useMemo(()=>i.jsx(m7,{}),[]);return Ed(t),i.jsx(Ei,{})}function sV(){const{knowledge:t,workspaces:{workspaces:s}}=ut(),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(V5,{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 Ed(u),i.jsx(Ei,{})}const aV="_wizard_1260s_1",iV="_container_1260s_10",oV="_stepContent_1260s_19",rV="_logoArea_1260s_28",lV="_logoImage_1260s_32",cV="_heading_1260s_41",dV="_tagline_1260s_49",uV="_subtitle_1260s_56",fV="_featureList_1260s_64",pV="_runtimeGrid_1260s_89",mV="_runtimeCard_1260s_101",hV="_runtimeName_1260s_133",gV="_runtimeDescription_1260s_139",vV="_buttonRow_1260s_144",yV="_primaryButton_1260s_151",bV="_ghostButton_1260s_185",_V="_dots_1260s_213",xV="_dot_1260s_213",We={wizard:aV,container:iV,stepContent:oV,logoArea:rV,logoImage:lV,heading:cV,tagline:dV,subtitle:uV,featureList:fV,runtimeGrid:pV,runtimeCard:mV,runtimeName:hV,runtimeDescription:gV,buttonRow:vV,primaryButton:yV,ghostButton:bV,dots:_V,dot:xV};function kV({onNext:t}){return i.jsxs("div",{className:We.stepContent,"data-testid":"setup-welcome",children:[i.jsx("div",{className:We.logoArea,children:i.jsx("img",{src:wd("grackle-logo.png"),alt:"Grackle",className:We.logoImage})}),i.jsx("h1",{className:We.heading,children:"Welcome to Grackle"}),i.jsx("p",{className:We.tagline,children:"Multi-agent orchestration for software teams"}),i.jsx("button",{type:"button",className:We.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function SV({onNext:t,onBack:s}){return i.jsxs("div",{className:We.stepContent,"data-testid":"setup-about",children:[i.jsx("h2",{className:We.heading,children:"What is Grackle?"}),i.jsxs("ul",{className:We.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:We.buttonRow,children:[i.jsx("button",{type:"button",className:We.ghostButton,onClick:s,children:"Back"}),i.jsx("button",{type:"button",className:We.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const jV=[{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 TV({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:We.stepContent,"data-testid":"setup-runtime",children:[i.jsx("h2",{className:We.heading,children:"Choose Your Runtime"}),i.jsx("p",{className:We.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),i.jsx("div",{className:We.runtimeGrid,children:jV.map(u=>i.jsxs("button",{type:"button",className:We.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:We.runtimeName,children:u.name}),i.jsx("span",{className:We.runtimeDescription,children:u.description})]},u.id))}),i.jsxs("div",{className:We.buttonRow,children:[i.jsx("button",{type:"button",className:We.ghostButton,onClick:o,children:"Back"}),i.jsx("button",{type:"button",className:We.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function wV(){return typeof Notification<"u"}function NV({onFinish:t,onBack:s,finishDisabled:o}){const r=wV(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return i.jsxs("div",{className:We.stepContent,"data-testid":"setup-notifications",children:[i.jsx("h2",{className:We.heading,children:"Stay in the Loop"}),i.jsx("p",{className:We.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:We.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:We.buttonRow,children:[i.jsx("button",{type:"button",className:We.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:We.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),i.jsx("button",{type:"button",className:We.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):i.jsx("button",{type:"button",className:We.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const CV=4,m_={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function EV(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=ut(),{showToast:c}=pn(),d=vt(),[u,p]=y.useState(0),[m,g]=y.useState("claude-code"),[v,b]=y.useState(!1),_=t.find(j=>j.id==="claude-code"),k=y.useCallback(j=>{g(j),p(3)},[]),S=y.useCallback(()=>{const j=m;b(!0);const T=[];if(_&&j!==_.runtime){const C=m_[j]??"sonnet";T.push(s(_.id,void 0,void 0,void 0,j,C))}const w=t.find(C=>C.id===ny);if(w&&j!==w.runtime){const C=m_[j]??"sonnet";T.push(s(ny,void 0,void 0,void 0,j,C))}Promise.all(T).then(()=>o()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),b(!1)})},[m,_,t,s,o,d,c]);return r===!0?i.jsx(zn,{to:"/",replace:!0}):i.jsx("div",{className:We.wizard,"data-testid":"setup-wizard",children:i.jsxs("div",{className:We.container,children:[i.jsx(as,{mode:"wait",children:i.jsxs($t.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(kV,{onNext:()=>p(1)}),u===1&&i.jsx(SV,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&i.jsx(TV,{currentRuntime:m,onFinish:k,onBack:()=>p(1),finishDisabled:!_}),u===3&&i.jsx(NV,{onFinish:S,onBack:()=>p(2),finishDisabled:v})]},u)}),i.jsx("div",{className:We.dots,children:Array.from({length:CV},(j,T)=>i.jsx("span",{className:We.dot,"data-active":T===u},T))})]})})}const AV="_root_zndgp_1",DV="_body_zndgp_7",MV="_main_zndgp_19",RV="_sidebarWrapper_zndgp_26",IV="_overlay_zndgp_51",qr={root:AV,body:DV,main:MV,sidebarWrapper:RV,overlay:IV},OV=y.lazy(()=>b_(()=>import("./KnowledgePage-CBvUnREp.js"),__vite__mapDeps([2,1,3,4,5])).then(t=>({default:t.KnowledgePage}))),ik=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function BV({tabs:t}){const{connectionStatus:s,environments:{environments:o},sessions:{sessions:r},tasks:{tasks:c}}=ut(),{toasts:d,dismissToast:u}=pn(),p=Jt(),m=r$(),g=m!==void 0,[v,b]=y.useState(!1),_=y.useCallback(()=>b(k=>!k),[]);return y.useEffect(()=>{b(!1)},[p.pathname]),y.useEffect(()=>{if(!v)return;const k=S=>{S.key==="Escape"&&b(!1)};return document.addEventListener("keydown",k),()=>{document.removeEventListener("keydown",k)}},[v]),i.jsxs(i.Fragment,{children:[i.jsx(nI,{connectionStatus:s,environments:o,sessions:r,onToggleSidebar:g?_:void 0,sidebarOpen:v}),i.jsx(dI,{tabs:t}),i.jsxs("div",{className:qr.body,children:[g&&i.jsx("div",{className:qr.sidebarWrapper,"data-sidebar-open":v,children:i.jsx(gI,{content:m})}),g&&v&&i.jsx("div",{className:qr.overlay,"data-testid":"drawer-overlay",onClick:()=>b(!1)}),i.jsxs("div",{className:qr.main,children:[i.jsx(Ei,{}),i.jsx(jI,{sessions:r,tasks:c,environments:o})]})]}),i.jsx(wO,{toasts:d,onDismiss:u}),i.jsx(QU,{})]})}function LV(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connectionStatus:d,onboardingCompleted:u}=ut(),{pluginNames:p}=Cd(),{showToast:m}=pn();g9(s,m),x9(c,m),v9(o,r,m);const g=vt(),v=Jt();if(y.useEffect(()=>{t&&!v.pathname.includes("/tasks/")&&g(xm(t),{replace:!0})},[t,g,v.pathname]),d==="connected"&&u===!1)return i.jsx(zn,{to:"/setup",replace:!0});const b=H$(p);return i.jsx(o$,{children:i.jsxs("div",{className:qr.root,children:[ik&&i.jsx(hC,{}),i.jsx(BV,{tabs:b})]})})}function Ap(){const{workspaceId:t}=ua(),{workspaces:{workspaces:s}}=ut(),o=Jt(),r=s.find(g=>g.id===t),c=r!=null&&r.linkedEnvironmentIds?[...r.linkedEnvironmentIds].sort()[0]:void 0;if(!c)return s.length===0?void 0:i.jsx(zn,{to:"/environments",replace:!0});const d=encodeURIComponent(t),u=`/workspaces/${d}`,p=o.pathname.startsWith(u)?o.pathname.slice(u.length):"",m=`/environments/${encodeURIComponent(c)}/workspaces/${d}${p}${o.search}${o.hash}`;return i.jsx(zn,{to:m,replace:!0})}function zV(){const{pluginNames:t}=Cd(),s=t.includes("orchestration"),o=t.includes("knowledge");return i.jsxs(eN,{children:[i.jsx(Ee,{path:"setup",element:i.jsx(EV,{})}),i.jsxs(Ee,{element:i.jsx(LV,{}),children:[i.jsx(Ee,{index:!0,element:i.jsx(iP,{})}),i.jsx(Ee,{path:"sessions/new",element:i.jsx(bP,{})}),i.jsx(Ee,{path:"chat",element:i.jsx(hP,{})}),i.jsx(Ee,{path:"chat/:streamId",element:i.jsx(zn,{to:"/coordination",replace:!0})}),i.jsx(Ee,{path:"coordination",element:i.jsx(yP,{})}),i.jsx(Ee,{path:"sessions/:sessionId",element:i.jsx(SP,{})}),o&&i.jsx(Ee,{element:i.jsx(sV,{}),children:i.jsx(Ee,{path:"knowledge",element:i.jsx(y.Suspense,{fallback:i.jsx(w1,{}),children:i.jsx(OV,{})})})}),s&&i.jsxs(Ee,{element:i.jsx(eV,{}),children:[i.jsx(Ee,{path:"tasks",element:i.jsx(sP,{})}),i.jsx(Ee,{path:"tasks/new",element:i.jsx(l_,{})}),i.jsx(Ee,{path:"tasks/:taskId",element:i.jsx(To,{})}),i.jsx(Ee,{path:"tasks/:taskId/edit",element:i.jsx(To,{})}),i.jsx(Ee,{path:"tasks/:taskId/stream",element:i.jsx(To,{})})]}),i.jsxs(Ee,{element:i.jsx(tV,{}),children:[i.jsx(Ee,{path:"workspaces",element:i.jsx(zn,{to:"/environments",replace:!0})}),i.jsx(Ee,{path:"workspaces/new",element:i.jsx(zP,{})}),i.jsx(Ee,{path:"workspaces/:workspaceId",element:i.jsx(Ap,{})}),i.jsx(Ee,{path:"workspaces/:workspaceId/tasks/:taskId",element:i.jsx(Ap,{})}),i.jsx(Ee,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:i.jsx(Ap,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId",element:i.jsx(NP,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:i.jsx(l_,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:i.jsx(To,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:i.jsx(To,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:i.jsx(To,{})}),i.jsxs(Ee,{path:"environments",element:i.jsx(GP,{}),children:[i.jsx(Ee,{index:!0,element:i.jsx(aP,{})}),i.jsx(Ee,{path:"new",element:i.jsx(HP,{})}),i.jsx(Ee,{path:":environmentId",element:i.jsx(xU,{})}),i.jsx(Ee,{path:":environmentId/edit",element:i.jsx(PP,{})})]})]}),i.jsx(Ee,{element:i.jsx(nV,{}),children:i.jsxs(Ee,{path:"settings",element:i.jsx(jU,{}),children:[i.jsx(Ee,{index:!0,element:i.jsx(zn,{to:"credentials",replace:!0})}),i.jsx(Ee,{path:"environments",element:i.jsx(zn,{to:"/environments",replace:!0})}),i.jsx(Ee,{path:"credentials",element:i.jsx(TU,{})}),i.jsx(Ee,{path:"github-accounts",element:i.jsx(wU,{})}),i.jsx(Ee,{path:"tokens",element:i.jsx(zn,{to:"../credentials",replace:!0})}),i.jsx(Ee,{path:"personas",element:i.jsx(NU,{})}),i.jsx(Ee,{path:"personas/new",element:i.jsx(u_,{})}),i.jsx(Ee,{path:"personas/:personaId",element:i.jsx(u_,{})}),i.jsx(Ee,{path:"schedules",element:i.jsx(zU,{})}),i.jsx(Ee,{path:"schedules/new",element:i.jsx(f_,{})}),i.jsx(Ee,{path:"schedules/:scheduleId",element:i.jsx(f_,{})}),i.jsx(Ee,{path:"appearance",element:i.jsx(ZU,{})}),i.jsx(Ee,{path:"shortcuts",element:i.jsx(WU,{})}),i.jsx(Ee,{path:"plugins",element:i.jsx(XU,{})}),i.jsx(Ee,{path:"about",element:i.jsx(JU,{})})]})}),i.jsx(Ee,{path:"*",element:i.jsx(zn,{to:"/",replace:!0})})]})]})}const $V=1e4;function HV(){const{onboardingCompleted:t}=ut(),[s,o]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),$V);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return i.jsx(as,{mode:"wait",children:r?i.jsx($t.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:i.jsx(w1,{})},"splash"):i.jsx($t.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:i.jsx(TN,{basename:"/".replace(/\/$/,""),children:i.jsx(zV,{})})},"app")})}function PV(){const t=ik?R$:h9;return i.jsx(B$,{children:i.jsx(i$,{children:i.jsx(t$,{children:i.jsx(t,{children:i.jsx(HV,{})})})})})}F2.createRoot(document.getElementById("root")).render(i.jsx(y.StrictMode,{children:i.jsx(PV,{})}));export{fa as B,K_ as K,ut as a,xm as s,os as t,vt as u};