@grackle-ai/web 0.83.1 → 0.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{KnowledgePage-DZhFekbY.js → KnowledgePage-vV_eStmC.js} +1 -1
- package/dist/assets/index-pFJWXkif.css +1 -0
- package/dist/assets/index-tain5SBb.js +503 -0
- package/dist/index.html +2 -2
- package/package.json +2 -2
- package/dist/assets/index-BQcllX_W.css +0 -1
- package/dist/assets/index-B_I1xE0E.js +0 -502
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-vV_eStmC.js","assets/markdown-gcy1Jmzi.js","assets/dagview-BA5TtMAQ.js","assets/grpc-DU5jMhZD.js","assets/KnowledgePage-DMqJ4jlP.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as JS,a as y,j as l,v as WS,b as XS,t as Jl,i as QS,f as eT,M as up,c as dp}from"./markdown-gcy1Jmzi.js";import{r as tT,d as Qv,H as e0,P as t0,i as nT,B as sT,a as aT,C as iT,M as oT}from"./dagview-BA5TtMAQ.js";import{c as rT,a as lT,G as cT,C as Ec,b as uT,e as ob,w as dT,t as fT,p as Wl,d as pT,f as mT,M as hT,R as nr,A as rb,D as lb,W as gT,O as vT,g as yT,S as n0}from"./grpc-DU5jMhZD.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"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();var Xd={exports:{}},sr={},Qd={exports:{}},ef={};/**
|
|
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 s0;function bT(){return s0||(s0=1,(function(n){function s(I,$){var Q=I.length;I.push($);e:for(;0<Q;){var de=Q-1>>>1,me=I[de];if(0<c(me,$))I[de]=$,I[Q]=me,Q=de;else break e}}function i(I){return I.length===0?null:I[0]}function o(I){if(I.length===0)return null;var $=I[0],Q=I.pop();if(Q!==$){I[0]=Q;e:for(var de=0,me=I.length,ze=me>>>1;de<ze;){var je=2*(de+1)-1,Ne=I[je],Ae=je+1,ce=I[Ae];if(0>c(Ne,Q))Ae<me&&0>c(ce,Ne)?(I[de]=ce,I[Ae]=Q,de=Ae):(I[de]=Ne,I[je]=Q,de=je);else if(Ae<me&&0>c(ce,Q))I[de]=ce,I[Ae]=Q,de=Ae;else break e}}return $}function c(I,$){var Q=I.sortIndex-$.sortIndex;return Q!==0?Q:I.id-$.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var d=Date,m=d.now();n.unstable_now=function(){return d.now()-m}}var h=[],g=[],v=1,b=null,_=3,S=!1,T=!1,N=!1,j=!1,w=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function O(I){for(var $=i(g);$!==null;){if($.callback===null)o(g);else if($.startTime<=I)o(g),$.sortIndex=$.expirationTime,s(h,$);else break;$=i(g)}}function C(I){if(N=!1,O(I),!T)if(i(h)!==null)T=!0,M||(M=!0,ie());else{var $=i(g);$!==null&&re(C,$.startTime-I)}}var M=!1,G=-1,U=5,V=-1;function Z(){return j?!0:!(n.unstable_now()-V<U)}function ee(){if(j=!1,M){var I=n.unstable_now();V=I;var $=!0;try{e:{T=!1,N&&(N=!1,E(G),G=-1),S=!0;var Q=_;try{t:{for(O(I),b=i(h);b!==null&&!(b.expirationTime>I&&Z());){var de=b.callback;if(typeof de=="function"){b.callback=null,_=b.priorityLevel;var me=de(b.expirationTime<=I);if(I=n.unstable_now(),typeof me=="function"){b.callback=me,O(I),$=!0;break t}b===i(h)&&o(h),O(I)}else o(h);b=i(h)}if(b!==null)$=!0;else{var ze=i(g);ze!==null&&re(C,ze.startTime-I),$=!1}}break e}finally{b=null,_=Q,S=!1}$=void 0}}finally{$?ie():M=!1}}}var ie;if(typeof A=="function")ie=function(){A(ee)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,K=be.port2;be.port1.onmessage=ee,ie=function(){K.postMessage(null)}}else ie=function(){w(ee,0)};function re(I,$){G=w(function(){I(n.unstable_now())},$)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(I){I.callback=null},n.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<I?Math.floor(1e3/I):5},n.unstable_getCurrentPriorityLevel=function(){return _},n.unstable_next=function(I){switch(_){case 1:case 2:case 3:var $=3;break;default:$=_}var Q=_;_=$;try{return I()}finally{_=Q}},n.unstable_requestPaint=function(){j=!0},n.unstable_runWithPriority=function(I,$){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var Q=_;_=I;try{return $()}finally{_=Q}},n.unstable_scheduleCallback=function(I,$,Q){var de=n.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?de+Q:de):Q=de,I){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5e3}return me=Q+me,I={id:v++,callback:$,priorityLevel:I,startTime:Q,expirationTime:me,sortIndex:-1},Q>de?(I.sortIndex=Q,s(g,I),i(h)===null&&I===i(g)&&(N?(E(G),G=-1):N=!0,re(C,Q-de))):(I.sortIndex=me,s(h,I),T||S||(T=!0,M||(M=!0,ie()))),I},n.unstable_shouldYield=Z,n.unstable_wrapCallback=function(I){var $=_;return function(){var Q=_;_=$;try{return I.apply(this,arguments)}finally{_=Q}}}})(ef)),ef}var a0;function _T(){return a0||(a0=1,Qd.exports=bT()),Qd.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 i0;function xT(){if(i0)return sr;i0=1;var n=_T(),s=JS(),i=tT();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(u(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(o(188));return t!==e?null:e}for(var a=e,r=t;;){var f=a.return;if(f===null)break;var p=f.alternate;if(p===null){if(r=f.return,r!==null){a=r;continue}break}if(f.child===p.child){for(p=f.child;p;){if(p===a)return h(f),e;if(p===r)return h(f),t;p=p.sibling}throw Error(o(188))}if(a.return!==r.return)a=f,r=p;else{for(var x=!1,k=f.child;k;){if(k===a){x=!0,a=f,r=p;break}if(k===r){x=!0,r=f,a=p;break}k=k.sibling}if(!x){for(k=p.child;k;){if(k===a){x=!0,a=p,r=f;break}if(k===r){x=!0,r=p,a=f;break}k=k.sibling}if(!x)throw Error(o(189))}}if(a.alternate!==r)throw Error(o(190))}if(a.tag!==3)throw Error(o(188));return a.stateNode.current===a?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),A=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),Z=Symbol.for("react.memo_cache_sentinel"),ee=Symbol.iterator;function ie(e){return e===null||typeof e!="object"?null:(e=ee&&e[ee]||e["@@iterator"],typeof e=="function"?e:null)}var be=Symbol.for("react.client.reference");function K(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===be?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case N:return"Fragment";case w:return"Profiler";case j:return"StrictMode";case C:return"Suspense";case M:return"SuspenseList";case V:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case A:return e.displayName||"Context";case E:return(e._context.displayName||"Context")+".Consumer";case O:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case G:return t=e.displayName||null,t!==null?t:K(e.type)||"Memo";case U:t=e._payload,e=e._init;try{return K(e(t))}catch{}}return null}var re=Array.isArray,I=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},de=[],me=-1;function ze(e){return{current:e}}function je(e){0>me||(e.current=de[me],de[me]=null,me--)}function Ne(e,t){me++,de[me]=e.current,e.current=t}var Ae=ze(null),ce=ze(null),fe=ze(null),pe=ze(null);function Re(e,t){switch(Ne(fe,t),Ne(ce,e),Ne(Ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Sv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Sv(t),e=Tv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}je(Ae),Ne(Ae,e)}function Bt(){je(Ae),je(ce),je(fe)}function te(e){e.memoizedState!==null&&Ne(pe,e);var t=Ae.current,a=Tv(t,e.type);t!==a&&(Ne(ce,e),Ne(Ae,a))}function X(e){ce.current===e&&(je(Ae),je(ce)),pe.current===e&&(je(pe),Xo._currentValue=Q)}var Te,un;function Ze(e){if(Te===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Te=t&&t[1]||"",un=-1<a.stack.indexOf(`
|
|
19
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
+
`+Te+e+un}var Kn=!1;function Yn(e,t){if(!e||Kn)return"";Kn=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var W=function(){throw Error()};if(Object.defineProperty(W.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(W,[])}catch(F){var H=F}Reflect.construct(e,[],W)}else{try{W.call()}catch(F){H=F}e.call(W.prototype)}}else{try{throw Error()}catch(F){H=F}(W=e())&&typeof W.catch=="function"&&W.catch(function(){})}}catch(F){if(F&&H&&typeof F.stack=="string")return[F.stack,H.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=r.DetermineComponentFrameRoot(),x=p[0],k=p[1];if(x&&k){var D=x.split(`
|
|
21
|
+
`),P=k.split(`
|
|
22
|
+
`);for(f=r=0;r<D.length&&!D[r].includes("DetermineComponentFrameRoot");)r++;for(;f<P.length&&!P[f].includes("DetermineComponentFrameRoot");)f++;if(r===D.length||f===P.length)for(r=D.length-1,f=P.length-1;1<=r&&0<=f&&D[r]!==P[f];)f--;for(;1<=r&&0<=f;r--,f--)if(D[r]!==P[f]){if(r!==1||f!==1)do if(r--,f--,0>f||D[r]!==P[f]){var Y=`
|
|
23
|
+
`+D[r].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=r&&0<=f);break}}}finally{Kn=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ze(a):""}function zn(e,t){switch(e.tag){case 26:case 27:case 5:return Ze(e.type);case 16:return Ze("Lazy");case 13:return e.child!==t&&t!==null?Ze("Suspense Fallback"):Ze("Suspense");case 19:return Ze("SuspenseList");case 0:case 15:return Yn(e.type,!1);case 11:return Yn(e.type.render,!1);case 1:return Yn(e.type,!0);case 31:return Ze("Activity");default:return""}}function Jn(e){try{var t="",a=null;do t+=zn(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
|
|
24
|
+
Error generating stack: `+r.message+`
|
|
25
|
+
`+r.stack}}var Tn=Object.prototype.hasOwnProperty,Ls=n.unstable_scheduleCallback,dn=n.unstable_cancelCallback,Me=n.unstable_shouldYield,Mt=n.unstable_requestPaint,Kt=n.unstable_now,lo=n.unstable_getCurrentPriorityLevel,co=n.unstable_ImmediatePriority,uo=n.unstable_UserBlockingPriority,_a=n.unstable_NormalPriority,Or=n.unstable_LowPriority,fo=n.unstable_IdlePriority,Ir=n.log,Br=n.unstable_setDisableYieldValue,Us=null,Yt=null;function Pn(e){if(typeof Ir=="function"&&Br(e),Yt&&typeof Yt.setStrictMode=="function")try{Yt.setStrictMode(Us,e)}catch{}}var Jt=Math.clz32?Math.clz32:q,Lr=Math.log,qc=Math.LN2;function q(e){return e>>>=0,e===0?32:31-(Lr(e)/qc|0)|0}var ne=256,oe=262144,le=4194304;function ue(e){var t=e&42;if(t!==0)return t;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 qe(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var f=0,p=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var k=r&134217727;return k!==0?(r=k&~p,r!==0?f=ue(r):(x&=k,x!==0?f=ue(x):a||(a=k&~e,a!==0&&(f=ue(a))))):(k=r&~p,k!==0?f=ue(k):x!==0?f=ue(x):a||(a=r&~e,a!==0&&(f=ue(a)))),f===0?0:t!==0&&t!==f&&(t&p)===0&&(p=f&-f,a=t&-t,p>=a||p===32&&(a&4194048)!==0)?t:f}function ye(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Oe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Ke(){var e=le;return le<<=1,(le&62914560)===0&&(le=4194304),e}function nt(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function He(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function zt(e,t,a,r,f,p){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 k=e.entanglements,D=e.expirationTimes,P=e.hiddenUpdates;for(a=x&~a;0<a;){var Y=31-Jt(a),W=1<<Y;k[Y]=0,D[Y]=-1;var H=P[Y];if(H!==null)for(P[Y]=null,Y=0;Y<H.length;Y++){var F=H[Y];F!==null&&(F.lane&=-536870913)}a&=~W}r!==0&&Pt(e,r,0),p!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=p&~(x&~t))}function Pt(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Jt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function Tt(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-Jt(a),f=1<<r;f&t|e[r]&t&&(e[r]|=t),a&=~f}}function ls(e,t){var a=t&-t;return a=(a&42)!==0?1:Vn(a),(a&(e.suspendedLanes|t))!==0?0:a}function Vn(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 xa(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function rm(){var e=$.p;return e!==0?e:(e=window.event,e===void 0?32:Fv(e.type))}function lm(e,t){var a=$.p;try{return $.p=e,t()}finally{$.p=a}}var zs=Math.random().toString(36).slice(2),Vt="__reactFiber$"+zs,nn="__reactProps$"+zs,si="__reactContainer$"+zs,Hc="__reactEvents$"+zs,zx="__reactListeners$"+zs,Px="__reactHandles$"+zs,cm="__reactResources$"+zs,po="__reactMarker$"+zs;function Gc(e){delete e[Vt],delete e[nn],delete e[Hc],delete e[zx],delete e[Px]}function ai(e){var t=e[Vt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[si]||a[Vt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Av(e);e!==null;){if(a=e[Vt])return a;e=Av(e)}return t}e=a,a=e.parentNode}return null}function ii(e){if(e=e[Vt]||e[si]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function mo(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function oi(e){var t=e[cm];return t||(t=e[cm]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Lt(e){e[po]=!0}var um=new Set,dm={};function Sa(e,t){ri(e,t),ri(e+"Capture",t)}function ri(e,t){for(dm[e]=t,e=0;e<t.length;e++)um.add(t[e])}var Vx=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]*$"),fm={},pm={};function qx(e){return Tn.call(pm,e)?!0:Tn.call(fm,e)?!1:Vx.test(e)?pm[e]=!0:(fm[e]=!0,!1)}function Ur(e,t,a){if(qx(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function zr(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function cs(e,t,a,r){if(r===null)e.removeAttribute(a);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+r)}}function kn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Hx(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var f=r.get,p=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return f.call(this)},set:function(x){a=""+x,p.call(this,x)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $c(e){if(!e._valueTracker){var t=mm(e)?"checked":"value";e._valueTracker=Hx(e,t,""+e[t])}}function hm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=mm(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function Pr(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 Gx=/[\n"\\]/g;function wn(e){return e.replace(Gx,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Fc(e,t,a,r,f,p,x,k){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),t!=null?x==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+kn(t)):e.value!==""+kn(t)&&(e.value=""+kn(t)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),t!=null?Zc(e,x,kn(t)):a!=null?Zc(e,x,kn(a)):r!=null&&e.removeAttribute("value"),f==null&&p!=null&&(e.defaultChecked=!!p),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?e.name=""+kn(k):e.removeAttribute("name")}function gm(e,t,a,r,f,p,x,k){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),t!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||t!=null)){$c(e);return}a=a!=null?""+kn(a):"",t=t!=null?""+kn(t):a,k||t===e.value||(e.value=t),e.defaultValue=t}r=r??f,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=k?e.checked:!!r,e.defaultChecked=!!r,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),$c(e)}function Zc(e,t,a){t==="number"&&Pr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function li(e,t,a,r){if(e=e.options,t){t={};for(var f=0;f<a.length;f++)t["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=t.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&r&&(e[a].defaultSelected=!0)}else{for(a=""+kn(a),t=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,r&&(e[f].defaultSelected=!0);return}t!==null||e[f].disabled||(t=e[f])}t!==null&&(t.selected=!0)}}function vm(e,t,a){if(t!=null&&(t=""+kn(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+kn(a):""}function ym(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(o(92));if(re(r)){if(1<r.length)throw Error(o(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=kn(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),$c(e)}function ci(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var $x=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 bm(e,t,a){var r=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,a):typeof a!="number"||a===0||$x.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function _m(e,t,a){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var f in t)r=t[f],t.hasOwnProperty(f)&&a[f]!==r&&bm(e,f,r)}else for(var p in t)t.hasOwnProperty(p)&&bm(e,p,t[p])}function Kc(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 Fx=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"]]),Zx=/^[\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 Vr(e){return Zx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function us(){}var Yc=null;function Jc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ui=null,di=null;function xm(e){var t=ii(e);if(t&&(e=t.stateNode)){var a=e[nn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Fc(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+wn(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var f=r[nn]||null;if(!f)throw Error(o(90));Fc(r,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&hm(r)}break e;case"textarea":vm(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&li(e,!!a.multiple,t,!1)}}}var Wc=!1;function Sm(e,t,a){if(Wc)return e(t,a);Wc=!0;try{var r=e(t);return r}finally{if(Wc=!1,(ui!==null||di!==null)&&(Cl(),ui&&(t=ui,e=di,di=ui=null,xm(t),e)))for(t=0;t<e.length;t++)xm(e[t])}}function ho(e,t){var a=e.stateNode;if(a===null)return null;var r=a[nn]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(o(231,t,typeof a));return a}var ds=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xc=!1;if(ds)try{var go={};Object.defineProperty(go,"passive",{get:function(){Xc=!0}}),window.addEventListener("test",go,go),window.removeEventListener("test",go,go)}catch{Xc=!1}var Ps=null,Qc=null,qr=null;function Tm(){if(qr)return qr;var e,t=Qc,a=t.length,r,f="value"in Ps?Ps.value:Ps.textContent,p=f.length;for(e=0;e<a&&t[e]===f[e];e++);var x=a-e;for(r=1;r<=x&&t[a-r]===f[p-r];r++);return qr=f.slice(e,1<r?1-r:void 0)}function Hr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Gr(){return!0}function km(){return!1}function sn(e){function t(a,r,f,p,x){this._reactName=a,this._targetInst=f,this.type=r,this.nativeEvent=p,this.target=x,this.currentTarget=null;for(var k in e)e.hasOwnProperty(k)&&(a=e[k],this[k]=a?a(p):p[k]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Gr:km,this.isPropagationStopped=km,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Gr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Gr)},persist:function(){},isPersistent:Gr}),t}var Ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$r=sn(Ta),vo=b({},Ta,{view:0,detail:0}),Kx=sn(vo),eu,tu,yo,Fr=b({},vo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:su,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==yo&&(yo&&e.type==="mousemove"?(eu=e.screenX-yo.screenX,tu=e.screenY-yo.screenY):tu=eu=0,yo=e),eu)},movementY:function(e){return"movementY"in e?e.movementY:tu}}),wm=sn(Fr),Yx=b({},Fr,{dataTransfer:0}),Jx=sn(Yx),Wx=b({},vo,{relatedTarget:0}),nu=sn(Wx),Xx=b({},Ta,{animationName:0,elapsedTime:0,pseudoElement:0}),Qx=sn(Xx),e1=b({},Ta,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),t1=sn(e1),n1=b({},Ta,{data:0}),Nm=sn(n1),s1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},a1={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"},i1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function o1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=i1[e])?!!t[e]:!1}function su(){return o1}var r1=b({},vo,{key:function(e){if(e.key){var t=s1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Hr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?a1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:su,charCode:function(e){return e.type==="keypress"?Hr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Hr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),l1=sn(r1),c1=b({},Fr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jm=sn(c1),u1=b({},vo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:su}),d1=sn(u1),f1=b({},Ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),p1=sn(f1),m1=b({},Fr,{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}),h1=sn(m1),g1=b({},Ta,{newState:0,oldState:0}),v1=sn(g1),y1=[9,13,27,32],au=ds&&"CompositionEvent"in window,bo=null;ds&&"documentMode"in document&&(bo=document.documentMode);var b1=ds&&"TextEvent"in window&&!bo,Cm=ds&&(!au||bo&&8<bo&&11>=bo),Em=" ",Am=!1;function Dm(e,t){switch(e){case"keyup":return y1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fi=!1;function _1(e,t){switch(e){case"compositionend":return Rm(t);case"keypress":return t.which!==32?null:(Am=!0,Em);case"textInput":return e=t.data,e===Em&&Am?null:e;default:return null}}function x1(e,t){if(fi)return e==="compositionend"||!au&&Dm(e,t)?(e=Tm(),qr=Qc=Ps=null,fi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Cm&&t.locale!=="ko"?null:t.data;default:return null}}var S1={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 Mm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!S1[e.type]:t==="textarea"}function Om(e,t,a,r){ui?di?di.push(r):di=[r]:ui=r,t=Il(t,"onChange"),0<t.length&&(a=new $r("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var _o=null,xo=null;function T1(e){gv(e,0)}function Zr(e){var t=mo(e);if(hm(t))return e}function Im(e,t){if(e==="change")return t}var Bm=!1;if(ds){var iu;if(ds){var ou="oninput"in document;if(!ou){var Lm=document.createElement("div");Lm.setAttribute("oninput","return;"),ou=typeof Lm.oninput=="function"}iu=ou}else iu=!1;Bm=iu&&(!document.documentMode||9<document.documentMode)}function Um(){_o&&(_o.detachEvent("onpropertychange",zm),xo=_o=null)}function zm(e){if(e.propertyName==="value"&&Zr(xo)){var t=[];Om(t,xo,e,Jc(e)),Sm(T1,t)}}function k1(e,t,a){e==="focusin"?(Um(),_o=t,xo=a,_o.attachEvent("onpropertychange",zm)):e==="focusout"&&Um()}function w1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zr(xo)}function N1(e,t){if(e==="click")return Zr(t)}function j1(e,t){if(e==="input"||e==="change")return Zr(t)}function C1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fn=typeof Object.is=="function"?Object.is:C1;function So(e,t){if(fn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var f=a[r];if(!Tn.call(t,f)||!fn(e[f],t[f]))return!1}return!0}function Pm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vm(e,t){var a=Pm(e);e=0;for(var r;a;){if(a.nodeType===3){if(r=e+a.textContent.length,e<=t&&r>=t)return{node:a,offset:t-e};e=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Pm(a)}}function qm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?qm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Hm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pr(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Pr(e.document)}return t}function ru(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var E1=ds&&"documentMode"in document&&11>=document.documentMode,pi=null,lu=null,To=null,cu=!1;function Gm(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;cu||pi==null||pi!==Pr(r)||(r=pi,"selectionStart"in r&&ru(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),To&&So(To,r)||(To=r,r=Il(lu,"onSelect"),0<r.length&&(t=new $r("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=pi)))}function ka(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var mi={animationend:ka("Animation","AnimationEnd"),animationiteration:ka("Animation","AnimationIteration"),animationstart:ka("Animation","AnimationStart"),transitionrun:ka("Transition","TransitionRun"),transitionstart:ka("Transition","TransitionStart"),transitioncancel:ka("Transition","TransitionCancel"),transitionend:ka("Transition","TransitionEnd")},uu={},$m={};ds&&($m=document.createElement("div").style,"AnimationEvent"in window||(delete mi.animationend.animation,delete mi.animationiteration.animation,delete mi.animationstart.animation),"TransitionEvent"in window||delete mi.transitionend.transition);function wa(e){if(uu[e])return uu[e];if(!mi[e])return e;var t=mi[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in $m)return uu[e]=t[a];return e}var Fm=wa("animationend"),Zm=wa("animationiteration"),Km=wa("animationstart"),A1=wa("transitionrun"),D1=wa("transitionstart"),R1=wa("transitioncancel"),Ym=wa("transitionend"),Jm=new Map,du="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(" ");du.push("scrollEnd");function qn(e,t){Jm.set(e,t),Sa(t,[e])}var Kr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=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(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Nn=[],hi=0,fu=0;function Yr(){for(var e=hi,t=fu=hi=0;t<e;){var a=Nn[t];Nn[t++]=null;var r=Nn[t];Nn[t++]=null;var f=Nn[t];Nn[t++]=null;var p=Nn[t];if(Nn[t++]=null,r!==null&&f!==null){var x=r.pending;x===null?f.next=f:(f.next=x.next,x.next=f),r.pending=f}p!==0&&Wm(a,f,p)}}function Jr(e,t,a,r){Nn[hi++]=e,Nn[hi++]=t,Nn[hi++]=a,Nn[hi++]=r,fu|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function pu(e,t,a,r){return Jr(e,t,a,r),Wr(e)}function Na(e,t){return Jr(e,null,null,t),Wr(e)}function Wm(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var f=!1,p=e.return;p!==null;)p.childLanes|=a,r=p.alternate,r!==null&&(r.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(f=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,f&&t!==null&&(f=31-Jt(a),e=p.hiddenUpdates,r=e[f],r===null?e[f]=[t]:r.push(t),t.lane=a|536870912),p):null}function Wr(e){if(50<$o)throw $o=0,Sd=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var gi={};function M1(e,t,a,r){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=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pn(e,t,a,r){return new M1(e,t,a,r)}function mu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fs(e,t){var a=e.alternate;return a===null?(a=pn(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,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,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Xm(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,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,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Xr(e,t,a,r,f,p){var x=0;if(r=e,typeof e=="function")mu(e)&&(x=1);else if(typeof e=="string")x=US(e,a,Ae.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case V:return e=pn(31,a,t,f),e.elementType=V,e.lanes=p,e;case N:return ja(a.children,f,p,t);case j:x=8,f|=24;break;case w:return e=pn(12,a,t,f|2),e.elementType=w,e.lanes=p,e;case C:return e=pn(13,a,t,f),e.elementType=C,e.lanes=p,e;case M:return e=pn(19,a,t,f),e.elementType=M,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A:x=10;break e;case E:x=9;break e;case O:x=11;break e;case G:x=14;break e;case U:x=16,r=null;break e}x=29,a=Error(o(130,e===null?"null":typeof e,"")),r=null}return t=pn(x,a,t,f),t.elementType=e,t.type=r,t.lanes=p,t}function ja(e,t,a,r){return e=pn(7,e,r,t),e.lanes=a,e}function hu(e,t,a){return e=pn(6,e,null,t),e.lanes=a,e}function Qm(e){var t=pn(18,null,null,0);return t.stateNode=e,t}function gu(e,t,a){return t=pn(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var eh=new WeakMap;function jn(e,t){if(typeof e=="object"&&e!==null){var a=eh.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Jn(t)},eh.set(e,t),t)}return{value:e,source:t,stack:Jn(t)}}var vi=[],yi=0,Qr=null,ko=0,Cn=[],En=0,Vs=null,Wn=1,Xn="";function ps(e,t){vi[yi++]=ko,vi[yi++]=Qr,Qr=e,ko=t}function th(e,t,a){Cn[En++]=Wn,Cn[En++]=Xn,Cn[En++]=Vs,Vs=e;var r=Wn;e=Xn;var f=32-Jt(r)-1;r&=~(1<<f),a+=1;var p=32-Jt(t)+f;if(30<p){var x=f-f%5;p=(r&(1<<x)-1).toString(32),r>>=x,f-=x,Wn=1<<32-Jt(t)+f|a<<f|r,Xn=p+e}else Wn=1<<p|a<<f|r,Xn=e}function vu(e){e.return!==null&&(ps(e,1),th(e,1,0))}function yu(e){for(;e===Qr;)Qr=vi[--yi],vi[yi]=null,ko=vi[--yi],vi[yi]=null;for(;e===Vs;)Vs=Cn[--En],Cn[En]=null,Xn=Cn[--En],Cn[En]=null,Wn=Cn[--En],Cn[En]=null}function nh(e,t){Cn[En++]=Wn,Cn[En++]=Xn,Cn[En++]=Vs,Wn=t.id,Xn=t.overflow,Vs=e}var qt=null,lt=null,Ge=!1,qs=null,An=!1,bu=Error(o(519));function Hs(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wo(jn(t,e)),bu}function sh(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[Vt]=e,t[nn]=r,a){case"dialog":Ue("cancel",t),Ue("close",t);break;case"iframe":case"object":case"embed":Ue("load",t);break;case"video":case"audio":for(a=0;a<Zo.length;a++)Ue(Zo[a],t);break;case"source":Ue("error",t);break;case"img":case"image":case"link":Ue("error",t),Ue("load",t);break;case"details":Ue("toggle",t);break;case"input":Ue("invalid",t),gm(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Ue("invalid",t);break;case"textarea":Ue("invalid",t),ym(t,r.value,r.defaultValue,r.children)}a=r.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||r.suppressHydrationWarning===!0||_v(t.textContent,a)?(r.popover!=null&&(Ue("beforetoggle",t),Ue("toggle",t)),r.onScroll!=null&&Ue("scroll",t),r.onScrollEnd!=null&&Ue("scrollend",t),r.onClick!=null&&(t.onclick=us),t=!0):t=!1,t||Hs(e,!0)}function ah(e){for(qt=e.return;qt;)switch(qt.tag){case 5:case 31:case 13:An=!1;return;case 27:case 3:An=!0;return;default:qt=qt.return}}function bi(e){if(e!==qt)return!1;if(!Ge)return ah(e),Ge=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Ld(e.type,e.memoizedProps)),a=!a),a&<&&Hs(e),ah(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));lt=Ev(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));lt=Ev(e)}else t===27?(t=lt,sa(e.type)?(e=qd,qd=null,lt=e):lt=t):lt=qt?Rn(e.stateNode.nextSibling):null;return!0}function Ca(){lt=qt=null,Ge=!1}function _u(){var e=qs;return e!==null&&(ln===null?ln=e:ln.push.apply(ln,e),qs=null),e}function wo(e){qs===null?qs=[e]:qs.push(e)}var xu=ze(null),Ea=null,ms=null;function Gs(e,t,a){Ne(xu,t._currentValue),t._currentValue=a}function hs(e){e._currentValue=xu.current,je(xu)}function Su(e,t,a){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===a)break;e=e.return}}function Tu(e,t,a,r){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var p=f.dependencies;if(p!==null){var x=f.child;p=p.firstContext;e:for(;p!==null;){var k=p;p=f;for(var D=0;D<t.length;D++)if(k.context===t[D]){p.lanes|=a,k=p.alternate,k!==null&&(k.lanes|=a),Su(p.return,a,e),r||(x=null);break e}p=k.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(o(341));x.lanes|=a,p=x.alternate,p!==null&&(p.lanes|=a),Su(x,a,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function _i(e,t,a,r){e=null;for(var f=t,p=!1;f!==null;){if(!p){if((f.flags&524288)!==0)p=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(o(387));if(x=x.memoizedProps,x!==null){var k=f.type;fn(f.pendingProps.value,x.value)||(e!==null?e.push(k):e=[k])}}else if(f===pe.current){if(x=f.alternate,x===null)throw Error(o(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Xo):e=[Xo])}f=f.return}e!==null&&Tu(t,e,a,r),t.flags|=262144}function el(e){for(e=e.firstContext;e!==null;){if(!fn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Aa(e){Ea=e,ms=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ht(e){return ih(Ea,e)}function tl(e,t){return Ea===null&&Aa(e),ih(e,t)}function ih(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},ms===null){if(e===null)throw Error(o(308));ms=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ms=ms.next=t;return a}var O1=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},I1=n.unstable_scheduleCallback,B1=n.unstable_NormalPriority,jt={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ku(){return{controller:new O1,data:new Map,refCount:0}}function No(e){e.refCount--,e.refCount===0&&I1(B1,function(){e.controller.abort()})}var jo=null,wu=0,xi=0,Si=null;function L1(e,t){if(jo===null){var a=jo=[];wu=0,xi=Cd(),Si={status:"pending",value:void 0,then:function(r){a.push(r)}}}return wu++,t.then(oh,oh),t}function oh(){if(--wu===0&&jo!==null){Si!==null&&(Si.status="fulfilled");var e=jo;jo=null,xi=0,Si=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function U1(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var f=0;f<a.length;f++)(0,a[f])(t)},function(f){for(r.status="rejected",r.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),r}var rh=I.S;I.S=function(e,t){Gg=Kt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&L1(e,t),rh!==null&&rh(e,t)};var Da=ze(null);function Nu(){var e=Da.current;return e!==null?e:ot.pooledCache}function nl(e,t){t===null?Ne(Da,Da.current):Ne(Da,t.pool)}function lh(){var e=Nu();return e===null?null:{parent:jt._currentValue,pool:e}}var Ti=Error(o(460)),ju=Error(o(474)),sl=Error(o(542)),al={then:function(){}};function ch(e){return e=e.status,e==="fulfilled"||e==="rejected"}function uh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(us,us),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fh(e),e;default:if(typeof t.status=="string")t.then(us,us);else{if(e=ot,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var f=t;f.status="fulfilled",f.value=r}},function(r){if(t.status==="pending"){var f=t;f.status="rejected",f.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fh(e),e}throw Ma=t,Ti}}function Ra(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ma=a,Ti):a}}var Ma=null;function dh(){if(Ma===null)throw Error(o(459));var e=Ma;return Ma=null,e}function fh(e){if(e===Ti||e===sl)throw Error(o(483))}var ki=null,Co=0;function il(e){var t=Co;return Co+=1,ki===null&&(ki=[]),uh(ki,e,t)}function Eo(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ol(e,t){throw t.$$typeof===_?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function ph(e){function t(B,R){if(e){var z=B.deletions;z===null?(B.deletions=[R],B.flags|=16):z.push(R)}}function a(B,R){if(!e)return null;for(;R!==null;)t(B,R),R=R.sibling;return null}function r(B){for(var R=new Map;B!==null;)B.key!==null?R.set(B.key,B):R.set(B.index,B),B=B.sibling;return R}function f(B,R){return B=fs(B,R),B.index=0,B.sibling=null,B}function p(B,R,z){return B.index=z,e?(z=B.alternate,z!==null?(z=z.index,z<R?(B.flags|=67108866,R):z):(B.flags|=67108866,R)):(B.flags|=1048576,R)}function x(B){return e&&B.alternate===null&&(B.flags|=67108866),B}function k(B,R,z,J){return R===null||R.tag!==6?(R=hu(z,B.mode,J),R.return=B,R):(R=f(R,z),R.return=B,R)}function D(B,R,z,J){var _e=z.type;return _e===N?Y(B,R,z.props.children,J,z.key):R!==null&&(R.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===U&&Ra(_e)===R.type)?(R=f(R,z.props),Eo(R,z),R.return=B,R):(R=Xr(z.type,z.key,z.props,null,B.mode,J),Eo(R,z),R.return=B,R)}function P(B,R,z,J){return R===null||R.tag!==4||R.stateNode.containerInfo!==z.containerInfo||R.stateNode.implementation!==z.implementation?(R=gu(z,B.mode,J),R.return=B,R):(R=f(R,z.children||[]),R.return=B,R)}function Y(B,R,z,J,_e){return R===null||R.tag!==7?(R=ja(z,B.mode,J,_e),R.return=B,R):(R=f(R,z),R.return=B,R)}function W(B,R,z){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=hu(""+R,B.mode,z),R.return=B,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case S:return z=Xr(R.type,R.key,R.props,null,B.mode,z),Eo(z,R),z.return=B,z;case T:return R=gu(R,B.mode,z),R.return=B,R;case U:return R=Ra(R),W(B,R,z)}if(re(R)||ie(R))return R=ja(R,B.mode,z,null),R.return=B,R;if(typeof R.then=="function")return W(B,il(R),z);if(R.$$typeof===A)return W(B,tl(B,R),z);ol(B,R)}return null}function H(B,R,z,J){var _e=R!==null?R.key:null;if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return _e!==null?null:k(B,R,""+z,J);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case S:return z.key===_e?D(B,R,z,J):null;case T:return z.key===_e?P(B,R,z,J):null;case U:return z=Ra(z),H(B,R,z,J)}if(re(z)||ie(z))return _e!==null?null:Y(B,R,z,J,null);if(typeof z.then=="function")return H(B,R,il(z),J);if(z.$$typeof===A)return H(B,R,tl(B,z),J);ol(B,z)}return null}function F(B,R,z,J,_e){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return B=B.get(z)||null,k(R,B,""+J,_e);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case S:return B=B.get(J.key===null?z:J.key)||null,D(R,B,J,_e);case T:return B=B.get(J.key===null?z:J.key)||null,P(R,B,J,_e);case U:return J=Ra(J),F(B,R,z,J,_e)}if(re(J)||ie(J))return B=B.get(z)||null,Y(R,B,J,_e,null);if(typeof J.then=="function")return F(B,R,z,il(J),_e);if(J.$$typeof===A)return F(B,R,z,tl(R,J),_e);ol(R,J)}return null}function ge(B,R,z,J){for(var _e=null,Ye=null,ve=R,Ie=R=0,Ve=null;ve!==null&&Ie<z.length;Ie++){ve.index>Ie?(Ve=ve,ve=null):Ve=ve.sibling;var Je=H(B,ve,z[Ie],J);if(Je===null){ve===null&&(ve=Ve);break}e&&ve&&Je.alternate===null&&t(B,ve),R=p(Je,R,Ie),Ye===null?_e=Je:Ye.sibling=Je,Ye=Je,ve=Ve}if(Ie===z.length)return a(B,ve),Ge&&ps(B,Ie),_e;if(ve===null){for(;Ie<z.length;Ie++)ve=W(B,z[Ie],J),ve!==null&&(R=p(ve,R,Ie),Ye===null?_e=ve:Ye.sibling=ve,Ye=ve);return Ge&&ps(B,Ie),_e}for(ve=r(ve);Ie<z.length;Ie++)Ve=F(ve,B,Ie,z[Ie],J),Ve!==null&&(e&&Ve.alternate!==null&&ve.delete(Ve.key===null?Ie:Ve.key),R=p(Ve,R,Ie),Ye===null?_e=Ve:Ye.sibling=Ve,Ye=Ve);return e&&ve.forEach(function(la){return t(B,la)}),Ge&&ps(B,Ie),_e}function Se(B,R,z,J){if(z==null)throw Error(o(151));for(var _e=null,Ye=null,ve=R,Ie=R=0,Ve=null,Je=z.next();ve!==null&&!Je.done;Ie++,Je=z.next()){ve.index>Ie?(Ve=ve,ve=null):Ve=ve.sibling;var la=H(B,ve,Je.value,J);if(la===null){ve===null&&(ve=Ve);break}e&&ve&&la.alternate===null&&t(B,ve),R=p(la,R,Ie),Ye===null?_e=la:Ye.sibling=la,Ye=la,ve=Ve}if(Je.done)return a(B,ve),Ge&&ps(B,Ie),_e;if(ve===null){for(;!Je.done;Ie++,Je=z.next())Je=W(B,Je.value,J),Je!==null&&(R=p(Je,R,Ie),Ye===null?_e=Je:Ye.sibling=Je,Ye=Je);return Ge&&ps(B,Ie),_e}for(ve=r(ve);!Je.done;Ie++,Je=z.next())Je=F(ve,B,Ie,Je.value,J),Je!==null&&(e&&Je.alternate!==null&&ve.delete(Je.key===null?Ie:Je.key),R=p(Je,R,Ie),Ye===null?_e=Je:Ye.sibling=Je,Ye=Je);return e&&ve.forEach(function(YS){return t(B,YS)}),Ge&&ps(B,Ie),_e}function it(B,R,z,J){if(typeof z=="object"&&z!==null&&z.type===N&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case S:e:{for(var _e=z.key;R!==null;){if(R.key===_e){if(_e=z.type,_e===N){if(R.tag===7){a(B,R.sibling),J=f(R,z.props.children),J.return=B,B=J;break e}}else if(R.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===U&&Ra(_e)===R.type){a(B,R.sibling),J=f(R,z.props),Eo(J,z),J.return=B,B=J;break e}a(B,R);break}else t(B,R);R=R.sibling}z.type===N?(J=ja(z.props.children,B.mode,J,z.key),J.return=B,B=J):(J=Xr(z.type,z.key,z.props,null,B.mode,J),Eo(J,z),J.return=B,B=J)}return x(B);case T:e:{for(_e=z.key;R!==null;){if(R.key===_e)if(R.tag===4&&R.stateNode.containerInfo===z.containerInfo&&R.stateNode.implementation===z.implementation){a(B,R.sibling),J=f(R,z.children||[]),J.return=B,B=J;break e}else{a(B,R);break}else t(B,R);R=R.sibling}J=gu(z,B.mode,J),J.return=B,B=J}return x(B);case U:return z=Ra(z),it(B,R,z,J)}if(re(z))return ge(B,R,z,J);if(ie(z)){if(_e=ie(z),typeof _e!="function")throw Error(o(150));return z=_e.call(z),Se(B,R,z,J)}if(typeof z.then=="function")return it(B,R,il(z),J);if(z.$$typeof===A)return it(B,R,tl(B,z),J);ol(B,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,R!==null&&R.tag===6?(a(B,R.sibling),J=f(R,z),J.return=B,B=J):(a(B,R),J=hu(z,B.mode,J),J.return=B,B=J),x(B)):a(B,R)}return function(B,R,z,J){try{Co=0;var _e=it(B,R,z,J);return ki=null,_e}catch(ve){if(ve===Ti||ve===sl)throw ve;var Ye=pn(29,ve,null,B.mode);return Ye.lanes=J,Ye.return=B,Ye}finally{}}}var Oa=ph(!0),mh=ph(!1),$s=!1;function Cu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Eu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Fs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Zs(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Xe&2)!==0){var f=r.pending;return f===null?t.next=t:(t.next=f.next,f.next=t),r.pending=t,t=Wr(e),Wm(e,null,a),t}return Jr(e,r,t,a),Wr(e)}function Ao(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,Tt(e,a)}}function Au(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var f=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?f=p=x:p=p.next=x,a=a.next}while(a!==null);p===null?f=p=t:p=p.next=t}else f=p=t;a={baseState:r.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Du=!1;function Do(){if(Du){var e=Si;if(e!==null)throw e}}function Ro(e,t,a,r){Du=!1;var f=e.updateQueue;$s=!1;var p=f.firstBaseUpdate,x=f.lastBaseUpdate,k=f.shared.pending;if(k!==null){f.shared.pending=null;var D=k,P=D.next;D.next=null,x===null?p=P:x.next=P,x=D;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,k=Y.lastBaseUpdate,k!==x&&(k===null?Y.firstBaseUpdate=P:k.next=P,Y.lastBaseUpdate=D))}if(p!==null){var W=f.baseState;x=0,Y=P=D=null,k=p;do{var H=k.lane&-536870913,F=H!==k.lane;if(F?(Pe&H)===H:(r&H)===H){H!==0&&H===xi&&(Du=!0),Y!==null&&(Y=Y.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var ge=e,Se=k;H=t;var it=a;switch(Se.tag){case 1:if(ge=Se.payload,typeof ge=="function"){W=ge.call(it,W,H);break e}W=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Se.payload,H=typeof ge=="function"?ge.call(it,W,H):ge,H==null)break e;W=b({},W,H);break e;case 2:$s=!0}}H=k.callback,H!==null&&(e.flags|=64,F&&(e.flags|=8192),F=f.callbacks,F===null?f.callbacks=[H]:F.push(H))}else F={lane:H,tag:k.tag,payload:k.payload,callback:k.callback,next:null},Y===null?(P=Y=F,D=W):Y=Y.next=F,x|=H;if(k=k.next,k===null){if(k=f.shared.pending,k===null)break;F=k,k=F.next,F.next=null,f.lastBaseUpdate=F,f.shared.pending=null}}while(!0);Y===null&&(D=W),f.baseState=D,f.firstBaseUpdate=P,f.lastBaseUpdate=Y,p===null&&(f.shared.lanes=0),Xs|=x,e.lanes=x,e.memoizedState=W}}function hh(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function gh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)hh(a[e],t)}var wi=ze(null),rl=ze(0);function vh(e,t){e=ks,Ne(rl,e),Ne(wi,t),ks=e|t.baseLanes}function Ru(){Ne(rl,ks),Ne(wi,wi.current)}function Mu(){ks=rl.current,je(wi),je(rl)}var mn=ze(null),Dn=null;function Ks(e){var t=e.alternate;Ne(kt,kt.current&1),Ne(mn,e),Dn===null&&(t===null||wi.current!==null||t.memoizedState!==null)&&(Dn=e)}function Ou(e){Ne(kt,kt.current),Ne(mn,e),Dn===null&&(Dn=e)}function yh(e){e.tag===22?(Ne(kt,kt.current),Ne(mn,e),Dn===null&&(Dn=e)):Ys()}function Ys(){Ne(kt,kt.current),Ne(mn,mn.current)}function hn(e){je(mn),Dn===e&&(Dn=null),je(kt)}var kt=ze(0);function ll(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Pd(a)||Vd(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var gs=0,De=null,st=null,Ct=null,cl=!1,Ni=!1,Ia=!1,ul=0,Mo=0,ji=null,z1=0;function yt(){throw Error(o(321))}function Iu(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!fn(e[a],t[a]))return!1;return!0}function Bu(e,t,a,r,f,p){return gs=p,De=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?tg:Wu,Ia=!1,p=a(r,f),Ia=!1,Ni&&(p=_h(t,a,r,f)),bh(e),p}function bh(e){I.H=Bo;var t=st!==null&&st.next!==null;if(gs=0,Ct=st=De=null,cl=!1,Mo=0,ji=null,t)throw Error(o(300));e===null||Et||(e=e.dependencies,e!==null&&el(e)&&(Et=!0))}function _h(e,t,a,r){De=e;var f=0;do{if(Ni&&(ji=null),Mo=0,Ni=!1,25<=f)throw Error(o(301));if(f+=1,Ct=st=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}I.H=ng,p=t(a,r)}while(Ni);return p}function P1(){var e=I.H,t=e.useState()[0];return t=typeof t.then=="function"?Oo(t):t,e=e.useState()[0],(st!==null?st.memoizedState:null)!==e&&(De.flags|=1024),t}function Lu(){var e=ul!==0;return ul=0,e}function Uu(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function zu(e){if(cl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}cl=!1}gs=0,Ct=st=De=null,Ni=!1,Mo=ul=0,ji=null}function Qt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?De.memoizedState=Ct=e:Ct=Ct.next=e,Ct}function wt(){if(st===null){var e=De.alternate;e=e!==null?e.memoizedState:null}else e=st.next;var t=Ct===null?De.memoizedState:Ct.next;if(t!==null)Ct=t,st=e;else{if(e===null)throw De.alternate===null?Error(o(467)):Error(o(310));st=e,e={memoizedState:st.memoizedState,baseState:st.baseState,baseQueue:st.baseQueue,queue:st.queue,next:null},Ct===null?De.memoizedState=Ct=e:Ct=Ct.next=e}return Ct}function dl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oo(e){var t=Mo;return Mo+=1,ji===null&&(ji=[]),e=uh(ji,e,t),t=De,(Ct===null?t.memoizedState:Ct.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?tg:Wu),e}function fl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Oo(e);if(e.$$typeof===A)return Ht(e)}throw Error(o(438,String(e)))}function Pu(e){var t=null,a=De.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=De.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(f){return f.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=dl(),De.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=Z;return t.index++,a}function vs(e,t){return typeof t=="function"?t(e):t}function pl(e){var t=wt();return Vu(t,st,e)}function Vu(e,t,a){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=a;var f=e.baseQueue,p=r.pending;if(p!==null){if(f!==null){var x=f.next;f.next=p.next,p.next=x}t.baseQueue=f=p,r.pending=null}if(p=e.baseState,f===null)e.memoizedState=p;else{t=f.next;var k=x=null,D=null,P=t,Y=!1;do{var W=P.lane&-536870913;if(W!==P.lane?(Pe&W)===W:(gs&W)===W){var H=P.revertLane;if(H===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),W===xi&&(Y=!0);else if((gs&H)===H){P=P.next,H===xi&&(Y=!0);continue}else W={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},D===null?(k=D=W,x=p):D=D.next=W,De.lanes|=H,Xs|=H;W=P.action,Ia&&a(p,W),p=P.hasEagerState?P.eagerState:a(p,W)}else H={lane:W,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},D===null?(k=D=H,x=p):D=D.next=H,De.lanes|=W,Xs|=W;P=P.next}while(P!==null&&P!==t);if(D===null?x=p:D.next=k,!fn(p,e.memoizedState)&&(Et=!0,Y&&(a=Si,a!==null)))throw a;e.memoizedState=p,e.baseState=x,e.baseQueue=D,r.lastRenderedState=p}return f===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function qu(e){var t=wt(),a=t.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=e;var r=a.dispatch,f=a.pending,p=t.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do p=e(p,x.action),x=x.next;while(x!==f);fn(p,t.memoizedState)||(Et=!0),t.memoizedState=p,t.baseQueue===null&&(t.baseState=p),a.lastRenderedState=p}return[p,r]}function xh(e,t,a){var r=De,f=wt(),p=Ge;if(p){if(a===void 0)throw Error(o(407));a=a()}else a=t();var x=!fn((st||f).memoizedState,a);if(x&&(f.memoizedState=a,Et=!0),f=f.queue,$u(kh.bind(null,r,f,e),[e]),f.getSnapshot!==t||x||Ct!==null&&Ct.memoizedState.tag&1){if(r.flags|=2048,Ci(9,{destroy:void 0},Th.bind(null,r,f,a,t),null),ot===null)throw Error(o(349));p||(gs&127)!==0||Sh(r,t,a)}return a}function Sh(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=De.updateQueue,t===null?(t=dl(),De.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Th(e,t,a,r){t.value=a,t.getSnapshot=r,wh(t)&&Nh(e)}function kh(e,t,a){return a(function(){wh(t)&&Nh(e)})}function wh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!fn(e,a)}catch{return!0}}function Nh(e){var t=Na(e,2);t!==null&&cn(t,e,2)}function Hu(e){var t=Qt();if(typeof e=="function"){var a=e;if(e=a(),Ia){Pn(!0);try{a()}finally{Pn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:e},t}function jh(e,t,a,r){return e.baseState=a,Vu(e,st,typeof r=="function"?r:vs)}function V1(e,t,a,r,f){if(gl(e))throw Error(o(485));if(e=t.action,e!==null){var p={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){p.listeners.push(x)}};I.T!==null?a(!0):p.isTransition=!1,r(p),a=t.pending,a===null?(p.next=t.pending=p,Ch(t,p)):(p.next=a.next,t.pending=a.next=p)}}function Ch(e,t){var a=t.action,r=t.payload,f=e.state;if(t.isTransition){var p=I.T,x={};I.T=x;try{var k=a(f,r),D=I.S;D!==null&&D(x,k),Eh(e,t,k)}catch(P){Gu(e,t,P)}finally{p!==null&&x.types!==null&&(p.types=x.types),I.T=p}}else try{p=a(f,r),Eh(e,t,p)}catch(P){Gu(e,t,P)}}function Eh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){Ah(e,t,r)},function(r){return Gu(e,t,r)}):Ah(e,t,a)}function Ah(e,t,a){t.status="fulfilled",t.value=a,Dh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Ch(e,a)))}function Gu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,Dh(t),t=t.next;while(t!==r)}e.action=null}function Dh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Rh(e,t){return t}function Mh(e,t){if(Ge){var a=ot.formState;if(a!==null){e:{var r=De;if(Ge){if(lt){t:{for(var f=lt,p=An;f.nodeType!==8;){if(!p){f=null;break t}if(f=Rn(f.nextSibling),f===null){f=null;break t}}p=f.data,f=p==="F!"||p==="F"?f:null}if(f){lt=Rn(f.nextSibling),r=f.data==="F!";break e}}Hs(r)}r=!1}r&&(t=a[0])}}return a=Qt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rh,lastRenderedState:t},a.queue=r,a=Xh.bind(null,De,r),r.dispatch=a,r=Hu(!1),p=Ju.bind(null,De,!1,r.queue),r=Qt(),f={state:t,dispatch:null,action:e,pending:null},r.queue=f,a=V1.bind(null,De,f,p,a),f.dispatch=a,r.memoizedState=e,[t,a,!1]}function Oh(e){var t=wt();return Ih(t,st,e)}function Ih(e,t,a){if(t=Vu(e,t,Rh)[0],e=pl(vs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Oo(t)}catch(x){throw x===Ti?sl:x}else r=t;t=wt();var f=t.queue,p=f.dispatch;return a!==t.memoizedState&&(De.flags|=2048,Ci(9,{destroy:void 0},q1.bind(null,f,a),null)),[r,p,e]}function q1(e,t){e.action=t}function Bh(e){var t=wt(),a=st;if(a!==null)return Ih(t,a,e);wt(),t=t.memoizedState,a=wt();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function Ci(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=De.updateQueue,t===null&&(t=dl(),De.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(r=a.next,a.next=e,e.next=r,t.lastEffect=e),e}function Lh(){return wt().memoizedState}function ml(e,t,a,r){var f=Qt();De.flags|=e,f.memoizedState=Ci(1|t,{destroy:void 0},a,r===void 0?null:r)}function hl(e,t,a,r){var f=wt();r=r===void 0?null:r;var p=f.memoizedState.inst;st!==null&&r!==null&&Iu(r,st.memoizedState.deps)?f.memoizedState=Ci(t,p,a,r):(De.flags|=e,f.memoizedState=Ci(1|t,p,a,r))}function Uh(e,t){ml(8390656,8,e,t)}function $u(e,t){hl(2048,8,e,t)}function H1(e){De.flags|=4;var t=De.updateQueue;if(t===null)t=dl(),De.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function zh(e){var t=wt().memoizedState;return H1({ref:t,nextImpl:e}),function(){if((Xe&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Ph(e,t){return hl(4,2,e,t)}function Vh(e,t){return hl(4,4,e,t)}function qh(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Hh(e,t,a){a=a!=null?a.concat([e]):null,hl(4,4,qh.bind(null,t,e),a)}function Fu(){}function Gh(e,t){var a=wt();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&Iu(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function $h(e,t){var a=wt();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&Iu(t,r[1]))return r[0];if(r=e(),Ia){Pn(!0);try{e()}finally{Pn(!1)}}return a.memoizedState=[r,t],r}function Zu(e,t,a){return a===void 0||(gs&1073741824)!==0&&(Pe&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Fg(),De.lanes|=e,Xs|=e,a)}function Fh(e,t,a,r){return fn(a,t)?a:wi.current!==null?(e=Zu(e,a,r),fn(e,t)||(Et=!0),e):(gs&42)===0||(gs&1073741824)!==0&&(Pe&261930)===0?(Et=!0,e.memoizedState=a):(e=Fg(),De.lanes|=e,Xs|=e,t)}function Zh(e,t,a,r,f){var p=$.p;$.p=p!==0&&8>p?p:8;var x=I.T,k={};I.T=k,Ju(e,!1,t,a);try{var D=f(),P=I.S;if(P!==null&&P(k,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var Y=U1(D,r);Io(e,t,Y,yn(e))}else Io(e,t,r,yn(e))}catch(W){Io(e,t,{then:function(){},status:"rejected",reason:W},yn())}finally{$.p=p,x!==null&&k.types!==null&&(x.types=k.types),I.T=x}}function G1(){}function Ku(e,t,a,r){if(e.tag!==5)throw Error(o(476));var f=Kh(e).queue;Zh(e,f,t,Q,a===null?G1:function(){return Yh(e),a(r)})}function Kh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:Q},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Yh(e){var t=Kh(e);t.next===null&&(t=e.alternate.memoizedState),Io(e,t.next.queue,{},yn())}function Yu(){return Ht(Xo)}function Jh(){return wt().memoizedState}function Wh(){return wt().memoizedState}function $1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=yn();e=Fs(a);var r=Zs(t,e,a);r!==null&&(cn(r,t,a),Ao(r,t,a)),t={cache:ku()},e.payload=t;return}t=t.return}}function F1(e,t,a){var r=yn();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},gl(e)?Qh(t,a):(a=pu(e,t,a,r),a!==null&&(cn(a,e,r),eg(a,t,r)))}function Xh(e,t,a){var r=yn();Io(e,t,a,r)}function Io(e,t,a,r){var f={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(gl(e))Qh(t,f);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=t.lastRenderedReducer,p!==null))try{var x=t.lastRenderedState,k=p(x,a);if(f.hasEagerState=!0,f.eagerState=k,fn(k,x))return Jr(e,t,f,0),ot===null&&Yr(),!1}catch{}finally{}if(a=pu(e,t,f,r),a!==null)return cn(a,e,r),eg(a,t,r),!0}return!1}function Ju(e,t,a,r){if(r={lane:2,revertLane:Cd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},gl(e)){if(t)throw Error(o(479))}else t=pu(e,a,r,2),t!==null&&cn(t,e,2)}function gl(e){var t=e.alternate;return e===De||t!==null&&t===De}function Qh(e,t){Ni=cl=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function eg(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,Tt(e,a)}}var Bo={readContext:Ht,use:fl,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useLayoutEffect:yt,useInsertionEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useSyncExternalStore:yt,useId:yt,useHostTransitionStatus:yt,useFormState:yt,useActionState:yt,useOptimistic:yt,useMemoCache:yt,useCacheRefresh:yt};Bo.useEffectEvent=yt;var tg={readContext:Ht,use:fl,useCallback:function(e,t){return Qt().memoizedState=[e,t===void 0?null:t],e},useContext:Ht,useEffect:Uh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,ml(4194308,4,qh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return ml(4194308,4,e,t)},useInsertionEffect:function(e,t){ml(4,2,e,t)},useMemo:function(e,t){var a=Qt();t=t===void 0?null:t;var r=e();if(Ia){Pn(!0);try{e()}finally{Pn(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=Qt();if(a!==void 0){var f=a(t);if(Ia){Pn(!0);try{a(t)}finally{Pn(!1)}}}else f=t;return r.memoizedState=r.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},r.queue=e,e=e.dispatch=F1.bind(null,De,e),[r.memoizedState,e]},useRef:function(e){var t=Qt();return e={current:e},t.memoizedState=e},useState:function(e){e=Hu(e);var t=e.queue,a=Xh.bind(null,De,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Fu,useDeferredValue:function(e,t){var a=Qt();return Zu(a,e,t)},useTransition:function(){var e=Hu(!1);return e=Zh.bind(null,De,e.queue,!0,!1),Qt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=De,f=Qt();if(Ge){if(a===void 0)throw Error(o(407));a=a()}else{if(a=t(),ot===null)throw Error(o(349));(Pe&127)!==0||Sh(r,t,a)}f.memoizedState=a;var p={value:a,getSnapshot:t};return f.queue=p,Uh(kh.bind(null,r,p,e),[e]),r.flags|=2048,Ci(9,{destroy:void 0},Th.bind(null,r,p,a,t),null),a},useId:function(){var e=Qt(),t=ot.identifierPrefix;if(Ge){var a=Xn,r=Wn;a=(r&~(1<<32-Jt(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ul++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=z1++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Yu,useFormState:Mh,useActionState:Mh,useOptimistic:function(e){var t=Qt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Ju.bind(null,De,!0,a),a.dispatch=t,[e,t]},useMemoCache:Pu,useCacheRefresh:function(){return Qt().memoizedState=$1.bind(null,De)},useEffectEvent:function(e){var t=Qt(),a={impl:e};return t.memoizedState=a,function(){if((Xe&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}},Wu={readContext:Ht,use:fl,useCallback:Gh,useContext:Ht,useEffect:$u,useImperativeHandle:Hh,useInsertionEffect:Ph,useLayoutEffect:Vh,useMemo:$h,useReducer:pl,useRef:Lh,useState:function(){return pl(vs)},useDebugValue:Fu,useDeferredValue:function(e,t){var a=wt();return Fh(a,st.memoizedState,e,t)},useTransition:function(){var e=pl(vs)[0],t=wt().memoizedState;return[typeof e=="boolean"?e:Oo(e),t]},useSyncExternalStore:xh,useId:Jh,useHostTransitionStatus:Yu,useFormState:Oh,useActionState:Oh,useOptimistic:function(e,t){var a=wt();return jh(a,st,e,t)},useMemoCache:Pu,useCacheRefresh:Wh};Wu.useEffectEvent=zh;var ng={readContext:Ht,use:fl,useCallback:Gh,useContext:Ht,useEffect:$u,useImperativeHandle:Hh,useInsertionEffect:Ph,useLayoutEffect:Vh,useMemo:$h,useReducer:qu,useRef:Lh,useState:function(){return qu(vs)},useDebugValue:Fu,useDeferredValue:function(e,t){var a=wt();return st===null?Zu(a,e,t):Fh(a,st.memoizedState,e,t)},useTransition:function(){var e=qu(vs)[0],t=wt().memoizedState;return[typeof e=="boolean"?e:Oo(e),t]},useSyncExternalStore:xh,useId:Jh,useHostTransitionStatus:Yu,useFormState:Bh,useActionState:Bh,useOptimistic:function(e,t){var a=wt();return st!==null?jh(a,st,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Pu,useCacheRefresh:Wh};ng.useEffectEvent=zh;function Xu(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Qu={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=yn(),f=Fs(r);f.payload=t,a!=null&&(f.callback=a),t=Zs(e,f,r),t!==null&&(cn(t,e,r),Ao(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=yn(),f=Fs(r);f.tag=1,f.payload=t,a!=null&&(f.callback=a),t=Zs(e,f,r),t!==null&&(cn(t,e,r),Ao(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=yn(),r=Fs(a);r.tag=2,t!=null&&(r.callback=t),t=Zs(e,r,a),t!==null&&(cn(t,e,a),Ao(t,e,a))}};function sg(e,t,a,r,f,p,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,p,x):t.prototype&&t.prototype.isPureReactComponent?!So(a,r)||!So(f,p):!0}function ag(e,t,a,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,r),t.state!==e&&Qu.enqueueReplaceState(t,t.state,null)}function Ba(e,t){var a=t;if("ref"in t){a={};for(var r in t)r!=="ref"&&(a[r]=t[r])}if(e=e.defaultProps){a===t&&(a=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function ig(e){Kr(e)}function og(e){console.error(e)}function rg(e){Kr(e)}function vl(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function lg(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function ed(e,t,a){return a=Fs(a),a.tag=3,a.payload={element:null},a.callback=function(){vl(e,t)},a}function cg(e){return e=Fs(e),e.tag=3,e}function ug(e,t,a,r){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var p=r.value;e.payload=function(){return f(p)},e.callback=function(){lg(t,a,r)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){lg(t,a,r),typeof f!="function"&&(Qs===null?Qs=new Set([this]):Qs.add(this));var k=r.stack;this.componentDidCatch(r.value,{componentStack:k!==null?k:""})})}function Z1(e,t,a,r,f){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&_i(t,a,f,!0),a=mn.current,a!==null){switch(a.tag){case 31:case 13:return Dn===null?El():a.alternate===null&&bt===0&&(bt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,r===al?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),wd(e,r,f)),!1;case 22:return a.flags|=65536,r===al?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([r]):a.add(r)),wd(e,r,f)),!1}throw Error(o(435,a.tag))}return wd(e,r,f),El(),!1}if(Ge)return t=mn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=f,r!==bu&&(e=Error(o(422),{cause:r}),wo(jn(e,a)))):(r!==bu&&(t=Error(o(423),{cause:r}),wo(jn(t,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,r=jn(r,a),f=ed(e.stateNode,r,f),Au(e,f),bt!==4&&(bt=2)),!1;var p=Error(o(520),{cause:r});if(p=jn(p,a),Go===null?Go=[p]:Go.push(p),bt!==4&&(bt=2),t===null)return!0;r=jn(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=ed(a.stateNode,r,e),Au(a,e),!1;case 1:if(t=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Qs===null||!Qs.has(p))))return a.flags|=65536,f&=-f,a.lanes|=f,f=cg(f),ug(f,e,a,r),Au(a,f),!1}a=a.return}while(a!==null);return!1}var td=Error(o(461)),Et=!1;function Gt(e,t,a,r){t.child=e===null?mh(t,null,a,r):Oa(t,e.child,a,r)}function dg(e,t,a,r,f){a=a.render;var p=t.ref;if("ref"in r){var x={};for(var k in r)k!=="ref"&&(x[k]=r[k])}else x=r;return Aa(t),r=Bu(e,t,a,x,p,f),k=Lu(),e!==null&&!Et?(Uu(e,t,f),ys(e,t,f)):(Ge&&k&&vu(t),t.flags|=1,Gt(e,t,r,f),t.child)}function fg(e,t,a,r,f){if(e===null){var p=a.type;return typeof p=="function"&&!mu(p)&&p.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=p,pg(e,t,p,r,f)):(e=Xr(a.type,null,r,t,t.mode,f),e.ref=t.ref,e.return=t,t.child=e)}if(p=e.child,!cd(e,f)){var x=p.memoizedProps;if(a=a.compare,a=a!==null?a:So,a(x,r)&&e.ref===t.ref)return ys(e,t,f)}return t.flags|=1,e=fs(p,r),e.ref=t.ref,e.return=t,t.child=e}function pg(e,t,a,r,f){if(e!==null){var p=e.memoizedProps;if(So(p,r)&&e.ref===t.ref)if(Et=!1,t.pendingProps=r=p,cd(e,f))(e.flags&131072)!==0&&(Et=!0);else return t.lanes=e.lanes,ys(e,t,f)}return nd(e,t,a,r,f)}function mg(e,t,a,r){var f=r.children,p=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,e!==null){for(r=t.child=e.child,f=0;r!==null;)f=f|r.lanes|r.childLanes,r=r.sibling;r=f&~p}else r=0,t.child=null;return hg(e,t,p,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&nl(t,p!==null?p.cachePool:null),p!==null?vh(t,p):Ru(),yh(t);else return r=t.lanes=536870912,hg(e,t,p!==null?p.baseLanes|a:a,a,r)}else p!==null?(nl(t,p.cachePool),vh(t,p),Ys(),t.memoizedState=null):(e!==null&&nl(t,null),Ru(),Ys());return Gt(e,t,f,a),t.child}function Lo(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function hg(e,t,a,r,f){var p=Nu();return p=p===null?null:{parent:jt._currentValue,pool:p},t.memoizedState={baseLanes:a,cachePool:p},e!==null&&nl(t,null),Ru(),yh(t),e!==null&&_i(e,t,r,!0),t.childLanes=f,null}function yl(e,t){return t=_l({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function gg(e,t,a){return Oa(t,e.child,null,a),e=yl(t,t.pendingProps),e.flags|=2,hn(t),t.memoizedState=null,e}function K1(e,t,a){var r=t.pendingProps,f=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ge){if(r.mode==="hidden")return e=yl(t,r),t.lanes=536870912,Lo(null,e);if(Ou(t),(e=lt)?(e=Cv(e,An),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Vs!==null?{id:Wn,overflow:Xn}:null,retryLane:536870912,hydrationErrors:null},a=Qm(e),a.return=t,t.child=a,qt=t,lt=null)):e=null,e===null)throw Hs(t);return t.lanes=536870912,null}return yl(t,r)}var p=e.memoizedState;if(p!==null){var x=p.dehydrated;if(Ou(t),f)if(t.flags&256)t.flags&=-257,t=gg(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Et||_i(e,t,a,!1),f=(a&e.childLanes)!==0,Et||f){if(r=ot,r!==null&&(x=ls(r,a),x!==0&&x!==p.retryLane))throw p.retryLane=x,Na(e,x),cn(r,e,x),td;El(),t=gg(e,t,a)}else e=p.treeContext,lt=Rn(x.nextSibling),qt=t,Ge=!0,qs=null,An=!1,e!==null&&nh(t,e),t=yl(t,r),t.flags|=4096;return t}return e=fs(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function bl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(o(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function nd(e,t,a,r,f){return Aa(t),a=Bu(e,t,a,r,void 0,f),r=Lu(),e!==null&&!Et?(Uu(e,t,f),ys(e,t,f)):(Ge&&r&&vu(t),t.flags|=1,Gt(e,t,a,f),t.child)}function vg(e,t,a,r,f,p){return Aa(t),t.updateQueue=null,a=_h(t,r,a,f),bh(e),r=Lu(),e!==null&&!Et?(Uu(e,t,p),ys(e,t,p)):(Ge&&r&&vu(t),t.flags|=1,Gt(e,t,a,p),t.child)}function yg(e,t,a,r,f){if(Aa(t),t.stateNode===null){var p=gi,x=a.contextType;typeof x=="object"&&x!==null&&(p=Ht(x)),p=new a(r,p),t.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Qu,t.stateNode=p,p._reactInternals=t,p=t.stateNode,p.props=r,p.state=t.memoizedState,p.refs={},Cu(t),x=a.contextType,p.context=typeof x=="object"&&x!==null?Ht(x):gi,p.state=t.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Xu(t,a,x,r),p.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(x=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),x!==p.state&&Qu.enqueueReplaceState(p,p.state,null),Ro(t,r,p,f),Do(),p.state=t.memoizedState),typeof p.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){p=t.stateNode;var k=t.memoizedProps,D=Ba(a,k);p.props=D;var P=p.context,Y=a.contextType;x=gi,typeof Y=="object"&&Y!==null&&(x=Ht(Y));var W=a.getDerivedStateFromProps;Y=typeof W=="function"||typeof p.getSnapshotBeforeUpdate=="function",k=t.pendingProps!==k,Y||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(k||P!==x)&&ag(t,p,r,x),$s=!1;var H=t.memoizedState;p.state=H,Ro(t,r,p,f),Do(),P=t.memoizedState,k||H!==P||$s?(typeof W=="function"&&(Xu(t,a,W,r),P=t.memoizedState),(D=$s||sg(t,a,D,r,H,P,x))?(Y||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(t.flags|=4194308)):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=P),p.props=r,p.state=P,p.context=x,r=D):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{p=t.stateNode,Eu(e,t),x=t.memoizedProps,Y=Ba(a,x),p.props=Y,W=t.pendingProps,H=p.context,P=a.contextType,D=gi,typeof P=="object"&&P!==null&&(D=Ht(P)),k=a.getDerivedStateFromProps,(P=typeof k=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==W||H!==D)&&ag(t,p,r,D),$s=!1,H=t.memoizedState,p.state=H,Ro(t,r,p,f),Do();var F=t.memoizedState;x!==W||H!==F||$s||e!==null&&e.dependencies!==null&&el(e.dependencies)?(typeof k=="function"&&(Xu(t,a,k,r),F=t.memoizedState),(Y=$s||sg(t,a,Y,r,H,F,D)||e!==null&&e.dependencies!==null&&el(e.dependencies))?(P||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(r,F,D),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(r,F,D)),typeof p.componentDidUpdate=="function"&&(t.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=F),p.props=r,p.state=F,p.context=D,r=Y):(typeof p.componentDidUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),r=!1)}return p=r,bl(e,t),r=(t.flags&128)!==0,p||r?(p=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:p.render(),t.flags|=1,e!==null&&r?(t.child=Oa(t,e.child,null,f),t.child=Oa(t,null,a,f)):Gt(e,t,a,f),t.memoizedState=p.state,e=t.child):e=ys(e,t,f),e}function bg(e,t,a,r){return Ca(),t.flags|=256,Gt(e,t,a,r),t.child}var sd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ad(e){return{baseLanes:e,cachePool:lh()}}function id(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=vn),e}function _g(e,t,a){var r=t.pendingProps,f=!1,p=(t.flags&128)!==0,x;if((x=p)||(x=e!==null&&e.memoizedState===null?!1:(kt.current&2)!==0),x&&(f=!0,t.flags&=-129),x=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ge){if(f?Ks(t):Ys(),(e=lt)?(e=Cv(e,An),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Vs!==null?{id:Wn,overflow:Xn}:null,retryLane:536870912,hydrationErrors:null},a=Qm(e),a.return=t,t.child=a,qt=t,lt=null)):e=null,e===null)throw Hs(t);return Vd(e)?t.lanes=32:t.lanes=536870912,null}var k=r.children;return r=r.fallback,f?(Ys(),f=t.mode,k=_l({mode:"hidden",children:k},f),r=ja(r,f,a,null),k.return=t,r.return=t,k.sibling=r,t.child=k,r=t.child,r.memoizedState=ad(a),r.childLanes=id(e,x,a),t.memoizedState=sd,Lo(null,r)):(Ks(t),od(t,k))}var D=e.memoizedState;if(D!==null&&(k=D.dehydrated,k!==null)){if(p)t.flags&256?(Ks(t),t.flags&=-257,t=rd(e,t,a)):t.memoizedState!==null?(Ys(),t.child=e.child,t.flags|=128,t=null):(Ys(),k=r.fallback,f=t.mode,r=_l({mode:"visible",children:r.children},f),k=ja(k,f,a,null),k.flags|=2,r.return=t,k.return=t,r.sibling=k,t.child=r,Oa(t,e.child,null,a),r=t.child,r.memoizedState=ad(a),r.childLanes=id(e,x,a),t.memoizedState=sd,t=Lo(null,r));else if(Ks(t),Vd(k)){if(x=k.nextSibling&&k.nextSibling.dataset,x)var P=x.dgst;x=P,r=Error(o(419)),r.stack="",r.digest=x,wo({value:r,source:null,stack:null}),t=rd(e,t,a)}else if(Et||_i(e,t,a,!1),x=(a&e.childLanes)!==0,Et||x){if(x=ot,x!==null&&(r=ls(x,a),r!==0&&r!==D.retryLane))throw D.retryLane=r,Na(e,r),cn(x,e,r),td;Pd(k)||El(),t=rd(e,t,a)}else Pd(k)?(t.flags|=192,t.child=e.child,t=null):(e=D.treeContext,lt=Rn(k.nextSibling),qt=t,Ge=!0,qs=null,An=!1,e!==null&&nh(t,e),t=od(t,r.children),t.flags|=4096);return t}return f?(Ys(),k=r.fallback,f=t.mode,D=e.child,P=D.sibling,r=fs(D,{mode:"hidden",children:r.children}),r.subtreeFlags=D.subtreeFlags&65011712,P!==null?k=fs(P,k):(k=ja(k,f,a,null),k.flags|=2),k.return=t,r.return=t,r.sibling=k,t.child=r,Lo(null,r),r=t.child,k=e.child.memoizedState,k===null?k=ad(a):(f=k.cachePool,f!==null?(D=jt._currentValue,f=f.parent!==D?{parent:D,pool:D}:f):f=lh(),k={baseLanes:k.baseLanes|a,cachePool:f}),r.memoizedState=k,r.childLanes=id(e,x,a),t.memoizedState=sd,Lo(e.child,r)):(Ks(t),a=e.child,e=a.sibling,a=fs(a,{mode:"visible",children:r.children}),a.return=t,a.sibling=null,e!==null&&(x=t.deletions,x===null?(t.deletions=[e],t.flags|=16):x.push(e)),t.child=a,t.memoizedState=null,a)}function od(e,t){return t=_l({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function _l(e,t){return e=pn(22,e,null,t),e.lanes=0,e}function rd(e,t,a){return Oa(t,e.child,null,a),e=od(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xg(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Su(e.return,t,a)}function ld(e,t,a,r,f,p){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:f,treeForkCount:p}:(x.isBackwards=t,x.rendering=null,x.renderingStartTime=0,x.last=r,x.tail=a,x.tailMode=f,x.treeForkCount=p)}function Sg(e,t,a){var r=t.pendingProps,f=r.revealOrder,p=r.tail;r=r.children;var x=kt.current,k=(x&2)!==0;if(k?(x=x&1|2,t.flags|=128):x&=1,Ne(kt,x),Gt(e,t,r,a),r=Ge?ko:0,!k&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xg(e,a,t);else if(e.tag===19)xg(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=t.child,f=null;a!==null;)e=a.alternate,e!==null&&ll(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=t.child,t.child=null):(f=a.sibling,a.sibling=null),ld(t,!1,f,a,p,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=t.child,t.child=null;f!==null;){if(e=f.alternate,e!==null&&ll(e)===null){t.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}ld(t,!0,a,null,p,r);break;case"together":ld(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function ys(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Xs|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(_i(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,a=fs(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=fs(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function cd(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&el(e)))}function Y1(e,t,a){switch(t.tag){case 3:Re(t,t.stateNode.containerInfo),Gs(t,jt,e.memoizedState.cache),Ca();break;case 27:case 5:te(t);break;case 4:Re(t,t.stateNode.containerInfo);break;case 10:Gs(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ou(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Ks(t),t.flags|=128,null):(a&t.child.childLanes)!==0?_g(e,t,a):(Ks(t),e=ys(e,t,a),e!==null?e.sibling:null);Ks(t);break;case 19:var f=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(_i(e,t,a,!1),r=(a&t.childLanes)!==0),f){if(r)return Sg(e,t,a);t.flags|=128}if(f=t.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ne(kt,kt.current),r)break;return null;case 22:return t.lanes=0,mg(e,t,a,t.pendingProps);case 24:Gs(t,jt,e.memoizedState.cache)}return ys(e,t,a)}function Tg(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Et=!0;else{if(!cd(e,a)&&(t.flags&128)===0)return Et=!1,Y1(e,t,a);Et=(e.flags&131072)!==0}else Et=!1,Ge&&(t.flags&1048576)!==0&&th(t,ko,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Ra(t.elementType),t.type=e,typeof e=="function")mu(e)?(r=Ba(e,r),t.tag=1,t=yg(null,t,e,r,a)):(t.tag=0,t=nd(null,t,e,r,a));else{if(e!=null){var f=e.$$typeof;if(f===O){t.tag=11,t=dg(null,t,e,r,a);break e}else if(f===G){t.tag=14,t=fg(null,t,e,r,a);break e}}throw t=K(e)||e,Error(o(306,t,""))}}return t;case 0:return nd(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,f=Ba(r,t.pendingProps),yg(e,t,r,f,a);case 3:e:{if(Re(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var p=t.memoizedState;f=p.element,Eu(e,t),Ro(t,r,null,a);var x=t.memoizedState;if(r=x.cache,Gs(t,jt,r),r!==p.cache&&Tu(t,[jt],a,!0),Do(),r=x.element,p.isDehydrated)if(p={element:r,isDehydrated:!1,cache:x.cache},t.updateQueue.baseState=p,t.memoizedState=p,t.flags&256){t=bg(e,t,r,a);break e}else if(r!==f){f=jn(Error(o(424)),t),wo(f),t=bg(e,t,r,a);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(lt=Rn(e.firstChild),qt=t,Ge=!0,qs=null,An=!0,a=mh(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ca(),r===f){t=ys(e,t,a);break e}Gt(e,t,r,a)}t=t.child}return t;case 26:return bl(e,t),e===null?(a=Ov(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ge||(a=t.type,e=t.pendingProps,r=Bl(fe.current).createElement(a),r[Vt]=t,r[nn]=e,$t(r,a,e),Lt(r),t.stateNode=r):t.memoizedState=Ov(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return te(t),e===null&&Ge&&(r=t.stateNode=Dv(t.type,t.pendingProps,fe.current),qt=t,An=!0,f=lt,sa(t.type)?(qd=f,lt=Rn(r.firstChild)):lt=f),Gt(e,t,t.pendingProps.children,a),bl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ge&&((f=r=lt)&&(r=wS(r,t.type,t.pendingProps,An),r!==null?(t.stateNode=r,qt=t,lt=Rn(r.firstChild),An=!1,f=!0):f=!1),f||Hs(t)),te(t),f=t.type,p=t.pendingProps,x=e!==null?e.memoizedProps:null,r=p.children,Ld(f,p)?r=null:x!==null&&Ld(f,x)&&(t.flags|=32),t.memoizedState!==null&&(f=Bu(e,t,P1,null,null,a),Xo._currentValue=f),bl(e,t),Gt(e,t,r,a),t.child;case 6:return e===null&&Ge&&((e=a=lt)&&(a=NS(a,t.pendingProps,An),a!==null?(t.stateNode=a,qt=t,lt=null,e=!0):e=!1),e||Hs(t)),null;case 13:return _g(e,t,a);case 4:return Re(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Oa(t,null,r,a):Gt(e,t,r,a),t.child;case 11:return dg(e,t,t.type,t.pendingProps,a);case 7:return Gt(e,t,t.pendingProps,a),t.child;case 8:return Gt(e,t,t.pendingProps.children,a),t.child;case 12:return Gt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,Gs(t,t.type,r.value),Gt(e,t,r.children,a),t.child;case 9:return f=t.type._context,r=t.pendingProps.children,Aa(t),f=Ht(f),r=r(f),t.flags|=1,Gt(e,t,r,a),t.child;case 14:return fg(e,t,t.type,t.pendingProps,a);case 15:return pg(e,t,t.type,t.pendingProps,a);case 19:return Sg(e,t,a);case 31:return K1(e,t,a);case 22:return mg(e,t,a,t.pendingProps);case 24:return Aa(t),r=Ht(jt),e===null?(f=Nu(),f===null&&(f=ot,p=ku(),f.pooledCache=p,p.refCount++,p!==null&&(f.pooledCacheLanes|=a),f=p),t.memoizedState={parent:r,cache:f},Cu(t),Gs(t,jt,f)):((e.lanes&a)!==0&&(Eu(e,t),Ro(t,null,null,a),Do()),f=e.memoizedState,p=t.memoizedState,f.parent!==r?(f={parent:r,cache:r},t.memoizedState=f,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=f),Gs(t,jt,r)):(r=p.cache,Gs(t,jt,r),r!==f.cache&&Tu(t,[jt],a,!0))),Gt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function bs(e){e.flags|=4}function ud(e,t,a,r,f){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Jg())e.flags|=8192;else throw Ma=al,ju}else e.flags&=-16777217}function kg(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!zv(t))if(Jg())e.flags|=8192;else throw Ma=al,ju}function xl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ke():536870912,e.lanes|=t,Ri|=t)}function Uo(e,t){if(!Ge)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ct(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,r|=f.subtreeFlags&65011712,r|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,r|=f.subtreeFlags,r|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function J1(e,t,a){var r=t.pendingProps;switch(yu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(t),null;case 1:return ct(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),hs(jt),Bt(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(bi(t)?bs(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,_u())),ct(t),null;case 26:var f=t.type,p=t.memoizedState;return e===null?(bs(t),p!==null?(ct(t),kg(t,p)):(ct(t),ud(t,f,null,r,a))):p?p!==e.memoizedState?(bs(t),ct(t),kg(t,p)):(ct(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&bs(t),ct(t),ud(t,f,e,r,a)),null;case 27:if(X(t),a=fe.current,f=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&bs(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return ct(t),null}e=Ae.current,bi(t)?sh(t):(e=Dv(f,r,a),t.stateNode=e,bs(t))}return ct(t),null;case 5:if(X(t),f=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&bs(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return ct(t),null}if(p=Ae.current,bi(t))sh(t);else{var x=Bl(fe.current);switch(p){case 1:p=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:p=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":p=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":p=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":p=x.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof r.is=="string"?x.createElement("select",{is:r.is}):x.createElement("select"),r.multiple?p.multiple=!0:r.size&&(p.size=r.size);break;default:p=typeof r.is=="string"?x.createElement(f,{is:r.is}):x.createElement(f)}}p[Vt]=t,p[nn]=r;e:for(x=t.child;x!==null;){if(x.tag===5||x.tag===6)p.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===t)break e;for(;x.sibling===null;){if(x.return===null||x.return===t)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}t.stateNode=p;e:switch($t(p,f,r),f){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&bs(t)}}return ct(t),ud(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&bs(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(o(166));if(e=fe.current,bi(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,f=qt,f!==null)switch(f.tag){case 27:case 5:r=f.memoizedProps}e[Vt]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||_v(e.nodeValue,a)),e||Hs(t,!0)}else e=Bl(e).createTextNode(r),e[Vt]=t,t.stateNode=e}return ct(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=bi(t),a!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Vt]=t}else Ca(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ct(t),e=!1}else a=_u(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(hn(t),t):(hn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return ct(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=bi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!f)throw Error(o(318));if(f=t.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(o(317));f[Vt]=t}else Ca(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ct(t),f=!1}else f=_u(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return t.flags&256?(hn(t),t):(hn(t),null)}return hn(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,f=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(f=r.alternate.memoizedState.cachePool.pool),p=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(p=r.memoizedState.cachePool.pool),p!==f&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),xl(t,t.updateQueue),ct(t),null);case 4:return Bt(),e===null&&Rd(t.stateNode.containerInfo),ct(t),null;case 10:return hs(t.type),ct(t),null;case 19:if(je(kt),r=t.memoizedState,r===null)return ct(t),null;if(f=(t.flags&128)!==0,p=r.rendering,p===null)if(f)Uo(r,!1);else{if(bt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(p=ll(e),p!==null){for(t.flags|=128,Uo(r,!1),e=p.updateQueue,t.updateQueue=e,xl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Xm(a,e),a=a.sibling;return Ne(kt,kt.current&1|2),Ge&&ps(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Kt()>Nl&&(t.flags|=128,f=!0,Uo(r,!1),t.lanes=4194304)}else{if(!f)if(e=ll(p),e!==null){if(t.flags|=128,f=!0,e=e.updateQueue,t.updateQueue=e,xl(t,e),Uo(r,!0),r.tail===null&&r.tailMode==="hidden"&&!p.alternate&&!Ge)return ct(t),null}else 2*Kt()-r.renderingStartTime>Nl&&a!==536870912&&(t.flags|=128,f=!0,Uo(r,!1),t.lanes=4194304);r.isBackwards?(p.sibling=t.child,t.child=p):(e=r.last,e!==null?e.sibling=p:t.child=p,r.last=p)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Kt(),e.sibling=null,a=kt.current,Ne(kt,f?a&1|2:a&1),Ge&&ps(t,r.treeForkCount),e):(ct(t),null);case 22:case 23:return hn(t),Mu(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(ct(t),t.subtreeFlags&6&&(t.flags|=8192)):ct(t),a=t.updateQueue,a!==null&&xl(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),e!==null&&je(Da),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),hs(jt),ct(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function W1(e,t){switch(yu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return hs(jt),Bt(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return X(t),null;case 31:if(t.memoizedState!==null){if(hn(t),t.alternate===null)throw Error(o(340));Ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(hn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return je(kt),null;case 4:return Bt(),null;case 10:return hs(t.type),null;case 22:case 23:return hn(t),Mu(),e!==null&&je(Da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return hs(jt),null;case 25:return null;default:return null}}function wg(e,t){switch(yu(t),t.tag){case 3:hs(jt),Bt();break;case 26:case 27:case 5:X(t);break;case 4:Bt();break;case 31:t.memoizedState!==null&&hn(t);break;case 13:hn(t);break;case 19:je(kt);break;case 10:hs(t.type);break;case 22:case 23:hn(t),Mu(),e!==null&&je(Da);break;case 24:hs(jt)}}function zo(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var f=r.next;a=f;do{if((a.tag&e)===e){r=void 0;var p=a.create,x=a.inst;r=p(),x.destroy=r}a=a.next}while(a!==f)}}catch(k){tt(t,t.return,k)}}function Js(e,t,a){try{var r=t.updateQueue,f=r!==null?r.lastEffect:null;if(f!==null){var p=f.next;r=p;do{if((r.tag&e)===e){var x=r.inst,k=x.destroy;if(k!==void 0){x.destroy=void 0,f=t;var D=a,P=k;try{P()}catch(Y){tt(f,D,Y)}}}r=r.next}while(r!==p)}}catch(Y){tt(t,t.return,Y)}}function Ng(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{gh(t,a)}catch(r){tt(e,e.return,r)}}}function jg(e,t,a){a.props=Ba(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){tt(e,t,r)}}function Po(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(f){tt(e,t,f)}}function Qn(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(f){tt(e,t,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){tt(e,t,f)}else a.current=null}function Cg(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(f){tt(e,e.return,f)}}function dd(e,t,a){try{var r=e.stateNode;bS(r,e.type,a,t),r[nn]=t}catch(f){tt(e,e.return,f)}}function Eg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&sa(e.type)||e.tag===4}function fd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Eg(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&&sa(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 pd(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=us));else if(r!==4&&(r===27&&sa(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(pd(e,t,a),e=e.sibling;e!==null;)pd(e,t,a),e=e.sibling}function Sl(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(r!==4&&(r===27&&sa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Sl(e,t,a),e=e.sibling;e!==null;)Sl(e,t,a),e=e.sibling}function Ag(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,f=t.attributes;f.length;)t.removeAttributeNode(f[0]);$t(t,r,a),t[Vt]=e,t[nn]=a}catch(p){tt(e,e.return,p)}}var _s=!1,At=!1,md=!1,Dg=typeof WeakSet=="function"?WeakSet:Set,Ut=null;function X1(e,t){if(e=e.containerInfo,Id=Hl,e=Hm(e),ru(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var f=r.anchorOffset,p=r.focusNode;r=r.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var x=0,k=-1,D=-1,P=0,Y=0,W=e,H=null;t:for(;;){for(var F;W!==a||f!==0&&W.nodeType!==3||(k=x+f),W!==p||r!==0&&W.nodeType!==3||(D=x+r),W.nodeType===3&&(x+=W.nodeValue.length),(F=W.firstChild)!==null;)H=W,W=F;for(;;){if(W===e)break t;if(H===a&&++P===f&&(k=x),H===p&&++Y===r&&(D=x),(F=W.nextSibling)!==null)break;W=H,H=W.parentNode}W=F}a=k===-1||D===-1?null:{start:k,end:D}}else a=null}a=a||{start:0,end:0}}else a=null;for(Bd={focusedElem:e,selectionRange:a},Hl=!1,Ut=t;Ut!==null;)if(t=Ut,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ut=e;else for(;Ut!==null;){switch(t=Ut,p=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.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&&p!==null){e=void 0,a=t,f=p.memoizedProps,p=p.memoizedState,r=a.stateNode;try{var ge=Ba(a.type,f);e=r.getSnapshotBeforeUpdate(ge,p),r.__reactInternalSnapshotBeforeUpdate=e}catch(Se){tt(a,a.return,Se)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)zd(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":zd(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(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Ut=e;break}Ut=t.return}}function Rg(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Ss(e,a),r&4&&zo(5,a);break;case 1:if(Ss(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(x){tt(a,a.return,x)}else{var f=Ba(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(f,t,e.__reactInternalSnapshotBeforeUpdate)}catch(x){tt(a,a.return,x)}}r&64&&Ng(a),r&512&&Po(a,a.return);break;case 3:if(Ss(e,a),r&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{gh(e,t)}catch(x){tt(a,a.return,x)}}break;case 27:t===null&&r&4&&Ag(a);case 26:case 5:Ss(e,a),t===null&&r&4&&Cg(a),r&512&&Po(a,a.return);break;case 12:Ss(e,a);break;case 31:Ss(e,a),r&4&&Ig(e,a);break;case 13:Ss(e,a),r&4&&Bg(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=rS.bind(null,a),jS(e,a))));break;case 22:if(r=a.memoizedState!==null||_s,!r){t=t!==null&&t.memoizedState!==null||At,f=_s;var p=At;_s=r,(At=t)&&!p?Ts(e,a,(a.subtreeFlags&8772)!==0):Ss(e,a),_s=f,At=p}break;case 30:break;default:Ss(e,a)}}function Mg(e){var t=e.alternate;t!==null&&(e.alternate=null,Mg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Gc(t)),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 mt=null,an=!1;function xs(e,t,a){for(a=a.child;a!==null;)Og(e,t,a),a=a.sibling}function Og(e,t,a){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(Us,a)}catch{}switch(a.tag){case 26:At||Qn(a,t),xs(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:At||Qn(a,t);var r=mt,f=an;sa(a.type)&&(mt=a.stateNode,an=!1),xs(e,t,a),Yo(a.stateNode),mt=r,an=f;break;case 5:At||Qn(a,t);case 6:if(r=mt,f=an,mt=null,xs(e,t,a),mt=r,an=f,mt!==null)if(an)try{(mt.nodeType===9?mt.body:mt.nodeName==="HTML"?mt.ownerDocument.body:mt).removeChild(a.stateNode)}catch(p){tt(a,t,p)}else try{mt.removeChild(a.stateNode)}catch(p){tt(a,t,p)}break;case 18:mt!==null&&(an?(e=mt,Nv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Pi(e)):Nv(mt,a.stateNode));break;case 4:r=mt,f=an,mt=a.stateNode.containerInfo,an=!0,xs(e,t,a),mt=r,an=f;break;case 0:case 11:case 14:case 15:Js(2,a,t),At||Js(4,a,t),xs(e,t,a);break;case 1:At||(Qn(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&jg(a,t,r)),xs(e,t,a);break;case 21:xs(e,t,a);break;case 22:At=(r=At)||a.memoizedState!==null,xs(e,t,a),At=r;break;default:xs(e,t,a)}}function Ig(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Pi(e)}catch(a){tt(t,t.return,a)}}}function Bg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Pi(e)}catch(a){tt(t,t.return,a)}}function Q1(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Dg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Dg),t;default:throw Error(o(435,e.tag))}}function Tl(e,t){var a=Q1(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var f=lS.bind(null,e,r);r.then(f,f)}})}function on(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var f=a[r],p=e,x=t,k=x;e:for(;k!==null;){switch(k.tag){case 27:if(sa(k.type)){mt=k.stateNode,an=!1;break e}break;case 5:mt=k.stateNode,an=!1;break e;case 3:case 4:mt=k.stateNode.containerInfo,an=!0;break e}k=k.return}if(mt===null)throw Error(o(160));Og(p,x,f),mt=null,an=!1,p=f.alternate,p!==null&&(p.return=null),f.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Lg(t,e),t=t.sibling}var Hn=null;function Lg(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:on(t,e),rn(e),r&4&&(Js(3,e,e.return),zo(3,e),Js(5,e,e.return));break;case 1:on(t,e),rn(e),r&512&&(At||a===null||Qn(a,a.return)),r&64&&_s&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var f=Hn;if(on(t,e),rn(e),r&512&&(At||a===null||Qn(a,a.return)),r&4){var p=a!==null?a.memoizedState:null;if(r=e.memoizedState,a===null)if(r===null)if(e.stateNode===null){e:{r=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(r){case"title":p=f.getElementsByTagName("title")[0],(!p||p[po]||p[Vt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=f.createElement(r),f.head.insertBefore(p,f.querySelector("head > title"))),$t(p,r,a),p[Vt]=e,Lt(p),r=p;break e;case"link":var x=Lv("link","href",f).get(r+(a.href||""));if(x){for(var k=0;k<x.length;k++)if(p=x[k],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(k,1);break t}}p=f.createElement(r),$t(p,r,a),f.head.appendChild(p);break;case"meta":if(x=Lv("meta","content",f).get(r+(a.content||""))){for(k=0;k<x.length;k++)if(p=x[k],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(k,1);break t}}p=f.createElement(r),$t(p,r,a),f.head.appendChild(p);break;default:throw Error(o(468,r))}p[Vt]=e,Lt(p),r=p}e.stateNode=r}else Uv(f,e.type,e.stateNode);else e.stateNode=Bv(f,r,e.memoizedProps);else p!==r?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,r===null?Uv(f,e.type,e.stateNode):Bv(f,r,e.memoizedProps)):r===null&&e.stateNode!==null&&dd(e,e.memoizedProps,a.memoizedProps)}break;case 27:on(t,e),rn(e),r&512&&(At||a===null||Qn(a,a.return)),a!==null&&r&4&&dd(e,e.memoizedProps,a.memoizedProps);break;case 5:if(on(t,e),rn(e),r&512&&(At||a===null||Qn(a,a.return)),e.flags&32){f=e.stateNode;try{ci(f,"")}catch(ge){tt(e,e.return,ge)}}r&4&&e.stateNode!=null&&(f=e.memoizedProps,dd(e,f,a!==null?a.memoizedProps:f)),r&1024&&(md=!0);break;case 6:if(on(t,e),rn(e),r&4){if(e.stateNode===null)throw Error(o(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(ge){tt(e,e.return,ge)}}break;case 3:if(zl=null,f=Hn,Hn=Ll(t.containerInfo),on(t,e),Hn=f,rn(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{Pi(t.containerInfo)}catch(ge){tt(e,e.return,ge)}md&&(md=!1,Ug(e));break;case 4:r=Hn,Hn=Ll(e.stateNode.containerInfo),on(t,e),rn(e),Hn=r;break;case 12:on(t,e),rn(e);break;case 31:on(t,e),rn(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 13:on(t,e),rn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(wl=Kt()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 22:f=e.memoizedState!==null;var D=a!==null&&a.memoizedState!==null,P=_s,Y=At;if(_s=P||f,At=Y||D,on(t,e),At=Y,_s=P,rn(e),r&8192)e:for(t=e.stateNode,t._visibility=f?t._visibility&-2:t._visibility|1,f&&(a===null||D||_s||At||La(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){D=a=t;try{if(p=D.stateNode,f)x=p.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{k=D.stateNode;var W=D.memoizedProps.style,H=W!=null&&W.hasOwnProperty("display")?W.display:null;k.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(ge){tt(D,D.return,ge)}}}else if(t.tag===6){if(a===null){D=t;try{D.stateNode.nodeValue=f?"":D.memoizedProps}catch(ge){tt(D,D.return,ge)}}}else if(t.tag===18){if(a===null){D=t;try{var F=D.stateNode;f?jv(F,!0):jv(D.stateNode,!1)}catch(ge){tt(D,D.return,ge)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(a=r.retryQueue,a!==null&&(r.retryQueue=null,Tl(e,a))));break;case 19:on(t,e),rn(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 30:break;case 21:break;default:on(t,e),rn(e)}}function rn(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(Eg(r)){a=r;break}r=r.return}if(a==null)throw Error(o(160));switch(a.tag){case 27:var f=a.stateNode,p=fd(e);Sl(e,p,f);break;case 5:var x=a.stateNode;a.flags&32&&(ci(x,""),a.flags&=-33);var k=fd(e);Sl(e,k,x);break;case 3:case 4:var D=a.stateNode.containerInfo,P=fd(e);pd(e,P,D);break;default:throw Error(o(161))}}catch(Y){tt(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ug(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ug(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ss(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Rg(e,t.alternate,t),t=t.sibling}function La(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Js(4,t,t.return),La(t);break;case 1:Qn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&jg(t,t.return,a),La(t);break;case 27:Yo(t.stateNode);case 26:case 5:Qn(t,t.return),La(t);break;case 22:t.memoizedState===null&&La(t);break;case 30:La(t);break;default:La(t)}e=e.sibling}}function Ts(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,f=e,p=t,x=p.flags;switch(p.tag){case 0:case 11:case 15:Ts(f,p,a),zo(4,p);break;case 1:if(Ts(f,p,a),r=p,f=r.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(P){tt(r,r.return,P)}if(r=p,f=r.updateQueue,f!==null){var k=r.stateNode;try{var D=f.shared.hiddenCallbacks;if(D!==null)for(f.shared.hiddenCallbacks=null,f=0;f<D.length;f++)hh(D[f],k)}catch(P){tt(r,r.return,P)}}a&&x&64&&Ng(p),Po(p,p.return);break;case 27:Ag(p);case 26:case 5:Ts(f,p,a),a&&r===null&&x&4&&Cg(p),Po(p,p.return);break;case 12:Ts(f,p,a);break;case 31:Ts(f,p,a),a&&x&4&&Ig(f,p);break;case 13:Ts(f,p,a),a&&x&4&&Bg(f,p);break;case 22:p.memoizedState===null&&Ts(f,p,a),Po(p,p.return);break;case 30:break;default:Ts(f,p,a)}t=t.sibling}}function hd(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&No(a))}function gd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&No(e))}function Gn(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)zg(e,t,a,r),t=t.sibling}function zg(e,t,a,r){var f=t.flags;switch(t.tag){case 0:case 11:case 15:Gn(e,t,a,r),f&2048&&zo(9,t);break;case 1:Gn(e,t,a,r);break;case 3:Gn(e,t,a,r),f&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&No(e)));break;case 12:if(f&2048){Gn(e,t,a,r),e=t.stateNode;try{var p=t.memoizedProps,x=p.id,k=p.onPostCommit;typeof k=="function"&&k(x,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(D){tt(t,t.return,D)}}else Gn(e,t,a,r);break;case 31:Gn(e,t,a,r);break;case 13:Gn(e,t,a,r);break;case 23:break;case 22:p=t.stateNode,x=t.alternate,t.memoizedState!==null?p._visibility&2?Gn(e,t,a,r):Vo(e,t):p._visibility&2?Gn(e,t,a,r):(p._visibility|=2,Ei(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),f&2048&&hd(x,t);break;case 24:Gn(e,t,a,r),f&2048&&gd(t.alternate,t);break;default:Gn(e,t,a,r)}}function Ei(e,t,a,r,f){for(f=f&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var p=e,x=t,k=a,D=r,P=x.flags;switch(x.tag){case 0:case 11:case 15:Ei(p,x,k,D,f),zo(8,x);break;case 23:break;case 22:var Y=x.stateNode;x.memoizedState!==null?Y._visibility&2?Ei(p,x,k,D,f):Vo(p,x):(Y._visibility|=2,Ei(p,x,k,D,f)),f&&P&2048&&hd(x.alternate,x);break;case 24:Ei(p,x,k,D,f),f&&P&2048&&gd(x.alternate,x);break;default:Ei(p,x,k,D,f)}t=t.sibling}}function Vo(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,f=r.flags;switch(r.tag){case 22:Vo(a,r),f&2048&&hd(r.alternate,r);break;case 24:Vo(a,r),f&2048&&gd(r.alternate,r);break;default:Vo(a,r)}t=t.sibling}}var qo=8192;function Ai(e,t,a){if(e.subtreeFlags&qo)for(e=e.child;e!==null;)Pg(e,t,a),e=e.sibling}function Pg(e,t,a){switch(e.tag){case 26:Ai(e,t,a),e.flags&qo&&e.memoizedState!==null&&zS(a,Hn,e.memoizedState,e.memoizedProps);break;case 5:Ai(e,t,a);break;case 3:case 4:var r=Hn;Hn=Ll(e.stateNode.containerInfo),Ai(e,t,a),Hn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=qo,qo=16777216,Ai(e,t,a),qo=r):Ai(e,t,a));break;default:Ai(e,t,a)}}function Vg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ho(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];Ut=r,Hg(r,e)}Vg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)qg(e),e=e.sibling}function qg(e){switch(e.tag){case 0:case 11:case 15:Ho(e),e.flags&2048&&Js(9,e,e.return);break;case 3:Ho(e);break;case 12:Ho(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,kl(e)):Ho(e);break;default:Ho(e)}}function kl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];Ut=r,Hg(r,e)}Vg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Js(8,t,t.return),kl(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,kl(t));break;default:kl(t)}e=e.sibling}}function Hg(e,t){for(;Ut!==null;){var a=Ut;switch(a.tag){case 0:case 11:case 15:Js(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var r=a.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:No(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,Ut=r;else e:for(a=e;Ut!==null;){r=Ut;var f=r.sibling,p=r.return;if(Mg(r),r===a){Ut=null;break e}if(f!==null){f.return=p,Ut=f;break e}Ut=p}}}var eS={getCacheForType:function(e){var t=Ht(jt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Ht(jt).controller.signal}},tS=typeof WeakMap=="function"?WeakMap:Map,Xe=0,ot=null,Le=null,Pe=0,et=0,gn=null,Ws=!1,Di=!1,vd=!1,ks=0,bt=0,Xs=0,Ua=0,yd=0,vn=0,Ri=0,Go=null,ln=null,bd=!1,wl=0,Gg=0,Nl=1/0,jl=null,Qs=null,Ot=0,ea=null,Mi=null,ws=0,_d=0,xd=null,$g=null,$o=0,Sd=null;function yn(){return(Xe&2)!==0&&Pe!==0?Pe&-Pe:I.T!==null?Cd():rm()}function Fg(){if(vn===0)if((Pe&536870912)===0||Ge){var e=oe;oe<<=1,(oe&3932160)===0&&(oe=262144),vn=e}else vn=536870912;return e=mn.current,e!==null&&(e.flags|=32),vn}function cn(e,t,a){(e===ot&&(et===2||et===9)||e.cancelPendingCommit!==null)&&(Oi(e,0),ta(e,Pe,vn,!1)),He(e,a),((Xe&2)===0||e!==ot)&&(e===ot&&((Xe&2)===0&&(Ua|=a),bt===4&&ta(e,Pe,vn,!1)),es(e))}function Zg(e,t,a){if((Xe&6)!==0)throw Error(o(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||ye(e,t),f=r?aS(e,t):kd(e,t,!0),p=r;do{if(f===0){Di&&!r&&ta(e,t,0,!1);break}else{if(a=e.current.alternate,p&&!nS(a)){f=kd(e,t,!1),p=!1;continue}if(f===2){if(p=t,e.errorRecoveryDisabledLanes&p)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){t=x;e:{var k=e;f=Go;var D=k.current.memoizedState.isDehydrated;if(D&&(Oi(k,x).flags|=256),x=kd(k,x,!1),x!==2){if(vd&&!D){k.errorRecoveryDisabledLanes|=p,Ua|=p,f=4;break e}p=ln,ln=f,p!==null&&(ln===null?ln=p:ln.push.apply(ln,p))}f=x}if(p=!1,f!==2)continue}}if(f===1){Oi(e,0),ta(e,t,0,!0);break}e:{switch(r=e,p=f,p){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:ta(r,t,vn,!Ws);break e;case 2:ln=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(f=wl+300-Kt(),10<f)){if(ta(r,t,vn,!Ws),qe(r,0,!0)!==0)break e;ws=t,r.timeoutHandle=kv(Kg.bind(null,r,a,ln,jl,bd,t,vn,Ua,Ri,Ws,p,"Throttled",-0,0),f);break e}Kg(r,a,ln,jl,bd,t,vn,Ua,Ri,Ws,p,null,-0,0)}}break}while(!0);es(e)}function Kg(e,t,a,r,f,p,x,k,D,P,Y,W,H,F){if(e.timeoutHandle=-1,W=t.subtreeFlags,W&8192||(W&16785408)===16785408){W={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:us},Pg(t,p,W);var ge=(p&62914560)===p?wl-Kt():(p&4194048)===p?Gg-Kt():0;if(ge=PS(W,ge),ge!==null){ws=p,e.cancelPendingCommit=ge(nv.bind(null,e,t,p,a,r,f,x,k,D,Y,W,null,H,F)),ta(e,p,x,!P);return}}nv(e,t,p,a,r,f,x,k,D)}function nS(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var f=a[r],p=f.getSnapshot;f=f.value;try{if(!fn(p(),f))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ta(e,t,a,r){t&=~yd,t&=~Ua,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var f=t;0<f;){var p=31-Jt(f),x=1<<p;r[p]=-1,f&=~x}a!==0&&Pt(e,a,t)}function Cl(){return(Xe&6)===0?(Fo(0),!1):!0}function Td(){if(Le!==null){if(et===0)var e=Le.return;else e=Le,ms=Ea=null,zu(e),ki=null,Co=0,e=Le;for(;e!==null;)wg(e.alternate,e),e=e.return;Le=null}}function Oi(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,SS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),ws=0,Td(),ot=e,Le=a=fs(e.current,null),Pe=t,et=0,gn=null,Ws=!1,Di=ye(e,t),vd=!1,Ri=vn=yd=Ua=Xs=bt=0,ln=Go=null,bd=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var f=31-Jt(r),p=1<<f;t|=e[f],r&=~p}return ks=t,Yr(),a}function Yg(e,t){De=null,I.H=Bo,t===Ti||t===sl?(t=dh(),et=3):t===ju?(t=dh(),et=4):et=t===td?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,gn=t,Le===null&&(bt=1,vl(e,jn(t,e.current)))}function Jg(){var e=mn.current;return e===null?!0:(Pe&4194048)===Pe?Dn===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?e===Dn:!1}function Wg(){var e=I.H;return I.H=Bo,e===null?Bo:e}function Xg(){var e=I.A;return I.A=eS,e}function El(){bt=4,Ws||(Pe&4194048)!==Pe&&mn.current!==null||(Di=!0),(Xs&134217727)===0&&(Ua&134217727)===0||ot===null||ta(ot,Pe,vn,!1)}function kd(e,t,a){var r=Xe;Xe|=2;var f=Wg(),p=Xg();(ot!==e||Pe!==t)&&(jl=null,Oi(e,t)),t=!1;var x=bt;e:do try{if(et!==0&&Le!==null){var k=Le,D=gn;switch(et){case 8:Td(),x=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(t=!0);var P=et;if(et=0,gn=null,Ii(e,k,D,P),a&&Di){x=0;break e}break;default:P=et,et=0,gn=null,Ii(e,k,D,P)}}sS(),x=bt;break}catch(Y){Yg(e,Y)}while(!0);return t&&e.shellSuspendCounter++,ms=Ea=null,Xe=r,I.H=f,I.A=p,Le===null&&(ot=null,Pe=0,Yr()),x}function sS(){for(;Le!==null;)Qg(Le)}function aS(e,t){var a=Xe;Xe|=2;var r=Wg(),f=Xg();ot!==e||Pe!==t?(jl=null,Nl=Kt()+500,Oi(e,t)):Di=ye(e,t);e:do try{if(et!==0&&Le!==null){t=Le;var p=gn;t:switch(et){case 1:et=0,gn=null,Ii(e,t,p,1);break;case 2:case 9:if(ch(p)){et=0,gn=null,ev(t);break}t=function(){et!==2&&et!==9||ot!==e||(et=7),es(e)},p.then(t,t);break e;case 3:et=7;break e;case 4:et=5;break e;case 7:ch(p)?(et=0,gn=null,ev(t)):(et=0,gn=null,Ii(e,t,p,7));break;case 5:var x=null;switch(Le.tag){case 26:x=Le.memoizedState;case 5:case 27:var k=Le;if(x?zv(x):k.stateNode.complete){et=0,gn=null;var D=k.sibling;if(D!==null)Le=D;else{var P=k.return;P!==null?(Le=P,Al(P)):Le=null}break t}}et=0,gn=null,Ii(e,t,p,5);break;case 6:et=0,gn=null,Ii(e,t,p,6);break;case 8:Td(),bt=6;break e;default:throw Error(o(462))}}iS();break}catch(Y){Yg(e,Y)}while(!0);return ms=Ea=null,I.H=r,I.A=f,Xe=a,Le!==null?0:(ot=null,Pe=0,Yr(),bt)}function iS(){for(;Le!==null&&!Me();)Qg(Le)}function Qg(e){var t=Tg(e.alternate,e,ks);e.memoizedProps=e.pendingProps,t===null?Al(e):Le=t}function ev(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=vg(a,t,t.pendingProps,t.type,void 0,Pe);break;case 11:t=vg(a,t,t.pendingProps,t.type.render,t.ref,Pe);break;case 5:zu(t);default:wg(a,t),t=Le=Xm(t,ks),t=Tg(a,t,ks)}e.memoizedProps=e.pendingProps,t===null?Al(e):Le=t}function Ii(e,t,a,r){ms=Ea=null,zu(t),ki=null,Co=0;var f=t.return;try{if(Z1(e,f,t,a,Pe)){bt=1,vl(e,jn(a,e.current)),Le=null;return}}catch(p){if(f!==null)throw Le=f,p;bt=1,vl(e,jn(a,e.current)),Le=null;return}t.flags&32768?(Ge||r===1?e=!0:Di||(Pe&536870912)!==0?e=!1:(Ws=e=!0,(r===2||r===9||r===3||r===6)&&(r=mn.current,r!==null&&r.tag===13&&(r.flags|=16384))),tv(t,e)):Al(t)}function Al(e){var t=e;do{if((t.flags&32768)!==0){tv(t,Ws);return}e=t.return;var a=J1(t.alternate,t,ks);if(a!==null){Le=a;return}if(t=t.sibling,t!==null){Le=t;return}Le=t=e}while(t!==null);bt===0&&(bt=5)}function tv(e,t){do{var a=W1(e.alternate,e);if(a!==null){a.flags&=32767,Le=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Le=e;return}Le=e=a}while(e!==null);bt=6,Le=null}function nv(e,t,a,r,f,p,x,k,D){e.cancelPendingCommit=null;do Dl();while(Ot!==0);if((Xe&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(p=t.lanes|t.childLanes,p|=fu,zt(e,a,p,x,k,D),e===ot&&(Le=ot=null,Pe=0),Mi=t,ea=e,ws=a,_d=p,xd=f,$g=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,cS(_a,function(){return rv(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=I.T,I.T=null,f=$.p,$.p=2,x=Xe,Xe|=4;try{X1(e,t,a)}finally{Xe=x,$.p=f,I.T=r}}Ot=1,sv(),av(),iv()}}function sv(){if(Ot===1){Ot=0;var e=ea,t=Mi,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=I.T,I.T=null;var r=$.p;$.p=2;var f=Xe;Xe|=4;try{Lg(t,e);var p=Bd,x=Hm(e.containerInfo),k=p.focusedElem,D=p.selectionRange;if(x!==k&&k&&k.ownerDocument&&qm(k.ownerDocument.documentElement,k)){if(D!==null&&ru(k)){var P=D.start,Y=D.end;if(Y===void 0&&(Y=P),"selectionStart"in k)k.selectionStart=P,k.selectionEnd=Math.min(Y,k.value.length);else{var W=k.ownerDocument||document,H=W&&W.defaultView||window;if(H.getSelection){var F=H.getSelection(),ge=k.textContent.length,Se=Math.min(D.start,ge),it=D.end===void 0?Se:Math.min(D.end,ge);!F.extend&&Se>it&&(x=it,it=Se,Se=x);var B=Vm(k,Se),R=Vm(k,it);if(B&&R&&(F.rangeCount!==1||F.anchorNode!==B.node||F.anchorOffset!==B.offset||F.focusNode!==R.node||F.focusOffset!==R.offset)){var z=W.createRange();z.setStart(B.node,B.offset),F.removeAllRanges(),Se>it?(F.addRange(z),F.extend(R.node,R.offset)):(z.setEnd(R.node,R.offset),F.addRange(z))}}}}for(W=[],F=k;F=F.parentNode;)F.nodeType===1&&W.push({element:F,left:F.scrollLeft,top:F.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<W.length;k++){var J=W[k];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}Hl=!!Id,Bd=Id=null}finally{Xe=f,$.p=r,I.T=a}}e.current=t,Ot=2}}function av(){if(Ot===2){Ot=0;var e=ea,t=Mi,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=I.T,I.T=null;var r=$.p;$.p=2;var f=Xe;Xe|=4;try{Rg(e,t.alternate,t)}finally{Xe=f,$.p=r,I.T=a}}Ot=3}}function iv(){if(Ot===4||Ot===3){Ot=0,Mt();var e=ea,t=Mi,a=ws,r=$g;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Ot=5:(Ot=0,Mi=ea=null,ov(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Qs=null),xa(a),t=t.stateNode,Yt&&typeof Yt.onCommitFiberRoot=="function")try{Yt.onCommitFiberRoot(Us,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=I.T,f=$.p,$.p=2,I.T=null;try{for(var p=e.onRecoverableError,x=0;x<r.length;x++){var k=r[x];p(k.value,{componentStack:k.stack})}}finally{I.T=t,$.p=f}}(ws&3)!==0&&Dl(),es(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===Sd?$o++:($o=0,Sd=e):$o=0,Fo(0)}}function ov(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,No(t)))}function Dl(){return sv(),av(),iv(),rv()}function rv(){if(Ot!==5)return!1;var e=ea,t=_d;_d=0;var a=xa(ws),r=I.T,f=$.p;try{$.p=32>a?32:a,I.T=null,a=xd,xd=null;var p=ea,x=ws;if(Ot=0,Mi=ea=null,ws=0,(Xe&6)!==0)throw Error(o(331));var k=Xe;if(Xe|=4,qg(p.current),zg(p,p.current,x,a),Xe=k,Fo(0,!1),Yt&&typeof Yt.onPostCommitFiberRoot=="function")try{Yt.onPostCommitFiberRoot(Us,p)}catch{}return!0}finally{$.p=f,I.T=r,ov(e,t)}}function lv(e,t,a){t=jn(a,t),t=ed(e.stateNode,t,2),e=Zs(e,t,2),e!==null&&(He(e,2),es(e))}function tt(e,t,a){if(e.tag===3)lv(e,e,a);else for(;t!==null;){if(t.tag===3){lv(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Qs===null||!Qs.has(r))){e=jn(a,e),a=cg(2),r=Zs(t,a,2),r!==null&&(ug(a,r,t,e),He(r,2),es(r));break}}t=t.return}}function wd(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new tS;var f=new Set;r.set(t,f)}else f=r.get(t),f===void 0&&(f=new Set,r.set(t,f));f.has(a)||(vd=!0,f.add(a),e=oS.bind(null,e,t,a),t.then(e,e))}function oS(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ot===e&&(Pe&a)===a&&(bt===4||bt===3&&(Pe&62914560)===Pe&&300>Kt()-wl?(Xe&2)===0&&Oi(e,0):yd|=a,Ri===Pe&&(Ri=0)),es(e)}function cv(e,t){t===0&&(t=Ke()),e=Na(e,t),e!==null&&(He(e,t),es(e))}function rS(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),cv(e,a)}function lS(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),cv(e,a)}function cS(e,t){return Ls(e,t)}var Rl=null,Bi=null,Nd=!1,Ml=!1,jd=!1,na=0;function es(e){e!==Bi&&e.next===null&&(Bi===null?Rl=Bi=e:Bi=Bi.next=e),Ml=!0,Nd||(Nd=!0,dS())}function Fo(e,t){if(!jd&&Ml){jd=!0;do for(var a=!1,r=Rl;r!==null;){if(e!==0){var f=r.pendingLanes;if(f===0)var p=0;else{var x=r.suspendedLanes,k=r.pingedLanes;p=(1<<31-Jt(42|e)+1)-1,p&=f&~(x&~k),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,pv(r,p))}else p=Pe,p=qe(r,r===ot?p:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(p&3)===0||ye(r,p)||(a=!0,pv(r,p));r=r.next}while(a);jd=!1}}function uS(){uv()}function uv(){Ml=Nd=!1;var e=0;na!==0&&xS()&&(e=na);for(var t=Kt(),a=null,r=Rl;r!==null;){var f=r.next,p=dv(r,t);p===0?(r.next=null,a===null?Rl=f:a.next=f,f===null&&(Bi=a)):(a=r,(e!==0||(p&3)!==0)&&(Ml=!0)),r=f}Ot!==0&&Ot!==5||Fo(e),na!==0&&(na=0)}function dv(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,f=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var x=31-Jt(p),k=1<<x,D=f[x];D===-1?((k&a)===0||(k&r)!==0)&&(f[x]=Oe(k,t)):D<=t&&(e.expiredLanes|=k),p&=~k}if(t=ot,a=Pe,a=qe(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(et===2||et===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&dn(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ye(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&dn(r),xa(a)){case 2:case 8:a=uo;break;case 32:a=_a;break;case 268435456:a=fo;break;default:a=_a}return r=fv.bind(null,e),a=Ls(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&dn(r),e.callbackPriority=2,e.callbackNode=null,2}function fv(e,t){if(Ot!==0&&Ot!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Dl()&&e.callbackNode!==a)return null;var r=Pe;return r=qe(e,e===ot?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Zg(e,r,t),dv(e,Kt()),e.callbackNode!=null&&e.callbackNode===a?fv.bind(null,e):null)}function pv(e,t){if(Dl())return null;Zg(e,t,!0)}function dS(){TS(function(){(Xe&6)!==0?Ls(co,uS):uv()})}function Cd(){if(na===0){var e=xi;e===0&&(e=ne,ne<<=1,(ne&261888)===0&&(ne=256)),na=e}return na}function mv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Vr(""+e)}function hv(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function fS(e,t,a,r,f){if(t==="submit"&&a&&a.stateNode===f){var p=mv((f[nn]||null).action),x=r.submitter;x&&(t=(t=x[nn]||null)?mv(t.formAction):x.getAttribute("formAction"),t!==null&&(p=t,x=null));var k=new $r("action","action",null,r,f);e.push({event:k,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(na!==0){var D=x?hv(f,x):new FormData(f);Ku(a,{pending:!0,data:D,method:f.method,action:p},null,D)}}else typeof p=="function"&&(k.preventDefault(),D=x?hv(f,x):new FormData(f),Ku(a,{pending:!0,data:D,method:f.method,action:p},p,D))},currentTarget:f}]})}}for(var Ed=0;Ed<du.length;Ed++){var Ad=du[Ed],pS=Ad.toLowerCase(),mS=Ad[0].toUpperCase()+Ad.slice(1);qn(pS,"on"+mS)}qn(Fm,"onAnimationEnd"),qn(Zm,"onAnimationIteration"),qn(Km,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(A1,"onTransitionRun"),qn(D1,"onTransitionStart"),qn(R1,"onTransitionCancel"),qn(Ym,"onTransitionEnd"),ri("onMouseEnter",["mouseout","mouseover"]),ri("onMouseLeave",["mouseout","mouseover"]),ri("onPointerEnter",["pointerout","pointerover"]),ri("onPointerLeave",["pointerout","pointerover"]),Sa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Sa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Sa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Sa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),hS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Zo));function gv(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],f=r.event;r=r.listeners;e:{var p=void 0;if(t)for(var x=r.length-1;0<=x;x--){var k=r[x],D=k.instance,P=k.currentTarget;if(k=k.listener,D!==p&&f.isPropagationStopped())break e;p=k,f.currentTarget=P;try{p(f)}catch(Y){Kr(Y)}f.currentTarget=null,p=D}else for(x=0;x<r.length;x++){if(k=r[x],D=k.instance,P=k.currentTarget,k=k.listener,D!==p&&f.isPropagationStopped())break e;p=k,f.currentTarget=P;try{p(f)}catch(Y){Kr(Y)}f.currentTarget=null,p=D}}}}function Ue(e,t){var a=t[Hc];a===void 0&&(a=t[Hc]=new Set);var r=e+"__bubble";a.has(r)||(vv(t,e,2,!1),a.add(r))}function Dd(e,t,a){var r=0;t&&(r|=4),vv(a,e,r,t)}var Ol="_reactListening"+Math.random().toString(36).slice(2);function Rd(e){if(!e[Ol]){e[Ol]=!0,um.forEach(function(a){a!=="selectionchange"&&(hS.has(a)||Dd(a,!1,e),Dd(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ol]||(t[Ol]=!0,Dd("selectionchange",!1,t))}}function vv(e,t,a,r){switch(Fv(t)){case 2:var f=HS;break;case 8:f=GS;break;default:f=Zd}a=f.bind(null,t,a,e),f=void 0,!Xc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(f=!0),r?f!==void 0?e.addEventListener(t,a,{capture:!0,passive:f}):e.addEventListener(t,a,!0):f!==void 0?e.addEventListener(t,a,{passive:f}):e.addEventListener(t,a,!1)}function Md(e,t,a,r,f){var p=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var x=r.tag;if(x===3||x===4){var k=r.stateNode.containerInfo;if(k===f)break;if(x===4)for(x=r.return;x!==null;){var D=x.tag;if((D===3||D===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;k!==null;){if(x=ai(k),x===null)return;if(D=x.tag,D===5||D===6||D===26||D===27){r=p=x;continue e}k=k.parentNode}}r=r.return}Sm(function(){var P=p,Y=Jc(a),W=[];e:{var H=Jm.get(e);if(H!==void 0){var F=$r,ge=e;switch(e){case"keypress":if(Hr(a)===0)break e;case"keydown":case"keyup":F=l1;break;case"focusin":ge="focus",F=nu;break;case"focusout":ge="blur",F=nu;break;case"beforeblur":case"afterblur":F=nu;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":F=wm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":F=Jx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":F=d1;break;case Fm:case Zm:case Km:F=Qx;break;case Ym:F=p1;break;case"scroll":case"scrollend":F=Kx;break;case"wheel":F=h1;break;case"copy":case"cut":case"paste":F=t1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":F=jm;break;case"toggle":case"beforetoggle":F=v1}var Se=(t&4)!==0,it=!Se&&(e==="scroll"||e==="scrollend"),B=Se?H!==null?H+"Capture":null:H;Se=[];for(var R=P,z;R!==null;){var J=R;if(z=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||z===null||B===null||(J=ho(R,B),J!=null&&Se.push(Ko(R,J,z))),it)break;R=R.return}0<Se.length&&(H=new F(H,ge,null,a,Y),W.push({event:H,listeners:Se}))}}if((t&7)===0){e:{if(H=e==="mouseover"||e==="pointerover",F=e==="mouseout"||e==="pointerout",H&&a!==Yc&&(ge=a.relatedTarget||a.fromElement)&&(ai(ge)||ge[si]))break e;if((F||H)&&(H=Y.window===Y?Y:(H=Y.ownerDocument)?H.defaultView||H.parentWindow:window,F?(ge=a.relatedTarget||a.toElement,F=P,ge=ge?ai(ge):null,ge!==null&&(it=u(ge),Se=ge.tag,ge!==it||Se!==5&&Se!==27&&Se!==6)&&(ge=null)):(F=null,ge=P),F!==ge)){if(Se=wm,J="onMouseLeave",B="onMouseEnter",R="mouse",(e==="pointerout"||e==="pointerover")&&(Se=jm,J="onPointerLeave",B="onPointerEnter",R="pointer"),it=F==null?H:mo(F),z=ge==null?H:mo(ge),H=new Se(J,R+"leave",F,a,Y),H.target=it,H.relatedTarget=z,J=null,ai(Y)===P&&(Se=new Se(B,R+"enter",ge,a,Y),Se.target=z,Se.relatedTarget=it,J=Se),it=J,F&&ge)t:{for(Se=gS,B=F,R=ge,z=0,J=B;J;J=Se(J))z++;J=0;for(var _e=R;_e;_e=Se(_e))J++;for(;0<z-J;)B=Se(B),z--;for(;0<J-z;)R=Se(R),J--;for(;z--;){if(B===R||R!==null&&B===R.alternate){Se=B;break t}B=Se(B),R=Se(R)}Se=null}else Se=null;F!==null&&yv(W,H,F,Se,!1),ge!==null&&it!==null&&yv(W,it,ge,Se,!0)}}e:{if(H=P?mo(P):window,F=H.nodeName&&H.nodeName.toLowerCase(),F==="select"||F==="input"&&H.type==="file")var Ye=Im;else if(Mm(H))if(Bm)Ye=j1;else{Ye=w1;var ve=k1}else F=H.nodeName,!F||F.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?P&&Kc(P.elementType)&&(Ye=Im):Ye=N1;if(Ye&&(Ye=Ye(e,P))){Om(W,Ye,a,Y);break e}ve&&ve(e,H,P),e==="focusout"&&P&&H.type==="number"&&P.memoizedProps.value!=null&&Zc(H,"number",H.value)}switch(ve=P?mo(P):window,e){case"focusin":(Mm(ve)||ve.contentEditable==="true")&&(pi=ve,lu=P,To=null);break;case"focusout":To=lu=pi=null;break;case"mousedown":cu=!0;break;case"contextmenu":case"mouseup":case"dragend":cu=!1,Gm(W,a,Y);break;case"selectionchange":if(E1)break;case"keydown":case"keyup":Gm(W,a,Y)}var Ie;if(au)e:{switch(e){case"compositionstart":var Ve="onCompositionStart";break e;case"compositionend":Ve="onCompositionEnd";break e;case"compositionupdate":Ve="onCompositionUpdate";break e}Ve=void 0}else fi?Dm(e,a)&&(Ve="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ve="onCompositionStart");Ve&&(Cm&&a.locale!=="ko"&&(fi||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&fi&&(Ie=Tm()):(Ps=Y,Qc="value"in Ps?Ps.value:Ps.textContent,fi=!0)),ve=Il(P,Ve),0<ve.length&&(Ve=new Nm(Ve,e,null,a,Y),W.push({event:Ve,listeners:ve}),Ie?Ve.data=Ie:(Ie=Rm(a),Ie!==null&&(Ve.data=Ie)))),(Ie=b1?_1(e,a):x1(e,a))&&(Ve=Il(P,"onBeforeInput"),0<Ve.length&&(ve=new Nm("onBeforeInput","beforeinput",null,a,Y),W.push({event:ve,listeners:Ve}),ve.data=Ie)),fS(W,e,P,a,Y)}gv(W,t)})}function Ko(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Il(e,t){for(var a=t+"Capture",r=[];e!==null;){var f=e,p=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||p===null||(f=ho(e,a),f!=null&&r.unshift(Ko(e,f,p)),f=ho(e,t),f!=null&&r.push(Ko(e,f,p))),e.tag===3)return r;e=e.return}return[]}function gS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function yv(e,t,a,r,f){for(var p=t._reactName,x=[];a!==null&&a!==r;){var k=a,D=k.alternate,P=k.stateNode;if(k=k.tag,D!==null&&D===r)break;k!==5&&k!==26&&k!==27||P===null||(D=P,f?(P=ho(a,p),P!=null&&x.unshift(Ko(a,P,D))):f||(P=ho(a,p),P!=null&&x.push(Ko(a,P,D)))),a=a.return}x.length!==0&&e.push({event:t,listeners:x})}var vS=/\r\n?/g,yS=/\u0000|\uFFFD/g;function bv(e){return(typeof e=="string"?e:""+e).replace(vS,`
|
|
26
|
+
`).replace(yS,"")}function _v(e,t){return t=bv(t),bv(e)===t}function at(e,t,a,r,f,p){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||ci(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&ci(e,""+r);break;case"className":zr(e,"class",r);break;case"tabIndex":zr(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":zr(e,a,r);break;case"style":_m(e,r,p);break;case"data":if(t!=="object"){zr(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Vr(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="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 p=="function"&&(a==="formAction"?(t!=="input"&&at(e,t,"name",f.name,f,null),at(e,t,"formEncType",f.formEncType,f,null),at(e,t,"formMethod",f.formMethod,f,null),at(e,t,"formTarget",f.formTarget,f,null)):(at(e,t,"encType",f.encType,f,null),at(e,t,"method",f.method,f,null),at(e,t,"target",f.target,f,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Vr(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=us);break;case"onScroll":r!=null&&Ue("scroll",e);break;case"onScrollEnd":r!=null&&Ue("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(o(61));if(a=r.__html,a!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=Vr(""+r),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":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""+r):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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":r===!0?e.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(a,r):e.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(a):e.setAttribute(a,r);break;case"popover":Ue("beforetoggle",e),Ue("toggle",e),Ur(e,"popover",r);break;case"xlinkActuate":cs(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":cs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":cs(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":cs(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":cs(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":cs(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":cs(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":cs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":cs(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Ur(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Fx.get(a)||a,Ur(e,a,r))}}function Od(e,t,a,r,f,p){switch(a){case"style":_m(e,r,p);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(o(61));if(a=r.__html,a!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"children":typeof r=="string"?ci(e,r):(typeof r=="number"||typeof r=="bigint")&&ci(e,""+r);break;case"onScroll":r!=null&&Ue("scroll",e);break;case"onScrollEnd":r!=null&&Ue("scrollend",e);break;case"onClick":r!=null&&(e.onclick=us);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!dm.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),t=a.slice(2,f?a.length-7:void 0),p=e[nn]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(t,p,f),typeof r=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,f);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):Ur(e,a,r)}}}function $t(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ue("error",e),Ue("load",e);var r=!1,f=!1,p;for(p in a)if(a.hasOwnProperty(p)){var x=a[p];if(x!=null)switch(p){case"src":r=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:at(e,t,p,x,a,null)}}f&&at(e,t,"srcSet",a.srcSet,a,null),r&&at(e,t,"src",a.src,a,null);return;case"input":Ue("invalid",e);var k=p=x=f=null,D=null,P=null;for(r in a)if(a.hasOwnProperty(r)){var Y=a[r];if(Y!=null)switch(r){case"name":f=Y;break;case"type":x=Y;break;case"checked":D=Y;break;case"defaultChecked":P=Y;break;case"value":p=Y;break;case"defaultValue":k=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:at(e,t,r,Y,a,null)}}gm(e,p,k,D,P,x,f,!1);return;case"select":Ue("invalid",e),r=x=p=null;for(f in a)if(a.hasOwnProperty(f)&&(k=a[f],k!=null))switch(f){case"value":p=k;break;case"defaultValue":x=k;break;case"multiple":r=k;default:at(e,t,f,k,a,null)}t=p,a=x,e.multiple=!!r,t!=null?li(e,!!r,t,!1):a!=null&&li(e,!!r,a,!0);return;case"textarea":Ue("invalid",e),p=f=r=null;for(x in a)if(a.hasOwnProperty(x)&&(k=a[x],k!=null))switch(x){case"value":r=k;break;case"defaultValue":f=k;break;case"children":p=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(o(91));break;default:at(e,t,x,k,a,null)}ym(e,r,f,p);return;case"option":for(D in a)if(a.hasOwnProperty(D)&&(r=a[D],r!=null))switch(D){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:at(e,t,D,r,a,null)}return;case"dialog":Ue("beforetoggle",e),Ue("toggle",e),Ue("cancel",e),Ue("close",e);break;case"iframe":case"object":Ue("load",e);break;case"video":case"audio":for(r=0;r<Zo.length;r++)Ue(Zo[r],e);break;case"image":Ue("error",e),Ue("load",e);break;case"details":Ue("toggle",e);break;case"embed":case"source":case"link":Ue("error",e),Ue("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(P in a)if(a.hasOwnProperty(P)&&(r=a[P],r!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:at(e,t,P,r,a,null)}return;default:if(Kc(t)){for(Y in a)a.hasOwnProperty(Y)&&(r=a[Y],r!==void 0&&Od(e,t,Y,r,a,void 0));return}}for(k in a)a.hasOwnProperty(k)&&(r=a[k],r!=null&&at(e,t,k,r,a,null))}function bS(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,p=null,x=null,k=null,D=null,P=null,Y=null;for(F in a){var W=a[F];if(a.hasOwnProperty(F)&&W!=null)switch(F){case"checked":break;case"value":break;case"defaultValue":D=W;default:r.hasOwnProperty(F)||at(e,t,F,null,r,W)}}for(var H in r){var F=r[H];if(W=a[H],r.hasOwnProperty(H)&&(F!=null||W!=null))switch(H){case"type":p=F;break;case"name":f=F;break;case"checked":P=F;break;case"defaultChecked":Y=F;break;case"value":x=F;break;case"defaultValue":k=F;break;case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(o(137,t));break;default:F!==W&&at(e,t,H,F,r,W)}}Fc(e,x,k,D,P,Y,p,f);return;case"select":F=x=k=H=null;for(p in a)if(D=a[p],a.hasOwnProperty(p)&&D!=null)switch(p){case"value":break;case"multiple":F=D;default:r.hasOwnProperty(p)||at(e,t,p,null,r,D)}for(f in r)if(p=r[f],D=a[f],r.hasOwnProperty(f)&&(p!=null||D!=null))switch(f){case"value":H=p;break;case"defaultValue":k=p;break;case"multiple":x=p;default:p!==D&&at(e,t,f,p,r,D)}t=k,a=x,r=F,H!=null?li(e,!!a,H,!1):!!r!=!!a&&(t!=null?li(e,!!a,t,!0):li(e,!!a,a?[]:"",!1));return;case"textarea":F=H=null;for(k in a)if(f=a[k],a.hasOwnProperty(k)&&f!=null&&!r.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:at(e,t,k,null,r,f)}for(x in r)if(f=r[x],p=a[x],r.hasOwnProperty(x)&&(f!=null||p!=null))switch(x){case"value":H=f;break;case"defaultValue":F=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(o(91));break;default:f!==p&&at(e,t,x,f,r,p)}vm(e,H,F);return;case"option":for(var ge in a)if(H=a[ge],a.hasOwnProperty(ge)&&H!=null&&!r.hasOwnProperty(ge))switch(ge){case"selected":e.selected=!1;break;default:at(e,t,ge,null,r,H)}for(D in r)if(H=r[D],F=a[D],r.hasOwnProperty(D)&&H!==F&&(H!=null||F!=null))switch(D){case"selected":e.selected=H&&typeof H!="function"&&typeof H!="symbol";break;default:at(e,t,D,H,r,F)}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 Se in a)H=a[Se],a.hasOwnProperty(Se)&&H!=null&&!r.hasOwnProperty(Se)&&at(e,t,Se,null,r,H);for(P in r)if(H=r[P],F=a[P],r.hasOwnProperty(P)&&H!==F&&(H!=null||F!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(137,t));break;default:at(e,t,P,H,r,F)}return;default:if(Kc(t)){for(var it in a)H=a[it],a.hasOwnProperty(it)&&H!==void 0&&!r.hasOwnProperty(it)&&Od(e,t,it,void 0,r,H);for(Y in r)H=r[Y],F=a[Y],!r.hasOwnProperty(Y)||H===F||H===void 0&&F===void 0||Od(e,t,Y,H,r,F);return}}for(var B in a)H=a[B],a.hasOwnProperty(B)&&H!=null&&!r.hasOwnProperty(B)&&at(e,t,B,null,r,H);for(W in r)H=r[W],F=a[W],!r.hasOwnProperty(W)||H===F||H==null&&F==null||at(e,t,W,H,r,F)}function xv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _S(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var f=a[r],p=f.transferSize,x=f.initiatorType,k=f.duration;if(p&&k&&xv(x)){for(x=0,k=f.responseEnd,r+=1;r<a.length;r++){var D=a[r],P=D.startTime;if(P>k)break;var Y=D.transferSize,W=D.initiatorType;Y&&xv(W)&&(D=D.responseEnd,x+=Y*(D<k?1:(k-P)/(D-P)))}if(--r,t+=8*(p+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Id=null,Bd=null;function Bl(e){return e.nodeType===9?e:e.ownerDocument}function Sv(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 Tv(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Ld(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ud=null;function xS(){var e=window.event;return e&&e.type==="popstate"?e===Ud?!1:(Ud=e,!0):(Ud=null,!1)}var kv=typeof setTimeout=="function"?setTimeout:void 0,SS=typeof clearTimeout=="function"?clearTimeout:void 0,wv=typeof Promise=="function"?Promise:void 0,TS=typeof queueMicrotask=="function"?queueMicrotask:typeof wv<"u"?function(e){return wv.resolve(null).then(e).catch(kS)}:kv;function kS(e){setTimeout(function(){throw e})}function sa(e){return e==="head"}function Nv(e,t){var a=t,r=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(f),Pi(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")Yo(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Yo(a);for(var p=a.firstChild;p;){var x=p.nextSibling,k=p.nodeName;p[po]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=x}}else a==="body"&&Yo(e.ownerDocument.body);a=f}while(a);Pi(t)}function jv(e,t){var a=e;e=0;do{var r=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),r&&r.nodeType===8)if(a=r.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=r}while(a)}function zd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":zd(a),Gc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function wS(e,t,a,r){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[po])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==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(p=e.getAttribute("src"),(p!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var p=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=Rn(e.nextSibling),e===null)break}return null}function NS(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Rn(e.nextSibling),e===null))return null;return e}function Cv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Rn(e.nextSibling),e===null))return null;return e}function Pd(e){return e.data==="$?"||e.data==="$~"}function Vd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function jS(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function Rn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var qd=null;function Ev(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return Rn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Av(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Dv(e,t,a){switch(t=Bl(a),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function Yo(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Gc(e)}var Mn=new Map,Rv=new Set;function Ll(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ns=$.d;$.d={f:CS,r:ES,D:AS,C:DS,L:RS,m:MS,X:IS,S:OS,M:BS};function CS(){var e=Ns.f(),t=Cl();return e||t}function ES(e){var t=ii(e);t!==null&&t.tag===5&&t.type==="form"?Yh(t):Ns.r(e)}var Li=typeof document>"u"?null:document;function Mv(e,t,a){var r=Li;if(r&&typeof t=="string"&&t){var f=wn(t);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),Rv.has(f)||(Rv.add(f),e={rel:e,crossOrigin:a,href:t},r.querySelector(f)===null&&(t=r.createElement("link"),$t(t,"link",e),Lt(t),r.head.appendChild(t)))}}function AS(e){Ns.D(e),Mv("dns-prefetch",e,null)}function DS(e,t){Ns.C(e,t),Mv("preconnect",e,t)}function RS(e,t,a){Ns.L(e,t,a);var r=Li;if(r&&e&&t){var f='link[rel="preload"][as="'+wn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+wn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+wn(a.imageSizes)+'"]')):f+='[href="'+wn(e)+'"]';var p=f;switch(t){case"style":p=Ui(e);break;case"script":p=zi(e)}Mn.has(p)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Mn.set(p,e),r.querySelector(f)!==null||t==="style"&&r.querySelector(Jo(p))||t==="script"&&r.querySelector(Wo(p))||(t=r.createElement("link"),$t(t,"link",e),Lt(t),r.head.appendChild(t)))}}function MS(e,t){Ns.m(e,t);var a=Li;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",f='link[rel="modulepreload"][as="'+wn(r)+'"][href="'+wn(e)+'"]',p=f;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=zi(e)}if(!Mn.has(p)&&(e=b({rel:"modulepreload",href:e},t),Mn.set(p,e),a.querySelector(f)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Wo(p)))return}r=a.createElement("link"),$t(r,"link",e),Lt(r),a.head.appendChild(r)}}}function OS(e,t,a){Ns.S(e,t,a);var r=Li;if(r&&e){var f=oi(r).hoistableStyles,p=Ui(e);t=t||"default";var x=f.get(p);if(!x){var k={loading:0,preload:null};if(x=r.querySelector(Jo(p)))k.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Mn.get(p))&&Hd(e,a);var D=x=r.createElement("link");Lt(D),$t(D,"link",e),D._p=new Promise(function(P,Y){D.onload=P,D.onerror=Y}),D.addEventListener("load",function(){k.loading|=1}),D.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Ul(x,t,r)}x={type:"stylesheet",instance:x,count:1,state:k},f.set(p,x)}}}function IS(e,t){Ns.X(e,t);var a=Li;if(a&&e){var r=oi(a).hoistableScripts,f=zi(e),p=r.get(f);p||(p=a.querySelector(Wo(f)),p||(e=b({src:e,async:!0},t),(t=Mn.get(f))&&Gd(e,t),p=a.createElement("script"),Lt(p),$t(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},r.set(f,p))}}function BS(e,t){Ns.M(e,t);var a=Li;if(a&&e){var r=oi(a).hoistableScripts,f=zi(e),p=r.get(f);p||(p=a.querySelector(Wo(f)),p||(e=b({src:e,async:!0,type:"module"},t),(t=Mn.get(f))&&Gd(e,t),p=a.createElement("script"),Lt(p),$t(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},r.set(f,p))}}function Ov(e,t,a,r){var f=(f=fe.current)?Ll(f):null;if(!f)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Ui(a.href),a=oi(f).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ui(a.href);var p=oi(f).hoistableStyles,x=p.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,x),(p=f.querySelector(Jo(e)))&&!p._p&&(x.instance=p,x.state.loading=5),Mn.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},Mn.set(e,a),p||LS(f,e,a,x.state))),t&&r===null)throw Error(o(528,""));return x}if(t&&r!==null)throw Error(o(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=zi(a),a=oi(f).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Ui(e){return'href="'+wn(e)+'"'}function Jo(e){return'link[rel="stylesheet"]['+e+"]"}function Iv(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function LS(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),$t(t,"link",a),Lt(t),e.head.appendChild(t))}function zi(e){return'[src="'+wn(e)+'"]'}function Wo(e){return"script[async]"+e}function Bv(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+wn(a.href)+'"]');if(r)return t.instance=r,Lt(r),r;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Lt(r),$t(r,"style",f),Ul(r,a.precedence,e),t.instance=r;case"stylesheet":f=Ui(a.href);var p=e.querySelector(Jo(f));if(p)return t.state.loading|=4,t.instance=p,Lt(p),p;r=Iv(a),(f=Mn.get(f))&&Hd(r,f),p=(e.ownerDocument||e).createElement("link"),Lt(p);var x=p;return x._p=new Promise(function(k,D){x.onload=k,x.onerror=D}),$t(p,"link",r),t.state.loading|=4,Ul(p,a.precedence,e),t.instance=p;case"script":return p=zi(a.src),(f=e.querySelector(Wo(p)))?(t.instance=f,Lt(f),f):(r=a,(f=Mn.get(p))&&(r=b({},a),Gd(r,f)),e=e.ownerDocument||e,f=e.createElement("script"),Lt(f),$t(f,"link",r),e.head.appendChild(f),t.instance=f);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Ul(r,a.precedence,e));return t.instance}function Ul(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=r.length?r[r.length-1]:null,p=f,x=0;x<r.length;x++){var k=r[x];if(k.dataset.precedence===t)p=k;else if(p!==f)break}p?p.parentNode.insertBefore(e,p.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Hd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Gd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var zl=null;function Lv(e,t,a){if(zl===null){var r=new Map,f=zl=new Map;f.set(a,r)}else f=zl,r=f.get(a),r||(r=new Map,f.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var p=a[f];if(!(p[po]||p[Vt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var x=p.getAttribute(t)||"";x=e+x;var k=r.get(x);k?k.push(p):r.set(x,[p])}}return r}function Uv(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function US(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function zv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function zS(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=Ui(r.href),p=t.querySelector(Jo(f));if(p){t=p._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Pl.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=p,Lt(p);return}p=t.ownerDocument||t,r=Iv(r),(f=Mn.get(f))&&Hd(r,f),p=p.createElement("link"),Lt(p);var x=p;x._p=new Promise(function(k,D){x.onload=k,x.onerror=D}),$t(p,"link",r),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Pl.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var $d=0;function PS(e,t){return e.stylesheets&&e.count===0&&ql(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&ql(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+t);0<e.imgBytes&&$d===0&&($d=62500*_S());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ql(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>$d?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(f)}}:null}function Pl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ql(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Vl=null;function ql(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Vl=new Map,t.forEach(VS,e),Vl=null,Pl.call(e))}function VS(e,t){if(!(t.state.loading&4)){var a=Vl.get(e);if(a)var r=a.get(null);else{a=new Map,Vl.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<f.length;p++){var x=f[p];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),r=x)}r&&a.set(null,r)}f=t.instance,x=f.getAttribute("data-precedence"),p=a.get(x)||r,p===r&&a.set(null,f),a.set(x,f),this.count++,r=Pl.bind(this),f.addEventListener("load",r),f.addEventListener("error",r),p?p.parentNode.insertBefore(f,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),t.state.loading|=4}}var Xo={$$typeof:A,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function qS(e,t,a,r,f,p,x,k,D){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=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=r,this.onUncaughtError=f,this.onCaughtError=p,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function Pv(e,t,a,r,f,p,x,k,D,P,Y,W){return e=new qS(e,t,a,x,D,P,Y,W,k),t=1,p===!0&&(t|=24),p=pn(3,null,null,t),e.current=p,p.stateNode=e,t=ku(),t.refCount++,e.pooledCache=t,t.refCount++,p.memoizedState={element:r,isDehydrated:a,cache:t},Cu(p),e}function Vv(e){return e?(e=gi,e):gi}function qv(e,t,a,r,f,p){f=Vv(f),r.context===null?r.context=f:r.pendingContext=f,r=Fs(t),r.payload={element:a},p=p===void 0?null:p,p!==null&&(r.callback=p),a=Zs(e,r,t),a!==null&&(cn(a,e,t),Ao(a,e,t))}function Hv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Fd(e,t){Hv(e,t),(e=e.alternate)&&Hv(e,t)}function Gv(e){if(e.tag===13||e.tag===31){var t=Na(e,67108864);t!==null&&cn(t,e,67108864),Fd(e,67108864)}}function $v(e){if(e.tag===13||e.tag===31){var t=yn();t=Vn(t);var a=Na(e,t);a!==null&&cn(a,e,t),Fd(e,t)}}var Hl=!0;function HS(e,t,a,r){var f=I.T;I.T=null;var p=$.p;try{$.p=2,Zd(e,t,a,r)}finally{$.p=p,I.T=f}}function GS(e,t,a,r){var f=I.T;I.T=null;var p=$.p;try{$.p=8,Zd(e,t,a,r)}finally{$.p=p,I.T=f}}function Zd(e,t,a,r){if(Hl){var f=Kd(r);if(f===null)Md(e,t,r,Gl,a),Zv(e,r);else if(FS(f,e,t,a,r))r.stopPropagation();else if(Zv(e,r),t&4&&-1<$S.indexOf(e)){for(;f!==null;){var p=ii(f);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var x=ue(p.pendingLanes);if(x!==0){var k=p;for(k.pendingLanes|=2,k.entangledLanes|=2;x;){var D=1<<31-Jt(x);k.entanglements[1]|=D,x&=~D}es(p),(Xe&6)===0&&(Nl=Kt()+500,Fo(0))}}break;case 31:case 13:k=Na(p,2),k!==null&&cn(k,p,2),Cl(),Fd(p,2)}if(p=Kd(r),p===null&&Md(e,t,r,Gl,a),p===f)break;f=p}f!==null&&r.stopPropagation()}else Md(e,t,r,null,a)}}function Kd(e){return e=Jc(e),Yd(e)}var Gl=null;function Yd(e){if(Gl=null,e=ai(e),e!==null){var t=u(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=d(t),e!==null)return e;e=null}else if(a===31){if(e=m(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Gl=e,null}function Fv(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(lo()){case co:return 2;case uo:return 8;case _a:case Or:return 32;case fo:return 268435456;default:return 32}default:return 32}}var Jd=!1,aa=null,ia=null,oa=null,Qo=new Map,er=new Map,ra=[],$S="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 Zv(e,t){switch(e){case"focusin":case"focusout":aa=null;break;case"dragenter":case"dragleave":ia=null;break;case"mouseover":case"mouseout":oa=null;break;case"pointerover":case"pointerout":Qo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":er.delete(t.pointerId)}}function tr(e,t,a,r,f,p){return e===null||e.nativeEvent!==p?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:p,targetContainers:[f]},t!==null&&(t=ii(t),t!==null&&Gv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,f!==null&&t.indexOf(f)===-1&&t.push(f),e)}function FS(e,t,a,r,f){switch(t){case"focusin":return aa=tr(aa,e,t,a,r,f),!0;case"dragenter":return ia=tr(ia,e,t,a,r,f),!0;case"mouseover":return oa=tr(oa,e,t,a,r,f),!0;case"pointerover":var p=f.pointerId;return Qo.set(p,tr(Qo.get(p)||null,e,t,a,r,f)),!0;case"gotpointercapture":return p=f.pointerId,er.set(p,tr(er.get(p)||null,e,t,a,r,f)),!0}return!1}function Kv(e){var t=ai(e.target);if(t!==null){var a=u(t);if(a!==null){if(t=a.tag,t===13){if(t=d(a),t!==null){e.blockedOn=t,lm(e.priority,function(){$v(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,lm(e.priority,function(){$v(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function $l(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Kd(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);Yc=r,a.target.dispatchEvent(r),Yc=null}else return t=ii(a),t!==null&&Gv(t),e.blockedOn=a,!1;t.shift()}return!0}function Yv(e,t,a){$l(e)&&a.delete(t)}function ZS(){Jd=!1,aa!==null&&$l(aa)&&(aa=null),ia!==null&&$l(ia)&&(ia=null),oa!==null&&$l(oa)&&(oa=null),Qo.forEach(Yv),er.forEach(Yv)}function Fl(e,t){e.blockedOn===t&&(e.blockedOn=null,Jd||(Jd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,ZS)))}var Zl=null;function Jv(e){Zl!==e&&(Zl=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Zl===e&&(Zl=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],f=e[t+2];if(typeof r!="function"){if(Yd(r||a)===null)continue;break}var p=ii(a);p!==null&&(e.splice(t,3),t-=3,Ku(p,{pending:!0,data:f,method:a.method,action:r},r,f))}}))}function Pi(e){function t(D){return Fl(D,e)}aa!==null&&Fl(aa,e),ia!==null&&Fl(ia,e),oa!==null&&Fl(oa,e),Qo.forEach(t),er.forEach(t);for(var a=0;a<ra.length;a++){var r=ra[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<ra.length&&(a=ra[0],a.blockedOn===null);)Kv(a),a.blockedOn===null&&ra.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var f=a[r],p=a[r+1],x=f[nn]||null;if(typeof p=="function")x||Jv(a);else if(x){var k=null;if(p&&p.hasAttribute("formAction")){if(f=p,x=p[nn]||null)k=x.formAction;else if(Yd(f)!==null)continue}else k=x.action;typeof k=="function"?a[r+1]=k:(a.splice(r,3),r-=3),Jv(a)}}}function Wv(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function t(){f!==null&&(f(),f=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),f!==null&&(f(),f=null)}}}function Wd(e){this._internalRoot=e}Kl.prototype.render=Wd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var a=t.current,r=yn();qv(a,r,e,t,null,null)},Kl.prototype.unmount=Wd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;qv(e.current,2,null,e,null,null),Cl(),t[si]=null}};function Kl(e){this._internalRoot=e}Kl.prototype.unstable_scheduleHydration=function(e){if(e){var t=rm();e={blockedOn:null,target:e,priority:t};for(var a=0;a<ra.length&&t!==0&&t<ra[a].priority;a++);ra.splice(a,0,e),a===0&&Kv(e)}};var Xv=s.version;if(Xv!=="19.2.4")throw Error(o(527,Xv,"19.2.4"));$.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var KS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yl.isDisabled&&Yl.supportsFiber)try{Us=Yl.inject(KS),Yt=Yl}catch{}}return sr.createRoot=function(e,t){if(!c(e))throw Error(o(299));var a=!1,r="",f=ig,p=og,x=rg;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(f=t.onUncaughtError),t.onCaughtError!==void 0&&(p=t.onCaughtError),t.onRecoverableError!==void 0&&(x=t.onRecoverableError)),t=Pv(e,1,!1,null,null,a,r,null,f,p,x,Wv),e[si]=t.current,Rd(e),new Wd(t)},sr.hydrateRoot=function(e,t,a){if(!c(e))throw Error(o(299));var r=!1,f="",p=ig,x=og,k=rg,D=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(k=a.onRecoverableError),a.formState!==void 0&&(D=a.formState)),t=Pv(e,1,!0,t,a??null,r,f,D,p,x,k,Wv),t.context=Vv(null),a=t.current,r=yn(),r=Vn(r),f=Fs(r),f.callback=null,Zs(a,f,r),a=r,t.current.lanes=a,He(t,a),es(t),e[si]=t.current,Rd(e),new Kl(t)},sr.version="19.2.4",sr}var o0;function ST(){if(o0)return Xd.exports;o0=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(s){console.error(s)}}return n(),Xd.exports=xT(),Xd.exports}var TT=ST();const kT="modulepreload",wT=function(n){return"/"+n},r0={},NT=function(s,i,o){let c=Promise.resolve();if(i&&i.length>0){let d=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 m=document.querySelector("meta[property=csp-nonce]"),h=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=d(i.map(g=>{if(g=wT(g),g in r0)return;r0[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":kT,v||(_.as="script"),_.crossOrigin="",_.href=g,h&&_.setAttribute("nonce",h),document.head.appendChild(_),v)return new Promise((S,T)=>{_.addEventListener("load",S),_.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${g}`)))})}))}function u(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return c.then(d=>{for(const m of d||[])m.status==="rejected"&&u(m.reason);return s().catch(u)})},jT=new Proxy(globalThis.fetch,{apply(n,s,i){return Reflect.apply(globalThis.fetch,s,i)}}),CT=rT({baseUrl:"/",fetch:jT}),we=lT(cT,CT);/**
|
|
27
|
+
* react-router v7.13.2
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Remix Software Inc.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
33
|
+
*
|
|
34
|
+
* @license MIT
|
|
35
|
+
*/var l0="popstate";function c0(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function ET(n={}){function s(o,c){var g;let u=(g=c.state)==null?void 0:g.masked,{pathname:d,search:m,hash:h}=u||o.location;return Lf("",{pathname:d,search:m,hash:h},c.state&&c.state.usr||null,c.state&&c.state.key||"default",u?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function i(o,c){return typeof c=="string"?c:_r(c)}return DT(s,i,null,n)}function dt(n,s){if(n===!1||n===null||typeof n>"u")throw new Error(s)}function Ln(n,s){if(!n){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function AT(){return Math.random().toString(36).substring(2,10)}function u0(n,s){return{usr:n.state,key:n.key,idx:s,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Lf(n,s,i=null,o,c){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof s=="string"?ao(s):s,state:i,key:s&&s.key||o||AT(),unstable_mask:c}}function _r({pathname:n="/",search:s="",hash:i=""}){return s&&s!=="?"&&(n+=s.charAt(0)==="?"?s:"?"+s),i&&i!=="#"&&(n+=i.charAt(0)==="#"?i:"#"+i),n}function ao(n){let s={};if(n){let i=n.indexOf("#");i>=0&&(s.hash=n.substring(i),n=n.substring(0,i));let o=n.indexOf("?");o>=0&&(s.search=n.substring(o),n=n.substring(0,o)),n&&(s.pathname=n)}return s}function DT(n,s,i,o={}){let{window:c=document.defaultView,v5Compat:u=!1}=o,d=c.history,m="POP",h=null,g=v();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function v(){return(d.state||{idx:null}).idx}function b(){m="POP";let j=v(),w=j==null?null:j-g;g=j,h&&h({action:m,location:N.location,delta:w})}function _(j,w){m="PUSH";let E=c0(j)?j:Lf(N.location,j,w);g=v()+1;let A=u0(E,g),O=N.createHref(E.unstable_mask||E);try{d.pushState(A,"",O)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;c.location.assign(O)}u&&h&&h({action:m,location:N.location,delta:1})}function S(j,w){m="REPLACE";let E=c0(j)?j:Lf(N.location,j,w);g=v();let A=u0(E,g),O=N.createHref(E.unstable_mask||E);d.replaceState(A,"",O),u&&h&&h({action:m,location:N.location,delta:0})}function T(j){return RT(j)}let N={get action(){return m},get location(){return n(c,d)},listen(j){if(h)throw new Error("A history only accepts one active listener");return c.addEventListener(l0,b),h=j,()=>{c.removeEventListener(l0,b),h=null}},createHref(j){return s(c,j)},createURL:T,encodeLocation(j){let w=T(j);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:_,replace:S,go(j){return d.go(j)}};return N}function RT(n,s=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),dt(i,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:_r(n);return o=o.replace(/ $/,"%20"),!s&&o.startsWith("//")&&(o=i+o),new URL(o,i)}function cb(n,s,i="/"){return MT(n,s,i,!1)}function MT(n,s,i,o){let c=typeof s=="string"?ao(s):s,u=Os(c.pathname||"/",i);if(u==null)return null;let d=ub(n);OT(d);let m=null;for(let h=0;m==null&&h<d.length;++h){let g=fb(u);m=HT(d[h],g,o)}return m}function ub(n,s=[],i=[],o="",c=!1){let u=(d,m,h=c,g)=>{let v={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:m,route:d};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(o)&&h)return;dt(v.relativePath.startsWith(o),`Absolute route path "${v.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(o.length)}let b=ss([o,v.relativePath]),_=i.concat(v);d.children&&d.children.length>0&&(dt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),ub(d.children,s,_,b,h)),!(d.path==null&&!d.index)&&s.push({path:b,score:VT(b,d.index),routesMeta:_})};return n.forEach((d,m)=>{var h;if(d.path===""||!((h=d.path)!=null&&h.includes("?")))u(d,m);else for(let g of db(d.path))u(d,m,!0,g)}),s}function db(n){let s=n.split("/");if(s.length===0)return[];let[i,...o]=s,c=i.endsWith("?"),u=i.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let d=db(o.join("/")),m=[];return m.push(...d.map(h=>h===""?u:[u,h].join("/"))),c&&m.push(...d),m.map(h=>n.startsWith("/")&&h===""?"/":h)}function OT(n){n.sort((s,i)=>s.score!==i.score?i.score-s.score:qT(s.routesMeta.map(o=>o.childrenIndex),i.routesMeta.map(o=>o.childrenIndex)))}var IT=/^:[\w-]+$/,BT=3,LT=2,UT=1,zT=10,PT=-2,d0=n=>n==="*";function VT(n,s){let i=n.split("/"),o=i.length;return i.some(d0)&&(o+=PT),s&&(o+=LT),i.filter(c=>!d0(c)).reduce((c,u)=>c+(IT.test(u)?BT:u===""?UT:zT),o)}function qT(n,s){return n.length===s.length&&n.slice(0,-1).every((o,c)=>o===s[c])?n[n.length-1]-s[s.length-1]:0}function HT(n,s,i=!1){let{routesMeta:o}=n,c={},u="/",d=[];for(let m=0;m<o.length;++m){let h=o[m],g=m===o.length-1,v=u==="/"?s:s.slice(u.length)||"/",b=xr({path:h.relativePath,caseSensitive:h.caseSensitive,end:g},v),_=h.route;if(!b&&g&&i&&!o[o.length-1].route.index&&(b=xr({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),d.push({params:c,pathname:ss([u,b.pathname]),pathnameBase:KT(ss([u,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(u=ss([u,b.pathnameBase]))}return d}function xr(n,s){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[i,o]=GT(n.path,n.caseSensitive,n.end),c=s.match(i);if(!c)return null;let u=c[0],d=u.replace(/(.)\/+$/,"$1"),m=c.slice(1);return{params:o.reduce((g,{paramName:v,isOptional:b},_)=>{if(v==="*"){let T=m[_]||"";d=u.slice(0,u.length-T.length).replace(/(.)\/+$/,"$1")}const S=m[_];return b&&!S?g[v]=void 0:g[v]=(S||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:d,pattern:n}}function GT(n,s=!1,i=!0){Ln(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let o=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,m,h,g,v)=>{if(o.push({paramName:m,isOptional:h!=null}),h){let b=v.charAt(g+d.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(o.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),o]}function fb(n){try{return n.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Ln(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),n}}function Os(n,s){if(s==="/")return n;if(!n.toLowerCase().startsWith(s.toLowerCase()))return null;let i=s.endsWith("/")?s.length-1:s.length,o=n.charAt(i);return o&&o!=="/"?null:n.slice(i)||"/"}var $T=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function FT(n,s="/"){let{pathname:i,search:o="",hash:c=""}=typeof n=="string"?ao(n):n,u;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?u=f0(i.substring(1),"/"):u=f0(i,s)):u=s,{pathname:u,search:YT(o),hash:JT(c)}}function f0(n,s){let i=s.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function tf(n,s,i,o){return`Cannot include a '${n}' character in a manually specified \`to.${s}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ZT(n){return n.filter((s,i)=>i===0||s.route.path&&s.route.path.length>0)}function fp(n){let s=ZT(n);return s.map((i,o)=>o===s.length-1?i.pathname:i.pathnameBase)}function Ac(n,s,i,o=!1){let c;typeof n=="string"?c=ao(n):(c={...n},dt(!c.pathname||!c.pathname.includes("?"),tf("?","pathname","search",c)),dt(!c.pathname||!c.pathname.includes("#"),tf("#","pathname","hash",c)),dt(!c.search||!c.search.includes("#"),tf("#","search","hash",c)));let u=n===""||c.pathname==="",d=u?"/":c.pathname,m;if(d==null)m=i;else{let b=s.length-1;if(!o&&d.startsWith("..")){let _=d.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}m=b>=0?s[b]:"/"}let h=FT(c,m),g=d&&d!=="/"&&d.endsWith("/"),v=(u||d===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(g||v)&&(h.pathname+="/"),h}var ss=n=>n.join("/").replace(/\/\/+/g,"/"),KT=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),YT=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,JT=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,WT=class{constructor(n,s,i,o=!1){this.status=n,this.statusText=s||"",this.internal=o,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function XT(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function QT(n){return n.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var pb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function mb(n,s){let i=n;if(typeof i!="string"||!$T.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let o=i,c=!1;if(pb)try{let u=new URL(window.location.href),d=i.startsWith("//")?new URL(u.protocol+i):new URL(i),m=Os(d.pathname,s);d.origin===u.origin&&m!=null?i=m+d.search+d.hash:c=!0}catch{Ln(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var hb=["POST","PUT","PATCH","DELETE"];new Set(hb);var ek=["GET",...hb];new Set(ek);var io=y.createContext(null);io.displayName="DataRouter";var Dc=y.createContext(null);Dc.displayName="DataRouterState";var tk=y.createContext(!1),gb=y.createContext({isTransitioning:!1});gb.displayName="ViewTransition";var nk=y.createContext(new Map);nk.displayName="Fetchers";var sk=y.createContext(null);sk.displayName="Await";var Sn=y.createContext(null);Sn.displayName="Navigation";var Cr=y.createContext(null);Cr.displayName="Location";var Un=y.createContext({outlet:null,matches:[],isDataRoute:!1});Un.displayName="Route";var pp=y.createContext(null);pp.displayName="RouteError";var vb="REACT_ROUTER_ERROR",ak="REDIRECT",ik="ROUTE_ERROR_RESPONSE";function ok(n){if(n.startsWith(`${vb}:${ak}:{`))try{let s=JSON.parse(n.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 rk(n){if(n.startsWith(`${vb}:${ik}:{`))try{let s=JSON.parse(n.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new WT(s.status,s.statusText,s.data)}catch{}}function lk(n,{relative:s}={}){dt(Xa(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:o}=y.useContext(Sn),{hash:c,pathname:u,search:d}=Er(n,{relative:s}),m=u;return i!=="/"&&(m=u==="/"?i:ss([i,u])),o.createHref({pathname:m,search:d,hash:c})}function Xa(){return y.useContext(Cr)!=null}function It(){return dt(Xa(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(Cr).location}function Dt(n){dt(Xa(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=It();return y.useMemo(()=>xr(n,fb(s)),[s,n])}var yb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function bb(n){y.useContext(Sn).static||y.useLayoutEffect(n)}function Rc(){let{isDataRoute:n}=y.useContext(Un);return n?Tk():ck()}function ck(){dt(Xa(),"useNavigate() may be used only in the context of a <Router> component.");let n=y.useContext(io),{basename:s,navigator:i}=y.useContext(Sn),{matches:o}=y.useContext(Un),{pathname:c}=It(),u=JSON.stringify(fp(o)),d=y.useRef(!1);return bb(()=>{d.current=!0}),y.useCallback((h,g={})=>{if(Ln(d.current,yb),!d.current)return;if(typeof h=="number"){i.go(h);return}let v=Ac(h,JSON.parse(u),c,g.relative==="path");n==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:ss([s,v.pathname])),(g.replace?i.replace:i.push)(v,g.state,g)},[s,i,u,c,n])}var uk=y.createContext(null);function dk(n){let s=y.useContext(Un).outlet;return y.useMemo(()=>s&&y.createElement(uk.Provider,{value:n},s),[s,n])}function va(){let{matches:n}=y.useContext(Un),s=n[n.length-1];return s?s.params:{}}function Er(n,{relative:s}={}){let{matches:i}=y.useContext(Un),{pathname:o}=It(),c=JSON.stringify(fp(i));return y.useMemo(()=>Ac(n,JSON.parse(c),o,s==="path"),[n,c,o,s])}function fk(n,s){return _b(n,s)}function _b(n,s,i){var j;dt(Xa(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=y.useContext(Sn),{matches:c}=y.useContext(Un),u=c[c.length-1],d=u?u.params:{},m=u?u.pathname:"/",h=u?u.pathnameBase:"/",g=u&&u.route;{let w=g&&g.path||"";Sb(m,!g||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (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.
|
|
36
|
+
|
|
37
|
+
Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let v=It(),b;if(s){let w=typeof s=="string"?ao(s):s;dt(h==="/"||((j=w.pathname)==null?void 0:j.startsWith(h)),`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 "${h}" but pathname "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=v;let _=b.pathname||"/",S=_;if(h!=="/"){let w=h.replace(/^\//,"").split("/");S="/"+_.replace(/^\//,"").split("/").slice(w.length).join("/")}let T=cb(n,{pathname:S});Ln(g||T!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Ln(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.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 N=vk(T&&T.map(w=>Object.assign({},w,{params:Object.assign({},d,w.params),pathname:ss([h,o.encodeLocation?o.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?h:ss([h,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),c,i);return s&&N?y.createElement(Cr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},N):N}function pk(){let n=Sk(),s=XT(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),i=n instanceof Error?n.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},u={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",n),d=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:u},"ErrorBoundary")," or"," ",y.createElement("code",{style:u},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},s),i?y.createElement("pre",{style:c},i):null,d)}var mk=y.createElement(pk,null),xb=class extends y.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){return s.location!==n.location||s.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:s.error,location:s.location,revalidation:n.revalidation||s.revalidation}}componentDidCatch(n,s){this.props.onError?this.props.onError(n,s):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const i=rk(n.digest);i&&(n=i)}let s=n!==void 0?y.createElement(Un.Provider,{value:this.props.routeContext},y.createElement(pp.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?y.createElement(hk,{error:n},s):s}};xb.contextType=tk;var nf=new WeakMap;function hk({children:n,error:s}){let{basename:i}=y.useContext(Sn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let o=ok(s.digest);if(o){let c=nf.get(s);if(c)throw c;let u=mb(o.location,i);if(pb&&!nf.get(s))if(u.isExternal||o.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:o.replace}));throw nf.set(s,d),d}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return n}function gk({routeContext:n,match:s,children:i}){let o=y.useContext(io);return o&&o.static&&o.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(Un.Provider,{value:n},i)}function vk(n,s=[],i){let o=i==null?void 0:i.state;if(n==null){if(!o)return null;if(o.errors)n=o.matches;else if(s.length===0&&!o.initialized&&o.matches.length>0)n=o.matches;else return null}let c=n,u=o==null?void 0:o.errors;if(u!=null){let v=c.findIndex(b=>b.route.id&&(u==null?void 0:u[b.route.id])!==void 0);dt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let d=!1,m=-1;if(i&&o){d=o.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(m=v),b.route.id){let{loaderData:_,errors:S}=o,T=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!S||S[b.route.id]===void 0);if(b.route.lazy||T){i.isStatic&&(d=!0),m>=0?c=c.slice(0,m+1):c=[c[0]];break}}}}let h=i==null?void 0:i.onError,g=o&&h?(v,b)=>{var _,S;h(v,{location:o.location,params:((S=(_=o.matches)==null?void 0:_[0])==null?void 0:S.params)??{},unstable_pattern:QT(o.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let S,T=!1,N=null,j=null;o&&(S=u&&b.route.id?u[b.route.id]:void 0,N=b.route.errorElement||mk,d&&(m<0&&_===0?(Sb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,j=null):m===_&&(T=!0,j=b.route.hydrateFallbackElement||null)));let w=s.concat(c.slice(0,_+1)),E=()=>{let A;return S?A=N:T?A=j:b.route.Component?A=y.createElement(b.route.Component,null):b.route.element?A=b.route.element:A=v,y.createElement(gk,{match:b,routeContext:{outlet:v,matches:w,isDataRoute:o!=null},children:A})};return o&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement(xb,{location:o.location,revalidation:o.revalidation,component:N,error:S,children:E(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:g}):E()},null)}function mp(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yk(n){let s=y.useContext(io);return dt(s,mp(n)),s}function bk(n){let s=y.useContext(Dc);return dt(s,mp(n)),s}function _k(n){let s=y.useContext(Un);return dt(s,mp(n)),s}function hp(n){let s=_k(n),i=s.matches[s.matches.length-1];return dt(i.route.id,`${n} can only be used on routes that contain a unique "id"`),i.route.id}function xk(){return hp("useRouteId")}function Sk(){var o;let n=y.useContext(pp),s=bk("useRouteError"),i=hp("useRouteError");return n!==void 0?n:(o=s.errors)==null?void 0:o[i]}function Tk(){let{router:n}=yk("useNavigate"),s=hp("useNavigate"),i=y.useRef(!1);return bb(()=>{i.current=!0}),y.useCallback(async(c,u={})=>{Ln(i.current,yb),i.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:s,...u}))},[n,s])}var p0={};function Sb(n,s,i){!s&&!p0[n]&&(p0[n]=!0,Ln(!1,i))}y.memo(kk);function kk({routes:n,future:s,state:i,isStatic:o,onError:c}){return _b(n,void 0,{state:i,isStatic:o,onError:c})}function Zn({to:n,replace:s,state:i,relative:o}){dt(Xa(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Sn);Ln(!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:u}=y.useContext(Un),{pathname:d}=It(),m=Rc(),h=Ac(n,fp(u),d,o==="path"),g=JSON.stringify(h);return y.useEffect(()=>{m(JSON.parse(g),{replace:s,state:i,relative:o})},[m,g,o,s,i]),null}function Qa(n){return dk(n.context)}function Ce(n){dt(!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 wk({basename:n="/",children:s=null,location:i,navigationType:o="POP",navigator:c,static:u=!1,unstable_useTransitions:d}){dt(!Xa(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let m=n.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:m,navigator:c,static:u,unstable_useTransitions:d,future:{}}),[m,c,u,d]);typeof i=="string"&&(i=ao(i));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:S="default",unstable_mask:T}=i,N=y.useMemo(()=>{let j=Os(g,m);return j==null?null:{location:{pathname:j,search:v,hash:b,state:_,key:S,unstable_mask:T},navigationType:o}},[m,g,v,b,_,S,o,T]);return Ln(N!=null,`<Router basename="${m}"> 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.`),N==null?null:y.createElement(Sn.Provider,{value:h},y.createElement(Cr.Provider,{children:s,value:N}))}function Nk({children:n,location:s}){return fk(Uf(n),s)}function Uf(n,s=[]){let i=[];return y.Children.forEach(n,(o,c)=>{if(!y.isValidElement(o))return;let u=[...s,c];if(o.type===y.Fragment){i.push.apply(i,Uf(o.props.children,u));return}dt(o.type===Ce,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),dt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={id:o.props.id||u.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(d.children=Uf(o.props.children,u)),i.push(d)}),i}var uc="get",dc="application/x-www-form-urlencoded";function Mc(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function jk(n){return Mc(n)&&n.tagName.toLowerCase()==="button"}function Ck(n){return Mc(n)&&n.tagName.toLowerCase()==="form"}function Ek(n){return Mc(n)&&n.tagName.toLowerCase()==="input"}function Ak(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Dk(n,s){return n.button===0&&(!s||s==="_self")&&!Ak(n)}function zf(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((s,i)=>{let o=n[i];return s.concat(Array.isArray(o)?o.map(c=>[i,c]):[[i,o]])},[]))}function Rk(n,s){let i=zf(n);return s&&s.forEach((o,c)=>{i.has(c)||s.getAll(c).forEach(u=>{i.append(c,u)})}),i}var Xl=null;function Mk(){if(Xl===null)try{new FormData(document.createElement("form"),0),Xl=!1}catch{Xl=!0}return Xl}var Ok=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function sf(n){return n!=null&&!Ok.has(n)?(Ln(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${dc}"`),null):n}function Ik(n,s){let i,o,c,u,d;if(Ck(n)){let m=n.getAttribute("action");o=m?Os(m,s):null,i=n.getAttribute("method")||uc,c=sf(n.getAttribute("enctype"))||dc,u=new FormData(n)}else if(jk(n)||Ek(n)&&(n.type==="submit"||n.type==="image")){let m=n.form;if(m==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=n.getAttribute("formaction")||m.getAttribute("action");if(o=h?Os(h,s):null,i=n.getAttribute("formmethod")||m.getAttribute("method")||uc,c=sf(n.getAttribute("formenctype"))||sf(m.getAttribute("enctype"))||dc,u=new FormData(m,n),!Mk()){let{name:g,type:v,value:b}=n;if(v==="image"){let _=g?`${g}.`:"";u.append(`${_}x`,"0"),u.append(`${_}y`,"0")}else g&&u.append(g,b)}}else{if(Mc(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=uc,o=null,c=dc,d=n}return u&&c==="text/plain"&&(d=u,u=void 0),{action:o,method:i.toLowerCase(),encType:c,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function gp(n,s){if(n===!1||n===null||typeof n>"u")throw new Error(s)}function Bk(n,s,i,o){let c=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return i?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:s&&Os(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function Lk(n,s){if(n.id in s)return s[n.id];try{let i=await import(n.module);return s[n.id]=i,i}catch(i){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Uk(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function zk(n,s,i){let o=await Promise.all(n.map(async c=>{let u=s.routes[c.route.id];if(u){let d=await Lk(u,i);return d.links?d.links():[]}return[]}));return Hk(o.flat(1).filter(Uk).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function m0(n,s,i,o,c,u){let d=(h,g)=>i[g]?h.route.id!==i[g].route.id:!0,m=(h,g)=>{var v;return i[g].pathname!==h.pathname||((v=i[g].route.path)==null?void 0:v.endsWith("*"))&&i[g].params["*"]!==h.params["*"]};return u==="assets"?s.filter((h,g)=>d(h,g)||m(h,g)):u==="data"?s.filter((h,g)=>{var b;let v=o.routes[h.route.id];if(!v||!v.hasLoader)return!1;if(d(h,g)||m(h,g))return!0;if(h.route.shouldRevalidate){let _=h.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((b=i[0])==null?void 0:b.params)||{},nextUrl:new URL(n,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function Pk(n,s,{includeHydrateFallback:i}={}){return Vk(n.map(o=>{let c=s.routes[o.route.id];if(!c)return[];let u=[c.module];return c.clientActionModule&&(u=u.concat(c.clientActionModule)),c.clientLoaderModule&&(u=u.concat(c.clientLoaderModule)),i&&c.hydrateFallbackModule&&(u=u.concat(c.hydrateFallbackModule)),c.imports&&(u=u.concat(c.imports)),u}).flat(1))}function Vk(n){return[...new Set(n)]}function qk(n){let s={},i=Object.keys(n).sort();for(let o of i)s[o]=n[o];return s}function Hk(n,s){let i=new Set;return new Set(s),n.reduce((o,c)=>{let u=JSON.stringify(qk(c));return i.has(u)||(i.add(u),o.push({key:u,link:c})),o},[])}function Tb(){let n=y.useContext(io);return gp(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function Gk(){let n=y.useContext(Dc);return gp(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var vp=y.createContext(void 0);vp.displayName="FrameworkContext";function kb(){let n=y.useContext(vp);return gp(n,"You must render this element inside a <HydratedRouter> element"),n}function $k(n,s){let i=y.useContext(vp),[o,c]=y.useState(!1),[u,d]=y.useState(!1),{onFocus:m,onBlur:h,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,_=y.useRef(null);y.useEffect(()=>{if(n==="render"&&d(!0),n==="viewport"){let N=w=>{w.forEach(E=>{d(E.isIntersecting)})},j=new IntersectionObserver(N,{threshold:.5});return _.current&&j.observe(_.current),()=>{j.disconnect()}}},[n]),y.useEffect(()=>{if(o){let N=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(N)}}},[o]);let S=()=>{c(!0)},T=()=>{c(!1),d(!1)};return i?n!=="intent"?[u,_,{}]:[u,_,{onFocus:ar(m,S),onBlur:ar(h,T),onMouseEnter:ar(g,S),onMouseLeave:ar(v,T),onTouchStart:ar(b,S)}]:[!1,_,{}]}function ar(n,s){return i=>{n&&n(i),i.defaultPrevented||s(i)}}function Fk({page:n,...s}){let{router:i}=Tb(),o=y.useMemo(()=>cb(i.routes,n,i.basename),[i.routes,n,i.basename]);return o?y.createElement(Kk,{page:n,matches:o,...s}):null}function Zk(n){let{manifest:s,routeModules:i}=kb(),[o,c]=y.useState([]);return y.useEffect(()=>{let u=!1;return zk(n,s,i).then(d=>{u||c(d)}),()=>{u=!0}},[n,s,i]),o}function Kk({page:n,matches:s,...i}){let o=It(),{future:c,manifest:u,routeModules:d}=kb(),{basename:m}=Tb(),{loaderData:h,matches:g}=Gk(),v=y.useMemo(()=>m0(n,s,g,u,o,"data"),[n,s,g,u,o]),b=y.useMemo(()=>m0(n,s,g,u,o,"assets"),[n,s,g,u,o]),_=y.useMemo(()=>{if(n===o.pathname+o.search+o.hash)return[];let N=new Set,j=!1;if(s.forEach(E=>{var O;let A=u.routes[E.route.id];!A||!A.hasLoader||(!v.some(C=>C.route.id===E.route.id)&&E.route.id in h&&((O=d[E.route.id])!=null&&O.shouldRevalidate)||A.hasClientLoader?j=!0:N.add(E.route.id))}),N.size===0)return[];let w=Bk(n,m,c.unstable_trailingSlashAwareDataRequests,"data");return j&&N.size>0&&w.searchParams.set("_routes",s.filter(E=>N.has(E.route.id)).map(E=>E.route.id).join(",")),[w.pathname+w.search]},[m,c.unstable_trailingSlashAwareDataRequests,h,o,u,v,s,n,d]),S=y.useMemo(()=>Pk(b,u),[b,u]),T=Zk(b);return y.createElement(y.Fragment,null,_.map(N=>y.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...i})),S.map(N=>y.createElement("link",{key:N,rel:"modulepreload",href:N,...i})),T.map(({key:N,link:j})=>y.createElement("link",{key:N,nonce:i.nonce,...j,crossOrigin:j.crossOrigin??i.crossOrigin})))}function Yk(...n){return s=>{n.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var Jk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Jk&&(window.__reactRouterVersion="7.13.2")}catch{}function Wk({basename:n,children:s,unstable_useTransitions:i,window:o}){let c=y.useRef();c.current==null&&(c.current=ET({window:o,v5Compat:!0}));let u=c.current,[d,m]=y.useState({action:u.action,location:u.location}),h=y.useCallback(g=>{i===!1?m(g):y.startTransition(()=>m(g))},[i]);return y.useLayoutEffect(()=>u.listen(h),[u,h]),y.createElement(wk,{basename:n,children:s,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:i})}var wb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yp=y.forwardRef(function({onClick:s,discover:i="render",prefetch:o="none",relative:c,reloadDocument:u,replace:d,unstable_mask:m,state:h,target:g,to:v,preventScrollReset:b,viewTransition:_,unstable_defaultShouldRevalidate:S,...T},N){let{basename:j,navigator:w,unstable_useTransitions:E}=y.useContext(Sn),A=typeof v=="string"&&wb.test(v),O=mb(v,j);v=O.to;let C=lk(v,{relative:c}),M=It(),G=null;if(m){let re=Ac(m,[],M.unstable_mask?M.unstable_mask.pathname:"/",!0);j!=="/"&&(re.pathname=re.pathname==="/"?j:ss([j,re.pathname])),G=w.createHref(re)}let[U,V,Z]=$k(o,T),ee=tw(v,{replace:d,unstable_mask:m,state:h,target:g,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:S,unstable_useTransitions:E});function ie(re){s&&s(re),re.defaultPrevented||ee(re)}let be=!(O.isExternal||u),K=y.createElement("a",{...T,...Z,href:(be?G:void 0)||O.absoluteURL||C,onClick:be?ie:s,ref:Yk(N,V),target:g,"data-discover":!A&&i==="render"?"true":void 0});return U&&!A?y.createElement(y.Fragment,null,K,y.createElement(Fk,{page:C})):K});yp.displayName="Link";var Xk=y.forwardRef(function({"aria-current":s="page",caseSensitive:i=!1,className:o="",end:c=!1,style:u,to:d,viewTransition:m,children:h,...g},v){let b=Er(d,{relative:g.relative}),_=It(),S=y.useContext(Dc),{navigator:T,basename:N}=y.useContext(Sn),j=S!=null&&ow(b)&&m===!0,w=T.encodeLocation?T.encodeLocation(b).pathname:b.pathname,E=_.pathname,A=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;i||(E=E.toLowerCase(),A=A?A.toLowerCase():null,w=w.toLowerCase()),A&&N&&(A=Os(A,N)||A);const O=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let C=E===w||!c&&E.startsWith(w)&&E.charAt(O)==="/",M=A!=null&&(A===w||!c&&A.startsWith(w)&&A.charAt(w.length)==="/"),G={isActive:C,isPending:M,isTransitioning:j},U=C?s:void 0,V;typeof o=="function"?V=o(G):V=[o,C?"active":null,M?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let Z=typeof u=="function"?u(G):u;return y.createElement(yp,{...g,"aria-current":U,className:V,ref:v,style:Z,to:d,viewTransition:m},typeof h=="function"?h(G):h)});Xk.displayName="NavLink";var Qk=y.forwardRef(({discover:n="render",fetcherKey:s,navigate:i,reloadDocument:o,replace:c,state:u,method:d=uc,action:m,onSubmit:h,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...S},T)=>{let{unstable_useTransitions:N}=y.useContext(Sn),j=aw(),w=iw(m,{relative:g}),E=d.toLowerCase()==="get"?"get":"post",A=typeof m=="string"&&wb.test(m),O=C=>{if(h&&h(C),C.defaultPrevented)return;C.preventDefault();let M=C.nativeEvent.submitter,G=(M==null?void 0:M.getAttribute("formmethod"))||d,U=()=>j(M||C.currentTarget,{fetcherKey:s,method:G,navigate:i,replace:c,state:u,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_});N&&i!==!1?y.startTransition(()=>U()):U()};return y.createElement("form",{ref:T,method:E,action:w,onSubmit:o?h:O,...S,"data-discover":!A&&n==="render"?"true":void 0})});Qk.displayName="Form";function ew(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Nb(n){let s=y.useContext(io);return dt(s,ew(n)),s}function tw(n,{target:s,replace:i,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:m,unstable_defaultShouldRevalidate:h,unstable_useTransitions:g}={}){let v=Rc(),b=It(),_=Er(n,{relative:d});return y.useCallback(S=>{if(Dk(S,s)){S.preventDefault();let T=i!==void 0?i:_r(b)===_r(_),N=()=>v(n,{replace:T,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:m,unstable_defaultShouldRevalidate:h});g?y.startTransition(()=>N()):N()}},[b,v,_,i,o,c,s,n,u,d,m,h,g])}function bp(n){Ln(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(zf(n)),i=y.useRef(!1),o=It(),c=y.useMemo(()=>Rk(o.search,i.current?null:s.current),[o.search]),u=Rc(),d=y.useCallback((m,h)=>{const g=zf(typeof m=="function"?m(new URLSearchParams(c)):m);i.current=!0,u("?"+g,h)},[u,c]);return[c,d]}var nw=0,sw=()=>`__${String(++nw)}__`;function aw(){let{router:n}=Nb("useSubmit"),{basename:s}=y.useContext(Sn),i=xk(),o=n.fetch,c=n.navigate;return y.useCallback(async(u,d={})=>{let{action:m,method:h,encType:g,formData:v,body:b}=Ik(u,s);if(d.navigate===!1){let _=d.fetcherKey||sw();await o(_,i,d.action||m,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:b,formMethod:d.method||h,formEncType:d.encType||g,flushSync:d.flushSync})}else await c(d.action||m,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:b,formMethod:d.method||h,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:i,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,s,i])}function iw(n,{relative:s}={}){let{basename:i}=y.useContext(Sn),o=y.useContext(Un);dt(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),u={...Er(n||".",{relative:s})},d=It();if(n==null){u.search=d.search;let m=new URLSearchParams(u.search),h=m.getAll("index");if(h.some(v=>v==="")){m.delete("index"),h.filter(b=>b).forEach(b=>m.append("index",b));let v=m.toString();u.search=v?`?${v}`:""}}return(!n||n===".")&&c.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(u.pathname=u.pathname==="/"?i:ss([i,u.pathname])),_r(u)}function ow(n,{relative:s}={}){let i=y.useContext(gb);dt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Nb("useViewTransitionState"),c=Er(n,{relative:s});if(!i.isTransitioning)return!1;let u=Os(i.currentLocation.pathname,o)||i.currentLocation.pathname,d=Os(i.nextLocation.pathname,o)||i.nextLocation.pathname;return xr(c.pathname,d)!=null||xr(c.pathname,u)!=null}function St(){const n=Rc();return y.useCallback((s,i)=>{typeof s=="number"?n(s):n(s,i)},[n])}function jb(n){return`/sessions/${encodeURIComponent(n)}`}function Wi(n,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(n)}`:`/workspaces/${encodeURIComponent(n)}`}function os(n,s,i,o){const c=encodeURIComponent(n);let u;return i&&o?u=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(i)}/tasks/${c}`:i?u=`/workspaces/${encodeURIComponent(i)}/tasks/${c}`:u=`/tasks/${c}`,s?`${u}/${s}`:u}function ei(n,s,i){const o=new URLSearchParams;n&&o.set("workspace",n),s&&o.set("parent",s);const c=o.toString();if(n&&i){const u=`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(n)}/tasks/new`;return s?`${u}?parent=${encodeURIComponent(s)}`:u}return c?`/tasks/new?${c}`:"/tasks/new"}function Cb(n){return`/sessions/new?${new URLSearchParams({env:n}).toString()}`}const Xi="/environments",rw="/environments/new";function Qi(n){return`/environments/${encodeURIComponent(n)}`}function lw(n){return`/environments/${encodeURIComponent(n)}/edit`}const Ji="/settings",cw="/settings/credentials",af="/settings/personas",uw="/settings/personas/new";function Eb(n){return`/settings/personas/${encodeURIComponent(n)}`}const dw="/settings/shortcuts",fw="/pair",pw="/chat",Ya="/",mw="/tasks",Ab="/workspaces/new",Db="/knowledge",hw=3e3;function gw(n){const[s,i]=y.useState(!1),o=y.useRef(n.onSessionEvent);o.current=n.onSessionEvent;const c=y.useRef(n.onDomainEvent);c.current=n.onDomainEvent;const u=y.useRef(n.onConnect);u.current=n.onConnect;const d=y.useRef(n.onDisconnect);return d.current=n.onDisconnect,y.useEffect(()=>{let m=!1,h;async function g(){var v,b;if(!m){try{const _=we.streamEvents({});i(!0),(v=u.current)==null||v.call(u);for await(const S of _){if(m)break;const T=S.event;if(T.case==="sessionEvent"){const N=T.value;o.current({sessionId:N.sessionId,type:N.type,timestamp:N.timestamp,content:N.content,raw:N.raw})}else if(T.case==="domainEvent"){const N=T.value;c.current({id:N.id,type:N.type,timestamp:N.timestamp,payloadJson:N.payloadJson})}}}catch(_){if(_ instanceof Ec&&_.code===uT.Unauthenticated){window.location.href=fw;return}}m||(i(!1),(b=d.current)==null||b.call(d),h=setTimeout(()=>{g().catch(()=>{})},hw))}}return g().catch(()=>{}),()=>{m=!0,clearTimeout(h),i(!1)}},[]),{connected:s}}function Rb(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Mb(n,s){return console.warn(`[ws] Malformed "${n}" message: ${s}`),!1}function vw(n){return Rb(n)&&typeof n.sessionId=="string"&&typeof n.eventType=="string"&&typeof n.timestamp=="string"&&typeof n.content=="string"&&(n.raw===void 0||typeof n.raw=="string")}const yw=new Set(["off","subscription","api_key"]),Ql=new Set(["off","on"]);function bw(n){return Rb(n)&&yw.has(n.claude)&&Ql.has(n.github)&&Ql.has(n.copilot)&&Ql.has(n.codex)&&Ql.has(n.goose)}function Ob(n){switch(n){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 n}}function Ib(n){switch(n){case"completed":return"completed";case"killed":return"killed";case"failed":return"interrupted";case"interrupted":return"interrupted";case"terminated":return"terminated";default:return}}const Vi=5e3;function _w(n){return{id:n.id,displayName:n.displayName,adapterType:n.adapterType,adapterConfig:n.adapterConfig||"{}",status:n.status,bootstrapped:n.bootstrapped}}function h0(n){return{id:n.id,environmentId:n.environmentId,runtime:n.runtime,status:n.status,prompt:n.prompt,startedAt:n.startedAt,endedAt:n.endedAt||void 0,error:n.error||void 0,endReason:n.endReason||void 0,personaId:n.personaId||void 0,inputTokens:n.inputTokens,outputTokens:n.outputTokens,costUsd:n.costUsd}}function xw(n){return{sessionId:n.sessionId,eventType:ob(n.type),timestamp:n.timestamp,content:n.content,raw:n.raw||void 0}}function Sw(n){return{id:n.id,name:n.name,description:n.description,repoUrl:n.repoUrl,environmentId:n.environmentId,status:dT(n.status),workingDirectory:n.workingDirectory,useWorktrees:n.useWorktrees,defaultPersonaId:n.defaultPersonaId,createdAt:n.createdAt,updatedAt:n.updatedAt}}function g0(n){return{id:n.id,workspaceId:n.workspaceId??void 0,title:n.title,description:n.description,status:fT(n.status),branch:n.branch,latestSessionId:n.latestSessionId,dependsOn:[...n.dependsOn],sortOrder:n.sortOrder,createdAt:n.createdAt,startedAt:n.startedAt||void 0,completedAt:n.completedAt||void 0,parentTaskId:n.parentTaskId,depth:n.depth,childTaskIds:[...n.childTaskIds],canDecompose:n.canDecompose,defaultPersonaId:n.defaultPersonaId,workpad:n.workpad}}function Tw(n){return{id:n.id,workspaceId:n.workspaceId,taskId:n.taskId,sessionId:n.sessionId,category:n.category,title:n.title,content:n.content,tags:[...n.tags],createdAt:n.createdAt}}function kw(n){return{name:n.name,tokenType:n.type,envVar:n.envVar,filePath:n.filePath,expiresAt:n.expiresAt}}function ww(n){return{claude:pT(n.claude),github:Wl(n.github),copilot:Wl(n.copilot),codex:Wl(n.codex),goose:Wl(n.goose)}}function Nw(n){return{name:n.name,repository:n.repository,state:n.state,gitStatus:n.gitStatus}}function of(n){return{id:n.id,name:n.name,description:n.description,systemPrompt:n.systemPrompt,toolConfig:n.toolConfig?JSON.stringify({allowedTools:[...n.toolConfig.allowedTools],disallowedTools:[...n.toolConfig.disallowedTools]}):"{}",runtime:n.runtime,model:n.model,maxTurns:n.maxTurns,mcpServers:JSON.stringify(n.mcpServers.map(s=>({name:s.name,command:s.command,args:[...s.args],tools:[...s.tools]}))),createdAt:n.createdAt,updatedAt:n.updatedAt,type:n.type||"agent",script:n.script,allowedMcpTools:[...n.allowedMcpTools]}}function jw(n){return{inputTokens:n.inputTokens,outputTokens:n.outputTokens,costUsd:n.costUsd,sessionCount:n.sessionCount}}function ec(n,s=0){return{id:n.id,label:n.title||n.label||n.id,kind:n.kind,category:n.category||void 0,sourceType:n.sourceType||void 0,sourceId:n.sourceId||void 0,content:n.content||void 0,tags:n.tags.length>0?[...n.tags]:void 0,workspaceId:n.workspaceId||void 0,createdAt:n.createdAt||void 0,updatedAt:n.updatedAt||void 0,val:s}}function rf(n){return{source:n.fromId,target:n.toId,type:n.type}}const v0=5e3;function Cw(){const[n,s]=y.useState([]),[i,o]=y.useState({}),c=y.useCallback(()=>{we.listEnvironments({}).then(_=>{s(_.environments.map(_w))},()=>{})},[]),u=y.useCallback(_=>{switch(_.type){case"environment.added":return!0;case"environment.removed":{const S=_.payload.environmentId;return S&&(s(T=>T.filter(N=>N.id!==S)),o(T=>{const N={...T};return delete N[S],N})),!0}case"environment.changed":return c(),!0;case"environment.provision_progress":{const S=_.payload;if(typeof S.environmentId!="string"||typeof S.stage!="string"||typeof S.message!="string"||typeof S.progress!="number")return Mb("environment.provision_progress","invalid payload"),!0;if(o(T=>({...T,[S.environmentId]:{stage:S.stage,message:S.message,progress:S.progress}})),S.stage==="ready"){const T=S.environmentId;setTimeout(()=>{o(N=>{const j={...N};return delete j[T],j})},v0)}return!0}default:return!1}},[c]),d=y.useCallback(_=>{var S;if(_.type==="environments"){const T=Array.isArray((S=_.payload)==null?void 0:S.environments)?_.payload.environments:[];return s(T),!0}return!1},[]),m=y.useCallback((_,S,T)=>{we.addEnvironment({displayName:_,adapterType:S,adapterConfig:JSON.stringify(T??{})}).catch(()=>{})},[]),h=y.useCallback((_,S)=>{we.updateEnvironment({id:_,displayName:S.displayName,adapterConfig:S.adapterConfig?JSON.stringify(S.adapterConfig):void 0}).catch(()=>{})},[]),g=y.useCallback((_,S)=>{(async()=>{try{const N=we.provisionEnvironment({id:_,force:S??!1});for await(const j of N)o(w=>({...w,[_]:{stage:j.stage,message:j.message,progress:j.progress}})),j.stage==="ready"&&setTimeout(()=>{o(w=>{const E={...w};return delete E[_],E})},v0)}catch{o(N=>{const j={...N};return delete j[_],j})}})().catch(()=>{})},[]),v=y.useCallback(_=>{we.stopEnvironment({id:_}).catch(()=>{})},[]),b=y.useCallback(_=>{we.removeEnvironment({id:_}).catch(()=>{})},[]);return{environments:n,provisionStatus:i,loadEnvironments:c,addEnvironment:m,updateEnvironment:h,provisionEnvironment:g,stopEnvironment:v,removeEnvironment:b,handleEvent:u,handleLegacyMessage:d}}const lf=new Set(["pending","running","idle"]),Ew=new Set(["completed","failed","interrupted","hibernating","suspended"]),y0=["pending","running","idle"];function Aw(){const[n,s]=y.useState([]),[i,o]=y.useState([]),[c,u]=y.useState(0),[d,m]=y.useState(void 0),[h,g]=y.useState({}),v=y.useCallback(()=>{we.listSessions({}).then(C=>{const M=C.sessions.map(h0);s(G=>{const U=new Map(G.map(V=>[V.id,V]));return M.map(V=>{const Z=U.get(V.id),ee=Z==null?void 0:Z.status;return!ee||ee===V.status?V:Ew.has(ee)&&lf.has(V.status)?{...V,status:ee,...Z.endReason!==void 0?{endReason:Z.endReason}:{}}:lf.has(ee)&&lf.has(V.status)&&y0.indexOf(ee)>y0.indexOf(V.status)?{...V,status:ee}:V})})},()=>{})},[]),b=y.useCallback(C=>{if(C.type!=="session_event")return!1;if(!vw(C.payload))return Mb("session_event","payload is not a valid SessionEvent"),!0;const M=C.payload;let G=0;if(o(U=>{const V=[...U,M];return V.length>Vi?(G=V.length-Vi,V.slice(-Vi)):V}),G>0&&u(U=>U+G),M.eventType==="usage")try{const U=JSON.parse(M.content),V=Number(U.input_tokens)||0,Z=Number(U.output_tokens)||0,ee=Number(U.cost_usd)||0;(V>0||Z>0||ee>0)&&s(ie=>ie.map(be=>be.id===M.sessionId?{...be,inputTokens:(be.inputTokens??0)+V,outputTokens:(be.outputTokens??0)+Z,costUsd:(be.costUsd??0)+ee}:be))}catch{}if(M.eventType==="status"){const U=Ob(M.content),V=Ib(M.content);s(Z=>Z.some(ie=>ie.id===M.sessionId)?Z.map(ie=>ie.id===M.sessionId?{...ie,status:U,...V!==void 0?{endReason:V}:{}}:ie):[...Z,{id:M.sessionId,environmentId:"",runtime:"",status:U,prompt:"",startedAt:M.timestamp,...V!==void 0?{endReason:V}:{}}])}return!0},[]),_=y.useCallback(C=>{b({type:"session_event",payload:C})},[b]),S=y.useCallback(C=>{var M,G,U,V,Z;switch(C.type){case"sessions":{const ee=Array.isArray((M=C.payload)==null?void 0:M.sessions)?C.payload.sessions:[];return s(ee),!0}case"spawned":{const ee=(G=C.payload)==null?void 0:G.sessionId;return typeof ee=="string"&&ee&&m(ee),v(),!0}case"session_events":{const ee=Array.isArray((U=C.payload)==null?void 0:U.events)?C.payload.events:[];return ee.length>0&&o(ee),!0}case"task_sessions":{const ee=(V=C.payload)==null?void 0:V.taskId;if(typeof ee=="string"&&ee){const ie=Array.isArray((Z=C.payload)==null?void 0:Z.sessions)?C.payload.sessions:[];g(be=>({...be,[ee]:ie}))}return!0}default:return!1}},[v]),T=y.useCallback((C,M,G,U)=>{we.spawnAgent({environmentId:C,prompt:M,personaId:G||"",workingDirectory:U||""}).then(V=>{m(V.id),v()},()=>{})},[v]),N=y.useCallback((C,M)=>{we.sendInput({sessionId:C,text:M}).catch(()=>{})},[]),j=y.useCallback(C=>{we.killAgent({id:C,graceful:!1}).catch(()=>{})},[]),w=y.useCallback(C=>{we.killAgent({id:C,graceful:!0}).catch(()=>{})},[]),E=y.useCallback(C=>{we.getSessionEvents({id:C}).then(M=>{const G=M.events.map(xw);if(G.length>0){let U=0;o(V=>{const Z=new Set;for(const be of V)be.sessionId===C&&Z.add(`${be.timestamp}|${be.eventType}`);const ee=G.filter(be=>!Z.has(`${be.timestamp}|${be.eventType}`)),ie=[...V,...ee].sort((be,K)=>be.sessionId!==K.sessionId?0:be.timestamp.localeCompare(K.timestamp));return ie.length>Vi?(U=ie.length-Vi,ie.slice(-Vi)):ie}),U>0&&u(V=>V+U)}},()=>{})},[]),A=y.useCallback(()=>{o([]),u(0)},[]),O=y.useCallback(C=>{we.getTaskSessions({id:C}).then(M=>{const G=M.sessions.map(h0);g(U=>({...U,[C]:G}))},()=>{})},[]);return{sessions:n,events:i,eventsDropped:c,lastSpawnedId:d,taskSessions:h,loadSessions:v,spawn:T,sendInput:N,kill:j,stopGraceful:w,loadSessionEvents:E,clearEvents:A,loadTaskSessions:O,handleMessage:b,handleSessionEvent:_,handleLegacyMessage:S}}function Dw(){const[n,s]=y.useState([]),[i,o]=y.useState(!1),c=y.useCallback(()=>{we.listWorkspaces({}).then(v=>{s(v.workspaces.map(Sw))},()=>{})},[]),u=y.useCallback(v=>{switch(v.type){case"workspace.created":return o(!1),c(),!0;case"workspace.archived":case"workspace.updated":return c(),!0;default:return!1}},[c]),d=y.useCallback(()=>{o(!1)},[]),m=y.useCallback((v,b,_,S,T,N,j,w,E)=>{o(!0),we.createWorkspace({name:v,description:b||"",repoUrl:_||"",environmentId:S||"",defaultPersonaId:T||void 0,useWorktrees:N??!0,workingDirectory:j||void 0}).then(()=>{o(!1),w==null||w()},A=>{o(!1);const O=A instanceof Ec?A.message:"Failed to create workspace";E==null||E(O)})},[]),h=y.useCallback(v=>{we.archiveWorkspace({id:v}).catch(()=>{})},[]),g=y.useCallback((v,b)=>{we.updateWorkspace({id:v,...b}).catch(()=>{})},[]);return{workspaces:n,workspaceCreating:i,loadWorkspaces:c,createWorkspace:m,archiveWorkspace:h,updateWorkspace:g,handleEvent:u,onDisconnect:d}}function Rw(){const[n,s]=y.useState([]),[i,o]=y.useState(void 0),c=y.useRef({}),u=y.useCallback(E=>{we.listTasks({workspaceId:E}).then(A=>{const O=A.tasks.map(g0);s(C=>[...C.filter(M=>M.workspaceId!==E),...O])},()=>{})},[]),d=y.useCallback(()=>{we.listTasks({}).then(E=>{const A=E.tasks.map(g0);s(O=>{const C=new Set(A.map(M=>M.id));return[...O.filter(M=>!C.has(M.id)),...A]})},()=>{})},[]),m=y.useCallback((E,A)=>{const O=C=>{clearTimeout(c.current[C]),c.current[C]=setTimeout(()=>{delete c.current[C],u(C)},200)};E?O(E):A&&s(C=>{const M=C.find(G=>G.id===A);return M!=null&&M.workspaceId?O(M.workspaceId):d(),C})},[u,d]),h=y.useCallback(E=>{const A=E.payload;switch(E.type){case"task.created":{const O=typeof A.workspaceId=="string"?A.workspaceId:"";return O&&u(O),!0}case"task.started":{const O=typeof A.taskId=="string"?A.taskId:"",C=typeof A.sessionId=="string"?A.sessionId:"",M=typeof A.workspaceId=="string"?A.workspaceId:"";return o(G=>O&&G===O?void 0:G),C&&O&&s(G=>G.map(U=>U.id===O?{...U,latestSessionId:C}:U)),m(M,O),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const O=typeof A.workspaceId=="string"?A.workspaceId:"",C=typeof A.taskId=="string"?A.taskId:"";return m(O,C),!0}default:return!1}},[u,m]),g=y.useCallback(()=>{o(void 0)},[]),v=y.useCallback(E=>{var A,O;if(E.type==="tasks"){const C=Array.isArray((A=E.payload)==null?void 0:A.tasks)?E.payload.tasks:[],M=typeof((O=E.payload)==null?void 0:O.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s(M?G=>[...G.filter(U=>U.workspaceId!==M),...C]:G=>{const U=new Set(C.map(V=>V.id));return[...G.filter(V=>!U.has(V.id)),...C]}),!0}return!1},[]),b=y.useCallback((E,A,O,C,M,G,U,V,Z)=>{we.createTask({workspaceId:E,title:A,description:O||"",dependsOn:C||[],parentTaskId:M||"",defaultPersonaId:G||void 0,canDecompose:U??void 0}).then(()=>{V==null||V()},ee=>{const ie=ee instanceof Ec?ee.message:"Failed to create task";Z==null||Z(ie)})},[]),_=y.useCallback((E,A,O,C)=>{o(E),we.startTask({taskId:E,personaId:A||"",environmentId:O||"",notes:C||""}).catch(()=>{o(void 0)})},[]),S=y.useCallback(E=>{we.stopTask({id:E}).catch(()=>{})},[]),T=y.useCallback(E=>{we.completeTask({id:E}).catch(()=>{})},[]),N=y.useCallback(E=>{we.resumeTask({id:E}).catch(()=>{})},[]),j=y.useCallback((E,A,O,C,M)=>{we.updateTask({id:E,title:A,description:O,dependsOn:C,...M!==void 0?{defaultPersonaId:M}:{}}).catch(()=>{})},[]),w=y.useCallback(E=>{we.deleteTask({id:E}).catch(()=>{})},[]);return{tasks:n,taskStartingId:i,loadTasks:u,loadAllTasks:d,createTask:b,startTask:_,stopTask:S,completeTask:T,resumeTask:N,updateTask:j,deleteTask:w,handleEvent:h,onDisconnect:g,handleLegacyMessage:v}}function Mw(){const[n,s]=y.useState([]),i=y.useCallback(u=>{we.queryFindings({workspaceId:u}).then(d=>{s(d.findings.map(Tw))},()=>{})},[]),o=y.useCallback(u=>{if(u.type==="finding.posted"){const d=typeof u.payload.workspaceId=="string"?u.payload.workspaceId:"";return d&&i(d),!0}return!1},[i]),c=y.useCallback((u,d,m,h,g)=>{we.postFinding({workspaceId:u,title:d,content:m,category:h??"general",tags:g??[]}).catch(()=>{})},[]);return{findings:n,loadFindings:i,postFinding:c,handleEvent:o}}function Ow(){const[n,s]=y.useState([]),i=y.useCallback(()=>{we.listTokens({}).then(d=>{s(d.tokens.map(kw))},()=>{})},[]),o=y.useCallback(d=>d.type==="token.changed"?(i(),!0):!1,[i]),c=y.useCallback((d,m,h,g,v)=>{we.setToken({name:d,value:m,type:h,envVar:g,filePath:v}).catch(()=>{})},[]),u=y.useCallback(d=>{we.deleteToken({name:d}).catch(()=>{})},[]);return{tokens:n,loadTokens:i,setToken:c,deleteToken:u,handleEvent:o}}function Iw(){const[n,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),i=y.useCallback(()=>{we.getCredentialProviders({}).then(u=>{s(ww(u))},()=>{})},[]),o=y.useCallback(u=>u.type==="credential.providers_changed"?(bw(u.payload)&&s(u.payload),!0):!1,[]),c=y.useCallback(u=>{const d=[{provider:"claude",value:u.claude},{provider:"github",value:u.github},{provider:"copilot",value:u.copilot},{provider:"codex",value:u.codex},{provider:"goose",value:u.goose}];for(const{provider:m,value:h}of d)we.setCredentialProvider({provider:m,value:h}).catch(()=>{})},[]);return{credentialProviders:n,loadCredentials:i,updateCredentialProviders:c,handleEvent:o}}function Bw(){const[n,s]=y.useState([]),[i,o]=y.useState(""),[c,u]=y.useState(""),[d,m]=y.useState(!1),h=y.useCallback(()=>{we.listCodespaces({}).then(v=>{s(v.codespaces.map(Nw)),u(v.error)},()=>{})},[]),g=y.useCallback((v,b)=>{m(!0),o(""),we.createCodespace({repo:v,machine:b??""}).then(()=>{m(!1),h()},_=>{m(!1);const S=_ instanceof Ec?_.message:"Failed to create codespace";o(S)})},[h]);return{codespaces:n,codespaceError:i,codespaceListError:c,codespaceCreating:d,listCodespaces:h,createCodespace:g}}function Lw(){const[n,s]=y.useState([]),i=y.useCallback(()=>{we.listPersonas({}).then(m=>{s(m.personas.map(of))},()=>{})},[]),o=y.useCallback(m=>{switch(m.type){case"persona.created":case"persona.updated":case"persona.deleted":return i(),!0;default:return!1}},[i]),c=y.useCallback((m,h,g,v,b,_,S,T,N)=>we.createPersona({name:m,description:h,systemPrompt:g,runtime:v||"",model:b||"",maxTurns:_||0,type:S||"agent",script:T||"",allowedMcpTools:N||[]}).then(j=>{const w=of(j);return s(E=>[...E.filter(A=>A.id!==w.id),w]),w}),[]),u=y.useCallback((m,h,g,v,b,_,S,T,N,j)=>{const w={id:m};return h!==void 0&&(w.name=h),g!==void 0&&(w.description=g),v!==void 0&&(w.systemPrompt=v),b!==void 0&&(w.runtime=b),_!==void 0&&(w.model=_),S!==void 0&&(w.maxTurns=S),T!==void 0&&(w.type=T),N!==void 0&&(w.script=N),j!==void 0&&(w.allowedMcpTools=j),we.updatePersona(w).then(E=>{const A=of(E);return s(O=>O.map(C=>C.id===A.id?A:C)),A})},[]),d=y.useCallback(async m=>{await we.deletePersona({id:m}),s(h=>h.filter(g=>g.id!==m))},[]);return{personas:n,loadPersonas:i,createPersona:c,updatePersona:u,deletePersona:d,handleEvent:o}}function Uw(n){if(n)try{return JSON.parse(n)}catch{return}}function zw(){const[n,s]=y.useState(new Map),[i,o]=y.useState([]),[c,u]=y.useState(void 0),[d,m]=y.useState(void 0),[h,g]=y.useState(!1),[v,b]=y.useState(""),_=y.useRef(""),S=y.useCallback(O=>{const C=O??"";_.current=C,b(""),g(!0),we.listRecentKnowledgeNodes({limit:30,workspaceId:C}).then(M=>{const G=new Map,U=[];for(const V of M.nodes)G.set(V.id,ec(V));for(const V of M.edges)U.push(rf(V));for(const V of U){const Z=G.get(V.source);Z&&(Z.val+=1);const ee=G.get(V.target);ee&&(ee.val+=1)}s(G),o(U),g(!1)},()=>{g(!1)})},[]),T=y.useCallback(O=>{O.trim()&&(b(O),m(void 0),u(void 0),g(!0),we.searchKnowledge({query:O,limit:20,workspaceId:_.current}).then(C=>{const M=new Map,G=[];for(const U of C.results){U.node&&M.set(U.node.id,ec(U.node,U.edges.length));for(const V of U.edges)G.push(rf(V))}s(M),o(G),g(!1)},()=>{g(!1)}))},[]),N=y.useCallback(()=>{S(_.current)},[S]),j=y.useCallback(O=>{m(O),we.getKnowledgeNode({id:O}).then(C=>{if(!C.node){u(void 0);return}u({node:ec(C.node,C.edges.length),edges:C.edges.map(M=>({fromId:M.fromId,toId:M.toId,type:M.type,metadata:Uw(M.metadataJson)}))})},()=>{u(void 0)})},[]),w=y.useCallback(()=>{m(void 0),u(void 0)},[]),E=y.useCallback(O=>{we.expandKnowledgeNode({id:O,depth:1}).then(C=>{s(M=>{const G=new Map(M);for(const U of C.nodes)G.has(U.id)||G.set(U.id,ec(U));return G}),o(M=>{const G=new Set(M.map(V=>`${V.source}:${V.target}:${V.type}`)),U=[];for(const V of C.edges){const Z=rf(V),ee=`${Z.source}:${Z.target}:${Z.type}`;G.has(ee)||U.push(Z)}return[...M,...U]})},()=>{})},[]),A=y.useCallback(O=>!1,[]);return{graphData:{nodes:[...n.values()],links:i},selectedNode:c,selectedId:d,loading:h,searchQuery:v,search:T,clearSearch:N,selectNode:j,clearSelection:w,expandNode:E,loadRecent:S,handleEvent:A}}function Pw(){const[n,s]=y.useState(""),[i,o]=y.useState(void 0),[c,u]=y.useState({}),d=Cw(),m=Aw(),h=Dw(),g=Rw(),v=Mw(),b=Ow(),_=Iw(),S=Bw(),T=Lw(),N=zw(),{connected:j}=gw({onSessionEvent:Z=>{m.handleSessionEvent({sessionId:Z.sessionId,eventType:ob(Z.type),timestamp:Z.timestamp,content:Z.content,raw:Z.raw||void 0})},onDomainEvent:Z=>{try{const ee=JSON.parse(Z.payloadJson);M({id:Z.id,type:Z.type,timestamp:Z.timestamp,payload:ee})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",Z.payloadJson)}},onConnect:G,onDisconnect:U}),w="default_persona_id",E="onboarding_completed",A=y.useCallback(async Z=>{const ee=await we.setSetting({key:w,value:Z});s(ee.value)},[]),O=y.useCallback(()=>{o(!0),we.setSetting({key:E,value:"true"}).catch(()=>{})},[]),C=y.useCallback((Z,ee)=>{we.getUsage({scope:Z,id:ee}).then(ie=>{const be=`${Z}:${ee}`;u(K=>({...K,[be]:jw(ie)}))},()=>{})},[]);function M(Z){const ee=Z.payload.key,ie=Z.payload.value;if(Z.type==="setting.changed"){ee===w&&s(ie??""),ee===E&&o(ie==="true");return}if(d.handleEvent(Z)){(Z.type==="environment.removed"||Z.type==="environment.changed")&&m.loadSessions();return}if(!h.handleEvent(Z)){if(g.handleEvent(Z)){Z.type==="task.started"&&m.loadSessions();return}v.handleEvent(Z)||b.handleEvent(Z)||_.handleEvent(Z)||T.handleEvent(Z)||N.handleEvent(Z)}}function G(){d.loadEnvironments(),m.loadSessions(),h.loadWorkspaces(),b.loadTokens(),_.loadCredentials(),T.loadPersonas(),we.getSetting({key:w}).then(Z=>{s(Z.value)},()=>{}),we.getSetting({key:E}).then(Z=>{o(Z.value==="true")},()=>{}),g.loadAllTasks()}function U(){h.onDisconnect(),g.onDisconnect()}const V=y.useCallback(()=>{d.loadEnvironments(),m.loadSessions(),h.loadWorkspaces(),b.loadTokens()},[d.loadEnvironments,m.loadSessions,h.loadWorkspaces,b.loadTokens]);return{connected:j,environments:d.environments,sessions:m.sessions,events:m.events,eventsDropped:m.eventsDropped,lastSpawnedId:m.lastSpawnedId,workspaces:h.workspaces,tasks:g.tasks,findings:v.findings,tokens:b.tokens,spawn:m.spawn,sendInput:m.sendInput,kill:m.kill,stopGraceful:m.stopGraceful,refresh:V,loadSessionEvents:m.loadSessionEvents,clearEvents:m.clearEvents,loadWorkspaces:h.loadWorkspaces,createWorkspace:h.createWorkspace,archiveWorkspace:h.archiveWorkspace,updateWorkspace:h.updateWorkspace,loadTasks:g.loadTasks,loadAllTasks:g.loadAllTasks,createTask:g.createTask,startTask:g.startTask,stopTask:g.stopTask,completeTask:g.completeTask,resumeTask:g.resumeTask,updateTask:g.updateTask,deleteTask:g.deleteTask,loadFindings:v.loadFindings,postFinding:v.postFinding,loadEnvironments:d.loadEnvironments,addEnvironment:d.addEnvironment,updateEnvironment:d.updateEnvironment,loadTokens:b.loadTokens,setToken:b.setToken,deleteToken:b.deleteToken,credentialProviders:_.credentialProviders,updateCredentialProviders:_.updateCredentialProviders,provisionStatus:d.provisionStatus,provisionEnvironment:d.provisionEnvironment,stopEnvironment:d.stopEnvironment,removeEnvironment:d.removeEnvironment,codespaces:S.codespaces,codespaceError:S.codespaceError,codespaceListError:S.codespaceListError,codespaceCreating:S.codespaceCreating,listCodespaces:S.listCodespaces,createCodespace:S.createCodespace,workspaceCreating:h.workspaceCreating,taskStartingId:g.taskStartingId,personas:T.personas,createPersona:T.createPersona,updatePersona:T.updatePersona,deletePersona:T.deletePersona,taskSessions:m.taskSessions,loadTaskSessions:m.loadTaskSessions,appDefaultPersonaId:n,setAppDefaultPersonaId:A,onboardingCompleted:i,completeOnboarding:O,usageCache:c,loadUsage:C,knowledge:N}}const _p=y.createContext(void 0);function Vw({children:n}){const s=Pw();return l.jsx(_p.Provider,{value:s,children:n})}function pt(){const n=y.useContext(_p);if(!n)throw new Error("useGrackle must be used within GrackleProvider");return n}const ns=[{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
|
|
38
|
+
export function verifyToken(req: Request, res: Response, next: NextFunction): void {
|
|
39
|
+
const header = req.headers.authorization;
|
|
40
|
+
if (!header?.startsWith("Bearer ")) {
|
|
41
|
+
res.status(401).json({ error: "Missing token" });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
|
|
45
|
+
req.user = decoded;
|
|
46
|
+
next();
|
|
47
|
+
}
|
|
48
|
+
\`\`\``,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
|
|
49
|
+
CREATE TABLE audit_log (
|
|
50
|
+
id BIGSERIAL PRIMARY KEY,
|
|
51
|
+
user_id UUID REFERENCES users(id),
|
|
52
|
+
action TEXT NOT NULL,
|
|
53
|
+
entity_type TEXT NOT NULL,
|
|
54
|
+
entity_id TEXT NOT NULL,
|
|
55
|
+
old_value JSONB,
|
|
56
|
+
new_value JSONB,
|
|
57
|
+
ip_address INET,
|
|
58
|
+
created_at TIMESTAMPTZ DEFAULT now()
|
|
59
|
+
);
|
|
60
|
+
\`\`\``,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}],ca=[{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"}],qw=new Map(ns.map(n=>[n.id,n]));function cf(n){const s=qw.get(n);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${n}"`);return s}const b0={"kn-auth-flow":{node:cf("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:cf("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:cf("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"}]}},Hw=[{id:"env-local-01",displayName:"Local Dev",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0},{id:"env-docker-01",displayName:"Docker Sandbox",adapterType:"docker",adapterConfig:'{"image":"node:20"}',status:"connected",bootstrapped:!0},{id:"env-cs-01",displayName:"GitHub Codespace",adapterType:"codespace",adapterConfig:'{"codespaceName":"my-codespace"}',status:"connected",bootstrapped:!0},{id:"env-remote-01",displayName:"Staging (SSH)",adapterType:"ssh",adapterConfig:'{"host":"192.168.1.10","user":"deploy","sshPort":22}',status:"disconnected",bootstrapped:!1}],Gw=[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z",endedAt:"2026-02-26T15:12:00Z",error:"Context window exceeded before completing implementation",inputTokens:84200,outputTokens:12750,costUsd:.41},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Refactor the authentication middleware to use JWT tokens",startedAt:"2026-02-27T08:15:00Z",inputTokens:42600,outputTokens:8100,costUsd:.22},{id:"sess-002",environmentId:"env-docker-01",runtime:"copilot",status:"stopped",endReason:"completed",prompt:"Write unit tests for the user registration endpoint",startedAt:"2026-02-27T07:30:00Z",endedAt:"2026-02-27T07:33:00Z",inputTokens:31400,outputTokens:9800,costUsd:.18},{id:"sess-003",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Migrate database schema to add audit_log table",startedAt:"2026-02-26T22:45:00Z",endedAt:"2026-02-26T23:10:00Z",inputTokens:56300,outputTokens:14200,costUsd:.31},{id:"sess-004",environmentId:"env-docker-01",runtime:"codex",status:"running",prompt:"Implement rate limiting for the public API",startedAt:"2026-02-27T09:00:00Z",inputTokens:18900,outputTokens:4500,costUsd:.1},{id:"sess-005",environmentId:"env-cs-01",runtime:"claude-code",status:"suspended",prompt:"Refactor database connection pooling for multi-tenant isolation",startedAt:"2026-02-27T06:00:00Z",inputTokens:67800,outputTokens:19300,costUsd:.38}],$w=[{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.
|
|
61
|
+
Project: acme/alpha — Node.js + Express REST API
|
|
62
|
+
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";
|
|
63
|
+
import type { Request, Response, NextFunction } from "express";
|
|
64
|
+
|
|
65
|
+
export function requireAuth(req: Request, res: Response, next: NextFunction): void {
|
|
66
|
+
if (!req.session?.userId) {
|
|
67
|
+
res.status(401).json({ error: "Not authenticated" });
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
next();
|
|
71
|
+
}`,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) {
|
|
72
|
+
src/routes/login.ts:18: req.session.userId = user.id;
|
|
73
|
+
src/routes/login.ts:19: req.session.role = user.role;
|
|
74
|
+
src/routes/protected.ts:7: const userId = req.session.userId;`,raw:JSON.stringify({tool_use_id:"tu-prev-002"})},{sessionId:"sess-001-prev",eventType:"usage",timestamp:"2026-02-26T14:30:00Z",content:JSON.stringify({input_tokens:42100,output_tokens:6350,cost_usd:.21})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:30:02Z",content:"Found 3 files using session-based auth. Now let me read the login route and the protected route to understand the full flow before making changes."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:30:03Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/login.ts"}}),raw:JSON.stringify({id:"tu-prev-003",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:30:04Z",content:`import { Router } from "express";
|
|
75
|
+
import bcrypt from "bcrypt";
|
|
76
|
+
import { db } from "../db.js";
|
|
77
|
+
|
|
78
|
+
const router = Router();
|
|
79
|
+
|
|
80
|
+
router.post("/login", async (req, res) => {
|
|
81
|
+
const { email, password } = req.body;
|
|
82
|
+
const user = await db.users.findByEmail(email);
|
|
83
|
+
if (!user || !await bcrypt.compare(password, user.passwordHash)) {
|
|
84
|
+
return res.status(401).json({ error: "Invalid credentials" });
|
|
85
|
+
}
|
|
86
|
+
req.session.userId = user.id;
|
|
87
|
+
req.session.role = user.role;
|
|
88
|
+
res.json({ ok: true });
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
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.
|
|
92
|
+
Project: acme/alpha — Node.js + Express REST API
|
|
93
|
+
Task: Implement auth middleware using JWT tokens
|
|
94
|
+
|
|
95
|
+
Note: A previous session attempted this task but was interrupted. Pick up where it left off.`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:04Z",content:"I'll pick up the JWT auth migration. The previous session identified 3 files that need updating. Let me verify the current state and start implementing."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:04.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Install jsonwebtoken package",activeForm:"Installing jsonwebtoken",status:"pending"},{content:"Rewrite auth middleware for JWT",activeForm:"Rewriting auth middleware",status:"pending"},{content:"Update login route to issue tokens",activeForm:"Updating login route",status:"pending"},{content:"Update protected routes",activeForm:"Updating protected routes",status:"pending"},{content:"Fix and update tests",activeForm:"Fixing tests",status:"pending"},{content:"Run full test suite",activeForm:"Running tests",status:"pending"}]}})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:05Z",content:JSON.stringify({tool:"Grep",args:{pattern:"express-session|req\\.session",path:"src/",output_mode:"files_with_matches"}}),raw:JSON.stringify({id:"tu-001-01",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:06Z",content:`src/middleware/auth.ts
|
|
96
|
+
src/routes/login.ts
|
|
97
|
+
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
|
|
98
|
+
|
|
99
|
+
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";
|
|
100
|
+
import type { Request, Response, NextFunction } from "express";
|
|
101
|
+
|
|
102
|
+
const JWT_SECRET = process.env.JWT_SECRET || "change-me";
|
|
103
|
+
|
|
104
|
+
export interface JwtPayload {
|
|
105
|
+
userId: string;
|
|
106
|
+
role: string;
|
|
107
|
+
iat: number;
|
|
108
|
+
exp: number;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function verifyToken(req: Request, res: Response, next: NextFunction): void {
|
|
112
|
+
const header = req.headers.authorization;
|
|
113
|
+
if (!header?.startsWith("Bearer ")) {
|
|
114
|
+
res.status(401).json({ error: "Missing or malformed token" });
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
|
|
119
|
+
req.user = decoded;
|
|
120
|
+
next();
|
|
121
|
+
} catch (err) {
|
|
122
|
+
if (err instanceof jwt.TokenExpiredError) {
|
|
123
|
+
res.status(401).json({ error: "Token expired" });
|
|
124
|
+
} else {
|
|
125
|
+
res.status(403).json({ error: "Invalid token" });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
`}}),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.
|
|
130
|
+
|
|
131
|
+
The new login flow will:
|
|
132
|
+
1. Validate credentials (unchanged)
|
|
133
|
+
2. Generate a JWT with \`userId\` and \`role\` claims
|
|
134
|
+
3. Return the token in the response body
|
|
135
|
+
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";
|
|
136
|
+
import bcrypt from "bcrypt";
|
|
137
|
+
import jwt from "jsonwebtoken";
|
|
138
|
+
import crypto from "node:crypto";
|
|
139
|
+
import { db } from "../db.js";
|
|
140
|
+
|
|
141
|
+
const JWT_SECRET = process.env.JWT_SECRET || "change-me";
|
|
142
|
+
const ACCESS_TOKEN_EXPIRY = "24h";
|
|
143
|
+
const REFRESH_TOKEN_BYTES = 48;
|
|
144
|
+
|
|
145
|
+
const router = Router();
|
|
146
|
+
|
|
147
|
+
router.post("/login", async (req, res) => {
|
|
148
|
+
const { email, password } = req.body;
|
|
149
|
+
const user = await db.users.findByEmail(email);
|
|
150
|
+
if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
|
|
151
|
+
return res.status(401).json({ error: "Invalid credentials" });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const accessToken = jwt.sign(
|
|
155
|
+
{ userId: user.id, role: user.role },
|
|
156
|
+
JWT_SECRET,
|
|
157
|
+
{ expiresIn: ACCESS_TOKEN_EXPIRY },
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
|
|
161
|
+
await db.refreshTokens.create({ userId: user.id, token: refreshToken });
|
|
162
|
+
|
|
163
|
+
res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
export default router;
|
|
167
|
+
`}}),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
|
|
168
|
+
PASS src/routes/__tests__/protected.test.ts
|
|
169
|
+
FAIL src/middleware/__tests__/auth.test.ts
|
|
170
|
+
x should reject missing session (12ms)
|
|
171
|
+
x should allow valid session (8ms)
|
|
172
|
+
|
|
173
|
+
2 failed, 12 passed, 14 total
|
|
174
|
+
|
|
175
|
+
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.
|
|
176
|
+
|
|
177
|
+
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";
|
|
178
|
+
import jwt from "jsonwebtoken";
|
|
179
|
+
import { verifyToken } from "../auth.js";
|
|
180
|
+
import { createMockReqRes } from "../../test-utils/mock-express.js";
|
|
181
|
+
|
|
182
|
+
const SECRET = "test-secret";
|
|
183
|
+
process.env.JWT_SECRET = SECRET;
|
|
184
|
+
|
|
185
|
+
describe("verifyToken", () => {
|
|
186
|
+
it("should reject requests without Authorization header", () => {
|
|
187
|
+
const { req, res, next } = createMockReqRes();
|
|
188
|
+
verifyToken(req, res, next);
|
|
189
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it("should reject expired tokens", () => {
|
|
193
|
+
const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
|
|
194
|
+
const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
|
|
195
|
+
verifyToken(req, res, next);
|
|
196
|
+
expect(res.status).toHaveBeenCalledWith(401);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it("should accept valid tokens and attach user to request", () => {
|
|
200
|
+
const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
|
|
201
|
+
const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
|
|
202
|
+
verifyToken(req, res, next);
|
|
203
|
+
expect(next).toHaveBeenCalled();
|
|
204
|
+
expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
`}}),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
|
|
208
|
+
PASS src/routes/__tests__/protected.test.ts
|
|
209
|
+
PASS src/middleware/__tests__/auth.test.ts
|
|
210
|
+
|
|
211
|
+
Test Suites: 3 passed, 3 total
|
|
212
|
+
Tests: 14 passed, 14 total`,raw:JSON.stringify({tool_use_id:"tu-001-08"})},{sessionId:"sess-001",eventType:"usage",timestamp:"2026-02-27T08:15:41Z",content:JSON.stringify({input_tokens:42600,output_tokens:8100,cost_usd:.22})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:42Z",content:`All 14 tests pass. Here's a summary of the changes:
|
|
213
|
+
|
|
214
|
+
### Changes made
|
|
215
|
+
|
|
216
|
+
| File | Action |
|
|
217
|
+
|------|--------|
|
|
218
|
+
| \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
|
|
219
|
+
| \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
|
|
220
|
+
| \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
|
|
221
|
+
| \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
|
|
222
|
+
|
|
223
|
+
### Key decisions
|
|
224
|
+
- **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
|
|
225
|
+
- **Refresh tokens**: 48-byte random hex, stored in DB
|
|
226
|
+
- **Error handling**: Distinguishes expired tokens (401) from invalid tokens (403)`},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:30:01Z",content:"running"},{sessionId:"sess-002",eventType:"system",timestamp:"2026-02-27T07:30:02Z",content:`You are a QA engineer. Write comprehensive tests covering happy paths, edge cases, error scenarios, and security.
|
|
227
|
+
Project: acme/alpha — Node.js + Express REST API
|
|
228
|
+
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";
|
|
229
|
+
import bcrypt from "bcrypt";
|
|
230
|
+
import { db } from "../db.js";
|
|
231
|
+
import { validateEmail, validatePassword } from "../utils/validators.js";
|
|
232
|
+
|
|
233
|
+
const SALT_ROUNDS = 12;
|
|
234
|
+
const router = Router();
|
|
235
|
+
|
|
236
|
+
router.post("/register", async (req, res) => {
|
|
237
|
+
const { name, email, password } = req.body;
|
|
238
|
+
|
|
239
|
+
if (!name || !email || !password) {
|
|
240
|
+
return res.status(400).json({ error: "Missing required fields" });
|
|
241
|
+
}
|
|
242
|
+
if (!validateEmail(email)) {
|
|
243
|
+
return res.status(400).json({ error: "Invalid email format" });
|
|
244
|
+
}
|
|
245
|
+
if (!validatePassword(password)) {
|
|
246
|
+
return res.status(400).json({ error: "Password too weak" });
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const existing = await db.users.findByEmail(email);
|
|
250
|
+
if (existing) {
|
|
251
|
+
return res.status(409).json({ error: "Email already registered" });
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
|
|
255
|
+
const user = await db.users.create({ name, email, passwordHash });
|
|
256
|
+
res.status(201).json({ id: user.id, name: user.name, email: user.email });
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
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:
|
|
260
|
+
|
|
261
|
+
1. **Happy path** - valid registration
|
|
262
|
+
2. **Missing fields** - each required field missing
|
|
263
|
+
3. **Invalid email** - malformed email format
|
|
264
|
+
4. **Weak password** - password validation failure
|
|
265
|
+
5. **Duplicate email** - conflict with existing user
|
|
266
|
+
6. **SQL injection** - malicious email input
|
|
267
|
+
7. **XSS payload** - HTML in the name field
|
|
268
|
+
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
|
|
269
|
+
POST /api/register
|
|
270
|
+
✓ should register a valid user (28ms)
|
|
271
|
+
✓ should reject missing name (4ms)
|
|
272
|
+
✓ should reject missing email (3ms)
|
|
273
|
+
✓ should reject missing password (3ms)
|
|
274
|
+
✓ should reject invalid email format (5ms)
|
|
275
|
+
✓ should reject weak password (4ms)
|
|
276
|
+
✓ should reject duplicate email (12ms)
|
|
277
|
+
✓ should sanitize HTML in name field (6ms)
|
|
278
|
+
|
|
279
|
+
Tests: 8 passed, 8 total`,raw:JSON.stringify({tool_use_id:"tu-002-03"})},{sessionId:"sess-002",eventType:"usage",timestamp:"2026-02-27T07:32:00Z",content:JSON.stringify({input_tokens:31400,output_tokens:9800,cost_usd:.18})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:32:30Z",content:"All 8 test cases pass. Created `src/routes/__tests__/register.test.ts` with comprehensive coverage for the registration endpoint including input validation, duplicate detection, and security edge cases."},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:33:00Z",content:"completed"},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T22:45:01Z",content:"running"},{sessionId:"sess-003",eventType:"system",timestamp:"2026-02-26T22:45:02Z",content:`You are a database engineer. Focus on safe migrations, zero-downtime deployments, and data integrity.
|
|
280
|
+
Project: acme/alpha — Node.js + Express + PostgreSQL
|
|
281
|
+
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 (
|
|
282
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
283
|
+
name TEXT NOT NULL,
|
|
284
|
+
email TEXT UNIQUE NOT NULL,
|
|
285
|
+
password_hash TEXT NOT NULL,
|
|
286
|
+
role TEXT DEFAULT 'user',
|
|
287
|
+
created_at TIMESTAMPTZ DEFAULT now(),
|
|
288
|
+
updated_at TIMESTAMPTZ DEFAULT now()
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
CREATE TABLE sessions (
|
|
292
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
293
|
+
user_id UUID REFERENCES users(id),
|
|
294
|
+
expires_at TIMESTAMPTZ NOT NULL,
|
|
295
|
+
created_at TIMESTAMPTZ DEFAULT now()
|
|
296
|
+
);`,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
|
|
297
|
+
-- Add audit logging and user activity tracking
|
|
298
|
+
|
|
299
|
+
BEGIN;
|
|
300
|
+
|
|
301
|
+
-- 1. Add last_login_at to users
|
|
302
|
+
ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
|
|
303
|
+
|
|
304
|
+
-- 2. Index for session cleanup queries
|
|
305
|
+
CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
|
|
306
|
+
|
|
307
|
+
-- 3. Audit log table
|
|
308
|
+
CREATE TABLE audit_log (
|
|
309
|
+
id BIGSERIAL PRIMARY KEY,
|
|
310
|
+
user_id UUID REFERENCES users(id),
|
|
311
|
+
action TEXT NOT NULL,
|
|
312
|
+
entity_type TEXT NOT NULL,
|
|
313
|
+
entity_id TEXT NOT NULL,
|
|
314
|
+
old_value JSONB,
|
|
315
|
+
new_value JSONB,
|
|
316
|
+
ip_address INET,
|
|
317
|
+
created_at TIMESTAMPTZ DEFAULT now()
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
CREATE INDEX idx_audit_log_user ON audit_log (user_id);
|
|
321
|
+
CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
|
|
322
|
+
CREATE INDEX idx_audit_log_created ON audit_log (created_at);
|
|
323
|
+
|
|
324
|
+
COMMIT;
|
|
325
|
+
`}}),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
|
|
326
|
+
- ALTER TABLE users ADD COLUMN last_login_at
|
|
327
|
+
- CREATE INDEX CONCURRENTLY idx_sessions_expires_at
|
|
328
|
+
- CREATE TABLE audit_log
|
|
329
|
+
- 3 indexes on audit_log
|
|
330
|
+
|
|
331
|
+
WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
|
|
332
|
+
Please split this into a separate migration step.`,raw:JSON.stringify({tool_use_id:"tu-003-03",is_error:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:15Z",content:"Good catch from the dry run! `CREATE INDEX CONCURRENTLY` can't run inside a transaction. I need to split the migration into two files: one for the transactional DDL and another for the concurrent index creation."},{sessionId:"sess-003",eventType:"usage",timestamp:"2026-02-26T23:00:00Z",content:JSON.stringify({input_tokens:56300,output_tokens:14200,cost_usd:.31})},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T23:10:00Z",content:"interrupted"},{sessionId:"sess-004",eventType:"status",timestamp:"2026-02-27T09:00:01Z",content:"running"},{sessionId:"sess-004",eventType:"system",timestamp:"2026-02-27T09:00:02Z",content:`You are a backend engineer specializing in API infrastructure.
|
|
333
|
+
Project: acme/data-pipeline — ETL pipelines for analytics
|
|
334
|
+
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
|
|
335
|
+
src/middleware/error-handler.ts
|
|
336
|
+
src/middleware/logger.ts
|
|
337
|
+
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:
|
|
338
|
+
|
|
339
|
+
- Uses an **in-memory token bucket** per client IP
|
|
340
|
+
- Supports configurable rate (requests/second) and burst size
|
|
341
|
+
- Returns \`429 Too Many Requests\` with \`Retry-After\` header
|
|
342
|
+
- Has a Redis adapter option for multi-instance deployments
|
|
343
|
+
|
|
344
|
+
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.
|
|
345
|
+
Project: acme/alpha — Node.js + Express + PostgreSQL
|
|
346
|
+
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";
|
|
347
|
+
|
|
348
|
+
const pool = new pg.Pool({
|
|
349
|
+
connectionString: process.env.DATABASE_URL,
|
|
350
|
+
max: 20,
|
|
351
|
+
idleTimeoutMillis: 30000,
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
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:
|
|
355
|
+
|
|
356
|
+
1. **A \`PoolManager\` class** that creates and caches per-tenant pools
|
|
357
|
+
2. **Configurable limits** per tenant (max connections, idle timeout)
|
|
358
|
+
3. **Health checks** with automatic pool eviction for unhealthy connections
|
|
359
|
+
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";
|
|
360
|
+
src/routes/users.ts:2:import { pool } from "../db/pool.js";
|
|
361
|
+
src/routes/register.ts:3:import { pool } from "../db/pool.js";
|
|
362
|
+
src/routes/admin.ts:4:import { pool } from "../db/pool.js";
|
|
363
|
+
src/services/billing.ts:2:import { pool } from "../db/pool.js";
|
|
364
|
+
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:
|
|
365
|
+
1. Create a new \`PoolManager\` abstraction
|
|
366
|
+
2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
|
|
367
|
+
3. Add middleware to extract tenant ID from the request
|
|
368
|
+
|
|
369
|
+
This is a significant refactor. Let me start with the PoolManager class.`},{sessionId:"sess-005",eventType:"usage",timestamp:"2026-02-27T06:30:00Z",content:JSON.stringify({input_tokens:67800,output_tokens:19300,cost_usd:.38})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],Fw=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",environmentId:"env-local-01",status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2026-01-15T10:00:00Z",updatedAt:"2026-01-15T10:00:00Z"},{id:"proj-beta",name:"Data Pipeline",description:"ETL pipelines for analytics and reporting",repoUrl:"https://github.com/acme/data-pipeline",environmentId:"env-docker-01",status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2026-02-01T14:30:00Z",updatedAt:"2026-02-01T14:30:00Z"},{id:"proj-gamma",name:"Mobile App",description:"React Native cross-platform mobile application",repoUrl:"",environmentId:"env-local-01",status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],Zw=[{id:"task-001",workspaceId:"proj-alpha",title:"Implement JWT authentication",description:"Replace session-based auth with JWT tokens across all protected routes",status:"working",branch:"feat/jwt-auth",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-001a","task-001b","task-001c"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Design and implement JWT-based authentication with access/refresh tokens, replacing session-based auth.",extra:{approach:"Replace express-session with JWT Bearer tokens. Access tokens expire in 24h, refresh tokens stored in DB.",files_changed:["src/middleware/auth.ts","src/routes/login.ts","src/routes/protected.ts"],decisions:["Chose jsonwebtoken over jose for consistency with existing codebase","24h access token expiry — long enough for dev sessions, short enough for security","Refresh tokens are 48-byte random hex stored in DB with user association"],blockers:"Need to verify token rotation strategy with security team before merging"}})},{id:"task-001a",workspaceId:"proj-alpha",title:"Design token schema",description:"Define JWT payload structure, expiry, and refresh token strategy",status:"complete",branch:"feat/jwt-auth/design-token-schema",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:10:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-001b",workspaceId:"proj-alpha",title:"Implement auth middleware",description:"Build Express middleware that verifies JWT Bearer tokens",status:"working",branch:"feat/jwt-auth/implement-auth-middleware",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:15:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-001c",workspaceId:"proj-alpha",title:"Write auth integration tests",description:"End-to-end tests for login flow, token refresh, and protected route access",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-25T10:20:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-002",workspaceId:"proj-alpha",title:"Add rate limiting",description:"Implement token-bucket rate limiting for public API endpoints",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:05:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-003",workspaceId:"proj-alpha",title:"Set up OpenAPI documentation",description:"Generate Swagger docs from route decorators and serve at /api/docs",status:"paused",branch:"feat/openapi-docs",latestSessionId:"sess-002",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-24T16:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-004",workspaceId:"proj-alpha",title:"Database connection pooling",description:"Switch from single connection to a connection pool with health checks",status:"complete",branch:"feat/db-pool",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-23T11:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-005",workspaceId:"proj-alpha",title:"Fix N+1 query in user list",description:"Use a JOIN instead of per-row lookups in GET /api/users",status:"not_started",branch:"fix/user-list-n1",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:5,createdAt:"2026-02-22T09:30:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006",workspaceId:"proj-beta",title:"Add Parquet export support",description:"Allow pipeline outputs to be written as Parquet files for Spark consumption",status:"working",branch:"feat/parquet-export",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-006a","task-006b","task-006c","task-006d"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Plan for adding Parquet export support, including compression options and performance benchmarks.",extra:{approach:"Use apache-arrow npm package for Parquet write support. Map internal column types to Arrow type system.",compression:{supported:["snappy","zstd","gzip"],default:"snappy"},benchmarks:{"1M rows snappy":"2.3s","1M rows zstd":"3.1s","1M rows gzip":"4.8s"}}})},{id:"task-006a",workspaceId:"proj-beta",title:"Define Parquet schema mapping",description:"Map internal column types to Arrow/Parquet type system",status:"complete",branch:"feat/parquet-export/define-parquet-schema-mapping",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:05:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006b",workspaceId:"proj-beta",title:"Implement row-group writer",description:"Write buffered row groups with configurable batch size",status:"complete",branch:"feat/parquet-export/implement-row-group-writer",latestSessionId:"",dependsOn:["task-006a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:10:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006c",workspaceId:"proj-beta",title:"Add compression options",description:"Support Snappy, ZSTD, and GZIP compression for Parquet output",status:"working",branch:"feat/parquet-export/add-compression-options",latestSessionId:"sess-004",dependsOn:["task-006b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T08:15:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006d",workspaceId:"proj-beta",title:"Write Parquet integration tests",description:"Round-trip tests: write Parquet, read back with pyarrow, verify data integrity",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-006c"],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-26T08:20:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-007",workspaceId:"proj-beta",title:"Implement incremental loads",description:"Track watermarks so pipelines only process new/changed rows",status:"working",branch:"feat/incremental",latestSessionId:"sess-004",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:30:00Z",parentTaskId:"",depth:0,childTaskIds:["task-007a","task-007b"],canDecompose:!0,defaultPersonaId:"",workpad:""},{id:"task-007a",workspaceId:"proj-beta",title:"Design watermark storage",description:"Define schema for per-pipeline high-watermark tracking",status:"complete",branch:"feat/incremental/design-watermark-storage",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:35:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-007b",workspaceId:"proj-beta",title:"Implement change detection query",description:"Generate WHERE clauses from watermarks to fetch only changed rows",status:"failed",branch:"feat/incremental/implement-change-detection-query",latestSessionId:"",dependsOn:["task-007a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:40:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-008",workspaceId:"proj-beta",title:"Add pipeline monitoring dashboard",description:"Real-time metrics for pipeline throughput, latency, and error rates",status:"paused",branch:"feat/monitoring",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T09:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""}],_0=[{id:"find-001",workspaceId:"proj-alpha",taskId:"task-001",sessionId:"sess-001",category:"architecture",title:"Auth middleware is tightly coupled to Express",content:"The current auth middleware directly references Express Request/Response types. Consider extracting a framework-agnostic token verification layer so we can reuse it in the WebSocket auth path.",tags:["auth","decoupling","middleware"],createdAt:"2026-02-27T08:16:00Z"},{id:"find-002",workspaceId:"proj-alpha",taskId:"task-003",sessionId:"sess-002",category:"api",title:"Missing pagination on GET /api/users",content:"The users endpoint returns all rows without limit/offset. For datasets over 10k rows this will cause timeouts. Recommend cursor-based pagination with a default page size of 50.",tags:["api","pagination","performance"],createdAt:"2026-02-27T07:31:00Z"},{id:"find-003",workspaceId:"proj-alpha",taskId:"task-005",sessionId:"sess-003",category:"bug",title:"Race condition in session cleanup",content:"When two requests hit /api/logout concurrently, the second call throws a 500 because the session row has already been deleted. Needs an idempotent DELETE or a conditional check.",tags:["bug","concurrency","sessions"],createdAt:"2026-02-26T22:50:00Z"},{id:"find-004",workspaceId:"proj-alpha",taskId:"task-004",sessionId:"",category:"decision",title:"Chose pg-pool over knex connection pool",content:"pg-pool gives us direct control over idle timeout, max connections, and health check queries. Knex wraps pg-pool anyway and adds overhead we don't need since we write raw SQL.",tags:["database","decision","postgres"],createdAt:"2026-02-23T11:30:00Z"},{id:"find-005",workspaceId:"proj-alpha",taskId:"",sessionId:"",category:"dependency",title:"jsonwebtoken has 3 high-severity CVEs",content:"The jsonwebtoken package (v8.x) has known vulnerabilities. Consider migrating to jose which is maintained, supports ESM, and covers the same JWS/JWE surface area with zero dependencies.",tags:["security","dependency","jwt"],createdAt:"2026-02-27T08:20:00Z"},{id:"find-006",workspaceId:"proj-alpha",taskId:"task-001",sessionId:"sess-001",category:"pattern",title:"Consistent error response shape",content:"All error responses should follow the shape `{ error: string, code: string, details?: unknown }`. Currently some routes return `{ message: string }` and others return `{ error: string }`.",tags:["api","consistency","error-handling"],createdAt:"2026-02-27T08:17:00Z"},{id:"find-007",workspaceId:"proj-beta",taskId:"task-007",sessionId:"sess-004",category:"architecture",title:"Watermark storage should be pluggable",content:"The incremental load watermarks are currently stored in a local SQLite file. For production multi-worker scenarios, this needs to be backed by a shared store (Redis or Postgres).",tags:["architecture","pipeline","scalability"],createdAt:"2026-02-27T09:05:00Z"}],Kw=[{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:""}],Yw=[{id:"persona-arch",name:"Software Architect",description:"Designs system architecture, defines interfaces, and decomposes large features into implementable tasks.",systemPrompt:"You are a senior software architect. Focus on clean interfaces, separation of concerns, and scalable patterns. When decomposing work, create concrete subtasks with clear acceptance criteria.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:50,mcpServers:"[]",createdAt:"2026-02-20T10:00:00Z",updatedAt:"2026-02-20T10:00:00Z",type:"agent",script:"",allowedMcpTools:["task_create","task_update","task_list","finding_post","finding_list","knowledge_search","knowledge_create_node","session_spawn"]},{id:"persona-fe",name:"Frontend Engineer",description:"React specialist — builds UI components, writes CSS, implements routing, and creates Playwright tests.",systemPrompt:"You are a frontend engineer specializing in React, TypeScript, and modern CSS. Follow component composition patterns, use semantic HTML, and write accessible markup.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:100,mcpServers:"[]",createdAt:"2026-02-20T10:05:00Z",updatedAt:"2026-02-20T10:05:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-reviewer",name:"Code Reviewer",description:"Reviews diffs for correctness, security, and style. Posts findings for issues discovered.",systemPrompt:"You are a meticulous code reviewer. Check for security vulnerabilities, performance issues, and style consistency. Post findings for anything noteworthy.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:30,mcpServers:"[]",createdAt:"2026-02-20T10:10:00Z",updatedAt:"2026-02-20T10:10:00Z",type:"agent",script:"",allowedMcpTools:["finding_post","finding_list","knowledge_search"]},{id:"persona-tester",name:"QA Engineer",description:"Writes comprehensive test suites — unit tests, integration tests, and E2E Playwright specs.",systemPrompt:"You are a QA engineer focused on test coverage. Write tests that cover happy paths, edge cases, error scenarios, and accessibility. Use Playwright for E2E tests.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:80,mcpServers:"[]",createdAt:"2026-02-20T10:15:00Z",updatedAt:"2026-02-20T10:15:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-lint",name:"Lint & Format",description:"Scripted persona — runs ESLint and Prettier on changed files, auto-fixes violations, and posts a findings summary.",systemPrompt:"",toolConfig:"{}",runtime:"genaiscript",model:"",maxTurns:1,mcpServers:"[]",createdAt:"2026-02-21T09:00:00Z",updatedAt:"2026-02-21T09:00:00Z",type:"script",script:`const files = env.files.filter(f => /\\.(ts|tsx|js)$/.test(f.filename));
|
|
370
|
+
for (const f of files) {
|
|
371
|
+
const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);
|
|
372
|
+
if (eslintResult.exitCode !== 0) {
|
|
373
|
+
env.findings.push({ category: "lint", title: \`Lint issues in \${f.filename}\`, content: eslintResult.stderr });
|
|
374
|
+
}
|
|
375
|
+
const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);
|
|
376
|
+
if (prettierResult.exitCode !== 0) {
|
|
377
|
+
env.findings.push({ category: "format", title: \`Prettier issues in \${f.filename}\`, content: prettierResult.stderr });
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],Jw={"task-001b":[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z"},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Implement auth middleware",startedAt:"2026-02-27T08:15:00Z"}],"task-006c":[{id:"sess-004",environmentId:"env-docker-01",runtime:"claude-code",status:"running",prompt:"Add compression options",startedAt:"2026-02-27T09:00:00Z"}]};function Ee(n){return new Date(Date.now()+n).toISOString()}const x0=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(1200),content:JSON.stringify({tool:"Glob",args:{pattern:"src/routes/**/*.ts"}}),raw:JSON.stringify({id:"stream-a-01",type:"tool_use"})}},{delayMs:1600,event:{eventType:"tool_result",timestamp:Ee(1600),content:`src/routes/users.ts
|
|
381
|
+
src/routes/auth.ts
|
|
382
|
+
src/routes/billing.ts
|
|
383
|
+
src/routes/admin.ts
|
|
384
|
+
src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Ee(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
|
|
385
|
+
|
|
386
|
+
\`\`\`typescript
|
|
387
|
+
const router = Router();
|
|
388
|
+
router.use(authenticate);
|
|
389
|
+
router.use(validateBody);
|
|
390
|
+
|
|
391
|
+
router.get("/", listUsers);
|
|
392
|
+
router.post("/", createUser);
|
|
393
|
+
router.get("/:id", getUser);
|
|
394
|
+
router.put("/:id", updateUser);
|
|
395
|
+
router.delete("/:id", deleteUser);
|
|
396
|
+
\`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Ee(3200),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --testPathPattern=routes"}}),raw:JSON.stringify({id:"stream-a-02",type:"tool_use"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Ee(4e3),content:` PASS src/routes/__tests__/users.test.ts
|
|
397
|
+
PASS src/routes/__tests__/auth.test.ts
|
|
398
|
+
PASS src/routes/__tests__/billing.test.ts
|
|
399
|
+
|
|
400
|
+
Test Suites: 3 passed, 3 total
|
|
401
|
+
Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Ee(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_usd:.15})}},{delayMs:5e3,event:{eventType:"text",timestamp:Ee(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Ee(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(1200),content:JSON.stringify({tool:"Read",args:{file_path:"migrations/001_initial.sql"}}),raw:JSON.stringify({id:"stream-b-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Ee(1800),content:`CREATE TABLE users (
|
|
402
|
+
id UUID PRIMARY KEY,
|
|
403
|
+
name TEXT NOT NULL,
|
|
404
|
+
email TEXT UNIQUE NOT NULL,
|
|
405
|
+
created_at TIMESTAMPTZ DEFAULT now()
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
CREATE TABLE sessions (
|
|
409
|
+
id UUID PRIMARY KEY,
|
|
410
|
+
user_id UUID REFERENCES users(id),
|
|
411
|
+
expires_at TIMESTAMPTZ NOT NULL
|
|
412
|
+
);`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Ee(2600),content:`I found the tables to modify:
|
|
413
|
+
- **users**: add column \`last_login_at\`
|
|
414
|
+
- **sessions**: add index on \`expires_at\`
|
|
415
|
+
- **audit_log**: new table
|
|
416
|
+
|
|
417
|
+
This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
|
|
418
|
+
|
|
419
|
+
Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Ee(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(700),content:JSON.stringify({tool:"Bash",args:{command:"npm run migrate"}}),raw:JSON.stringify({id:"stream-b-02",type:"tool_use"})}},{delayMs:2200,event:{eventType:"tool_result",timestamp:Ee(1700),content:`Applying 002_add_last_login.sql... done
|
|
420
|
+
Applying 003_sessions_index.sql... done
|
|
421
|
+
Applying 004_audit_log.sql... done
|
|
422
|
+
|
|
423
|
+
3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Ee(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Ee(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(1200),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/billing.ts"}}),raw:JSON.stringify({id:"stream-c-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Ee(1800),content:`import { StripeClient } from "./stripe-client.js";
|
|
424
|
+
import type { Invoice, LineItem } from "../types/billing.js";
|
|
425
|
+
|
|
426
|
+
export class BillingService {
|
|
427
|
+
constructor(private stripe: StripeClient) {}
|
|
428
|
+
|
|
429
|
+
async calculateMonthlyTotal(userId: string): Promise<number> {
|
|
430
|
+
const invoices = await this.stripe.listInvoices(userId);
|
|
431
|
+
return invoices.reduce((sum, inv) => sum + inv.total, 0);
|
|
432
|
+
}
|
|
433
|
+
}`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Ee(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Ee(2800),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/stripe-client.ts"}}),raw:JSON.stringify({id:"stream-c-02",type:"tool_use"})}},{delayMs:3200,event:{eventType:"tool_result",timestamp:Ee(3200),content:"Error: ENOENT: no such file or directory, open 'src/services/stripe-client.ts'",raw:JSON.stringify({tool_use_id:"stream-c-02",is_error:!0})}},{delayMs:3600,event:{eventType:"error",timestamp:Ee(3600),content:"Cannot resolve import 'src/services/stripe-client.ts' — module not found. The billing service depends on a Stripe client that doesn't exist in this environment."}},{delayMs:4e3,event:{eventType:"status",timestamp:Ee(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(1200),content:JSON.stringify({tool:"Read",args:{file_path:"/src/middleware/auth.ts"}}),raw:JSON.stringify({id:"tool-mock-001"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Ee(1800),content:`import jwt from "jsonwebtoken";
|
|
434
|
+
import type { Request, Response, NextFunction } from "express";
|
|
435
|
+
|
|
436
|
+
const JWT_SECRET = process.env.JWT_SECRET || "change-me";
|
|
437
|
+
|
|
438
|
+
export function verifyToken(req: Request, res: Response, next: NextFunction): void {
|
|
439
|
+
const header = req.headers.authorization;
|
|
440
|
+
if (!header?.startsWith("Bearer ")) {
|
|
441
|
+
res.status(401).json({ error: "Missing token" });
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
try {
|
|
445
|
+
const decoded = jwt.verify(header.slice(7), JWT_SECRET);
|
|
446
|
+
if (decoded.exp > Date.now() / 1000) {
|
|
447
|
+
res.status(403).json({ error: "Token expired" });
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
req.user = decoded;
|
|
451
|
+
next();
|
|
452
|
+
} catch {
|
|
453
|
+
res.status(403).json({ error: "Invalid token" });
|
|
454
|
+
}
|
|
455
|
+
}`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Ee(2600),content:"Found the issue — the token expiry check on line 14 is using `>` instead of `<`. A token is expired when `exp < now`, but the code checks `exp > now` which means it rejects *valid* tokens and accepts *expired* ones. Let me fix it."}},{delayMs:3400,event:{eventType:"tool_use",timestamp:Ee(3400),content:JSON.stringify({tool:"Edit",args:{file_path:"/src/middleware/auth.ts",old_string:" if (decoded.exp > Date.now() / 1000) {",new_string:" if (decoded.exp < Date.now() / 1000) {"}}),raw:JSON.stringify({id:"tool-mock-002"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Ee(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Ee(4600),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --grep auth"}}),raw:JSON.stringify({id:"tool-mock-003"})}},{delayMs:5800,event:{eventType:"tool_result",timestamp:Ee(5800),content:`[exit 0] > jest --grep auth
|
|
456
|
+
|
|
457
|
+
PASS src/auth.test.ts
|
|
458
|
+
✓ validates JWT token (12ms)
|
|
459
|
+
✓ rejects expired token (3ms)
|
|
460
|
+
✓ handles missing header (1ms)
|
|
461
|
+
|
|
462
|
+
Tests: 3 passed, 3 total
|
|
463
|
+
Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Ee(6400),content:JSON.stringify({tool:"Grep",args:{pattern:"decoded\\.exp",path:"src/"}}),raw:JSON.stringify({id:"tool-mock-004"})}},{delayMs:7e3,event:{eventType:"tool_result",timestamp:Ee(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
|
|
464
|
+
src/utils/token-refresh.ts:28: const remaining = decoded.exp - Date.now() / 1000;`,raw:JSON.stringify({tool_use_id:"tool-mock-004",is_error:!1})}},{delayMs:7800,event:{eventType:"text",timestamp:Ee(7800),content:"Fixed. The token expiry comparison was inverted — `decoded.exp > Date.now()` should have been `<` (a token is expired when its `exp` is in the past). The other occurrence in `token-refresh.ts` uses subtraction (not comparison), so it was already correct. All 3 auth tests pass."}},{delayMs:8400,event:{eventType:"usage",timestamp:Ee(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_usd:.12})}},{delayMs:8800,event:{eventType:"status",timestamp:Ee(8800),content:"completed"}}]}],S0=400;function Ww({children:n}){const[s,i]=y.useState(Hw),[o,c]=y.useState(Gw),[u,d]=y.useState($w),[m,h]=y.useState(void 0),[g,v]=y.useState(Fw),[b,_]=y.useState(Zw),[S,T]=y.useState(_0),[N,j]=y.useState(Kw),[w,E]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[A,O]=y.useState(Yw),[C]=y.useState(Jw),[M,G]=y.useState(""),[U,V]=y.useState(ns),[Z,ee]=y.useState(ca),[ie,be]=y.useState(void 0),[K,re]=y.useState(void 0),[I,$]=y.useState(""),Q=y.useRef(void 0),de=y.useRef(0),me=y.useRef(0),ze=y.useRef(new Set),je=y.useRef(new Map),Ne=y.useRef(b);Ne.current=b;const Ae=y.useRef(new Map),ce=y.useRef(new Map),fe=y.useCallback(q=>(de.current+=1,`mock-${q}-${String(de.current).padStart(3,"0")}`),[]),pe=y.useCallback(()=>{const q=x0[me.current%x0.length];return me.current+=1,q},[]),Re=y.useCallback((q,ne,oe)=>{const le=setTimeout(()=>{var ue;ze.current.delete(le),oe&&((ue=je.current.get(oe))==null||ue.delete(le)),q()},ne);ze.current.add(le),oe&&(je.current.has(oe)||je.current.set(oe,new Set),je.current.get(oe).add(le))},[]),Bt=y.useCallback(q=>{const ne=je.current.get(q);ne&&(ne.forEach(oe=>{clearTimeout(oe),ze.current.delete(oe)}),je.current.delete(q))},[]),te=y.useCallback((q,ne,oe)=>{c(le=>le.map(ue=>ue.id===q?{...ue,status:ne,...oe!==void 0?{endReason:oe}:{}}:ue))},[]),X=y.useCallback(q=>{d(ne=>[...ne,q])},[]),Te=y.useCallback((q,ne,oe)=>{ne.forEach((le,ue)=>{Re(()=>{const qe={sessionId:q,...le.event,timestamp:new Date().toISOString()};if(X(qe),le.event.eventType==="status"){const ye=Ob(le.event.content),Oe=Ib(le.event.content);te(q,ye,Oe)}ue===ne.length-1&&oe&&oe()},le.delayMs,q)})},[Re,X,te]),un=y.useCallback((q,ne,oe,le)=>{console.log("[MockGrackle] spawn",{environmentId:q,prompt:ne,runtime:le});const ue=fe("sess"),qe={id:ue,environmentId:q,runtime:le||"claude-code",status:"running",prompt:ne,startedAt:new Date().toISOString()};c(Oe=>[...Oe,qe]),h(ue);const ye=pe();if(console.log(`[MockGrackle] Playing scenario: ${ye.label}`),ye.pauseForInput){const Oe=ye.pauseAfterStep??ye.steps.length-1,Ke=ye.steps.slice(0,Oe+1),nt=Ke.length>0?Ke[Ke.length-1].delayMs:0;Te(ue,Ke),Re(()=>{te(ue,"idle"),X({sessionId:ue,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},nt+S0,ue),ye.resumeSteps&&Ae.current.set(ue,ye.resumeSteps)}else Te(ue,ye.steps)},[fe,pe,Te,Re,te,X]),Ze=y.useCallback(q=>{console.log("[MockGrackle] kill",q),Bt(q),Ae.current.delete(q),te(q,"stopped","killed"),X({sessionId:q,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),_(ne=>ne.map(oe=>oe.latestSessionId===q&&oe.status==="working"?{...oe,status:"not_started"}:oe))},[Bt,te,X]),Kn=y.useCallback(q=>{console.log("[MockGrackle] stopGraceful",q),Bt(q),Ae.current.delete(q),te(q,"stopped","terminated"),X({sessionId:q,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),_(ne=>ne.map(oe=>oe.latestSessionId===q&&oe.status==="working"?{...oe,status:"not_started"}:oe))},[Bt,te,X]),Yn=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),zn=y.useCallback(q=>{console.log("[MockGrackle] loadSessionEvents",q)},[]),Jn=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),d([])},[]),Tn=y.useCallback((q,ne,oe,le,ue,qe,ye,Oe,Ke)=>{console.log("[MockGrackle] createWorkspace",{name:q,description:ne});const nt={id:fe("proj"),name:q,description:ne||"",repoUrl:oe||"",environmentId:le||"",status:"active",workingDirectory:ye||"",useWorktrees:qe??!0,defaultPersonaId:ue||"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(He=>[...He,nt]),Oe&&Oe()},[fe]),Ls=y.useCallback(q=>{console.log("[MockGrackle] archiveWorkspace",q),v(ne=>ne.map(oe=>oe.id===q?{...oe,status:"archived"}:oe))},[]),dn=y.useCallback(q=>{console.log("[MockGrackle] loadTasks",q)},[]),Me=y.useCallback((q,ne,oe,le,ue,qe,ye,Oe,Ke)=>{console.log("[MockGrackle] createTask",{workspaceId:q,title:ne,parentTaskId:ue}),_(nt=>{const zt=nt.filter(Vn=>Vn.workspaceId===q).reduce((Vn,xa)=>Math.max(Vn,xa.sortOrder),0),Pt=ue?nt.find(Vn=>Vn.id===ue):void 0;if(ue&&!Pt)return console.warn("[MockGrackle] Parent task not found:",ue),nt;if(Pt&&!Pt.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ue),nt;const Tt=Pt?Pt.depth+1:0,ls={id:fe("task"),workspaceId:q,title:ne,description:oe||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:le||[],reviewNotes:void 0,sortOrder:zt+1,createdAt:new Date().toISOString(),parentTaskId:ue||"",depth:Tt,childTaskIds:[],canDecompose:ye??!ue,defaultPersonaId:qe||"",workpad:""};return[...nt,ls]}),Oe&&Oe()},[fe]),Mt=y.useCallback((q,ne,oe,le)=>{var nt;console.log("[MockGrackle] startTask",{taskId:q});const ue=Ne.current.find(He=>He.id===q),qe=(ue==null?void 0:ue.title)??"",ye=fe("sess"),Oe={id:ye,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:qe||q,startedAt:new Date().toISOString()};c(He=>[...He,Oe]),_(He=>He.map(zt=>zt.id===q?{...zt,status:"working",latestSessionId:ye,branch:`mock/${q.slice(0,8)}`}:zt));const Ke=pe();if(console.log(`[MockGrackle] Playing task scenario: ${Ke.label}`),Ke.pauseForInput){const He=Ke.pauseAfterStep??Ke.steps.length-1,zt=Ke.steps.slice(0,He+1),Pt=zt.length>0?zt[zt.length-1].delayMs:0;if(Te(ye,zt),Re(()=>{te(ye,"idle"),X({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},Pt+S0,ye),Ke.resumeSteps){const Tt=[...Ke.resumeSteps];Ae.current.set(ye,Tt);const ls=Tt.reduce((Vn,xa)=>Math.max(Vn,xa.delayMs),0);ce.current.set(ye,{taskId:q,delayAfterResume:ls+200})}}else{const He=Ke.steps.length>0?Ke.steps[Ke.steps.length-1].delayMs:0;Te(ye,Ke.steps);const zt=(nt=Ke.steps[Ke.steps.length-1])==null?void 0:nt.event.content;Re(()=>{zt==="completed"?_(Pt=>Pt.map(Tt=>Tt.id===q&&Tt.status==="working"?{...Tt,status:"paused"}:Tt)):zt==="failed"&&_(Pt=>Pt.map(Tt=>Tt.id===q&&Tt.status==="working"?{...Tt,status:"failed"}:Tt))},He+100,ye)}},[fe,pe,Te,Re,te,X]),Kt=y.useCallback((q,ne)=>{console.log("[MockGrackle] sendInput",{sessionId:q,text:ne}),X({sessionId:q,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ne}`}),te(q,"running"),X({sessionId:q,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const oe=Ae.current.get(q);if(oe)Ae.current.delete(q),Te(q,oe);else{const ue=[{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"}}];Te(q,ue)}const le=ce.current.get(q);le&&(ce.current.delete(q),Re(()=>{_(ue=>ue.map(qe=>qe.id===le.taskId&&qe.status==="working"?{...qe,status:"paused"}:qe))},le.delayAfterResume,q))},[X,te,Te,Re]),lo=y.useCallback(q=>{console.log("[MockGrackle] completeTask",q),_(ne=>ne.map(oe=>oe.id===q?{...oe,status:"complete"}:oe))},[]),co=y.useCallback(q=>{console.log("[MockGrackle] resumeTask",q)},[]),uo=y.useCallback((q,ne,oe,le,ue)=>{console.log("[MockGrackle] updateTask",{taskId:q,title:ne}),_(qe=>qe.map(ye=>ye.id===q?{...ye,title:ne.trim()||ye.title,description:oe,dependsOn:le,...ue!==void 0?{defaultPersonaId:ue}:{}}:ye))},[]),_a=y.useCallback(q=>{console.log("[MockGrackle] deleteTask",q),_(ne=>ne.filter(oe=>oe.id!==q))},[]),Or=y.useCallback(q=>{console.log("[MockGrackle] loadFindings",q),T(_0.filter(ne=>ne.workspaceId===q))},[]),fo=y.useCallback((q,ne,oe,le,ue)=>{console.log("[MockGrackle] postFinding",{workspaceId:q,title:ne});const qe={id:fe("find"),workspaceId:q,taskId:"",sessionId:"",category:le||"general",title:ne,content:oe,tags:ue||[],createdAt:new Date().toISOString()};T(ye=>[...ye,qe])},[fe]),Ir=y.useCallback(()=>{console.log("[MockGrackle] loadEnvironments")},[]),Br=y.useCallback((q,ne,oe)=>{console.log("[MockGrackle] addEnvironment",{displayName:q,adapterType:ne,adapterConfig:oe})},[]),Us=y.useCallback((q,ne)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:q,...ne}),i(oe=>oe.map(le=>le.id!==q?le:{...le,...ne.displayName!==void 0?{displayName:ne.displayName}:{},...ne.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ne.adapterConfig)}:{}}))},[]),Yt=y.useCallback(()=>{console.log("[MockGrackle] loadTokens")},[]),Pn=y.useCallback((q,ne,oe,le,ue)=>{console.log("[MockGrackle] setToken",{name:q,tokenType:oe}),j(qe=>[...qe.filter(Oe=>Oe.name!==q),{name:q,tokenType:oe,envVar:le,filePath:ue,expiresAt:""}])},[]),Jt=y.useCallback(q=>{console.log("[MockGrackle] deleteToken",q),j(ne=>ne.filter(oe=>oe.name!==q))},[]),Lr=y.useCallback(q=>{console.log("[MockGrackle] updateCredentialProviders",q),E(q)},[]);y.useEffect(()=>()=>{ze.current.forEach(clearTimeout),ze.current.clear()},[]);const qc=y.useMemo(()=>({connected:!0,send:()=>{},environments:s,sessions:o,events:u,eventsDropped:0,lastSpawnedId:m,workspaces:g,tasks:b,findings:S,tokens:N,credentialProviders:w,spawn:un,sendInput:Kt,kill:Ze,stopGraceful:Kn,refresh:Yn,loadSessionEvents:zn,clearEvents:Jn,loadWorkspaces:()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Tn,archiveWorkspace:Ls,updateWorkspace:(q,ne)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:q,...ne}),v(oe=>oe.map(le=>le.id!==q?le:{...le,...ne.name!==void 0?{name:ne.name}:{},...ne.description!==void 0?{description:ne.description}:{},...ne.repoUrl!==void 0?{repoUrl:ne.repoUrl}:{},...ne.environmentId!==void 0?{environmentId:ne.environmentId}:{},...ne.workingDirectory!==void 0?{workingDirectory:ne.workingDirectory}:{},...ne.useWorktrees!==void 0?{useWorktrees:ne.useWorktrees}:{},...ne.defaultPersonaId!==void 0?{defaultPersonaId:ne.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},loadTasks:dn,loadAllTasks:()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Me,startTask:Mt,stopTask:q=>{console.log("[MockGrackle] stopTask",{taskId:q}),lo(q)},completeTask:lo,resumeTask:co,updateTask:uo,deleteTask:_a,loadFindings:Or,postFinding:fo,loadEnvironments:Ir,addEnvironment:Br,updateEnvironment:Us,loadTokens:Yt,setToken:Pn,deleteToken:Jt,updateCredentialProviders:Lr,provisionStatus:{},provisionEnvironment:(q,ne)=>{},stopEnvironment:()=>{},removeEnvironment:()=>{},codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:()=>{},createCodespace:()=>{},workspaceCreating:!1,taskStartingId:void 0,personas:A,createPersona:async(q,ne,oe,le,ue,qe,ye,Oe,Ke)=>{console.log("[MockGrackle] createPersona",{name:q});const nt={id:`mock-persona-${Date.now()}`,name:q,description:ne,systemPrompt:oe,toolConfig:"{}",runtime:le??"claude-code",model:ue||"",maxTurns:qe||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:ye||"agent",script:Oe||"",allowedMcpTools:Ke||[]};return O(He=>[...He,nt]),nt},updatePersona:async(q,ne,oe,le,ue,qe,ye,Oe,Ke,nt)=>{console.log("[MockGrackle] updatePersona",{personaId:q,name:ne});const He=A.find(Tt=>Tt.id===q);if(!He)throw new Error(`Persona not found: ${q}`);const zt=new Date().toISOString(),Pt={...He,...ne!==void 0?{name:ne}:{},...oe!==void 0?{description:oe}:{},...le!==void 0?{systemPrompt:le}:{},...ue!==void 0?{runtime:ue}:{},...qe!==void 0?{model:qe}:{},...ye!==void 0?{maxTurns:ye}:{},...Oe!==void 0?{type:Oe}:{},...Ke!==void 0?{script:Ke}:{},...nt!==void 0?{allowedMcpTools:nt}:{},updatedAt:zt};return O(Tt=>Tt.map(ls=>ls.id===q?Pt:ls)),Pt},deletePersona:async q=>{console.log("[MockGrackle] deletePersona",q),O(ne=>ne.filter(oe=>oe.id!==q))},taskSessions:C,loadTaskSessions:q=>{console.log("[MockGrackle] loadTaskSessions",q)},appDefaultPersonaId:M,setAppDefaultPersonaId:async q=>{console.log("[MockGrackle] setAppDefaultPersonaId",q),G(q)},onboardingCompleted:!0,completeOnboarding:()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costUsd:1.12,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costUsd:.48,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costUsd:.63,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costUsd:.1,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costUsd:.63,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costUsd:.1,sessionCount:1}},loadUsage:(q,ne)=>{console.log(`[MockGrackle] loadUsage(${q}, ${ne})`)},knowledge:{graphData:{nodes:U,links:Z},selectedNode:ie,loading:!1,selectedId:K,searchQuery:I,search:q=>{if(console.log("[MockGrackle] knowledge.search",q),!q.trim()){$(q);return}$(q);const ne=Q.current,oe=ne?ns.filter(ye=>!ye.workspaceId||ye.workspaceId===ne):ns,le=q.toLowerCase(),ue=oe.filter(ye=>{var Oe,Ke,nt;return ye.label.toLowerCase().includes(le)||((Oe=ye.content)==null?void 0:Oe.toLowerCase().includes(le))||((Ke=ye.tags)==null?void 0:Ke.some(He=>He.toLowerCase().includes(le)))||((nt=ye.category)==null?void 0:nt.toLowerCase().includes(le))});V(ue);const qe=new Set(ue.map(ye=>ye.id));ee(ca.filter(ye=>qe.has(ye.source)&&qe.has(ye.target))),re(void 0),be(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),$("");const q=Q.current,ne=q?ns.filter(le=>!le.workspaceId||le.workspaceId===q):ns;V(ne);const oe=new Set(ne.map(le=>le.id));ee(ca.filter(le=>oe.has(le.source)&&oe.has(le.target)))},selectNode:q=>{console.log("[MockGrackle] knowledge.selectNode",q),re(q);const ne=q in b0?b0[q]:void 0;if(ne)be(ne);else{const oe=ns.find(le=>le.id===q);if(oe){const le=ca.filter(ue=>ue.source===q||ue.target===q).map(ue=>({fromId:ue.source,toId:ue.target,type:ue.type}));be({node:oe,edges:le})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),re(void 0),be(void 0)},expandNode:q=>{console.log("[MockGrackle] knowledge.expandNode",q),V(ne=>{const oe=new Set(ne.map(Oe=>Oe.id)),le=ca.filter(Oe=>Oe.source===q||Oe.target===q),ue=new Set;for(const Oe of le)oe.has(Oe.source)||ue.add(Oe.source),oe.has(Oe.target)||ue.add(Oe.target);if(ue.size===0)return ne;const qe=ns.filter(Oe=>ue.has(Oe.id)),ye=new Set([...oe,...ue]);return ee(Oe=>{const Ke=new Set(Oe.map(He=>`${He.source}|${He.target}|${He.type}`)),nt=ca.filter(He=>ye.has(He.source)&&ye.has(He.target)&&!Ke.has(`${He.source}|${He.target}|${He.type}`));return nt.length>0?[...Oe,...nt]:Oe}),[...ne,...qe]})},loadRecent:q=>{if(console.log("[MockGrackle] knowledge.loadRecent",q),Q.current=q,q){const ne=ns.filter(le=>!le.workspaceId||le.workspaceId===q);V(ne);const oe=new Set(ne.map(le=>le.id));ee(ca.filter(le=>oe.has(le.source)&&oe.has(le.target)))}else V(ns),ee(ca);$("")},handleEvent:()=>!1}}),[s,o,u,m,g,b,S,N,w,A,C,M,U,Z,ie,K,I,un,Kt,Ze,Kn,Yn,zn,Jn,Tn,Ls,dn,Me,Mt,lo,co,uo,_a,Or,fo,Ir,Br,Us,Yt,Pn,Jt,Lr]);return l.jsx(_p.Provider,{value:qc,children:n})}const Bb=y.createContext(void 0),Xw=4e3;function Qw({children:n}){const[s,i]=y.useState([]),o=y.useRef(0),c=y.useCallback(d=>{i(m=>m.filter(h=>h.id!==d))},[]),u=y.useCallback((d,m="info",h=Xw)=>{const g=`toast-${++o.current}`;i(v=>[...v,{id:g,message:d,variant:m,duration:h}])},[]);return l.jsx(Bb.Provider,{value:{toasts:s,showToast:u,dismissToast:c},children:n})}function Bs(){const n=y.useContext(Bb);if(!n)throw new Error("useToast must be used within ToastProvider");return n}const Oc=[{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"]}],Lb=new Set(Oc.map(n=>n.id)),T0="grackle";function Pf(n){return Oc.find(s=>s.id===n)}const Vf="grackle-theme",Ub="grackle-prefer-system",zb="(prefers-color-scheme: dark)";let cr=[],fc;function uf(){fc=void 0;for(const n of cr)n()}function qf(){return typeof window>"u"?!1:window.matchMedia(zb).matches}function mr(){if(typeof localStorage>"u")return T0;try{const n=localStorage.getItem(Vf);if(n!==null&&Lb.has(n))return n}catch{}return T0}function yc(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(Ub)==="true"}catch{return!1}}function Hf(n){return Oc.find(s=>s.variantLightId===n||s.variantDarkId===n)}function Pb(n,s){const i=Pf(n);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?qf()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const o=Hf(n);if(o!=null&&o.variantLightId&&o.variantDarkId)return qf()?o.variantDarkId:o.variantLightId}return n}function Hi(n,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=Pb(n,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&Hi(mr(),yc());function e2(){return fc===void 0&&(fc={themeId:mr(),systemDark:qf(),preferSystem:yc()}),fc}function t2(n){return cr=[...cr,n],()=>{cr=cr.filter(s=>s!==n)}}function n2(){const n=y.useSyncExternalStore(t2,e2),{themeId:s,preferSystem:i}=n,o=Pb(s,i),c=y.useCallback(d=>{if(Lb.has(d)){try{localStorage.setItem(Vf,d)}catch{}Hi(d,yc(),!0),uf()}},[]),u=y.useCallback(d=>{try{localStorage.setItem(Ub,d?"true":"false")}catch{}if(d){const m=mr(),h=Pf(m);if(h!=null&&h.hidden){const g=Hf(m);if(g)try{localStorage.setItem(Vf,g.id)}catch{}}}Hi(mr(),d,!0),uf()},[]);return y.useEffect(()=>{Hi(s,i)},[s,i]),y.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia(zb),m=()=>{const h=mr(),g=yc();if(g){const v=Pf(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&Hi(h,g),v!=null&&v.hidden){const b=Hf(h);b!=null&&b.variantDarkId&&b.variantLightId&&Hi(h,g)}}uf()};return d.addEventListener("change",m),()=>{d.removeEventListener("change",m)}},[]),{themeId:s,setTheme:c,resolvedThemeId:o,preferSystem:i,setPreferSystem:u}}const Vb=y.createContext(void 0);function s2({children:n}){const s=n2();return l.jsx(Vb.Provider,{value:s,children:n})}function qb(){const n=y.useContext(Vb);if(!n)throw new Error("useThemeContext must be used within ThemeProvider");return n}const a2="_container_1mq5u_1",i2="_hamburger_1mq5u_33",o2="_brand_1mq5u_49",r2="_brandLogo_1mq5u_68",l2="_info_1mq5u_75",c2="_connectionLabel_1mq5u_90",u2="_connectionDot_1mq5u_103",d2="_connected_1mq5u_106",f2="_disconnected_1mq5u_110",js={container:a2,hamburger:i2,brand:o2,brandLogo:r2,info:l2,connectionLabel:c2,connectionDot:u2,connected:d2,disconnected:f2};function p2({connected:n,environments:s,sessions:i,onToggleSidebar:o,sidebarOpen:c}){const u=St(),d=s.length,m=s.filter(g=>g.status==="connected").length,h=i.filter(g=>["running","idle"].includes(g.status)).length;return l.jsxs("div",{className:js.container,children:[o&&l.jsx("button",{type:"button",className:js.hamburger,onClick:o,"aria-label":"Toggle sidebar","aria-expanded":c,children:"☰"}),l.jsxs("button",{type:"button",className:js.brand,onClick:()=>u(Ya),title:"Home",children:[l.jsx("img",{src:"/icon-192x192.png",alt:"",className:js.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]}),l.jsxs("div",{className:js.info,children:[l.jsxs("span",{"aria-label":n?"Connected":"Disconnected",children:[l.jsx("span",{className:`${js.connectionDot} ${n?js.connected:js.disconnected}`,"aria-hidden":"true",children:"●"})," ",l.jsx("span",{className:js.connectionLabel,"aria-hidden":"true",children:n?"Connected":"Disconnected"})]}),l.jsxs("span",{children:[m,"/",d," env",d!==1?"s":""]}),l.jsxs("span",{children:[h," active"]})]})]})}const m2="_nav_13gkc_1",h2="_tab_13gkc_35",g2="_tabIcon_13gkc_68",v2="_tabLabel_13gkc_79",y2="_tabActive_13gkc_84",ir={nav:m2,tab:h2,tabIcon:g2,tabLabel:v2,tabActive:y2},za=[{view:"dashboard",label:"Dashboard",icon:"🏠",route:Ya,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:"💬",route:pw,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:"📋",route:mw,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:"🖥️",route:Xi,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:"🧠",route:Db,testId:"sidebar-tab-knowledge"},{view:"settings",label:"Settings",icon:"⚙️",route:cw,testId:"sidebar-tab-settings"}];function b2(n){return n===Ya||n==="/"?"dashboard":n.startsWith("/chat")||n.startsWith("/sessions")?"chat":n.startsWith("/workspaces")||n.startsWith("/environments")?"environments":n.startsWith(Db)?"knowledge":n.startsWith(Ji)?"settings":"tasks"}function _2(){const n=It(),s=St(),i=y.useRef(null),o=b2(n.pathname),c=y.useCallback(d=>{s(d.route)},[s]),u=y.useCallback(d=>{var b,_;const m=(b=i.current)==null?void 0:b.querySelectorAll('[role="tab"]');if(!m)return;const h=Array.from(m).findIndex(S=>S===document.activeElement),g=h>=0?h:za.findIndex(S=>S.view===o);let v=g;if(d.key==="ArrowRight"||d.key==="j"||d.key==="J")d.preventDefault(),v=(g+1)%za.length;else if(d.key==="ArrowLeft"||d.key==="k"||d.key==="K")d.preventDefault(),v=(g-1+za.length)%za.length;else if(d.key==="Home")d.preventDefault(),v=0;else if(d.key==="End")d.preventDefault(),v=za.length-1;else return;s(za[v].route),(_=m[v])==null||_.focus()},[o,s]);return l.jsx("nav",{className:ir.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:za.map(d=>{const m=d.view===o;return l.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${ir.tab} ${m?ir.tabActive:""}`,onClick:()=>c(d),"data-testid":d.testId,title:d.label,"aria-label":d.label,children:[l.jsx("span",{className:ir.tabIcon,"aria-hidden":"true",children:d.icon}),l.jsx("span",{className:ir.tabLabel,children:d.label})]},d.view)})})}const Hb=y.createContext(void 0),Gb=y.createContext(void 0);function x2({children:n}){const[s,i]=y.useState(void 0),o=y.useCallback(c=>{i(c)},[]);return l.jsx(Gb.Provider,{value:o,children:l.jsx(Hb.Provider,{value:s,children:n})})}function $b(){return y.useContext(Hb)}function S2(){const n=y.useContext(Gb);if(n===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return n}const T2="_container_pi6ii_1",k2="_content_pi6ii_66",k0={container:T2,content:k2},w2=320,Fb=220,Zb=600,Kb="grackle-sidebar-width";function N2(){try{const n=localStorage.getItem(Kb);if(n!==null){const s=Number(n);if(Number.isFinite(s)&&s>=Fb&&s<=Zb)return s}}catch{}return w2}function j2(n){try{localStorage.setItem(Kb,String(n))}catch{}}function C2(){const[n]=y.useState(N2),s=y.useRef(null),i=$b();if(y.useEffect(()=>{const o=s.current;if(!o)return;const c=new ResizeObserver(u=>{for(const d of u){const m=d.borderBoxSize[0];if(m){const h=Math.round(m.inlineSize);h>=Fb&&h<=Zb&&j2(h)}}});return c.observe(o),()=>{c.disconnect()}},[]),i!==void 0)return l.jsx("div",{className:k0.container,ref:s,"data-testid":"sidebar",style:{width:n},children:l.jsx("div",{className:k0.content,children:i})})}function Ic(n){const s=S2();y.useLayoutEffect(()=>(s(n),()=>{s(void 0)}),[n,s])}const xp=y.createContext({});function Sp(n){const s=y.useRef(null);return s.current===null&&(s.current=n()),s.current}const Bc=y.createContext(null),Tp=y.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});class E2 extends y.Component{getSnapshotBeforeUpdate(s){const i=this.props.childRef.current;if(i&&s.isPresent&&!this.props.isPresent){const o=this.props.sizeRef.current;o.height=i.offsetHeight||0,o.width=i.offsetWidth||0,o.top=i.offsetTop,o.left=i.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function A2({children:n,isPresent:s}){const i=y.useId(),o=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0}),{nonce:u}=y.useContext(Tp);return y.useInsertionEffect(()=>{const{width:d,height:m,top:h,left:g}=c.current;if(s||!o.current||!d||!m)return;o.current.dataset.motionPopId=i;const v=document.createElement("style");return u&&(v.nonce=u),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
|
|
465
|
+
[data-motion-pop-id="${i}"] {
|
|
466
|
+
position: absolute !important;
|
|
467
|
+
width: ${d}px !important;
|
|
468
|
+
height: ${m}px !important;
|
|
469
|
+
top: ${h}px !important;
|
|
470
|
+
left: ${g}px !important;
|
|
471
|
+
}
|
|
472
|
+
`),()=>{document.head.removeChild(v)}},[s]),l.jsx(E2,{isPresent:s,childRef:o,sizeRef:c,children:y.cloneElement(n,{ref:o})})}const D2=({children:n,initial:s,isPresent:i,onExitComplete:o,custom:c,presenceAffectsLayout:u,mode:d})=>{const m=Sp(R2),h=y.useId(),g=y.useCallback(b=>{m.set(b,!0);for(const _ of m.values())if(!_)return;o&&o()},[m,o]),v=y.useMemo(()=>({id:h,initial:s,isPresent:i,custom:c,onExitComplete:g,register:b=>(m.set(b,!1),()=>m.delete(b))}),u?[Math.random(),g]:[i,g]);return y.useMemo(()=>{m.forEach((b,_)=>m.set(_,!1))},[i]),y.useEffect(()=>{!i&&!m.size&&o&&o()},[i]),d==="popLayout"&&(n=l.jsx(A2,{isPresent:i,children:n})),l.jsx(Bc.Provider,{value:v,children:n})};function R2(){return new Map}function Yb(n=!0){const s=y.useContext(Bc);if(s===null)return[!0,null];const{isPresent:i,onExitComplete:o,register:c}=s,u=y.useId();y.useEffect(()=>{n&&c(u)},[n]);const d=y.useCallback(()=>n&&o&&o(u),[u,o,n]);return!i&&o?[!1,d]:[!0]}const tc=n=>n.key||"";function w0(n){const s=[];return y.Children.forEach(n,i=>{y.isValidElement(i)&&s.push(i)}),s}const kp=typeof window<"u",Jb=kp?y.useLayoutEffect:y.useEffect,rs=({children:n,custom:s,initial:i=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:u="sync",propagate:d=!1})=>{const[m,h]=Yb(d),g=y.useMemo(()=>w0(n),[n]),v=d&&!m?[]:g.map(tc),b=y.useRef(!0),_=y.useRef(g),S=Sp(()=>new Map),[T,N]=y.useState(g),[j,w]=y.useState(g);Jb(()=>{b.current=!1,_.current=g;for(let O=0;O<j.length;O++){const C=tc(j[O]);v.includes(C)?S.delete(C):S.get(C)!==!0&&S.set(C,!1)}},[j,v.length,v.join("-")]);const E=[];if(g!==T){let O=[...g];for(let C=0;C<j.length;C++){const M=j[C],G=tc(M);v.includes(G)||(O.splice(C,0,M),E.push(M))}u==="wait"&&E.length&&(O=E),w(w0(O)),N(g);return}const{forceRender:A}=y.useContext(xp);return l.jsx(l.Fragment,{children:j.map(O=>{const C=tc(O),M=d&&!m?!1:g===j||v.includes(C),G=()=>{if(S.has(C))S.set(C,!0);else return;let U=!0;S.forEach(V=>{V||(U=!1)}),U&&(A==null||A(),w(_.current),d&&(h==null||h()),o&&o())};return l.jsx(D2,{isPresent:M,initial:!b.current||i?void 0:!1,custom:M?void 0:s,presenceAffectsLayout:c,mode:u,onExitComplete:M?void 0:G,children:O},C)})})},_n=n=>n;let Wb=_n;const M2={useManualTiming:!1};function O2(n){let s=new Set,i=new Set,o=!1,c=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function m(g){u.has(g)&&(h.schedule(g),n()),g(d)}const h={schedule:(g,v=!1,b=!1)=>{const S=b&&o?s:i;return v&&u.add(g),S.has(g)||S.add(g),g},cancel:g=>{i.delete(g),u.delete(g)},process:g=>{if(d=g,o){c=!0;return}o=!0,[s,i]=[i,s],s.forEach(m),s.clear(),o=!1,c&&(c=!1,h.process(g))}};return h}const nc=["read","resolveKeyframes","update","preRender","render","postRender"],I2=40;function Xb(n,s){let i=!1,o=!0;const c={delta:0,timestamp:0,isProcessing:!1},u=()=>i=!0,d=nc.reduce((w,E)=>(w[E]=O2(u),w),{}),{read:m,resolveKeyframes:h,update:g,preRender:v,render:b,postRender:_}=d,S=()=>{const w=performance.now();i=!1,c.delta=o?1e3/60:Math.max(Math.min(w-c.timestamp,I2),1),c.timestamp=w,c.isProcessing=!0,m.process(c),h.process(c),g.process(c),v.process(c),b.process(c),_.process(c),c.isProcessing=!1,i&&s&&(o=!1,n(S))},T=()=>{i=!0,o=!0,c.isProcessing||n(S)};return{schedule:nc.reduce((w,E)=>{const A=d[E];return w[E]=(O,C=!1,M=!1)=>(i||T(),A.schedule(O,C,M)),w},{}),cancel:w=>{for(let E=0;E<nc.length;E++)d[nc[E]].cancel(w)},state:c,steps:d}}const{schedule:ft,cancel:ma,state:Ft,steps:df}=Xb(typeof requestAnimationFrame<"u"?requestAnimationFrame:_n,!0),Qb=y.createContext({strict:!1}),N0={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"]},eo={};for(const n in N0)eo[n]={isEnabled:s=>N0[n].some(i=>!!s[i])};function B2(n){for(const s in n)eo[s]={...eo[s],...n[s]}}const L2=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 bc(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||L2.has(n)}let e_=n=>!bc(n);function U2(n){n&&(e_=s=>s.startsWith("on")?!bc(s):n(s))}try{U2(require("@emotion/is-prop-valid").default)}catch{}function z2(n,s,i){const o={};for(const c in n)c==="values"&&typeof n.values=="object"||(e_(c)||i===!0&&bc(c)||!s&&!bc(c)||n.draggable&&c.startsWith("onDrag"))&&(o[c]=n[c]);return o}function P2(n){if(typeof Proxy>"u")return n;const s=new Map,i=(...o)=>n(...o);return new Proxy(i,{get:(o,c)=>c==="create"?n:(s.has(c)||s.set(c,n(c)),s.get(c))})}const Lc=y.createContext({});function Sr(n){return typeof n=="string"||Array.isArray(n)}function Uc(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const wp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Np=["initial",...wp];function zc(n){return Uc(n.animate)||Np.some(s=>Sr(n[s]))}function t_(n){return!!(zc(n)||n.variants)}function V2(n,s){if(zc(n)){const{initial:i,animate:o}=n;return{initial:i===!1||Sr(i)?i:void 0,animate:Sr(o)?o:void 0}}return n.inherit!==!1?s:{}}function q2(n){const{initial:s,animate:i}=V2(n,y.useContext(Lc));return y.useMemo(()=>({initial:s,animate:i}),[j0(s),j0(i)])}function j0(n){return Array.isArray(n)?n.join(" "):n}const H2=Symbol.for("motionComponentSymbol");function Gi(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function G2(n,s,i){return y.useCallback(o=>{o&&n.onMount&&n.onMount(o),s&&(o?s.mount(o):s.unmount()),i&&(typeof i=="function"?i(o):Gi(i)&&(i.current=o))},[s])}const jp=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),$2="framerAppearId",n_="data-"+jp($2),{schedule:Cp}=Xb(queueMicrotask,!1),s_=y.createContext({});function F2(n,s,i,o,c){var u,d;const{visualElement:m}=y.useContext(Lc),h=y.useContext(Qb),g=y.useContext(Bc),v=y.useContext(Tp).reducedMotion,b=y.useRef(null);o=o||h.renderer,!b.current&&o&&(b.current=o(n,{visualState:s,parent:m,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const _=b.current,S=y.useContext(s_);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&Z2(b.current,i,c,S);const T=y.useRef(!1);y.useInsertionEffect(()=>{_&&T.current&&_.update(i,g)});const N=i[n_],j=y.useRef(!!N&&!(!((u=window.MotionHandoffIsComplete)===null||u===void 0)&&u.call(window,N))&&((d=window.MotionHasOptimisedAnimation)===null||d===void 0?void 0:d.call(window,N)));return Jb(()=>{_&&(T.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Cp.render(_.render),j.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!j.current&&_.animationState&&_.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{var w;(w=window.MotionHandoffMarkAsComplete)===null||w===void 0||w.call(window,N)}),j.current=!1))}),_}function Z2(n,s,i,o){const{layoutId:c,layout:u,drag:d,dragConstraints:m,layoutScroll:h,layoutRoot:g}=s;n.projection=new i(n.latestValues,s["data-framer-portal-id"]?void 0:a_(n.parent)),n.projection.setOptions({layoutId:c,layout:u,alwaysMeasureLayout:!!d||m&&Gi(m),visualElement:n,animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:h,layoutRoot:g})}function a_(n){if(n)return n.options.allowProjection!==!1?n.projection:a_(n.parent)}function K2({preloadedFeatures:n,createVisualElement:s,useRender:i,useVisualState:o,Component:c}){var u,d;n&&B2(n);function m(g,v){let b;const _={...y.useContext(Tp),...g,layoutId:Y2(g)},{isStatic:S}=_,T=q2(g),N=o(g,S);if(!S&&kp){J2();const j=W2(_);b=j.MeasureLayout,T.visualElement=F2(c,N,_,s,j.ProjectionNode)}return l.jsxs(Lc.Provider,{value:T,children:[b&&T.visualElement?l.jsx(b,{visualElement:T.visualElement,..._}):null,i(c,g,G2(N,T.visualElement,v),N,S,T.visualElement)]})}m.displayName=`motion.${typeof c=="string"?c:`create(${(d=(u=c.displayName)!==null&&u!==void 0?u:c.name)!==null&&d!==void 0?d:""})`}`;const h=y.forwardRef(m);return h[H2]=c,h}function Y2({layoutId:n}){const s=y.useContext(xp).id;return s&&n!==void 0?s+"-"+n:n}function J2(n,s){y.useContext(Qb).strict}function W2(n){const{drag:s,layout:i}=eo;if(!s&&!i)return{};const o={...s,...i};return{MeasureLayout:s!=null&&s.isEnabled(n)||i!=null&&i.isEnabled(n)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}const X2=["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 Ep(n){return typeof n!="string"||n.includes("-")?!1:!!(X2.indexOf(n)>-1||/[A-Z]/u.test(n))}function C0(n){const s=[{},{}];return n==null||n.values.forEach((i,o)=>{s[0][o]=i.get(),s[1][o]=i.getVelocity()}),s}function Ap(n,s,i,o){if(typeof s=="function"){const[c,u]=C0(o);s=s(i!==void 0?i:n.custom,c,u)}if(typeof s=="string"&&(s=n.variants&&n.variants[s]),typeof s=="function"){const[c,u]=C0(o);s=s(i!==void 0?i:n.custom,c,u)}return s}const Gf=n=>Array.isArray(n),Q2=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),eN=n=>Gf(n)?n[n.length-1]||0:n,Xt=n=>!!(n&&n.getVelocity);function pc(n){const s=Xt(n)?n.get():n;return Q2(s)?s.toValue():s}function tN({scrapeMotionValuesFromProps:n,createRenderState:s,onUpdate:i},o,c,u){const d={latestValues:nN(o,c,u,n),renderState:s()};return i&&(d.onMount=m=>i({props:o,current:m,...d}),d.onUpdate=m=>i(m)),d}const i_=n=>(s,i)=>{const o=y.useContext(Lc),c=y.useContext(Bc),u=()=>tN(n,s,o,c);return i?u():Sp(u)};function nN(n,s,i,o){const c={},u=o(n,{});for(const _ in u)c[_]=pc(u[_]);let{initial:d,animate:m}=n;const h=zc(n),g=t_(n);s&&g&&!h&&n.inherit!==!1&&(d===void 0&&(d=s.initial),m===void 0&&(m=s.animate));let v=i?i.initial===!1:!1;v=v||d===!1;const b=v?m:d;if(b&&typeof b!="boolean"&&!Uc(b)){const _=Array.isArray(b)?b:[b];for(let S=0;S<_.length;S++){const T=Ap(n,_[S]);if(T){const{transitionEnd:N,transition:j,...w}=T;for(const E in w){let A=w[E];if(Array.isArray(A)){const O=v?A.length-1:0;A=A[O]}A!==null&&(c[E]=A)}for(const E in N)c[E]=N[E]}}}return c}const oo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ti=new Set(oo),o_=n=>s=>typeof s=="string"&&s.startsWith(n),r_=o_("--"),sN=o_("var(--"),Dp=n=>sN(n)?aN.test(n.split("/*")[0].trim()):!1,aN=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,l_=(n,s)=>s&&typeof n=="number"?s.transform(n):n,Is=(n,s,i)=>i>s?s:i<n?n:i,ro={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Tr={...ro,transform:n=>Is(0,1,n)},sc={...ro,default:1},Ar=n=>({test:s=>typeof s=="string"&&s.endsWith(n)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${n}`}),pa=Ar("deg"),as=Ar("%"),ke=Ar("px"),iN=Ar("vh"),oN=Ar("vw"),E0={...as,parse:n=>as.parse(n)/100,transform:n=>as.transform(n*100)},rN={borderWidth:ke,borderTopWidth:ke,borderRightWidth:ke,borderBottomWidth:ke,borderLeftWidth:ke,borderRadius:ke,radius:ke,borderTopLeftRadius:ke,borderTopRightRadius:ke,borderBottomRightRadius:ke,borderBottomLeftRadius:ke,width:ke,maxWidth:ke,height:ke,maxHeight:ke,top:ke,right:ke,bottom:ke,left:ke,padding:ke,paddingTop:ke,paddingRight:ke,paddingBottom:ke,paddingLeft:ke,margin:ke,marginTop:ke,marginRight:ke,marginBottom:ke,marginLeft:ke,backgroundPositionX:ke,backgroundPositionY:ke},lN={rotate:pa,rotateX:pa,rotateY:pa,rotateZ:pa,scale:sc,scaleX:sc,scaleY:sc,scaleZ:sc,skew:pa,skewX:pa,skewY:pa,distance:ke,translateX:ke,translateY:ke,translateZ:ke,x:ke,y:ke,z:ke,perspective:ke,transformPerspective:ke,opacity:Tr,originX:E0,originY:E0,originZ:ke},A0={...ro,transform:Math.round},Rp={...rN,...lN,zIndex:A0,size:ke,fillOpacity:Tr,strokeOpacity:Tr,numOctaves:A0},cN={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},uN=oo.length;function dN(n,s,i){let o="",c=!0;for(let u=0;u<uN;u++){const d=oo[u],m=n[d];if(m===void 0)continue;let h=!0;if(typeof m=="number"?h=m===(d.startsWith("scale")?1:0):h=parseFloat(m)===0,!h||i){const g=l_(m,Rp[d]);if(!h){c=!1;const v=cN[d]||d;o+=`${v}(${g}) `}i&&(s[d]=g)}}return o=o.trim(),i?o=i(s,c?"":o):c&&(o="none"),o}function Mp(n,s,i){const{style:o,vars:c,transformOrigin:u}=n;let d=!1,m=!1;for(const h in s){const g=s[h];if(ti.has(h)){d=!0;continue}else if(r_(h)){c[h]=g;continue}else{const v=l_(g,Rp[h]);h.startsWith("origin")?(m=!0,u[h]=v):o[h]=v}}if(s.transform||(d||i?o.transform=dN(s,n.transform,i):o.transform&&(o.transform="none")),m){const{originX:h="50%",originY:g="50%",originZ:v=0}=u;o.transformOrigin=`${h} ${g} ${v}`}}const fN={offset:"stroke-dashoffset",array:"stroke-dasharray"},pN={offset:"strokeDashoffset",array:"strokeDasharray"};function mN(n,s,i=1,o=0,c=!0){n.pathLength=1;const u=c?fN:pN;n[u.offset]=ke.transform(-o);const d=ke.transform(s),m=ke.transform(i);n[u.array]=`${d} ${m}`}function D0(n,s,i){return typeof n=="string"?n:ke.transform(s+i*n)}function hN(n,s,i){const o=D0(s,n.x,n.width),c=D0(i,n.y,n.height);return`${o} ${c}`}function Op(n,{attrX:s,attrY:i,attrScale:o,originX:c,originY:u,pathLength:d,pathSpacing:m=1,pathOffset:h=0,...g},v,b){if(Mp(n,g,b),v){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:_,style:S,dimensions:T}=n;_.transform&&(T&&(S.transform=_.transform),delete _.transform),T&&(c!==void 0||u!==void 0||S.transform)&&(S.transformOrigin=hN(T,c!==void 0?c:.5,u!==void 0?u:.5)),s!==void 0&&(_.x=s),i!==void 0&&(_.y=i),o!==void 0&&(_.scale=o),d!==void 0&&mN(_,d,m,h,!1)}const Ip=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),c_=()=>({...Ip(),attrs:{}}),Bp=n=>typeof n=="string"&&n.toLowerCase()==="svg";function u_(n,{style:s,vars:i},o,c){Object.assign(n.style,s,c&&c.getProjectionStyles(o));for(const u in i)n.style.setProperty(u,i[u])}const d_=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 f_(n,s,i,o){u_(n,s,void 0,o);for(const c in s.attrs)n.setAttribute(d_.has(c)?c:jp(c),s.attrs[c])}const _c={};function gN(n){Object.assign(_c,n)}function p_(n,{layout:s,layoutId:i}){return ti.has(n)||n.startsWith("origin")||(s||i!==void 0)&&(!!_c[n]||n==="opacity")}function Lp(n,s,i){var o;const{style:c}=n,u={};for(const d in c)(Xt(c[d])||s.style&&Xt(s.style[d])||p_(d,n)||((o=i==null?void 0:i.getValue(d))===null||o===void 0?void 0:o.liveStyle)!==void 0)&&(u[d]=c[d]);return u}function m_(n,s,i){const o=Lp(n,s,i);for(const c in n)if(Xt(n[c])||Xt(s[c])){const u=oo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;o[u]=n[c]}return o}function vN(n,s){try{s.dimensions=typeof n.getBBox=="function"?n.getBBox():n.getBoundingClientRect()}catch{s.dimensions={x:0,y:0,width:0,height:0}}}const R0=["x","y","width","height","cx","cy","r"],yN={useVisualState:i_({scrapeMotionValuesFromProps:m_,createRenderState:c_,onUpdate:({props:n,prevProps:s,current:i,renderState:o,latestValues:c})=>{if(!i)return;let u=!!n.drag;if(!u){for(const m in c)if(ti.has(m)){u=!0;break}}if(!u)return;let d=!s;if(s)for(let m=0;m<R0.length;m++){const h=R0[m];n[h]!==s[h]&&(d=!0)}d&&ft.read(()=>{vN(i,o),ft.render(()=>{Op(o,c,Bp(i.tagName),n.transformTemplate),f_(i,o)})})}})},bN={useVisualState:i_({scrapeMotionValuesFromProps:Lp,createRenderState:Ip})};function h_(n,s,i){for(const o in s)!Xt(s[o])&&!p_(o,i)&&(n[o]=s[o])}function _N({transformTemplate:n},s){return y.useMemo(()=>{const i=Ip();return Mp(i,s,n),Object.assign({},i.vars,i.style)},[s])}function xN(n,s){const i=n.style||{},o={};return h_(o,i,n),Object.assign(o,_N(n,s)),o}function SN(n,s){const i={},o=xN(n,s);return n.drag&&n.dragListener!==!1&&(i.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(i.tabIndex=0),i.style=o,i}function TN(n,s,i,o){const c=y.useMemo(()=>{const u=c_();return Op(u,s,Bp(o),n.transformTemplate),{...u.attrs,style:{...u.style}}},[s]);if(n.style){const u={};h_(u,n.style,n),c.style={...u,...c.style}}return c}function kN(n=!1){return(i,o,c,{latestValues:u},d)=>{const h=(Ep(i)?TN:SN)(o,u,d,i),g=z2(o,typeof i=="string",n),v=i!==y.Fragment?{...g,...h,ref:c}:{},{children:b}=o,_=y.useMemo(()=>Xt(b)?b.get():b,[b]);return y.createElement(i,{...v,children:_})}}function wN(n,s){return function(o,{forwardMotionProps:c}={forwardMotionProps:!1}){const d={...Ep(o)?yN:bN,preloadedFeatures:n,useRender:kN(c),createVisualElement:s,Component:o};return K2(d)}}function g_(n,s){if(!Array.isArray(s))return!1;const i=s.length;if(i!==n.length)return!1;for(let o=0;o<i;o++)if(s[o]!==n[o])return!1;return!0}function Pc(n,s,i){const o=n.getProps();return Ap(o,s,i!==void 0?i:o.custom,n)}function Up(n,s){return n?n[s]||n.default||n:void 0}const v_=new Set(["width","height","top","left","right","bottom",...oo]);let mc;function NN(){mc=void 0}const is={now:()=>(mc===void 0&&is.set(Ft.isProcessing||M2.useManualTiming?Ft.timestamp:performance.now()),mc),set:n=>{mc=n,queueMicrotask(NN)}};function zp(n,s){n.indexOf(s)===-1&&n.push(s)}function Pp(n,s){const i=n.indexOf(s);i>-1&&n.splice(i,1)}class Vp{constructor(){this.subscriptions=[]}add(s){return zp(this.subscriptions,s),()=>Pp(this.subscriptions,s)}notify(s,i,o){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,i,o);else for(let u=0;u<c;u++){const d=this.subscriptions[u];d&&d(s,i,o)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function y_(n,s){return s?n*(1e3/s):0}const M0=30,jN=n=>!isNaN(parseFloat(n));class CN{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(o,c=!0)=>{const u=is.now();this.updatedAt!==u&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(o),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=i.owner}setCurrent(s){this.current=s,this.updatedAt=is.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=jN(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,i){this.events[s]||(this.events[s]=new Vp);const o=this.events[s].add(i);return s==="change"?()=>{o(),ft.read(()=>{this.events.change.getSize()||this.stop()})}:o}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,i){this.passiveEffect=s,this.stopPassiveEffect=i}set(s,i=!0){!i||!this.passiveEffect?this.updateAndNotify(s,i):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,i,o){this.set(i),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-o}jump(s,i=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,i&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=is.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>M0)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,M0);return y_(parseFloat(this.current)-parseFloat(this.prevFrameValue),i)}start(s){return this.stop(),new Promise(i=>{this.hasAnimated=!0,this.animation=s(i),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function kr(n,s){return new CN(n,s)}function EN(n,s,i){n.hasValue(s)?n.getValue(s).set(i):n.addValue(s,kr(i))}function AN(n,s){const i=Pc(n,s);let{transitionEnd:o={},transition:c={},...u}=i||{};u={...u,...o};for(const d in u){const m=eN(u[d]);EN(n,d,m)}}function DN(n){return!!(Xt(n)&&n.add)}function $f(n,s){const i=n.getValue("willChange");if(DN(i))return i.add(s)}function b_(n){return n.props[n_]}function qp(n){let s;return()=>(s===void 0&&(s=n()),s)}const RN=qp(()=>window.ScrollTimeline!==void 0);class MN{constructor(s){this.stop=()=>this.runAll("stop"),this.animations=s.filter(Boolean)}get finished(){return Promise.all(this.animations.map(s=>"finished"in s?s.finished:s))}getAll(s){return this.animations[0][s]}setAll(s,i){for(let o=0;o<this.animations.length;o++)this.animations[o][s]=i}attachTimeline(s,i){const o=this.animations.map(c=>{if(RN()&&c.attachTimeline)return c.attachTimeline(s);if(typeof i=="function")return i(c)});return()=>{o.forEach((c,u)=>{c&&c(),this.animations[u].stop()})}}get time(){return this.getAll("time")}set time(s){this.setAll("time",s)}get speed(){return this.getAll("speed")}set speed(s){this.setAll("speed",s)}get startTime(){return this.getAll("startTime")}get duration(){let s=0;for(let i=0;i<this.animations.length;i++)s=Math.max(s,this.animations[i].duration);return s}runAll(s){this.animations.forEach(i=>i[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class ON extends MN{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Ds=n=>n*1e3,Rs=n=>n/1e3;function Hp(n){return typeof n=="function"}function O0(n,s){n.timeline=s,n.onfinish=null}const Gp=n=>Array.isArray(n)&&typeof n[0]=="number",IN={linearEasing:void 0};function BN(n,s){const i=qp(n);return()=>{var o;return(o=IN[s])!==null&&o!==void 0?o:i()}}const xc=BN(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),to=(n,s,i)=>{const o=s-n;return o===0?1:(i-n)/o},__=(n,s,i=10)=>{let o="";const c=Math.max(Math.round(s/i),2);for(let u=0;u<c;u++)o+=n(to(0,c-1,u))+", ";return`linear(${o.substring(0,o.length-2)})`};function x_(n){return!!(typeof n=="function"&&xc()||!n||typeof n=="string"&&(n in Ff||xc())||Gp(n)||Array.isArray(n)&&n.every(x_))}const ur=([n,s,i,o])=>`cubic-bezier(${n}, ${s}, ${i}, ${o})`,Ff={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ur([0,.65,.55,1]),circOut:ur([.55,0,1,.45]),backIn:ur([.31,.01,.66,-.59]),backOut:ur([.33,1.53,.69,.99])};function S_(n,s){if(n)return typeof n=="function"&&xc()?__(n,s):Gp(n)?ur(n):Array.isArray(n)?n.map(i=>S_(i,s)||Ff.easeOut):Ff[n]}const T_=(n,s,i)=>(((1-3*i+3*s)*n+(3*i-6*s))*n+3*s)*n,LN=1e-7,UN=12;function zN(n,s,i,o,c){let u,d,m=0;do d=s+(i-s)/2,u=T_(d,o,c)-n,u>0?i=d:s=d;while(Math.abs(u)>LN&&++m<UN);return d}function Dr(n,s,i,o){if(n===s&&i===o)return _n;const c=u=>zN(u,0,1,n,i);return u=>u===0||u===1?u:T_(c(u),s,o)}const k_=n=>s=>s<=.5?n(2*s)/2:(2-n(2*(1-s)))/2,w_=n=>s=>1-n(1-s),N_=Dr(.33,1.53,.69,.99),$p=w_(N_),j_=k_($p),C_=n=>(n*=2)<1?.5*$p(n):.5*(2-Math.pow(2,-10*(n-1))),Fp=n=>1-Math.sin(Math.acos(n)),E_=w_(Fp),A_=k_(Fp),D_=n=>/^0[^.\s]+$/u.test(n);function PN(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||D_(n):!0}const hr=n=>Math.round(n*1e5)/1e5,Zp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function VN(n){return n==null}const qN=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Kp=(n,s)=>i=>!!(typeof i=="string"&&qN.test(i)&&i.startsWith(n)||s&&!VN(i)&&Object.prototype.hasOwnProperty.call(i,s)),R_=(n,s,i)=>o=>{if(typeof o!="string")return o;const[c,u,d,m]=o.match(Zp);return{[n]:parseFloat(c),[s]:parseFloat(u),[i]:parseFloat(d),alpha:m!==void 0?parseFloat(m):1}},HN=n=>Is(0,255,n),ff={...ro,transform:n=>Math.round(HN(n))},Fa={test:Kp("rgb","red"),parse:R_("red","green","blue"),transform:({red:n,green:s,blue:i,alpha:o=1})=>"rgba("+ff.transform(n)+", "+ff.transform(s)+", "+ff.transform(i)+", "+hr(Tr.transform(o))+")"};function GN(n){let s="",i="",o="",c="";return n.length>5?(s=n.substring(1,3),i=n.substring(3,5),o=n.substring(5,7),c=n.substring(7,9)):(s=n.substring(1,2),i=n.substring(2,3),o=n.substring(3,4),c=n.substring(4,5),s+=s,i+=i,o+=o,c+=c),{red:parseInt(s,16),green:parseInt(i,16),blue:parseInt(o,16),alpha:c?parseInt(c,16)/255:1}}const Zf={test:Kp("#"),parse:GN,transform:Fa.transform},$i={test:Kp("hsl","hue"),parse:R_("hue","saturation","lightness"),transform:({hue:n,saturation:s,lightness:i,alpha:o=1})=>"hsla("+Math.round(n)+", "+as.transform(hr(s))+", "+as.transform(hr(i))+", "+hr(Tr.transform(o))+")"},Wt={test:n=>Fa.test(n)||Zf.test(n)||$i.test(n),parse:n=>Fa.test(n)?Fa.parse(n):$i.test(n)?$i.parse(n):Zf.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Fa.transform(n):$i.transform(n)},$N=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function FN(n){var s,i;return isNaN(n)&&typeof n=="string"&&(((s=n.match(Zp))===null||s===void 0?void 0:s.length)||0)+(((i=n.match($N))===null||i===void 0?void 0:i.length)||0)>0}const M_="number",O_="color",ZN="var",KN="var(",I0="${}",YN=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function wr(n){const s=n.toString(),i=[],o={color:[],number:[],var:[]},c=[];let u=0;const m=s.replace(YN,h=>(Wt.test(h)?(o.color.push(u),c.push(O_),i.push(Wt.parse(h))):h.startsWith(KN)?(o.var.push(u),c.push(ZN),i.push(h)):(o.number.push(u),c.push(M_),i.push(parseFloat(h))),++u,I0)).split(I0);return{values:i,split:m,indexes:o,types:c}}function I_(n){return wr(n).values}function B_(n){const{split:s,types:i}=wr(n),o=s.length;return c=>{let u="";for(let d=0;d<o;d++)if(u+=s[d],c[d]!==void 0){const m=i[d];m===M_?u+=hr(c[d]):m===O_?u+=Wt.transform(c[d]):u+=c[d]}return u}}const JN=n=>typeof n=="number"?0:n;function WN(n){const s=I_(n);return B_(n)(s.map(JN))}const ha={test:FN,parse:I_,createTransformer:B_,getAnimatableNone:WN},XN=new Set(["brightness","contrast","saturate","opacity"]);function QN(n){const[s,i]=n.slice(0,-1).split("(");if(s==="drop-shadow")return n;const[o]=i.match(Zp)||[];if(!o)return n;const c=i.replace(o,"");let u=XN.has(s)?1:0;return o!==i&&(u*=100),s+"("+u+c+")"}const ej=/\b([a-z-]*)\(.*?\)/gu,Kf={...ha,getAnimatableNone:n=>{const s=n.match(ej);return s?s.map(QN).join(" "):n}},tj={...Rp,color:Wt,backgroundColor:Wt,outlineColor:Wt,fill:Wt,stroke:Wt,borderColor:Wt,borderTopColor:Wt,borderRightColor:Wt,borderBottomColor:Wt,borderLeftColor:Wt,filter:Kf,WebkitFilter:Kf},Yp=n=>tj[n];function L_(n,s){let i=Yp(n);return i!==Kf&&(i=ha),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const nj=new Set(["auto","none","0"]);function sj(n,s,i){let o=0,c;for(;o<n.length&&!c;){const u=n[o];typeof u=="string"&&!nj.has(u)&&wr(u).values.length&&(c=n[o]),o++}if(c&&i)for(const u of s)n[u]=L_(i,c)}const B0=n=>n===ro||n===ke,L0=(n,s)=>parseFloat(n.split(", ")[s]),U0=(n,s)=>(i,{transform:o})=>{if(o==="none"||!o)return 0;const c=o.match(/^matrix3d\((.+)\)$/u);if(c)return L0(c[1],s);{const u=o.match(/^matrix\((.+)\)$/u);return u?L0(u[1],n):0}},aj=new Set(["x","y","z"]),ij=oo.filter(n=>!aj.has(n));function oj(n){const s=[];return ij.forEach(i=>{const o=n.getValue(i);o!==void 0&&(s.push([i,o.get()]),o.set(i.startsWith("scale")?1:0))}),s}const no={width:({x:n},{paddingLeft:s="0",paddingRight:i="0"})=>n.max-n.min-parseFloat(s)-parseFloat(i),height:({y:n},{paddingTop:s="0",paddingBottom:i="0"})=>n.max-n.min-parseFloat(s)-parseFloat(i),top:(n,{top:s})=>parseFloat(s),left:(n,{left:s})=>parseFloat(s),bottom:({y:n},{top:s})=>parseFloat(s)+(n.max-n.min),right:({x:n},{left:s})=>parseFloat(s)+(n.max-n.min),x:U0(4,13),y:U0(5,14)};no.translateX=no.x;no.translateY=no.y;const Ka=new Set;let Yf=!1,Jf=!1;function U_(){if(Jf){const n=Array.from(Ka).filter(o=>o.needsMeasurement),s=new Set(n.map(o=>o.element)),i=new Map;s.forEach(o=>{const c=oj(o);c.length&&(i.set(o,c),o.render())}),n.forEach(o=>o.measureInitialState()),s.forEach(o=>{o.render();const c=i.get(o);c&&c.forEach(([u,d])=>{var m;(m=o.getValue(u))===null||m===void 0||m.set(d)})}),n.forEach(o=>o.measureEndState()),n.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}Jf=!1,Yf=!1,Ka.forEach(n=>n.complete()),Ka.clear()}function z_(){Ka.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Jf=!0)})}function rj(){z_(),U_()}class Jp{constructor(s,i,o,c,u,d=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=i,this.name=o,this.motionValue=c,this.element=u,this.isAsync=d}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ka.add(this),Yf||(Yf=!0,ft.read(z_),ft.resolveKeyframes(U_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:i,element:o,motionValue:c}=this;for(let u=0;u<s.length;u++)if(s[u]===null)if(u===0){const d=c==null?void 0:c.get(),m=s[s.length-1];if(d!==void 0)s[0]=d;else if(o&&i){const h=o.readValue(i,m);h!=null&&(s[0]=h)}s[0]===void 0&&(s[0]=m),c&&d===void 0&&c.set(s[0])}else s[u]=s[u-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ka.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ka.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const P_=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),lj=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function cj(n){const s=lj.exec(n);if(!s)return[,];const[,i,o,c]=s;return[`--${i??o}`,c]}function V_(n,s,i=1){const[o,c]=cj(n);if(!o)return;const u=window.getComputedStyle(s).getPropertyValue(o);if(u){const d=u.trim();return P_(d)?parseFloat(d):d}return Dp(c)?V_(c,s,i+1):c}const q_=n=>s=>s.test(n),uj={test:n=>n==="auto",parse:n=>n},H_=[ro,ke,as,pa,oN,iN,uj],z0=n=>H_.find(q_(n));class G_ extends Jp{constructor(s,i,o,c,u){super(s,i,o,c,u,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:i,name:o}=this;if(!i||!i.current)return;super.readKeyframes();for(let h=0;h<s.length;h++){let g=s[h];if(typeof g=="string"&&(g=g.trim(),Dp(g))){const v=V_(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!v_.has(o)||s.length!==2)return;const[c,u]=s,d=z0(c),m=z0(u);if(d!==m)if(B0(d)&&B0(m))for(let h=0;h<s.length;h++){const g=s[h];typeof g=="string"&&(s[h]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:i}=this,o=[];for(let c=0;c<s.length;c++)PN(s[c])&&o.push(c);o.length&&sj(s,o,i)}measureInitialState(){const{element:s,unresolvedKeyframes:i,name:o}=this;if(!s||!s.current)return;o==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=no[o](s.measureViewportBox(),window.getComputedStyle(s.current)),i[0]=this.measuredOrigin;const c=i[i.length-1];c!==void 0&&s.getValue(o,c).jump(c,!1)}measureEndState(){var s;const{element:i,name:o,unresolvedKeyframes:c}=this;if(!i||!i.current)return;const u=i.getValue(o);u&&u.jump(this.measuredOrigin,!1);const d=c.length-1,m=c[d];c[d]=no[o](i.measureViewportBox(),window.getComputedStyle(i.current)),m!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=m),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([h,g])=>{i.getValue(h).set(g)}),this.resolveNoneKeyframes()}}const P0=(n,s)=>s==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(ha.test(n)||n==="0")&&!n.startsWith("url("));function dj(n){const s=n[0];if(n.length===1)return!0;for(let i=0;i<n.length;i++)if(n[i]!==s)return!0}function fj(n,s,i,o){const c=n[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const u=n[n.length-1],d=P0(c,s),m=P0(u,s);return!d||!m?!1:dj(n)||(i==="spring"||Hp(i))&&o}const pj=n=>n!==null;function Vc(n,{repeat:s,repeatType:i="loop"},o){const c=n.filter(pj),u=s&&i!=="loop"&&s%2===1?0:c.length-1;return!u||o===void 0?c[u]:o}const mj=40;class $_{constructor({autoplay:s=!0,delay:i=0,type:o="keyframes",repeat:c=0,repeatDelay:u=0,repeatType:d="loop",...m}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=is.now(),this.options={autoplay:s,delay:i,type:o,repeat:c,repeatDelay:u,repeatType:d,...m},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>mj?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&rj(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=is.now(),this.hasAttemptedResolve=!0;const{name:o,type:c,velocity:u,delay:d,onComplete:m,onUpdate:h,isGenerator:g}=this.options;if(!g&&!fj(s,o,c,u))if(d)this.options.duration=0;else{h&&h(Vc(s,this.options,i)),m&&m(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,i);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:i,...v},this.onPostResolved())}onPostResolved(){}then(s,i){return this.currentFinishedPromise.then(s,i)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const Wf=2e4;function F_(n){let s=0;const i=50;let o=n.next(s);for(;!o.done&&s<Wf;)s+=i,o=n.next(s);return s>=Wf?1/0:s}const vt=(n,s,i)=>n+(s-n)*i;function pf(n,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?n+(s-n)*6*i:i<1/2?s:i<2/3?n+(s-n)*(2/3-i)*6:n}function hj({hue:n,saturation:s,lightness:i,alpha:o}){n/=360,s/=100,i/=100;let c=0,u=0,d=0;if(!s)c=u=d=i;else{const m=i<.5?i*(1+s):i+s-i*s,h=2*i-m;c=pf(h,m,n+1/3),u=pf(h,m,n),d=pf(h,m,n-1/3)}return{red:Math.round(c*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:o}}function Sc(n,s){return i=>i>0?s:n}const mf=(n,s,i)=>{const o=n*n,c=i*(s*s-o)+o;return c<0?0:Math.sqrt(c)},gj=[Zf,Fa,$i],vj=n=>gj.find(s=>s.test(n));function V0(n){const s=vj(n);if(!s)return!1;let i=s.parse(n);return s===$i&&(i=hj(i)),i}const q0=(n,s)=>{const i=V0(n),o=V0(s);if(!i||!o)return Sc(n,s);const c={...i};return u=>(c.red=mf(i.red,o.red,u),c.green=mf(i.green,o.green,u),c.blue=mf(i.blue,o.blue,u),c.alpha=vt(i.alpha,o.alpha,u),Fa.transform(c))},yj=(n,s)=>i=>s(n(i)),Rr=(...n)=>n.reduce(yj),Xf=new Set(["none","hidden"]);function bj(n,s){return Xf.has(n)?i=>i<=0?n:s:i=>i>=1?s:n}function _j(n,s){return i=>vt(n,s,i)}function Wp(n){return typeof n=="number"?_j:typeof n=="string"?Dp(n)?Sc:Wt.test(n)?q0:Tj:Array.isArray(n)?Z_:typeof n=="object"?Wt.test(n)?q0:xj:Sc}function Z_(n,s){const i=[...n],o=i.length,c=n.map((u,d)=>Wp(u)(u,s[d]));return u=>{for(let d=0;d<o;d++)i[d]=c[d](u);return i}}function xj(n,s){const i={...n,...s},o={};for(const c in i)n[c]!==void 0&&s[c]!==void 0&&(o[c]=Wp(n[c])(n[c],s[c]));return c=>{for(const u in o)i[u]=o[u](c);return i}}function Sj(n,s){var i;const o=[],c={color:0,var:0,number:0};for(let u=0;u<s.values.length;u++){const d=s.types[u],m=n.indexes[d][c[d]],h=(i=n.values[m])!==null&&i!==void 0?i:0;o[u]=h,c[d]++}return o}const Tj=(n,s)=>{const i=ha.createTransformer(s),o=wr(n),c=wr(s);return o.indexes.var.length===c.indexes.var.length&&o.indexes.color.length===c.indexes.color.length&&o.indexes.number.length>=c.indexes.number.length?Xf.has(n)&&!c.values.length||Xf.has(s)&&!o.values.length?bj(n,s):Rr(Z_(Sj(o,c),c.values),i):Sc(n,s)};function K_(n,s,i){return typeof n=="number"&&typeof s=="number"&&typeof i=="number"?vt(n,s,i):Wp(n)(n,s)}const kj=5;function Y_(n,s,i){const o=Math.max(s-kj,0);return y_(i-n(o),s-o)}const _t={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},hf=.001;function wj({duration:n=_t.duration,bounce:s=_t.bounce,velocity:i=_t.velocity,mass:o=_t.mass}){let c,u,d=1-s;d=Is(_t.minDamping,_t.maxDamping,d),n=Is(_t.minDuration,_t.maxDuration,Rs(n)),d<1?(c=g=>{const v=g*d,b=v*n,_=v-i,S=Qf(g,d),T=Math.exp(-b);return hf-_/S*T},u=g=>{const b=g*d*n,_=b*i+i,S=Math.pow(d,2)*Math.pow(g,2)*n,T=Math.exp(-b),N=Qf(Math.pow(g,2),d);return(-c(g)+hf>0?-1:1)*((_-S)*T)/N}):(c=g=>{const v=Math.exp(-g*n),b=(g-i)*n+1;return-hf+v*b},u=g=>{const v=Math.exp(-g*n),b=(i-g)*(n*n);return v*b});const m=5/n,h=jj(c,u,m);if(n=Ds(n),isNaN(h))return{stiffness:_t.stiffness,damping:_t.damping,duration:n};{const g=Math.pow(h,2)*o;return{stiffness:g,damping:d*2*Math.sqrt(o*g),duration:n}}}const Nj=12;function jj(n,s,i){let o=i;for(let c=1;c<Nj;c++)o=o-n(o)/s(o);return o}function Qf(n,s){return n*Math.sqrt(1-s*s)}const Cj=["duration","bounce"],Ej=["stiffness","damping","mass"];function H0(n,s){return s.some(i=>n[i]!==void 0)}function Aj(n){let s={velocity:_t.velocity,stiffness:_t.stiffness,damping:_t.damping,mass:_t.mass,isResolvedFromDuration:!1,...n};if(!H0(n,Ej)&&H0(n,Cj))if(n.visualDuration){const i=n.visualDuration,o=2*Math.PI/(i*1.2),c=o*o,u=2*Is(.05,1,1-(n.bounce||0))*Math.sqrt(c);s={...s,mass:_t.mass,stiffness:c,damping:u}}else{const i=wj(n);s={...s,...i,mass:_t.mass},s.isResolvedFromDuration=!0}return s}function J_(n=_t.visualDuration,s=_t.bounce){const i=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:s}:n;let{restSpeed:o,restDelta:c}=i;const u=i.keyframes[0],d=i.keyframes[i.keyframes.length-1],m={done:!1,value:u},{stiffness:h,damping:g,mass:v,duration:b,velocity:_,isResolvedFromDuration:S}=Aj({...i,velocity:-Rs(i.velocity||0)}),T=_||0,N=g/(2*Math.sqrt(h*v)),j=d-u,w=Rs(Math.sqrt(h/v)),E=Math.abs(j)<5;o||(o=E?_t.restSpeed.granular:_t.restSpeed.default),c||(c=E?_t.restDelta.granular:_t.restDelta.default);let A;if(N<1){const C=Qf(w,N);A=M=>{const G=Math.exp(-N*w*M);return d-G*((T+N*w*j)/C*Math.sin(C*M)+j*Math.cos(C*M))}}else if(N===1)A=C=>d-Math.exp(-w*C)*(j+(T+w*j)*C);else{const C=w*Math.sqrt(N*N-1);A=M=>{const G=Math.exp(-N*w*M),U=Math.min(C*M,300);return d-G*((T+N*w*j)*Math.sinh(U)+C*j*Math.cosh(U))/C}}const O={calculatedDuration:S&&b||null,next:C=>{const M=A(C);if(S)m.done=C>=b;else{let G=0;N<1&&(G=C===0?Ds(T):Y_(A,C,M));const U=Math.abs(G)<=o,V=Math.abs(d-M)<=c;m.done=U&&V}return m.value=m.done?d:M,m},toString:()=>{const C=Math.min(F_(O),Wf),M=__(G=>O.next(C*G).value,C,30);return C+"ms "+M}};return O}function G0({keyframes:n,velocity:s=0,power:i=.8,timeConstant:o=325,bounceDamping:c=10,bounceStiffness:u=500,modifyTarget:d,min:m,max:h,restDelta:g=.5,restSpeed:v}){const b=n[0],_={done:!1,value:b},S=U=>m!==void 0&&U<m||h!==void 0&&U>h,T=U=>m===void 0?h:h===void 0||Math.abs(m-U)<Math.abs(h-U)?m:h;let N=i*s;const j=b+N,w=d===void 0?j:d(j);w!==j&&(N=w-b);const E=U=>-N*Math.exp(-U/o),A=U=>w+E(U),O=U=>{const V=E(U),Z=A(U);_.done=Math.abs(V)<=g,_.value=_.done?w:Z};let C,M;const G=U=>{S(_.value)&&(C=U,M=J_({keyframes:[_.value,T(_.value)],velocity:Y_(A,U,_.value),damping:c,stiffness:u,restDelta:g,restSpeed:v}))};return G(0),{calculatedDuration:null,next:U=>{let V=!1;return!M&&C===void 0&&(V=!0,O(U),G(U)),C!==void 0&&U>=C?M.next(U-C):(!V&&O(U),_)}}}const Dj=Dr(.42,0,1,1),Rj=Dr(0,0,.58,1),W_=Dr(.42,0,.58,1),Mj=n=>Array.isArray(n)&&typeof n[0]!="number",Oj={linear:_n,easeIn:Dj,easeInOut:W_,easeOut:Rj,circIn:Fp,circInOut:A_,circOut:E_,backIn:$p,backInOut:j_,backOut:N_,anticipate:C_},$0=n=>{if(Gp(n)){Wb(n.length===4);const[s,i,o,c]=n;return Dr(s,i,o,c)}else if(typeof n=="string")return Oj[n];return n};function Ij(n,s,i){const o=[],c=i||K_,u=n.length-1;for(let d=0;d<u;d++){let m=c(n[d],n[d+1]);if(s){const h=Array.isArray(s)?s[d]||_n:s;m=Rr(h,m)}o.push(m)}return o}function Bj(n,s,{clamp:i=!0,ease:o,mixer:c}={}){const u=n.length;if(Wb(u===s.length),u===1)return()=>s[0];if(u===2&&s[0]===s[1])return()=>s[1];const d=n[0]===n[1];n[0]>n[u-1]&&(n=[...n].reverse(),s=[...s].reverse());const m=Ij(s,o,c),h=m.length,g=v=>{if(d&&v<n[0])return s[0];let b=0;if(h>1)for(;b<n.length-2&&!(v<n[b+1]);b++);const _=to(n[b],n[b+1],v);return m[b](_)};return i?v=>g(Is(n[0],n[u-1],v)):g}function Lj(n,s){const i=n[n.length-1];for(let o=1;o<=s;o++){const c=to(0,s,o);n.push(vt(i,1,c))}}function Uj(n){const s=[0];return Lj(s,n.length-1),s}function zj(n,s){return n.map(i=>i*s)}function Pj(n,s){return n.map(()=>s||W_).splice(0,n.length-1)}function Tc({duration:n=300,keyframes:s,times:i,ease:o="easeInOut"}){const c=Mj(o)?o.map($0):$0(o),u={done:!1,value:s[0]},d=zj(i&&i.length===s.length?i:Uj(s),n),m=Bj(d,s,{ease:Array.isArray(c)?c:Pj(s,c)});return{calculatedDuration:n,next:h=>(u.value=m(h),u.done=h>=n,u)}}const Vj=n=>{const s=({timestamp:i})=>n(i);return{start:()=>ft.update(s,!0),stop:()=>ma(s),now:()=>Ft.isProcessing?Ft.timestamp:is.now()}},qj={decay:G0,inertia:G0,tween:Tc,keyframes:Tc,spring:J_},Hj=n=>n/100;class Xp extends $_{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:h}=this.options;h&&h()};const{name:i,motionValue:o,element:c,keyframes:u}=this.options,d=(c==null?void 0:c.KeyframeResolver)||Jp,m=(h,g)=>this.onKeyframesResolved(h,g);this.resolver=new d(u,m,i,o,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:i="keyframes",repeat:o=0,repeatDelay:c=0,repeatType:u,velocity:d=0}=this.options,m=Hp(i)?i:qj[i]||Tc;let h,g;m!==Tc&&typeof s[0]!="number"&&(h=Rr(Hj,K_(s[0],s[1])),s=[0,100]);const v=m({...this.options,keyframes:s});u==="mirror"&&(g=m({...this.options,keyframes:[...s].reverse(),velocity:-d})),v.calculatedDuration===null&&(v.calculatedDuration=F_(v));const{calculatedDuration:b}=v,_=b+c,S=_*(o+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:h,calculatedDuration:b,resolvedDuration:_,totalDuration:S}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,i=!1){const{resolved:o}=this;if(!o){const{keyframes:U}=this.options;return{done:!0,value:U[U.length-1]}}const{finalKeyframe:c,generator:u,mirroredGenerator:d,mapPercentToKeyframes:m,keyframes:h,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=o;if(this.startTime===null)return u.next(0);const{delay:_,repeat:S,repeatType:T,repeatDelay:N,onUpdate:j}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),i?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const w=this.currentTime-_*(this.speed>=0?1:-1),E=this.speed>=0?w<0:w>v;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let A=this.currentTime,O=u;if(S){const U=Math.min(this.currentTime,v)/b;let V=Math.floor(U),Z=U%1;!Z&&U>=1&&(Z=1),Z===1&&V--,V=Math.min(V,S+1),!!(V%2)&&(T==="reverse"?(Z=1-Z,N&&(Z-=N/b)):T==="mirror"&&(O=d)),A=Is(0,1,Z)*b}const C=E?{done:!1,value:h[0]}:O.next(A);m&&(C.value=m(C.value));let{done:M}=C;!E&&g!==null&&(M=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const G=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&M);return G&&c!==void 0&&(C.value=Vc(h,this.options,c)),j&&j(C.value),G&&this.finish(),C}get duration(){const{resolved:s}=this;return s?Rs(s.calculatedDuration):0}get time(){return Rs(this.currentTime)}set time(s){s=Ds(s),this.currentTime=s,this.holdTime!==null||this.speed===0?this.holdTime=s:this.driver&&(this.startTime=this.driver.now()-s/this.speed)}get speed(){return this.playbackSpeed}set speed(s){const i=this.playbackSpeed!==s;this.playbackSpeed=s,i&&(this.time=Rs(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=Vj,onPlay:i,startTime:o}=this.options;this.driver||(this.driver=s(u=>this.tick(u))),i&&i();const c=this.driver.now();this.holdTime!==null?this.startTime=c-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=c):this.startTime=o??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 Gj=new Set(["opacity","clipPath","filter","transform"]);function $j(n,s,i,{delay:o=0,duration:c=300,repeat:u=0,repeatType:d="loop",ease:m="easeInOut",times:h}={}){const g={[s]:i};h&&(g.offset=h);const v=S_(m,c);return Array.isArray(v)&&(g.easing=v),n.animate(g,{delay:o,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:u+1,direction:d==="reverse"?"alternate":"normal"})}const Fj=qp(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),kc=10,Zj=2e4;function Kj(n){return Hp(n.type)||n.type==="spring"||!x_(n.ease)}function Yj(n,s){const i=new Xp({...s,keyframes:n,repeat:0,delay:0,isGenerator:!0});let o={done:!1,value:n[0]};const c=[];let u=0;for(;!o.done&&u<Zj;)o=i.sample(u),c.push(o.value),u+=kc;return{times:void 0,keyframes:c,duration:u-kc,ease:"linear"}}const X_={anticipate:C_,backInOut:j_,circInOut:A_};function Jj(n){return n in X_}class F0 extends $_{constructor(s){super(s);const{name:i,motionValue:o,element:c,keyframes:u}=this.options;this.resolver=new G_(u,(d,m)=>this.onKeyframesResolved(d,m),i,o,c),this.resolver.scheduleResolve()}initPlayback(s,i){let{duration:o=300,times:c,ease:u,type:d,motionValue:m,name:h,startTime:g}=this.options;if(!m.owner||!m.owner.current)return!1;if(typeof u=="string"&&xc()&&Jj(u)&&(u=X_[u]),Kj(this.options)){const{onComplete:b,onUpdate:_,motionValue:S,element:T,...N}=this.options,j=Yj(s,N);s=j.keyframes,s.length===1&&(s[1]=s[0]),o=j.duration,c=j.times,u=j.ease,d="keyframes"}const v=$j(m.owner.current,h,s,{...this.options,duration:o,times:c,ease:u});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(O0(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;m.set(Vc(s,this.options,i)),b&&b(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:o,times:c,type:d,ease:u,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:i}=s;return Rs(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Rs(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.currentTime=Ds(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:i}=s;return i.playbackRate}set speed(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:i}=s;return i.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:i}=s;return i.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:i}=this;if(!i)return _n;const{animation:o}=i;O0(o,s)}return _n}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.playState==="finished"&&this.updateFinishedPromise(),i.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:i,keyframes:o,duration:c,type:u,ease:d,times:m}=s;if(i.playState==="idle"||i.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:_,...S}=this.options,T=new Xp({...S,keyframes:o,duration:c,type:u,ease:d,times:m,isGenerator:!0}),N=Ds(this.time);g.setWithVelocity(T.sample(N-kc).value,T.sample(N).value,kc)}const{onStop:h}=this.options;h&&h(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:i,name:o,repeatDelay:c,repeatType:u,damping:d,type:m}=s;if(!i||!i.owner||!(i.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:g}=i.owner.getProps();return Fj()&&o&&Gj.has(o)&&!h&&!g&&!c&&u!=="mirror"&&d!==0&&m!=="inertia"}}const Wj={type:"spring",stiffness:500,damping:25,restSpeed:10},Xj=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),Qj={type:"keyframes",duration:.8},eC={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},tC=(n,{keyframes:s})=>s.length>2?Qj:ti.has(n)?n.startsWith("scale")?Xj(s[1]):Wj:eC;function nC({when:n,delay:s,delayChildren:i,staggerChildren:o,staggerDirection:c,repeat:u,repeatType:d,repeatDelay:m,from:h,elapsed:g,...v}){return!!Object.keys(v).length}const Qp=(n,s,i,o={},c,u)=>d=>{const m=Up(o,n)||{},h=m.delay||o.delay||0;let{elapsed:g=0}=o;g=g-Ds(h);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...m,delay:-g,onUpdate:_=>{s.set(_),m.onUpdate&&m.onUpdate(_)},onComplete:()=>{d(),m.onComplete&&m.onComplete()},name:n,motionValue:s,element:u?void 0:c};nC(m)||(v={...v,...tC(n,v)}),v.duration&&(v.duration=Ds(v.duration)),v.repeatDelay&&(v.repeatDelay=Ds(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&&!u&&s.get()!==void 0){const _=Vc(v.keyframes,m);if(_!==void 0)return ft.update(()=>{v.onUpdate(_),v.onComplete()}),new ON([])}return!u&&F0.supports(v)?new F0(v):new Xp(v)};function sC({protectedKeys:n,needsAnimating:s},i){const o=n.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,o}function Q_(n,s,{delay:i=0,transitionOverride:o,type:c}={}){var u;let{transition:d=n.getDefaultTransition(),transitionEnd:m,...h}=s;o&&(d=o);const g=[],v=c&&n.animationState&&n.animationState.getState()[c];for(const b in h){const _=n.getValue(b,(u=n.latestValues[b])!==null&&u!==void 0?u:null),S=h[b];if(S===void 0||v&&sC(v,b))continue;const T={delay:i,...Up(d||{},b)};let N=!1;if(window.MotionHandoffAnimation){const w=b_(n);if(w){const E=window.MotionHandoffAnimation(w,b,ft);E!==null&&(T.startTime=E,N=!0)}}$f(n,b),_.start(Qp(b,_,S,n.shouldReduceMotion&&v_.has(b)?{type:!1}:T,n,N));const j=_.animation;j&&g.push(j)}return m&&Promise.all(g).then(()=>{ft.update(()=>{m&&AN(n,m)})}),g}function ep(n,s,i={}){var o;const c=Pc(n,s,i.type==="exit"?(o=n.presenceContext)===null||o===void 0?void 0:o.custom:void 0);let{transition:u=n.getDefaultTransition()||{}}=c||{};i.transitionOverride&&(u=i.transitionOverride);const d=c?()=>Promise.all(Q_(n,c,i)):()=>Promise.resolve(),m=n.variantChildren&&n.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=u;return aC(n,s,v+g,b,_,i)}:()=>Promise.resolve(),{when:h}=u;if(h){const[g,v]=h==="beforeChildren"?[d,m]:[m,d];return g().then(()=>v())}else return Promise.all([d(),m(i.delay)])}function aC(n,s,i=0,o=0,c=1,u){const d=[],m=(n.variantChildren.size-1)*o,h=c===1?(g=0)=>g*o:(g=0)=>m-g*o;return Array.from(n.variantChildren).sort(iC).forEach((g,v)=>{g.notify("AnimationStart",s),d.push(ep(g,s,{...u,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(d)}function iC(n,s){return n.sortNodePosition(s)}function oC(n,s,i={}){n.notify("AnimationStart",s);let o;if(Array.isArray(s)){const c=s.map(u=>ep(n,u,i));o=Promise.all(c)}else if(typeof s=="string")o=ep(n,s,i);else{const c=typeof s=="function"?Pc(n,s,i.custom):s;o=Promise.all(Q_(n,c,i))}return o.then(()=>{n.notify("AnimationComplete",s)})}const rC=Np.length;function ex(n){if(!n)return;if(!n.isControllingVariants){const i=n.parent?ex(n.parent)||{}:{};return n.props.initial!==void 0&&(i.initial=n.props.initial),i}const s={};for(let i=0;i<rC;i++){const o=Np[i],c=n.props[o];(Sr(c)||c===!1)&&(s[o]=c)}return s}const lC=[...wp].reverse(),cC=wp.length;function uC(n){return s=>Promise.all(s.map(({animation:i,options:o})=>oC(n,i,o)))}function dC(n){let s=uC(n),i=Z0(),o=!0;const c=h=>(g,v)=>{var b;const _=Pc(n,v,h==="exit"?(b=n.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:S,transitionEnd:T,...N}=_;g={...g,...N,...T}}return g};function u(h){s=h(n)}function d(h){const{props:g}=n,v=ex(n.parent)||{},b=[],_=new Set;let S={},T=1/0;for(let j=0;j<cC;j++){const w=lC[j],E=i[w],A=g[w]!==void 0?g[w]:v[w],O=Sr(A),C=w===h?E.isActive:null;C===!1&&(T=j);let M=A===v[w]&&A!==g[w]&&O;if(M&&o&&n.manuallyAnimateOnMount&&(M=!1),E.protectedKeys={...S},!E.isActive&&C===null||!A&&!E.prevProp||Uc(A)||typeof A=="boolean")continue;const G=fC(E.prevProp,A);let U=G||w===h&&E.isActive&&!M&&O||j>T&&O,V=!1;const Z=Array.isArray(A)?A:[A];let ee=Z.reduce(c(w),{});C===!1&&(ee={});const{prevResolvedValues:ie={}}=E,be={...ie,...ee},K=$=>{U=!0,_.has($)&&(V=!0,_.delete($)),E.needsAnimating[$]=!0;const Q=n.getValue($);Q&&(Q.liveStyle=!1)};for(const $ in be){const Q=ee[$],de=ie[$];if(S.hasOwnProperty($))continue;let me=!1;Gf(Q)&&Gf(de)?me=!g_(Q,de):me=Q!==de,me?Q!=null?K($):_.add($):Q!==void 0&&_.has($)?K($):E.protectedKeys[$]=!0}E.prevProp=A,E.prevResolvedValues=ee,E.isActive&&(S={...S,...ee}),o&&n.blockInitialAnimation&&(U=!1),U&&(!(M&&G)||V)&&b.push(...Z.map($=>({animation:$,options:{type:w}})))}if(_.size){const j={};_.forEach(w=>{const E=n.getBaseTarget(w),A=n.getValue(w);A&&(A.liveStyle=!0),j[w]=E??null}),b.push({animation:j})}let N=!!b.length;return o&&(g.initial===!1||g.initial===g.animate)&&!n.manuallyAnimateOnMount&&(N=!1),o=!1,N?s(b):Promise.resolve()}function m(h,g){var v;if(i[h].isActive===g)return Promise.resolve();(v=n.variantChildren)===null||v===void 0||v.forEach(_=>{var S;return(S=_.animationState)===null||S===void 0?void 0:S.setActive(h,g)}),i[h].isActive=g;const b=d(h);for(const _ in i)i[_].protectedKeys={};return b}return{animateChanges:d,setActive:m,setAnimateFunction:u,getState:()=>i,reset:()=>{i=Z0(),o=!0}}}function fC(n,s){return typeof s=="string"?s!==n:Array.isArray(s)?!g_(s,n):!1}function Pa(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Z0(){return{animate:Pa(!0),whileInView:Pa(),whileHover:Pa(),whileTap:Pa(),whileDrag:Pa(),whileFocus:Pa(),exit:Pa()}}class ya{constructor(s){this.isMounted=!1,this.node=s}update(){}}class pC extends ya{constructor(s){super(s),s.animationState||(s.animationState=dC(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Uc(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:i}=this.node.prevProps||{};s!==i&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let mC=0;class hC extends ya{constructor(){super(...arguments),this.id=mC++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:i}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===o)return;const c=this.node.animationState.setActive("exit",!s);i&&!s&&c.then(()=>i(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const gC={animation:{Feature:pC},exit:{Feature:hC}},Fn={x:!1,y:!1};function tx(){return Fn.x||Fn.y}function vC(n){return n==="x"||n==="y"?Fn[n]?null:(Fn[n]=!0,()=>{Fn[n]=!1}):Fn.x||Fn.y?null:(Fn.x=Fn.y=!0,()=>{Fn.x=Fn.y=!1})}const em=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function Nr(n,s,i,o={passive:!0}){return n.addEventListener(s,i,o),()=>n.removeEventListener(s,i)}function Mr(n){return{point:{x:n.pageX,y:n.pageY}}}const yC=n=>s=>em(s)&&n(s,Mr(s));function gr(n,s,i,o){return Nr(n,s,yC(i),o)}const K0=(n,s)=>Math.abs(n-s);function bC(n,s){const i=K0(n.x,s.x),o=K0(n.y,s.y);return Math.sqrt(i**2+o**2)}class nx{constructor(s,i,{transformPagePoint:o,contextWindow:c,dragSnapToOrigin:u=!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=vf(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,S=bC(b.offset,{x:0,y:0})>=3;if(!_&&!S)return;const{point:T}=b,{timestamp:N}=Ft;this.history.push({...T,timestamp:N});const{onStart:j,onMove:w}=this.handlers;_||(j&&j(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=gf(_,this.transformPagePoint),ft.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:S,onSessionEnd:T,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=vf(b.type==="pointercancel"?this.lastMoveEventInfo:gf(_,this.transformPagePoint),this.history);this.startEvent&&S&&S(b,j),T&&T(b,j)},!em(s))return;this.dragSnapToOrigin=u,this.handlers=i,this.transformPagePoint=o,this.contextWindow=c||window;const d=Mr(s),m=gf(d,this.transformPagePoint),{point:h}=m,{timestamp:g}=Ft;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,vf(m,this.history)),this.removeListeners=Rr(gr(this.contextWindow,"pointermove",this.handlePointerMove),gr(this.contextWindow,"pointerup",this.handlePointerUp),gr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),ma(this.updatePoint)}}function gf(n,s){return s?{point:s(n.point)}:n}function Y0(n,s){return{x:n.x-s.x,y:n.y-s.y}}function vf({point:n},s){return{point:n,delta:Y0(n,sx(s)),offset:Y0(n,_C(s)),velocity:xC(s,.1)}}function _C(n){return n[0]}function sx(n){return n[n.length-1]}function xC(n,s){if(n.length<2)return{x:0,y:0};let i=n.length-1,o=null;const c=sx(n);for(;i>=0&&(o=n[i],!(c.timestamp-o.timestamp>Ds(s)));)i--;if(!o)return{x:0,y:0};const u=Rs(c.timestamp-o.timestamp);if(u===0)return{x:0,y:0};const d={x:(c.x-o.x)/u,y:(c.y-o.y)/u};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}const ax=1e-4,SC=1-ax,TC=1+ax,ix=.01,kC=0-ix,wC=0+ix;function xn(n){return n.max-n.min}function NC(n,s,i){return Math.abs(n-s)<=i}function J0(n,s,i,o=.5){n.origin=o,n.originPoint=vt(s.min,s.max,n.origin),n.scale=xn(i)/xn(s),n.translate=vt(i.min,i.max,n.origin)-n.originPoint,(n.scale>=SC&&n.scale<=TC||isNaN(n.scale))&&(n.scale=1),(n.translate>=kC&&n.translate<=wC||isNaN(n.translate))&&(n.translate=0)}function vr(n,s,i,o){J0(n.x,s.x,i.x,o?o.originX:void 0),J0(n.y,s.y,i.y,o?o.originY:void 0)}function W0(n,s,i){n.min=i.min+s.min,n.max=n.min+xn(s)}function jC(n,s,i){W0(n.x,s.x,i.x),W0(n.y,s.y,i.y)}function X0(n,s,i){n.min=s.min-i.min,n.max=n.min+xn(s)}function yr(n,s,i){X0(n.x,s.x,i.x),X0(n.y,s.y,i.y)}function CC(n,{min:s,max:i},o){return s!==void 0&&n<s?n=o?vt(s,n,o.min):Math.max(n,s):i!==void 0&&n>i&&(n=o?vt(i,n,o.max):Math.min(n,i)),n}function Q0(n,s,i){return{min:s!==void 0?n.min+s:void 0,max:i!==void 0?n.max+i-(n.max-n.min):void 0}}function EC(n,{top:s,left:i,bottom:o,right:c}){return{x:Q0(n.x,i,c),y:Q0(n.y,s,o)}}function ey(n,s){let i=s.min-n.min,o=s.max-n.max;return s.max-s.min<n.max-n.min&&([i,o]=[o,i]),{min:i,max:o}}function AC(n,s){return{x:ey(n.x,s.x),y:ey(n.y,s.y)}}function DC(n,s){let i=.5;const o=xn(n),c=xn(s);return c>o?i=to(s.min,s.max-o,n.min):o>c&&(i=to(n.min,n.max-c,s.min)),Is(0,1,i)}function RC(n,s){const i={};return s.min!==void 0&&(i.min=s.min-n.min),s.max!==void 0&&(i.max=s.max-n.min),i}const tp=.35;function MC(n=tp){return n===!1?n=0:n===!0&&(n=tp),{x:ty(n,"left","right"),y:ty(n,"top","bottom")}}function ty(n,s,i){return{min:ny(n,s),max:ny(n,i)}}function ny(n,s){return typeof n=="number"?n:n[s]||0}const sy=()=>({translate:0,scale:1,origin:0,originPoint:0}),Fi=()=>({x:sy(),y:sy()}),ay=()=>({min:0,max:0}),Nt=()=>({x:ay(),y:ay()});function Bn(n){return[n("x"),n("y")]}function ox({top:n,left:s,right:i,bottom:o}){return{x:{min:s,max:i},y:{min:n,max:o}}}function OC({x:n,y:s}){return{top:s.min,right:n.max,bottom:s.max,left:n.min}}function IC(n,s){if(!s)return n;const i=s({x:n.left,y:n.top}),o=s({x:n.right,y:n.bottom});return{top:i.y,left:i.x,bottom:o.y,right:o.x}}function yf(n){return n===void 0||n===1}function np({scale:n,scaleX:s,scaleY:i}){return!yf(n)||!yf(s)||!yf(i)}function Ga(n){return np(n)||rx(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function rx(n){return iy(n.x)||iy(n.y)}function iy(n){return n&&n!=="0%"}function wc(n,s,i){const o=n-i,c=s*o;return i+c}function oy(n,s,i,o,c){return c!==void 0&&(n=wc(n,c,o)),wc(n,i,o)+s}function sp(n,s=0,i=1,o,c){n.min=oy(n.min,s,i,o,c),n.max=oy(n.max,s,i,o,c)}function lx(n,{x:s,y:i}){sp(n.x,s.translate,s.scale,s.originPoint),sp(n.y,i.translate,i.scale,i.originPoint)}const ry=.999999999999,ly=1.0000000000001;function BC(n,s,i,o=!1){const c=i.length;if(!c)return;s.x=s.y=1;let u,d;for(let m=0;m<c;m++){u=i[m],d=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(o&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Ki(n,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(s.x*=d.x.scale,s.y*=d.y.scale,lx(n,d)),o&&Ga(u.latestValues)&&Ki(n,u.latestValues))}s.x<ly&&s.x>ry&&(s.x=1),s.y<ly&&s.y>ry&&(s.y=1)}function Zi(n,s){n.min=n.min+s,n.max=n.max+s}function cy(n,s,i,o,c=.5){const u=vt(n.min,n.max,c);sp(n,s,i,u,o)}function Ki(n,s){cy(n.x,s.x,s.scaleX,s.scale,s.originX),cy(n.y,s.y,s.scaleY,s.scale,s.originY)}function cx(n,s){return ox(IC(n.getBoundingClientRect(),s))}function LC(n,s,i){const o=cx(n,i),{scroll:c}=s;return c&&(Zi(o.x,c.offset.x),Zi(o.y,c.offset.y)),o}const ux=({current:n})=>n?n.ownerDocument.defaultView:null,UC=new WeakMap;class zC{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=Nt(),this.visualElement=s}start(s,{snapToCursor:i=!1}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(Mr(v).point)},u=(v,b)=>{const{drag:_,dragPropagation:S,onDragStart:T}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=vC(_),!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),Bn(j=>{let w=this.getAxisMotionValue(j).get()||0;if(as.test(w)){const{projection:E}=this.visualElement;if(E&&E.layout){const A=E.layout.layoutBox[j];A&&(w=xn(A)*(parseFloat(w)/100))}}this.originPoint[j]=w}),T&&ft.postRender(()=>T(v,b)),$f(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},d=(v,b)=>{const{dragPropagation:_,dragDirectionLock:S,onDirectionLock:T,onDrag:N}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:j}=b;if(S&&this.currentDirection===null){this.currentDirection=PC(j),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",b.point,j),this.updateAxis("y",b.point,j),this.visualElement.render(),N&&N(v,b)},m=(v,b)=>this.stop(v,b),h=()=>Bn(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 nx(s,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:ux(this.visualElement)})}stop(s,i){const o=this.isDragging;if(this.cancel(),!o)return;const{velocity:c}=i;this.startAnimation(c);const{onDragEnd:u}=this.getProps();u&&ft.postRender(()=>u(s,i))}cancel(){this.isDragging=!1;const{projection:s,animationState:i}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:o}=this.getProps();!o&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i&&i.setActive("whileDrag",!1)}updateAxis(s,i,o){const{drag:c}=this.getProps();if(!o||!ac(s,c,this.currentDirection))return;const u=this.getAxisMotionValue(s);let d=this.originPoint[s]+o[s];this.constraints&&this.constraints[s]&&(d=CC(d,this.constraints[s],this.elastic[s])),u.set(d)}resolveConstraints(){var s;const{dragConstraints:i,dragElastic:o}=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,u=this.constraints;i&&Gi(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=EC(c.layoutBox,i):this.constraints=!1,this.elastic=MC(o),u!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Bn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=RC(c.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!Gi(s))return!1;const o=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const u=LC(o,c.root,this.visualElement.getTransformPagePoint());let d=AC(c.layout.layoutBox,u);if(i){const m=i(OC(d));this.hasMutatedConstraints=!!m,m&&(d=ox(m))}return d}startAnimation(s){const{drag:i,dragMomentum:o,dragElastic:c,dragTransition:u,dragSnapToOrigin:d,onDragTransitionEnd:m}=this.getProps(),h=this.constraints||{},g=Bn(v=>{if(!ac(v,i,this.currentDirection))return;let b=h&&h[v]||{};d&&(b={min:0,max:0});const _=c?200:1e6,S=c?40:1e7,T={type:"inertia",velocity:o?s[v]:0,bounceStiffness:_,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...u,...b};return this.startAxisValueAnimation(v,T)});return Promise.all(g).then(m)}startAxisValueAnimation(s,i){const o=this.getAxisMotionValue(s);return $f(this.visualElement,s),o.start(Qp(s,o,0,i,this.visualElement,!1))}stopAnimation(){Bn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Bn(s=>{var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.pause()})}getAnimationState(s){var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.state}getAxisMotionValue(s){const i=`_drag${s.toUpperCase()}`,o=this.visualElement.getProps(),c=o[i];return c||this.visualElement.getValue(s,(o.initial?o.initial[s]:void 0)||0)}snapToCursor(s){Bn(i=>{const{drag:o}=this.getProps();if(!ac(i,o,this.currentDirection))return;const{projection:c}=this.visualElement,u=this.getAxisMotionValue(i);if(c&&c.layout){const{min:d,max:m}=c.layout.layoutBox[i];u.set(s[i]-vt(d,m,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:o}=this.visualElement;if(!Gi(i)||!o||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Bn(d=>{const m=this.getAxisMotionValue(d);if(m&&this.constraints!==!1){const h=m.get();c[d]=DC({min:h,max:h},this.constraints[d])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.resolveConstraints(),Bn(d=>{if(!ac(d,s,null))return;const m=this.getAxisMotionValue(d),{min:h,max:g}=this.constraints[d];m.set(vt(h,g,c[d]))})}addListeners(){if(!this.visualElement.current)return;UC.set(this.visualElement,this);const s=this.visualElement.current,i=gr(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),o=()=>{const{dragConstraints:h}=this.getProps();Gi(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,u=c.addEventListener("measure",o);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),ft.read(o);const d=Nr(window,"resize",()=>this.scalePositionWithinConstraints()),m=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(Bn(v=>{const b=this.getAxisMotionValue(v);b&&(this.originPoint[v]+=h[v].translate,b.set(b.get()+h[v].translate))}),this.visualElement.render())}));return()=>{d(),i(),u(),m&&m()}}getProps(){const s=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:o=!1,dragPropagation:c=!1,dragConstraints:u=!1,dragElastic:d=tp,dragMomentum:m=!0}=s;return{...s,drag:i,dragDirectionLock:o,dragPropagation:c,dragConstraints:u,dragElastic:d,dragMomentum:m}}}function ac(n,s,i){return(s===!0||s===n)&&(i===null||i===n)}function PC(n,s=10){let i=null;return Math.abs(n.y)>s?i="y":Math.abs(n.x)>s&&(i="x"),i}class VC extends ya{constructor(s){super(s),this.removeGroupControls=_n,this.removeListeners=_n,this.controls=new zC(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 uy=n=>(s,i)=>{n&&ft.postRender(()=>n(s,i))};class qC extends ya{constructor(){super(...arguments),this.removePointerDownListener=_n}onPointerDown(s){this.session=new nx(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ux(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:uy(s),onStart:uy(i),onMove:o,onEnd:(u,d)=>{delete this.session,c&&ft.postRender(()=>c(u,d))}}}mount(){this.removePointerDownListener=gr(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 hc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function dy(n,s){return s.max===s.min?0:n/(s.max-s.min)*100}const or={correct:(n,s)=>{if(!s.target)return n;if(typeof n=="string")if(ke.test(n))n=parseFloat(n);else return n;const i=dy(n,s.target.x),o=dy(n,s.target.y);return`${i}% ${o}%`}},HC={correct:(n,{treeScale:s,projectionDelta:i})=>{const o=n,c=ha.parse(n);if(c.length>5)return o;const u=ha.createTransformer(n),d=typeof c[0]!="number"?1:0,m=i.x.scale*s.x,h=i.y.scale*s.y;c[0+d]/=m,c[1+d]/=h;const g=vt(m,h,.5);return typeof c[2+d]=="number"&&(c[2+d]/=g),typeof c[3+d]=="number"&&(c[3+d]/=g),u(c)}};class GC extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o,layoutId:c}=this.props,{projection:u}=s;gN($C),u&&(i.group&&i.group.add(u),o&&o.register&&c&&o.register(u),u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),hc.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:i,visualElement:o,drag:c,isPresent:u}=this.props,d=o.projection;return d&&(d.isPresent=u,c||s.layoutDependency!==i||i===void 0?d.willUpdate():this.safeToRemove(),s.isPresent!==u&&(u?d.promote():d.relegate()||ft.postRender(()=>{const m=d.getStack();(!m||!m.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Cp.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(c),o&&o.deregister&&o.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function dx(n){const[s,i]=Yb(),o=y.useContext(xp);return l.jsx(GC,{...n,layoutGroup:o,switchLayoutGroup:y.useContext(s_),isPresent:s,safeToRemove:i})}const $C={borderRadius:{...or,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:or,borderTopRightRadius:or,borderBottomLeftRadius:or,borderBottomRightRadius:or,boxShadow:HC};function FC(n,s,i){const o=Xt(n)?n:kr(n);return o.start(Qp("",o,s,i)),o.animation}function ZC(n){return n instanceof SVGElement&&n.tagName!=="svg"}const KC=(n,s)=>n.depth-s.depth;class YC{constructor(){this.children=[],this.isDirty=!1}add(s){zp(this.children,s),this.isDirty=!0}remove(s){Pp(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(KC),this.isDirty=!1,this.children.forEach(s)}}function JC(n,s){const i=is.now(),o=({timestamp:c})=>{const u=c-i;u>=s&&(ma(o),n(u-s))};return ft.read(o,!0),()=>ma(o)}const fx=["TopLeft","TopRight","BottomLeft","BottomRight"],WC=fx.length,fy=n=>typeof n=="string"?parseFloat(n):n,py=n=>typeof n=="number"||ke.test(n);function XC(n,s,i,o,c,u){c?(n.opacity=vt(0,i.opacity!==void 0?i.opacity:1,QC(o)),n.opacityExit=vt(s.opacity!==void 0?s.opacity:1,0,eE(o))):u&&(n.opacity=vt(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,o));for(let d=0;d<WC;d++){const m=`border${fx[d]}Radius`;let h=my(s,m),g=my(i,m);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||py(h)===py(g)?(n[m]=Math.max(vt(fy(h),fy(g),o),0),(as.test(g)||as.test(h))&&(n[m]+="%")):n[m]=g}(s.rotate||i.rotate)&&(n.rotate=vt(s.rotate||0,i.rotate||0,o))}function my(n,s){return n[s]!==void 0?n[s]:n.borderRadius}const QC=px(0,.5,E_),eE=px(.5,.95,_n);function px(n,s,i){return o=>o<n?0:o>s?1:i(to(n,s,o))}function hy(n,s){n.min=s.min,n.max=s.max}function On(n,s){hy(n.x,s.x),hy(n.y,s.y)}function gy(n,s){n.translate=s.translate,n.scale=s.scale,n.originPoint=s.originPoint,n.origin=s.origin}function vy(n,s,i,o,c){return n-=s,n=wc(n,1/i,o),c!==void 0&&(n=wc(n,1/c,o)),n}function tE(n,s=0,i=1,o=.5,c,u=n,d=n){if(as.test(s)&&(s=parseFloat(s),s=vt(d.min,d.max,s/100)-d.min),typeof s!="number")return;let m=vt(u.min,u.max,o);n===u&&(m-=s),n.min=vy(n.min,s,i,m,c),n.max=vy(n.max,s,i,m,c)}function yy(n,s,[i,o,c],u,d){tE(n,s[i],s[o],s[c],s.scale,u,d)}const nE=["x","scaleX","originX"],sE=["y","scaleY","originY"];function by(n,s,i,o){yy(n.x,s,nE,i?i.x:void 0,o?o.x:void 0),yy(n.y,s,sE,i?i.y:void 0,o?o.y:void 0)}function _y(n){return n.translate===0&&n.scale===1}function mx(n){return _y(n.x)&&_y(n.y)}function xy(n,s){return n.min===s.min&&n.max===s.max}function aE(n,s){return xy(n.x,s.x)&&xy(n.y,s.y)}function Sy(n,s){return Math.round(n.min)===Math.round(s.min)&&Math.round(n.max)===Math.round(s.max)}function hx(n,s){return Sy(n.x,s.x)&&Sy(n.y,s.y)}function Ty(n){return xn(n.x)/xn(n.y)}function ky(n,s){return n.translate===s.translate&&n.scale===s.scale&&n.originPoint===s.originPoint}class iE{constructor(){this.members=[]}add(s){zp(this.members,s),s.scheduleRender()}remove(s){if(Pp(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(s){const i=this.members.findIndex(c=>s===c);if(i===0)return!1;let o;for(let c=i;c>=0;c--){const u=this.members[c];if(u.isPresent!==!1){o=u;break}}return o?(this.promote(o),!0):!1}promote(s,i){const o=this.lead;if(s!==o&&(this.prevLead=o,this.lead=s,s.show(),o)){o.instance&&o.scheduleRender(),s.scheduleRender(),s.resumeFrom=o,i&&(s.resumeFrom.preserveOpacity=!0),o.snapshot&&(s.snapshot=o.snapshot,s.snapshot.latestValues=o.animationValues||o.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&o.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:i,resumingFrom:o}=s;i.onExitComplete&&i.onExitComplete(),o&&o.options.onExitComplete&&o.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function oE(n,s,i){let o="";const c=n.x.translate/s.x,u=n.y.translate/s.y,d=(i==null?void 0:i.z)||0;if((c||u||d)&&(o=`translate3d(${c}px, ${u}px, ${d}px) `),(s.x!==1||s.y!==1)&&(o+=`scale(${1/s.x}, ${1/s.y}) `),i){const{transformPerspective:g,rotate:v,rotateX:b,rotateY:_,skewX:S,skewY:T}=i;g&&(o=`perspective(${g}px) ${o}`),v&&(o+=`rotate(${v}deg) `),b&&(o+=`rotateX(${b}deg) `),_&&(o+=`rotateY(${_}deg) `),S&&(o+=`skewX(${S}deg) `),T&&(o+=`skewY(${T}deg) `)}const m=n.x.scale*s.x,h=n.y.scale*s.y;return(m!==1||h!==1)&&(o+=`scale(${m}, ${h})`),o||"none"}const $a={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},dr=typeof window<"u"&&window.MotionDebug!==void 0,bf=["","X","Y","Z"],rE={visibility:"hidden"},wy=1e3;let lE=0;function _f(n,s,i,o){const{latestValues:c}=s;c[n]&&(i[n]=c[n],s.setStaticValue(n,0),o&&(o[n]=0))}function gx(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:s}=n.options;if(!s)return;const i=b_(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:u}=n.options;window.MotionCancelOptimisedAnimation(i,"transform",ft,!(c||u))}const{parent:o}=n;o&&!o.hasCheckedOptimisedAppear&&gx(o)}function vx({attachResizeListener:n,defaultParent:s,measureScroll:i,checkIsScrollRoot:o,resetTransform:c}){return class{constructor(d={},m=s==null?void 0:s()){this.id=lE++,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,dr&&($a.totalNodes=$a.resolvedTargetDeltas=$a.recalculatedProjection=0),this.nodes.forEach(dE),this.nodes.forEach(gE),this.nodes.forEach(vE),this.nodes.forEach(fE),dr&&window.MotionDebug.record($a)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,this.root=m?m.root||m:this,this.path=m?[...m.path,m]:[],this.parent=m,this.depth=m?m.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new YC)}addEventListener(d,m){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new Vp),this.eventHandlers.get(d).add(m)}notifyListeners(d,...m){const h=this.eventHandlers.get(d);h&&h.notify(...m)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,m=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=ZC(d),this.instance=d;const{layoutId:h,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),m&&(g||h)&&(this.isLayoutDirty=!0),n){let b;const _=()=>this.root.updateBlockedByResize=!1;n(d,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=JC(_,250),hc.hasAnimatedSinceResize&&(hc.hasAnimatedSinceResize=!1,this.nodes.forEach(jy))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&v&&(h||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:S,layout:T})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||v.getDefaultTransition()||SE,{onLayoutAnimationStart:j,onLayoutAnimationComplete:w}=v.getProps(),E=!this.targetLayout||!hx(this.targetLayout,T)||S,A=!_&&S;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||A||_&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,A);const O={...Up(N,"layout"),onPlay:j,onComplete:w};(v.shouldReduceMotion||this.options.layoutRoot)&&(O.delay=0,O.type=!1),this.startAnimation(O)}else _||jy(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=T})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ma(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(yE),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&gx(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:m,layout:h}=this.options;if(m===void 0&&!h)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),d&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ny);return}this.isUpdating||this.nodes.forEach(mE),this.isUpdating=!1,this.nodes.forEach(hE),this.nodes.forEach(cE),this.nodes.forEach(uE),this.clearAllSnapshots();const m=is.now();Ft.delta=Is(0,1e3/60,m-Ft.timestamp),Ft.timestamp=m,Ft.isProcessing=!0,df.update.process(Ft),df.preRender.process(Ft),df.render.process(Ft),Ft.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Cp.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(pE),this.sharedNodes.forEach(bE)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ft.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ft.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 h=0;h<this.path.length;h++)this.path[h].updateScroll();const d=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Nt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:m}=this.options;m&&m.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let m=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(m=!1),m){const h=o(this.instance);this.scroll={animationId:this.root.animationId,phase:d,isRoot:h,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!c)return;const d=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,m=this.projectionDelta&&!mx(this.projectionDelta),h=this.getTransformTemplate(),g=h?h(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;d&&(m||Ga(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const m=this.measurePageBox();let h=this.removeElementScroll(m);return d&&(h=this.removeTransform(h)),TE(h),{animationId:this.root.animationId,measuredBox:m,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:m}=this.options;if(!m)return Nt();const h=m.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(kE))){const{scroll:v}=this.root;v&&(Zi(h.x,v.offset.x),Zi(h.y,v.offset.y))}return h}removeElementScroll(d){var m;const h=Nt();if(On(h,d),!((m=this.scroll)===null||m===void 0)&&m.wasRoot)return h;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&&On(h,d),Zi(h.x,b.offset.x),Zi(h.y,b.offset.y))}return h}applyTransform(d,m=!1){const h=Nt();On(h,d);for(let g=0;g<this.path.length;g++){const v=this.path[g];!m&&v.options.layoutScroll&&v.scroll&&v!==v.root&&Ki(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Ga(v.latestValues)&&Ki(h,v.latestValues)}return Ga(this.latestValues)&&Ki(h,this.latestValues),h}removeTransform(d){const m=Nt();On(m,d);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!g.instance||!Ga(g.latestValues))continue;np(g.latestValues)&&g.updateSnapshot();const v=Nt(),b=g.measurePageBox();On(v,b),by(m,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return Ga(this.latestValues)&&by(m,this.latestValues),m}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.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!==Ft.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){var m;const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==h;if(!(d||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((m=this.parent)===null||m===void 0)&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:_}=this.options;if(!(!this.layout||!(b||_))){if(this.resolvedRelativeTargetAt=Ft.timestamp,!this.targetDelta&&!this.relativeTarget){const S=this.getClosestProjectingParent();S&&S.layout&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nt(),this.relativeTargetOrigin=Nt(),yr(this.relativeTargetOrigin,this.layout.layoutBox,S.layout.layoutBox),On(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Nt(),this.targetWithTransforms=Nt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),jC(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):On(this.target,this.layout.layoutBox),lx(this.target,this.targetDelta)):On(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const S=this.getClosestProjectingParent();S&&!!S.resumingFrom==!!this.resumingFrom&&!S.options.layoutScroll&&S.target&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nt(),this.relativeTargetOrigin=Nt(),yr(this.relativeTargetOrigin,this.target,S.target),On(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}dr&&$a.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||np(this.parent.latestValues)||rx(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 d;const m=this.getLead(),h=!!this.resumingFrom||this!==m;let g=!0;if((this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty)&&(g=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===Ft.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;On(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,S=this.treeScale.y;BC(this.layoutCorrected,this.treeScale,this.path,h),m.layout&&!m.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(m.target=m.layout.layoutBox,m.targetWithTransforms=Nt());const{target:T}=m;if(!T){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(gy(this.prevProjectionDelta.x,this.projectionDelta.x),gy(this.prevProjectionDelta.y,this.projectionDelta.y)),vr(this.projectionDelta,this.layoutCorrected,T,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==S||!ky(this.projectionDelta.x,this.prevProjectionDelta.x)||!ky(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",T)),dr&&$a.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){var m;if((m=this.options.visualElement)===null||m===void 0||m.scheduleRender(),d){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Fi(),this.projectionDelta=Fi(),this.projectionDeltaWithTransform=Fi()}setAnimationOrigin(d,m=!1){const h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},b=Fi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!m;const _=Nt(),S=h?h.source:void 0,T=this.layout?this.layout.source:void 0,N=S!==T,j=this.getStack(),w=!j||j.members.length<=1,E=!!(N&&!w&&this.options.crossfade===!0&&!this.path.some(xE));this.animationProgress=0;let A;this.mixTargetDelta=O=>{const C=O/1e3;Cy(b.x,d.x,C),Cy(b.y,d.y,C),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(yr(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),_E(this.relativeTarget,this.relativeTargetOrigin,_,C),A&&aE(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Nt()),On(A,this.relativeTarget)),N&&(this.animationValues=v,XC(v,g,this.latestValues,C,E,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ma(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ft.update(()=>{hc.hasAnimatedSinceResize=!0,this.currentAnimation=FC(0,wy,{...d,onUpdate:m=>{this.mixTargetDelta(m),d.onUpdate&&d.onUpdate(m)},onComplete:()=>{d.onComplete&&d.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 d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(wy),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:m,target:h,layout:g,latestValues:v}=d;if(!(!m||!h||!g)){if(this!==d&&this.layout&&g&&yx(this.options.animationType,this.layout.layoutBox,g.layoutBox)){h=this.target||Nt();const b=xn(this.layout.layoutBox.x);h.x.min=d.target.x.min,h.x.max=h.x.min+b;const _=xn(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+_}On(m,h),Ki(m,v),vr(this.projectionDeltaWithTransform,this.layoutCorrected,m,v)}}registerSharedNode(d,m){this.sharedNodes.has(d)||this.sharedNodes.set(d,new iE),this.sharedNodes.get(d).add(m);const g=m.options.initialPromotionConfig;m.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(m):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:m}=this.options;return m?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:m}=this.options;return m?(d=this.getStack())===null||d===void 0?void 0:d.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:m,preserveFollowOpacity:h}={}){const g=this.getStack();g&&g.promote(this,h),d&&(this.projectionDelta=void 0,this.needsReset=!0),m&&this.setOptions({transition:m})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let m=!1;const{latestValues:h}=d;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(m=!0),!m)return;const g={};h.z&&_f("z",d,g,this.animationValues);for(let v=0;v<bf.length;v++)_f(`rotate${bf[v]}`,d,g,this.animationValues),_f(`skew${bf[v]}`,d,g,this.animationValues);d.render();for(const v in g)d.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);d.scheduleRender()}getProjectionStyles(d){var m,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return rE;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=pc(d==null?void 0:d.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const b=this.getLead();if(!this.projectionDelta||!this.layout||!b.target){const N={};return this.options.layoutId&&(N.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,N.pointerEvents=pc(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!Ga(this.latestValues)&&(N.transform=v?v({},""):"none",this.hasProjected=!1),N}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=oE(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x:S,y:T}=this.projectionDelta;g.transformOrigin=`${S.origin*100}% ${T.origin*100}% 0`,b.animationValues?g.opacity=b===this?(h=(m=_.opacity)!==null&&m!==void 0?m:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:g.opacity=b===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const N in _c){if(_[N]===void 0)continue;const{correct:j,applyTo:w}=_c[N],E=g.transform==="none"?_[N]:j(_[N],b);if(w){const A=w.length;for(let O=0;O<A;O++)g[w[O]]=E}else g[N]=E}return this.options.layoutId&&(g.pointerEvents=b===this?pc(d==null?void 0:d.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>{var m;return(m=d.currentAnimation)===null||m===void 0?void 0:m.stop()}),this.root.nodes.forEach(Ny),this.root.sharedNodes.clear()}}}function cE(n){n.updateLayout()}function uE(n){var s;const i=((s=n.resumeFrom)===null||s===void 0?void 0:s.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&i&&n.hasListeners("didUpdate")){const{layoutBox:o,measuredBox:c}=n.layout,{animationType:u}=n.options,d=i.source!==n.layout.source;u==="size"?Bn(b=>{const _=d?i.measuredBox[b]:i.layoutBox[b],S=xn(_);_.min=o[b].min,_.max=_.min+S}):yx(u,i.layoutBox,o)&&Bn(b=>{const _=d?i.measuredBox[b]:i.layoutBox[b],S=xn(o[b]);_.max=_.min+S,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[b].max=n.relativeTarget[b].min+S)});const m=Fi();vr(m,o,i.layoutBox);const h=Fi();d?vr(h,n.applyTransform(c,!0),i.measuredBox):vr(h,o,i.layoutBox);const g=!mx(m);let v=!1;if(!n.resumeFrom){const b=n.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:S}=b;if(_&&S){const T=Nt();yr(T,i.layoutBox,_.layoutBox);const N=Nt();yr(N,o,S.layoutBox),hx(T,N)||(v=!0),b.options.layoutRoot&&(n.relativeTarget=N,n.relativeTargetOrigin=T,n.relativeParent=b)}}}n.notifyListeners("didUpdate",{layout:o,snapshot:i,delta:h,layoutDelta:m,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(n.isLead()){const{onExitComplete:o}=n.options;o&&o()}n.options.transition=void 0}function dE(n){dr&&$a.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function fE(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function pE(n){n.clearSnapshot()}function Ny(n){n.clearMeasurements()}function mE(n){n.isLayoutDirty=!1}function hE(n){const{visualElement:s}=n.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),n.resetTransform()}function jy(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function gE(n){n.resolveTargetDelta()}function vE(n){n.calcProjection()}function yE(n){n.resetSkewAndRotation()}function bE(n){n.removeLeadSnapshot()}function Cy(n,s,i){n.translate=vt(s.translate,0,i),n.scale=vt(s.scale,1,i),n.origin=s.origin,n.originPoint=s.originPoint}function Ey(n,s,i,o){n.min=vt(s.min,i.min,o),n.max=vt(s.max,i.max,o)}function _E(n,s,i,o){Ey(n.x,s.x,i.x,o),Ey(n.y,s.y,i.y,o)}function xE(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const SE={duration:.45,ease:[.4,0,.1,1]},Ay=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),Dy=Ay("applewebkit/")&&!Ay("chrome/")?Math.round:_n;function Ry(n){n.min=Dy(n.min),n.max=Dy(n.max)}function TE(n){Ry(n.x),Ry(n.y)}function yx(n,s,i){return n==="position"||n==="preserve-aspect"&&!NC(Ty(s),Ty(i),.2)}function kE(n){var s;return n!==n.root&&((s=n.scroll)===null||s===void 0?void 0:s.wasRoot)}const wE=vx({attachResizeListener:(n,s)=>Nr(n,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),xf={current:void 0},bx=vx({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!xf.current){const n=new wE({});n.mount(window),n.setOptions({layoutScroll:!0}),xf.current=n}return xf.current},resetTransform:(n,s)=>{n.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),NE={pan:{Feature:qC},drag:{Feature:VC,ProjectionNode:bx,MeasureLayout:dx}};function jE(n,s,i){var o;if(n instanceof Element)return[n];if(typeof n=="string"){let c=document;const u=(o=void 0)!==null&&o!==void 0?o:c.querySelectorAll(n);return u?Array.from(u):[]}return Array.from(n)}function _x(n,s){const i=jE(n),o=new AbortController,c={passive:!0,...s,signal:o.signal};return[i,c,()=>o.abort()]}function My(n){return s=>{s.pointerType==="touch"||tx()||n(s)}}function CE(n,s,i={}){const[o,c,u]=_x(n,i),d=My(m=>{const{target:h}=m,g=s(m);if(typeof g!="function"||!h)return;const v=My(b=>{g(b),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return o.forEach(m=>{m.addEventListener("pointerenter",d,c)}),u}function Oy(n,s,i){const{props:o}=n;n.animationState&&o.whileHover&&n.animationState.setActive("whileHover",i==="Start");const c="onHover"+i,u=o[c];u&&ft.postRender(()=>u(s,Mr(s)))}class EE extends ya{mount(){const{current:s}=this.node;s&&(this.unmount=CE(s,i=>(Oy(this.node,i,"Start"),o=>Oy(this.node,o,"End"))))}unmount(){}}class AE 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=Rr(Nr(this.node.current,"focus",()=>this.onFocus()),Nr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const xx=(n,s)=>s?n===s?!0:xx(n,s.parentElement):!1,DE=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function RE(n){return DE.has(n.tagName)||n.tabIndex!==-1}const fr=new WeakSet;function Iy(n){return s=>{s.key==="Enter"&&n(s)}}function Sf(n,s){n.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const ME=(n,s)=>{const i=n.currentTarget;if(!i)return;const o=Iy(()=>{if(fr.has(i))return;Sf(i,"down");const c=Iy(()=>{Sf(i,"up")}),u=()=>Sf(i,"cancel");i.addEventListener("keyup",c,s),i.addEventListener("blur",u,s)});i.addEventListener("keydown",o,s),i.addEventListener("blur",()=>i.removeEventListener("keydown",o),s)};function By(n){return em(n)&&!tx()}function OE(n,s,i={}){const[o,c,u]=_x(n,i),d=m=>{const h=m.currentTarget;if(!By(m)||fr.has(h))return;fr.add(h);const g=s(m),v=(S,T)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!By(S)||!fr.has(h))&&(fr.delete(h),typeof g=="function"&&g(S,{success:T}))},b=S=>{v(S,i.useGlobalTarget||xx(h,S.target))},_=S=>{v(S,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return o.forEach(m=>{!RE(m)&&m.getAttribute("tabindex")===null&&(m.tabIndex=0),(i.useGlobalTarget?window:m).addEventListener("pointerdown",d,c),m.addEventListener("focus",g=>ME(g,c),c)}),u}function Ly(n,s,i){const{props:o}=n;n.animationState&&o.whileTap&&n.animationState.setActive("whileTap",i==="Start");const c="onTap"+(i==="End"?"":i),u=o[c];u&&ft.postRender(()=>u(s,Mr(s)))}class IE extends ya{mount(){const{current:s}=this.node;s&&(this.unmount=OE(s,i=>(Ly(this.node,i,"Start"),(o,{success:c})=>Ly(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const ap=new WeakMap,Tf=new WeakMap,BE=n=>{const s=ap.get(n.target);s&&s(n)},LE=n=>{n.forEach(BE)};function UE({root:n,...s}){const i=n||document;Tf.has(i)||Tf.set(i,{});const o=Tf.get(i),c=JSON.stringify(s);return o[c]||(o[c]=new IntersectionObserver(LE,{root:n,...s})),o[c]}function zE(n,s,i){const o=UE(s);return ap.set(n,i),o.observe(n),()=>{ap.delete(n),o.unobserve(n)}}const PE={some:0,all:1};class VE extends ya{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:i,margin:o,amount:c="some",once:u}=s,d={root:i?i.current:void 0,rootMargin:o,threshold:typeof c=="number"?c:PE[c]},m=h=>{const{isIntersecting:g}=h;if(this.isInView===g||(this.isInView=g,u&&!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;_&&_(h)};return zE(this.node.current,d,m)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:i}=this.node;["amount","margin","root"].some(qE(s,i))&&this.startObserver()}unmount(){}}function qE({viewport:n={}},{viewport:s={}}={}){return i=>n[i]!==s[i]}const HE={inView:{Feature:VE},tap:{Feature:IE},focus:{Feature:AE},hover:{Feature:EE}},GE={layout:{ProjectionNode:bx,MeasureLayout:dx}},Nc={current:null},tm={current:!1};function Sx(){if(tm.current=!0,!!kp)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),s=()=>Nc.current=n.matches;n.addListener(s),s()}else Nc.current=!1}const $E=[...H_,Wt,ha],FE=n=>$E.find(q_(n)),Uy=new WeakMap;function ZE(n,s,i){for(const o in s){const c=s[o],u=i[o];if(Xt(c))n.addValue(o,c);else if(Xt(u))n.addValue(o,kr(c,{owner:n}));else if(u!==c)if(n.hasValue(o)){const d=n.getValue(o);d.liveStyle===!0?d.jump(c):d.hasAnimated||d.set(c)}else{const d=n.getStaticValue(o);n.addValue(o,kr(d!==void 0?d:c,{owner:n}))}}for(const o in i)s[o]===void 0&&n.removeValue(o);return s}const zy=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class KE{scrapeMotionValuesFromProps(s,i,o){return{}}constructor({parent:s,props:i,presenceContext:o,reducedMotionConfig:c,blockInitialAnimation:u,visualState:d},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Jp,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const S=is.now();this.renderScheduledAt<S&&(this.renderScheduledAt=S,ft.render(this.render,!1,!0))};const{latestValues:h,renderState:g,onUpdate:v}=d;this.onUpdate=v,this.latestValues=h,this.baseTarget={...h},this.initialValues=i.initial?{...h}:{},this.renderState=g,this.parent=s,this.props=i,this.presenceContext=o,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=m,this.blockInitialAnimation=!!u,this.isControllingVariants=zc(i),this.isVariantNode=t_(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(i,{},this);for(const S in _){const T=_[S];h[S]!==void 0&&Xt(T)&&T.set(h[S],!1)}}mount(s){this.current=s,Uy.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,o)=>this.bindToMotionValue(o,i)),tm.current||Sx(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Nc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Uy.delete(this.current),this.projection&&this.projection.unmount(),ma(this.notifyUpdate),ma(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const i=this.features[s];i&&(i.unmount(),i.isMounted=!1)}this.current=null}bindToMotionValue(s,i){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const o=ti.has(s),c=i.on("change",m=>{this.latestValues[s]=m,this.props.onUpdate&&ft.preRender(this.notifyUpdate),o&&this.projection&&(this.projection.isTransformDirty=!0)}),u=i.on("renderRequest",this.scheduleRender);let d;window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,s,i)),this.valueSubscriptions.set(s,()=>{c(),u(),d&&d(),i.owner&&i.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in eo){const i=eo[s];if(!i)continue;const{isEnabled:o,Feature:c}=i;if(!this.features[s]&&c&&o(this.props)&&(this.features[s]=new c(this)),this.features[s]){const u=this.features[s];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Nt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,i){this.latestValues[s]=i}update(s,i){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let o=0;o<zy.length;o++){const c=zy[o];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const u="on"+c,d=s[u];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=ZE(this,this.scrapeMotionValuesFromProps(s,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(s),()=>i.variantChildren.delete(s)}addValue(s,i){const o=this.values.get(s);i!==o&&(o&&this.removeValue(s),this.bindToMotionValue(s,i),this.values.set(s,i),this.latestValues[s]=i.get())}removeValue(s){this.values.delete(s);const i=this.valueSubscriptions.get(s);i&&(i(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,i){if(this.props.values&&this.props.values[s])return this.props.values[s];let o=this.values.get(s);return o===void 0&&i!==void 0&&(o=kr(i===null?void 0:i,{owner:this}),this.addValue(s,o)),o}readValue(s,i){var o;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(o=this.getBaseTargetFromProps(this.props,s))!==null&&o!==void 0?o:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(P_(c)||D_(c))?c=parseFloat(c):!FE(c)&&ha.test(i)&&(c=L_(s,i)),this.setBaseTarget(s,Xt(c)?c.get():c)),Xt(c)?c.get():c}setBaseTarget(s,i){this.baseTarget[s]=i}getBaseTarget(s){var i;const{initial:o}=this.props;let c;if(typeof o=="string"||typeof o=="object"){const d=Ap(this.props,o,(i=this.presenceContext)===null||i===void 0?void 0:i.custom);d&&(c=d[s])}if(o&&c!==void 0)return c;const u=this.getBaseTargetFromProps(this.props,s);return u!==void 0&&!Xt(u)?u:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,i){return this.events[s]||(this.events[s]=new Vp),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class Tx extends KE{constructor(){super(...arguments),this.KeyframeResolver=G_}sortInstanceNodePosition(s,i){return s.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(s,i){return s.style?s.style[i]:void 0}removeValueFromRenderState(s,{vars:i,style:o}){delete i[s],delete o[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;Xt(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function YE(n){return window.getComputedStyle(n)}class JE extends Tx{constructor(){super(...arguments),this.type="html",this.renderInstance=u_}readValueFromInstance(s,i){if(ti.has(i)){const o=Yp(i);return o&&o.default||0}else{const o=YE(s),c=(r_(i)?o.getPropertyValue(i):o[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return cx(s,i)}build(s,i,o){Mp(s,i,o.transformTemplate)}scrapeMotionValuesFromProps(s,i,o){return Lp(s,i,o)}}class WE extends Tx{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Nt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(ti.has(i)){const o=Yp(i);return o&&o.default||0}return i=d_.has(i)?i:jp(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,o){return m_(s,i,o)}build(s,i,o){Op(s,i,this.isSVGTag,o.transformTemplate)}renderInstance(s,i,o,c){f_(s,i,o,c)}mount(s){this.isSVGTag=Bp(s.tagName),super.mount(s)}}const XE=(n,s)=>Ep(n)?new WE(s):new JE(s,{allowProjection:n!==y.Fragment}),QE=wN({...gC,...HE,...NE,...GE},XE),Rt=P2(QE);function eA(){!tm.current&&Sx();const[n]=y.useState(Nc.current);return n}const ip={not_started:{color:"var(--text-tertiary)",icon:"○",label:"Not Started"},working:{color:"var(--accent-green)",icon:"●",label:"Working"},paused:{color:"var(--accent-yellow)",icon:"◉",label:"Paused"},complete:{color:"var(--accent-green)",icon:"✓",label:"Complete"},failed:{color:"var(--accent-red)",icon:"✗",label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:"⦸",label:"Blocked"}};function ga(n){return n==="blocked"?ip.blocked:ip[nm(n)]}const tA={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function nA(n){return tA[nm(n)]??"statusPending"}const sA=["working","paused","failed","not_started","blocked","complete"],Py=["not_started","working","paused","complete","failed"],aA={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function nm(n){return n in ip&&n!=="blocked"?n:aA[n]??"not_started"}const iA={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"};function oA(n){if(n.length===0)return[];const s=[...n].sort((o,c)=>o[0]-c[0]),i=[[s[0][0],s[0][1]]];for(let o=1;o<s.length;o++){const c=i[i.length-1],[u,d]=s[o];u<=c[1]+1?c[1]=Math.max(c[1],d):i.push([u,d])}return i}function kx({text:n,indices:s,highlightClass:i}){if(!s||s.length===0)return l.jsx(l.Fragment,{children:n});const o=oA(s),c=[];let u=0;for(const[d,m]of o)d>u&&c.push(l.jsx("span",{children:n.slice(u,d)},`p${u}`)),c.push(l.jsx("mark",{className:i,children:n.slice(d,m+1)},`m${d}`)),u=m+1;return u<n.length&&c.push(l.jsx("span",{children:n.slice(u)},`p${u}`)),l.jsx(l.Fragment,{children:c})}function rA(n){const s=new Map(n.map(o=>[o.id,{...o,children:[]}])),i=[];for(const o of s.values())o.parentTaskId&&s.has(o.parentTaskId)?s.get(o.parentTaskId).children.push(o):i.push(o);for(const o of s.values())o.children.sort((c,u)=>c.sortOrder-u.sortOrder);return i.sort((o,c)=>o.sortOrder-c.sortOrder)}function lA(n,s){const i=new Map;for(const u of n){const m=u.dependsOn.length>0&&u.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":u.status,h=i.get(m);h?h.push(u):i.set(m,[u])}const o=[],c=new Set;for(const u of sA){c.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const m=ga(u);o.push({status:u,label:m.label,style:m,tasks:d})}}for(const[u,d]of i)if(!c.has(u)&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const m=ga(u);o.push({status:u,label:m.label,style:m,tasks:d})}return o}const cA="_container_z4i38_1",uA="_header_z4i38_5",dA="_headerActions_z4i38_17",fA="_searchInput_z4i38_23",pA="_searchHighlight_z4i38_56",mA="_groupToggle_z4i38_62",hA="_groupToggleActive_z4i38_89",gA="_addButton_z4i38_93",vA="_taskRow_z4i38_120",yA="_selected_z4i38_140",bA="_expandArrow_z4i38_150",_A="_expanded_z4i38_157",xA="_leafSpacer_z4i38_161",SA="_taskStatusIcon_z4i38_166",TA="_taskTitle_z4i38_170",kA="_workspaceBadge_z4i38_177",wA="_childCountBadge_z4i38_195",NA="_dependencyBadge_z4i38_208",jA="_blockedBadge_z4i38_220",CA="_addChildButton_z4i38_225",EA="_emptyState_z4i38_268",AA="_statusGroupHeader_z4i38_275",DA="_statusGroupIcon_z4i38_294",RA="_statusGroupLabel_z4i38_298",MA="_statusGroupCount_z4i38_303",Fe={container:cA,header:uA,headerActions:dA,searchInput:fA,searchHighlight:pA,groupToggle:mA,groupToggleActive:hA,addButton:gA,taskRow:vA,selected:yA,expandArrow:bA,expanded:_A,leafSpacer:xA,taskStatusIcon:SA,taskTitle:TA,workspaceBadge:kA,childCountBadge:wA,dependencyBadge:NA,blockedBadge:jA,addChildButton:CA,emptyState:EA,statusGroupHeader:AA,statusGroupIcon:DA,statusGroupLabel:RA,statusGroupCount:MA},OA=[{name:"title",weight:2},{name:"description",weight:1}],wx=16,IA=16,Nx="grackle-task-group-by-status";function Vy(){try{return localStorage.getItem(Nx)==="true"}catch{return!1}}function BA(n){try{localStorage.setItem(Nx,String(n))}catch{}}function LA({group:n,isExpanded:s,onToggle:i,selectedTaskId:o,navigate:c,titleHighlights:u,workspaceNames:d}){return l.jsxs("div",{"data-testid":`status-group-${n.status}`,children:[l.jsxs("div",{className:Fe.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:i,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),i())},children:[l.jsx("span",{className:`${Fe.expandArrow} ${s?Fe.expanded:""}`,children:"▸"}),l.jsx("span",{className:Fe.statusGroupIcon,style:{color:n.style.color},children:n.style.icon}),l.jsx("span",{className:Fe.statusGroupLabel,children:n.label}),l.jsx("span",{className:Fe.statusGroupCount,children:n.tasks.length})]}),l.jsx(rs,{children:s&&l.jsx(Rt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:n.tasks.map(m=>{const h=ga(m.status),g=o===m.id,v=m.parentTaskId||!m.workspaceId?void 0:d.get(m.workspaceId);return l.jsxs("div",{onClick:()=>c(os(m.id)),className:`${Fe.taskRow} ${g?Fe.selected:""}`,style:{"--task-indent":`${wx}px`},"data-task-id":m.id,children:[l.jsx("span",{className:Fe.leafSpacer}),l.jsx("span",{className:Fe.taskStatusIcon,style:{color:h.color},children:h.icon}),l.jsx("span",{className:Fe.taskTitle,title:m.title,children:l.jsx(kx,{text:m.title,indices:u.get(m.id),highlightClass:Fe.searchHighlight})}),v&&l.jsx("span",{className:Fe.workspaceBadge,title:v,children:v})]},m.id)})})})]})}function jx({node:n,depth:s,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:m,workspaceNames:h}){const g=ga(n.status),v=n.dependsOn.length>0&&n.dependsOn.some(w=>d.get(w)!=="complete"),b=i.has(n.id),_=n.children.length>0,S=c===n.id,T=wx+s*IA,j=s===0&&!n.parentTaskId&&n.workspaceId?h.get(n.workspaceId):void 0;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{onClick:()=>u(os(n.id)),className:`${Fe.taskRow} ${S?Fe.selected:""}`,style:{"--task-indent":`${T}px`},"data-task-id":n.id,children:[_&&l.jsx("span",{className:`${Fe.expandArrow} ${b?Fe.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:w=>{w.stopPropagation(),o(n.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),w.stopPropagation(),o(n.id))},children:"▸"}),!_&&l.jsx("span",{className:Fe.leafSpacer}),l.jsx("span",{className:Fe.taskStatusIcon,style:{color:g.color},children:g.icon}),l.jsx("span",{className:Fe.taskTitle,title:n.title,children:l.jsx(kx,{text:n.title,indices:m.get(n.id),highlightClass:Fe.searchHighlight})}),j&&l.jsx("span",{className:Fe.workspaceBadge,title:j,children:j}),_&&l.jsxs("span",{className:Fe.childCountBadge,children:[n.children.filter(w=>w.status==="complete").length,"/",n.children.length]}),n.dependsOn.length>0&&l.jsx("span",{className:`${Fe.dependencyBadge} ${v?Fe.blockedBadge:""}`,title:`Depends on: ${n.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<hT&&l.jsx("button",{onClick:w=>{w.stopPropagation(),u(ei(n.workspaceId,n.id))},title:"Add child task","aria-label":"Add child task",className:Fe.addChildButton,children:"+"})]}),l.jsx(rs,{children:_&&b&&l.jsx(Rt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:n.children.map(w=>l.jsx(jx,{node:w,depth:s+1,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:m,workspaceNames:h},w.id))})})]})}function UA({workspaces:n,tasks:s}){const i=St(),[o,c]=y.useState(new Set),[u,d]=y.useState(new Set),[m,h]=y.useState(Vy),[g,v]=y.useState(Vy),[b,_]=y.useState(new Map),S=Dt("/tasks/:taskId/*"),T=(S==null?void 0:S.params.taskId)!=="new"?S==null?void 0:S.params.taskId:void 0,N=y.useMemo(()=>new Map(s.map(K=>[K.id,K.status])),[s]),j=y.useMemo(()=>new Map(n.map(K=>[K.id,K.name])),[n]),w=()=>{const K=!m;BA(K),h(K),K&&(v(!0),_(new Map))},E=K=>{_(re=>{const I=new Map(re),$=I.has(K)?I.get(K):g;return I.set(K,!$),I})},A=K=>b.has(K)?b.get(K):g,O=K=>{c(re=>{const I=new Set(re);return I.has(K)?(I.delete(K),d($=>new Set($).add(K))):(I.add(K),d($=>{const Q=new Set($);return Q.delete(K),Q})),I})};y.useEffect(()=>{const K=new Set(s.filter(re=>re.parentTaskId).map(re=>re.parentTaskId));K.size>0&&c(re=>{const I=new Set(re);for(const $ of K)u.has($)||I.add($);return I})},[s,u]);const[C,M]=y.useState(""),{directMatchTaskIds:G,treeMatchTaskIds:U,titleHighlights:V}=y.useMemo(()=>{if(!C.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const K=mT(s,C,OA),re=new Set(K.map(de=>de.item.id)),I=new Map;for(const de of K){const me=de.matches.find(ze=>ze.key==="title");me&&I.set(de.item.id,me.indices)}const $=new Set(re),Q=new Map(s.map(de=>[de.id,de]));for(const de of[...re]){let me=Q.get(de);for(;me!=null&&me.parentTaskId;)$.add(me.parentTaskId),me=Q.get(me.parentTaskId)}return{directMatchTaskIds:re,treeMatchTaskIds:$,titleHighlights:I}},[C,s]),Z=G!==null,ee=Z?m?G:U:null,ie=ee?s.filter(K=>ee.has(K.id)):s,be=m?[]:rA(ie);return l.jsxs("div",{className:Fe.container,children:[l.jsxs("div",{className:Fe.header,children:[l.jsx("span",{children:"Tasks"}),l.jsxs("div",{className:Fe.headerActions,children:[l.jsx("button",{className:`${Fe.groupToggle} ${m?Fe.groupToggleActive:""}`,onClick:w,"aria-label":m?"Switch to tree view":"Group tasks by status","aria-pressed":m,title:m?"Switch to tree view":"Group tasks by status","data-testid":"task-group-by-status-toggle",children:"≡"}),l.jsx("button",{className:Fe.addButton,onClick:()=>i(ei()),"aria-label":"New task",title:"New task","data-testid":"new-task-button",children:"+"})]})]}),s.length>0&&l.jsx("input",{type:"text",value:C,onChange:K=>M(K.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Fe.searchInput,"data-testid":"sidebar-search"}),m?lA(ie,N).map(K=>l.jsx(LA,{group:K,isExpanded:A(K.status),onToggle:()=>E(K.status),selectedTaskId:T,navigate:i,titleHighlights:V,workspaceNames:j},K.status)):be.map(K=>l.jsx(jx,{node:K,depth:0,expandedTasks:o,toggleTask:O,selectedTaskId:T,navigate:i,taskStatusById:N,titleHighlights:V,workspaceNames:j},K.id)),ie.length===0&&!Z&&l.jsx("div",{className:Fe.emptyState,children:"No tasks yet. Click + to create one."}),ie.length===0&&Z&&l.jsx("div",{className:Fe.emptyState,children:"No matching tasks"})]})}const zA="_nav_14i94_1",PA="_tab_14i94_24",VA="_tabActive_14i94_62",qA="_tabLabel_14i94_75",HA="_statusDot_14i94_81",GA="_pulse_14i94_87",$A="_addButton_14i94_99",FA="_empty_14i94_132",ua={nav:zA,tab:PA,tabActive:VA,tabLabel:qA,statusDot:HA,pulse:GA,addButton:$A,empty:FA},ZA={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function KA({environments:n}){const s=St(),i=y.useRef(null),o=Dt("/environments/:environmentId"),c=Dt("/environments/:environmentId/edit"),u=Dt("/environments/:environmentId/workspaces/:workspaceId"),d=Dt("/environments/:environmentId/workspaces/:workspaceId/*"),m=(o==null?void 0:o.params.environmentId)??(c==null?void 0:c.params.environmentId)??(u==null?void 0:u.params.environmentId)??(d==null?void 0:d.params.environmentId),h=m==="new"?void 0:m,g=y.useCallback(_=>{s(Qi(_))},[s]),v=y.useCallback(_=>{var w;const S=(w=i.current)==null?void 0:w.querySelectorAll('[role="tab"]');if(!S||S.length===0)return;const T=Array.from(S).findIndex(E=>E===document.activeElement),N=T>=0?T:n.findIndex(E=>E.id===h);let j=N;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),j=(N+1)%S.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),j=(N-1+S.length)%S.length;else if(_.key==="Home")_.preventDefault(),j=0;else if(_.key==="End")_.preventDefault(),j=S.length-1;else return;j<n.length&&s(Qi(n[j].id)),S[j].focus()},[h,n,s]),b=h??(n.length>0?n[0].id:void 0);return l.jsxs("div",{className:ua.nav,"data-testid":"environment-nav",children:[l.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:n.map(_=>{const S=_.id===h,T=_.id===b,N=ZA[_.status]||"var(--text-tertiary)",j=_.status==="connected";return l.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:T?0:-1,className:`${ua.tab} ${S?ua.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[l.jsx("span",{className:`${ua.statusDot} ${j?ua.pulse:""}`,style:{color:N},children:"●"}),l.jsx("span",{className:ua.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),l.jsx("button",{type:"button",className:ua.addButton,onClick:()=>s(rw),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),n.length===0&&l.jsx("div",{className:ua.empty,children:"No environments yet."})]})}const YA="_nav_1bhou_1",JA="_tab_1bhou_24",WA="_tabIcon_1bhou_62",XA="_tabActive_1bhou_68",ic={nav:YA,tab:JA,tabIcon:WA,tabActive:XA},Cs=[{path:"credentials",label:"Credentials",icon:"🔑"},{path:"personas",label:"Personas",icon:"👤"},{path:"appearance",label:"Appearance",icon:"🎨"},{path:"shortcuts",label:"Shortcuts",icon:"⌨️"},{path:"about",label:"About",icon:"ℹ️"}];function QA(){var d;const n=It(),s=St(),i=y.useRef(null),o=((d=Cs.find(m=>{const h=`${Ji}/${m.path}`;return n.pathname===h||n.pathname.startsWith(`${h}/`)}))==null?void 0:d.path)??Cs[0].path,c=y.useCallback(m=>{s(`${Ji}/${m}`)},[s]),u=y.useCallback(m=>{var S,T;const h=(S=i.current)==null?void 0:S.querySelectorAll('[role="tab"]');if(!h)return;const g=Array.from(h).findIndex(N=>N===document.activeElement),v=g>=0?g:Cs.findIndex(N=>N.path===o);let b=v;if(m.key==="ArrowDown"||m.key==="j"||m.key==="J")m.preventDefault(),b=(v+1)%Cs.length;else if(m.key==="ArrowUp"||m.key==="k"||m.key==="K")m.preventDefault(),b=(v-1+Cs.length)%Cs.length;else if(m.key==="Home")m.preventDefault(),b=0;else if(m.key==="End")m.preventDefault(),b=Cs.length-1;else return;const _=Cs[b].path;s(`${Ji}/${_}`),(T=h[b])==null||T.focus()},[o,s]);return l.jsx("nav",{className:ic.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:Cs.map(m=>{const h=m.path===o;return l.jsxs("button",{role:"tab",type:"button","aria-selected":h,tabIndex:h?0:-1,className:`${ic.tab} ${h?ic.tabActive:""}`,onClick:()=>c(m.path),children:[l.jsx("span",{className:ic.tabIcon,"aria-hidden":"true",children:m.icon}),m.label]},m.path)})})}const eD="_nav_1snmp_1",tD="_searchForm_1snmp_8",nD="_searchInput_1snmp_15",sD="_searchButton_1snmp_33",aD="_clearButton_1snmp_68",iD="_workspaceSelect_1snmp_85",oD="_listHeader_1snmp_99",rD="_nodeList_1snmp_108",lD="_nodeItem_1snmp_116",cD="_indicator_1snmp_129",uD="_label_1snmp_136",dD="_badge_1snmp_145",In={nav:eD,searchForm:tD,searchInput:nD,searchButton:sD,clearButton:aD,workspaceSelect:iD,listHeader:oD,nodeList:rD,nodeItem:lD,indicator:cD,label:uD,badge:dD};function fD({nodes:n,workspaces:s,loading:i,searchQuery:o,onSearch:c,onClearSearch:u,onSelectNode:d,onWorkspaceChange:m}){const[h,g]=y.useState(""),v=y.useCallback(T=>{T.preventDefault(),h.trim()&&c(h.trim())},[h,c]),b=y.useCallback(()=>{g(""),u()},[u]),_=y.useCallback(T=>{d(T)},[d]),S=y.useCallback(T=>{g(""),m(T)},[m]);return l.jsxs("div",{className:In.nav,"data-testid":"knowledge-nav",children:[l.jsxs("form",{className:In.searchForm,onSubmit:v,children:[l.jsx("input",{className:In.searchInput,type:"text",placeholder:"Search...",value:h,onChange:T=>{g(T.target.value)},"data-testid":"knowledge-search-input"}),l.jsx("button",{type:"submit",className:In.searchButton,disabled:i,children:"Go"})]}),o&&l.jsx("button",{type:"button",className:In.clearButton,onClick:b,children:"Clear search"}),l.jsxs("select",{className:In.workspaceSelect,onChange:T=>{S(T.target.value)},"data-testid":"knowledge-workspace-filter",children:[l.jsx("option",{value:"",children:"All workspaces"}),s.map(T=>l.jsx("option",{value:T.id,children:T.name},T.id))]}),l.jsxs("div",{className:In.listHeader,children:["Nodes (",n.length,")"]}),l.jsx("ul",{className:In.nodeList,children:n.map(T=>l.jsxs("li",{className:In.nodeItem,onClick:()=>{_(T.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),_(T.id))},role:"button",tabIndex:0,children:[l.jsx("span",{className:In.indicator,style:{backgroundColor:T.kind==="reference"?"#4A9EFF":T.category==="decision"?"#22C55E":T.category==="concept"?"#A855F7":T.category==="snippet"?"#6B7280":"#EAB308"}}),l.jsx("span",{className:In.label,children:T.label}),l.jsx("span",{className:In.badge,children:T.kind==="reference"?T.sourceType:T.category})]},T.id))})]})}function pD(){const{workspaces:n,tasks:s}=pt(),i=y.useMemo(()=>l.jsx(UA,{workspaces:n,tasks:s}),[n,s]);return Ic(i),l.jsx(Qa,{})}function mD(){const{environments:n}=pt(),s=y.useMemo(()=>l.jsx(KA,{environments:n}),[n]);return Ic(s),l.jsx(Qa,{})}function hD(){const n=y.useMemo(()=>l.jsx(QA,{}),[]);return Ic(n),l.jsx(Qa,{})}function gD(){const{knowledge:n,workspaces:s}=pt(),i=y.useCallback(m=>{n.search(m)},[n]),o=y.useCallback(()=>{n.clearSearch()},[n]),c=y.useCallback(m=>{n.selectNode(m)},[n]),u=y.useCallback(m=>{n.loadRecent(m||void 0)},[n]),d=y.useMemo(()=>l.jsx(fD,{nodes:n.graphData.nodes,workspaces:s,loading:n.loading,searchQuery:n.searchQuery,onSearch:i,onClearSearch:o,onSelectNode:c,onWorkspaceChange:u}),[n,s,i,o,c,u]);return Ic(d),l.jsx(Qa,{})}const vD="_bar_tnfsh_1",yD="_btnPrimary_tnfsh_32",bD="_statusText_tnfsh_85",_D="_statusCompleted_tnfsh_90",xD="_statusFailed_tnfsh_94",SD="_statusBlocked_tnfsh_98",TD="_hintText_tnfsh_103",ht={bar:vD,btnPrimary:yD,statusText:bD,statusCompleted:_D,statusFailed:xD,statusBlocked:SD,hintText:TD};function kD({sessions:n,tasks:s,environments:i}){const o=St(),c=It(),u=Dt("/sessions/:sessionId"),d=Dt("/tasks/:taskId"),m=Dt("/tasks/:taskId/stream"),h=Dt("/tasks/:taskId/findings"),g=Dt("/tasks/:taskId/edit"),v=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),_=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),S=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),T=Dt("/sessions/new"),N=Dt("/environments/:environmentId/workspaces/:workspaceId"),j=Dt("/tasks/new"),w=Dt("/chat"),E=Dt("/"),A=Dt("/settings/*"),O=u==null?void 0:u.params.sessionId,C=(d==null?void 0:d.params.taskId)??(m==null?void 0:m.params.taskId)??(h==null?void 0:h.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId)??(_==null?void 0:_.params.taskId)??(S==null?void 0:S.params.taskId),M=v??b??_??S,G=(M==null?void 0:M.params.environmentId)??(N==null?void 0:N.params.environmentId),U=c.pathname.startsWith("/environments")&&!N&&!M,V=!!w,Z=!!T,ee=!!N&&!v&&!b&&!_&&!S,ie=!!j;if(!!E&&!Z&&!ee&&!ie||!!A||(!!g||!!S)||ie||U||Z)return l.jsx(l.Fragment,{});if(V)return i.find($=>$.adapterType==="local"&&$.status==="connected")?l.jsx(l.Fragment,{}):l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Add a local environment to start chatting"})});if(ee)return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Select a task or click + to create one"})});if(C){const I=s.find(de=>de.id===C);if(!I)return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Loading..."})});const $=new Map(s.map(de=>[de.id,de])),Q=I.dependsOn.some(de=>{const me=$.get(de);return me!==void 0&&me.status!=="complete"});if(I.status==="not_started"){const de=Q?I.dependsOn.map(me=>$.get(me)).filter(me=>me&&me.status!=="complete").map(me=>me.title):[];return l.jsx("div",{className:ht.bar,children:Q?l.jsxs("span",{className:ht.statusBlocked,children:["Blocked by: ",de.join(", ")]}):l.jsx("span",{className:ht.hintText,children:"Use the buttons above to start or manage this task"})})}if(I.status==="working"||I.status==="paused"){const de=I.latestSessionId||void 0,me=de?n.find(je=>je.id===de):void 0;return me&&me.status!=="stopped"?l.jsx(l.Fragment,{}):l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Waiting for agent..."})})}if(I.status==="complete")return l.jsxs("div",{className:ht.bar,children:[l.jsx("span",{className:`${ht.statusText} ${ht.statusCompleted}`,children:"Task completed"}),l.jsx("button",{onClick:()=>o(ei(I.workspaceId,void 0,G)),className:ht.btnPrimary,children:"+ New Task"})]});if(I.status==="failed")return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:`${ht.statusText} ${ht.statusFailed}`,children:"Task failed"})})}if(O){const I=n.find(de=>de.id===O),$=(I==null?void 0:I.status)==="stopped";if(I!==void 0&&!$)return l.jsx(l.Fragment,{});if($)return l.jsxs("div",{className:ht.bar,children:[l.jsxs("span",{className:`${ht.statusText} ${ht.hintText}`,children:["Session ",I.endReason||I.status]}),l.jsx("button",{onClick:()=>o(Cb(I.environmentId)),className:ht.btnPrimary,children:"+ New Chat"})]})}return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Loading..."})})}const wD="_toast_da8ll_1",ND="_success_da8ll_18",jD="_icon_da8ll_22",CD="_error_da8ll_25",ED="_warning_da8ll_32",AD="_info_da8ll_38",DD="_message_da8ll_53",RD="_close_da8ll_60",rr={toast:wD,success:ND,icon:jD,error:CD,warning:ED,info:AD,message:DD,close:RD},MD={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function OD({toast:n,onDismiss:s}){return y.useEffect(()=>{const i=setTimeout(()=>s(n.id),n.duration);return()=>clearTimeout(i)},[n.id,n.duration,s]),l.jsxs(Rt.div,{className:`${rr.toast} ${rr[n.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:[l.jsx("span",{className:rr.icon,"aria-hidden":"true",children:MD[n.variant]}),l.jsx("span",{className:rr.message,children:n.message}),l.jsx("button",{type:"button",className:rr.close,onClick:()=>s(n.id),"aria-label":"Dismiss notification",children:"×"})]})}const ID="_container_qqse2_1",BD={container:ID};function LD(){const{toasts:n,dismissToast:s}=Bs();return l.jsx("div",{className:BD.container,"data-testid":"toast-container",children:l.jsx(rs,{children:n.map(i=>l.jsx(OD,{toast:i,onDismiss:s},i.id))})})}const UD="_callout_1jaue_1",zD="_success_1jaue_11",PD="_icon_1jaue_15",VD="_error_1jaue_18",qD="_warning_1jaue_25",HD="_info_1jaue_32",GD="_content_1jaue_48",$D="_close_1jaue_53",lr={callout:UD,success:zD,icon:PD,error:VD,warning:qD,info:HD,content:GD,close:$D},FD={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function ZD({variant:n="info",children:s,dismissible:i=!1,className:o}){const[c,u]=y.useState(!1);return l.jsx(l.Fragment,{children:!c&&l.jsxs("div",{className:[lr.callout,lr[n],o].filter(Boolean).join(" "),role:n==="error"||n==="warning"?"alert":"status",children:[l.jsx("span",{className:lr.icon,"aria-hidden":"true",children:FD[n]}),l.jsx("span",{className:lr.content,children:s}),i&&l.jsx("button",{type:"button",className:lr.close,onClick:()=>u(!0),"aria-label":"Dismiss",children:"×"})]})})}const KD="_breadcrumbs_17or2_1",YD="_list_17or2_11",JD="_item_17or2_21",WD="_separator_17or2_28",XD="_link_17or2_34",QD="_current_17or2_57",qi={breadcrumbs:KD,list:YD,item:JD,separator:WD,link:XD,current:QD},eR="›";function ba({segments:n}){return l.jsx("nav",{className:qi.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:l.jsx("ol",{className:qi.list,children:n.map((s,i)=>{const o=i===n.length-1;return l.jsxs("li",{className:qi.item,children:[i>0&&l.jsx("span",{className:qi.separator,"aria-hidden":"true",children:eR}),s.url&&!o?l.jsx(yp,{className:qi.link,to:s.url,title:s.label,children:s.label}):l.jsx("span",{className:qi.current,"aria-current":"page",title:s.label,children:s.label})]},i)})})})}const tR="_btn_dwk2o_1",nR="_sm_dwk2o_22",sR="_md_dwk2o_28",aR="_lg_dwk2o_34",iR="_primary_dwk2o_40",oR="_danger_dwk2o_55",rR="_outline_dwk2o_70",lR="_ghost_dwk2o_80",kf={btn:tR,sm:nR,md:sR,lg:aR,primary:iR,danger:oR,outline:rR,ghost:lR},As=y.forwardRef(function({variant:s="primary",size:i="md",className:o,children:c,...u},d){const m=[kf.btn,kf[s],kf[i],o].filter(Boolean).join(" ");return l.jsx("button",{ref:d,className:m,...u,children:c})}),cR="_copyButton_1bqk0_1",uR={copyButton:cR},dR=2e3;async function fR(n,s){const i=new ClipboardItem({"text/html":new Blob([s],{type:"text/html"}),"text/plain":new Blob([n],{type:"text/plain"})});await navigator.clipboard.write([i])}function ni({text:n,getHtml:s,className:i,"data-testid":o}){const[c,u]=y.useState(!1),d=y.useRef(void 0);y.useEffect(()=>()=>{d.current!==void 0&&clearTimeout(d.current)},[]);const m=y.useCallback(async()=>{try{const h=s==null?void 0:s();if(h)try{await fR(n,h)}catch{await navigator.clipboard.writeText(n)}else await navigator.clipboard.writeText(n);u(!0),d.current!==void 0&&clearTimeout(d.current),d.current=setTimeout(()=>{u(!1),d.current=void 0},dR)}catch{}},[n,s]);return l.jsx("button",{type:"button",className:`${uR.copyButton} ${i??""}`,onClick:()=>{m().catch(()=>{})},"aria-label":c?"Copied":"Copy to clipboard","data-testid":o??"copy-button",children:c?"✓":"📋"})}const pR="_banner_bxqlh_1",mR="_label_bxqlh_15",hR="_text_bxqlh_25",gR="_link_bxqlh_29",oc={banner:pR,label:mR,text:hR,link:gR};function vR(){return l.jsxs("div",{className:oc.banner,"data-testid":"demo-banner",children:[l.jsx("span",{className:oc.label,children:"DEMO"}),l.jsxs("span",{className:oc.text,children:["This is an interactive demo with mock data."," ",l.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:oc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const yR="_container_og0yp_1",bR="_chevronButton_og0yp_6",_R="_mainButton_og0yp_6",xR="_sm_og0yp_34",SR="_md_og0yp_34",TR="_lg_og0yp_34",kR="_primary_og0yp_57",wR="_danger_og0yp_70",NR="_outline_og0yp_83",jR="_ghost_og0yp_92",CR="_dropdown_og0yp_100",ER="_option_og0yp_113",AR="_optionLabel_og0yp_130",DR="_optionDesc_og0yp_135",Es={container:yR,chevronButton:bR,mainButton:_R,sm:xR,md:SR,lg:TR,primary:kR,danger:wR,outline:NR,ghost:jR,dropdown:CR,option:ER,optionLabel:AR,optionDesc:DR};function Cx({label:n,onClick:s,options:i,variant:o="primary",size:c="md","data-testid":u}){const[d,m]=y.useState(!1),h=y.useRef(null);y.useEffect(()=>{if(!d)return;function _(S){h.current&&S.target instanceof Node&&!h.current.contains(S.target)&&m(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[d]),y.useEffect(()=>{if(!d)return;function _(S){S.key==="Escape"&&m(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[d]);const g=Es[o]||"",v=Es[c]||"",b=()=>{d&&m(!1),s()};return l.jsxs("div",{ref:h,className:Es.container,"data-testid":u,children:[l.jsx("button",{type:"button",className:`${Es.mainButton} ${g} ${v}`,onClick:b,"data-testid":u?`${u}-main`:void 0,children:n}),l.jsx("button",{type:"button",className:`${Es.chevronButton} ${g} ${v}`,onClick:()=>m(_=>!_),"aria-label":`More options for ${n}`,"aria-haspopup":"menu","aria-expanded":d,"data-testid":u?`${u}-chevron`:void 0,children:"▾"}),d&&l.jsx("div",{className:Es.dropdown,"data-testid":u?`${u}-menu`:void 0,children:i.map((_,S)=>l.jsxs("button",{type:"button",className:Es.option,onClick:()=>{_.onClick(),m(!1)},children:[l.jsx("span",{className:Es.optionLabel,children:_.label}),_.description&&l.jsx("span",{className:Es.optionDesc,children:_.description})]},S))})]})}function op(){op=function(c,u){return new i(c,void 0,u)};var n=RegExp.prototype,s=new WeakMap;function i(c,u,d){var m=new RegExp(c,u);return s.set(m,d||s.get(c)),jc(m,i.prototype)}function o(c,u){var d=s.get(u);return Object.keys(d).reduce(function(m,h){var g=d[h];if(typeof g=="number")m[h]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;m[h]=c[g[v]]}return m},Object.create(null))}return(function(c,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(u&&u.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),u&&jc(c,u)})(i,RegExp),i.prototype.exec=function(c){var u=n.exec.call(this,c);if(u){u.groups=o(u,this);var d=u.indices;d&&(d.groups=o(d,this))}return u},i.prototype[Symbol.replace]=function(c,u){if(typeof u=="string"){var d=s.get(this);return n[Symbol.replace].call(this,c,u.replace(/\$<([^>]+)>/g,function(h,g){var v=d[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof u=="function"){var m=this;return n[Symbol.replace].call(this,c,function(){var h=arguments;return typeof h[h.length-1]!="object"&&(h=[].slice.call(h)).push(o(h,m)),u.apply(this,h)})}return n[Symbol.replace].call(this,c,u)},op.apply(this,arguments)}function jc(n,s){return jc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},jc(n,s)}function qy(n,s){(s==null||s>n.length)&&(s=n.length);for(var i=0,o=new Array(s);i<s;i++)o[i]=n[i];return o}function wf(n,s){var i=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i)return(i=i.call(n)).next.bind(i);if(Array.isArray(n)||(i=(function(c,u){if(c){if(typeof c=="string")return qy(c,u);var d=Object.prototype.toString.call(c).slice(8,-1);return d==="Object"&&c.constructor&&(d=c.constructor.name),d==="Map"||d==="Set"?Array.from(c):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?qy(c,u):void 0}})(n))||s){i&&(n=i);var o=0;return function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
473
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var RR=(function(n){return function(s){return s===void 0&&(s={}),(function(o,c){if(c&&!o.registered(c))throw new Error('The default language "'+c+'" is not registered with refractor.')})(n,s.defaultLanguage),function(o){WS(o,"element",i)};function i(o,c,u){var d,m;if(u&&u.tagName==="pre"&&o.tagName==="code"){var h=(o==null||(d=o.data)==null?void 0:d.meta)||(o==null||(m=o.properties)==null?void 0:m.metastring)||"";o.properties.className?typeof o.properties.className=="boolean"?o.properties.className=[]:Array.isArray(o.properties.className)||(o.properties.className=[o.properties.className]):o.properties.className=[];var g,v,b=(function(C){for(var M,G=wf(C.properties.className);!(M=G()).done;){var U=M.value;if(U.slice(0,9)==="language-")return U.slice(9).toLowerCase()}return null})(o);if(!b&&s.defaultLanguage&&o.properties.className.push("language-"+(b=s.defaultLanguage)),o.properties.className.push("code-highlight"),b)try{var _,S;S=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,g=n.highlight(Jl(o),S),u.properties.className=(u.properties.className||[]).concat("language-"+S)}catch(C){if(!s.ignoreMissing||!/Unknown language/.test(C.message))throw C;g=o}else g=o;g.children=(v=1,function C(M){return M.reduce(function(G,U){if(U.type==="text"){var V=U.value,Z=(V.match(/\n/g)||"").length;if(Z===0)U.position={start:{line:v,column:1},end:{line:v,column:1}},G.push(U);else for(var ee,ie=V.split(`
|
|
474
|
+
`),be=wf(ie.entries());!(ee=be()).done;){var K=ee.value,re=K[0],I=K[1];G.push({type:"text",value:re===ie.length-1?I:I+`
|
|
475
|
+
`,position:{start:{line:v+re,column:1},end:{line:v+re,column:1}}})}return v+=Z,G}if(Object.prototype.hasOwnProperty.call(U,"children")){var $=v;return U.children=C(U.children),G.push(U),U.position={start:{line:$,column:1},end:{line:v,column:1}},G}return G.push(U),G},[])})(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 T,N=(function(C){var M=/{([\d,-]+)}/,G=C.split(",").map(function(Z){return Z.trim()}).join();if(M.test(G)){var U=M.exec(G)[1],V=QS(U);return function(Z){return V.includes(Z+1)}}return function(){return!1}})(h),j=(function(C){var M=op(/showLineNumbers=(\d+)/i,{lines:1});if(M.test(C)){var G=M.exec(C);return Number(G.groups.lines)}return 1})(h),w=(function(C){for(var M=new Array(C),G=0;G<C;G++)M[G]={type:"element",tagName:"span",properties:{className:[]},children:[]};return M})(g.position.end.line),E=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],A=function(){var C,M,G=T.value,U=G[0],V=G[1];V.properties.className=["code-line"];var Z=eT(g,function(ee){return ee.position.start.line<=U+1&&ee.position.end.line>=U+1});V.children=Z.children,(h.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!E.some(function(ee){return h.toLowerCase().includes(ee)})&&(V.properties.line=[(U+j).toString()],V.properties.className.push("line-number")),N(U)&&V.properties.className.push("highlight-line"),(b==="diff"||(C=b)!=null&&C.includes("diff-"))&&Jl(V).substring(0,1)==="-"?V.properties.className.push("deleted"):(b==="diff"||(M=b)!=null&&M.includes("diff-"))&&Jl(V).substring(0,1)==="+"&&V.properties.className.push("inserted")},O=wf(w.entries());!(T=O()).done;)A();w.length>0&&Jl(w[w.length-1]).trim()===""&&w.pop(),o.children=w}}}})(XS);function Ex(n){if(n>=1e6)return`${(n/1e6).toFixed(1)}M`;if(n>=1e3){const s=Number((n/1e3).toFixed(1));return s>=1e3?`${(n/1e6).toFixed(1)}M`:`${s.toFixed(1)}k`}return String(n)}function so(n){return n===0?"-":n<.01?`$${n.toFixed(4)}`:`$${n.toFixed(2)}`}const MR={read:"file-read",view:"file-read",edit:"file-edit",file_change:"file-edit",write:"file-write",bash:"shell",command_execution:"shell",grep:"search",glob:"search",todowrite:"todo",update_plan:"todo",todo_write:"todo",report_intent:"metadata"};function OR(n){return MR[n.toLowerCase()]??"generic"}const IR="_card_17a7m_2",BR="_cardBlue_17a7m_20",LR="_cardOrange_17a7m_24",UR="_cardGreen_17a7m_28",zR="_cardPurple_17a7m_32",PR="_cardNeutral_17a7m_36",VR="_cardRed_17a7m_40",qR="_header_17a7m_44",HR="_icon_17a7m_51",GR="_toolName_17a7m_58",$R="_fileName_17a7m_65",FR="_badge_17a7m_74",ZR="_spacer_17a7m_81",KR="_bodyToggle_17a7m_85",YR="_chevron_17a7m_103",JR="_chevronExpanded_17a7m_108",WR="_pre_17a7m_112",XR="_diffAdd_17a7m_136",QR="_diffRemove_17a7m_148",eM="_diffContext_17a7m_160",tM="_diffHeader_17a7m_169",nM="_diffLine_17a7m_175",sM="_exitOk_17a7m_181",aM="_exitError_17a7m_187",iM="_exitPending_17a7m_193",oM="_copyButtonInline_17a7m_207",rM="_inProgress_17a7m_221",lM="_metadata_17a7m_225",cM="_metadataPrefix_17a7m_232",ae={card:IR,cardBlue:BR,cardOrange:LR,cardGreen:UR,cardPurple:zR,cardNeutral:PR,cardRed:VR,header:qR,icon:HR,toolName:GR,fileName:$R,badge:FR,spacer:ZR,bodyToggle:KR,chevron:YR,chevronExpanded:JR,pre:WR,diffAdd:XR,diffRemove:QR,diffContext:eM,diffHeader:tM,diffLine:nM,exitOk:sM,exitError:aM,exitPending:iM,copyButtonInline:oM,inProgress:rM,metadata:lM,metadataPrefix:cM};function uM(n){if(n==null||typeof n!="object")return"";const s=n;return typeof s.file_path=="string"?s.file_path:typeof s.path=="string"?s.path:""}function dM(n){const s=n.split(/[/\\]/);return s[s.length-1]||n}const Nf=5;function Hy({tool:n,args:s,result:i,isError:o,writeVariant:c}){const[u,d]=y.useState(!1),m=uM(s),h=dM(m),g=i===void 0,v=o?ae.cardRed:c?ae.cardGreen:ae.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?"📝":"📄",S=c?"tool-card-file-write":"tool-card-file-read",T=(i==null?void 0:i.split(`
|
|
476
|
+
`))??[],N=T.length>Nf,j=u?T:T.slice(0,Nf);return l.jsxs("div",{className:`${ae.card} ${v} ${g?ae.inProgress:""}`,"data-testid":S,children:[l.jsxs("div",{className:ae.header,children:[l.jsx("span",{className:ae.icon,children:_}),l.jsx("span",{className:ae.toolName,style:{color:b},children:n}),h&&l.jsx("span",{className:ae.fileName,title:m,children:h}),!g&&T.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ae.spacer}),l.jsxs("span",{className:ae.badge,children:[T.length," lines"]})]}),!g&&!o&&i&&l.jsx(ni,{text:i,"data-testid":"tool-card-copy",className:ae.copyButtonInline})]}),o&&i&&l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-error",children:i}),!o&&!g&&T.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-content",children:j.map((w,E)=>l.jsxs("span",{className:ae.diffLine,children:[l.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:E+1}),w]},E))}),N&&l.jsxs("button",{type:"button",className:ae.bodyToggle,onClick:()=>{d(w=>!w)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${ae.chevron} ${u?ae.chevronExpanded:""}`,children:"▸"}),u?"collapse":`${T.length-Nf} more lines`]})]})]})}function fM(n){const s=n.split(`
|
|
477
|
+
`),i=[];for(const o of s)o.startsWith("diff --git")||o.startsWith("index ")||(o.startsWith("--- ")||o.startsWith("+++ "))&&!o.startsWith("---- ")&&!o.startsWith("++++ ")||(o.startsWith("@@")?i.push({type:"header",content:o}):o.startsWith("+")?i.push({type:"add",content:o.slice(1)}):o.startsWith("-")?i.push({type:"remove",content:o.slice(1)}):o.startsWith(" ")?i.push({type:"context",content:o.slice(1)}):o===""&&i.push({type:"context",content:""}));return i}function pM(n,s){const i=n.split(`
|
|
478
|
+
`),o=s.split(`
|
|
479
|
+
`),c=[];for(const u of i)c.push({type:"remove",content:u});for(const u of o)c.push({type:"add",content:u});return c}function mM(n){let s=0,i=0;for(const o of n)o.type==="add"&&s++,o.type==="remove"&&i++;return{added:s,removed:i}}function hM(n){if(n==null||typeof n!="object")return"";const s=n;return typeof s.file_path=="string"&&s.file_path||typeof s.path=="string"&&s.path||""}function gM(n){if(n===void 0||typeof n!="object"||n===null)return;const s=n,i=(typeof s.old_string=="string"?s.old_string:void 0)??(typeof s.old_str=="string"?s.old_str:void 0),o=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(i!==void 0&&o!==void 0)return{oldStr:i,newStr:o}}function vM(n){const s=n.split(/[/\\]/);return s[s.length-1]||n}function yM(n,s){if(s){let o=s;if(s.trimStart().startsWith("{"))try{const c=JSON.parse(s);typeof c.detailedContent=="string"&&(o=c.detailedContent)}catch{}if(o.includes("@@")||o.startsWith("diff ")){const c=fM(o);if(c.length>0)return c}}const i=gM(n);if(i)return pM(i.oldStr,i.newStr)}const jf=5;function bM({tool:n,args:s,result:i,isError:o,detailedResult:c}){const[u,d]=y.useState(!1),m=hM(s),h=vM(m),g=i===void 0,v=yM(s,c),b=v?mM(v):null,_=((v==null?void 0:v.length)??0)>jf,S=u?v:v==null?void 0:v.slice(0,jf);return l.jsxs("div",{className:`${ae.card} ${o?ae.cardRed:ae.cardOrange} ${g?ae.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[l.jsxs("div",{className:ae.header,children:[l.jsx("span",{className:ae.icon,children:"✏️"}),l.jsx("span",{className:ae.toolName,style:{color:"var(--accent-yellow)"},children:n}),h&&l.jsx("span",{className:ae.fileName,title:m,children:h}),b&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ae.spacer}),l.jsxs("span",{className:ae.badge,"data-testid":"tool-card-diff-stats",children:[l.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",l.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]}),!g&&!o&&(v||i)&&l.jsx(ni,{text:v?v.map(T=>`${T.type==="add"?"+":T.type==="remove"?"-":T.type==="header"?"":" "}${T.content}`).join(`
|
|
480
|
+
`):i,"data-testid":"tool-card-copy",className:ae.copyButtonInline})]}),o&&i&&l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-error",children:i}),!o&&S&&S.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-diff",children:S.map((T,N)=>{let j=ae.diffContext;return T.type==="add"&&(j=ae.diffAdd),T.type==="remove"&&(j=ae.diffRemove),T.type==="header"&&(j=ae.diffHeader),l.jsx("span",{className:`${ae.diffLine} ${j}`,children:T.content},N)})}),_&&l.jsxs("button",{type:"button",className:ae.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${ae.chevron} ${u?ae.chevronExpanded:""}`,children:"▸"}),u?"collapse":`${((v==null?void 0:v.length)??0)-jf} more lines`]})]}),!o&&!v&&!g&&i&&l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-content",children:i})]})}const _M=/^\[exit (\d+)\]\s*/;function xM(n){const s=_M.exec(n);return s?{exitCode:Number(s[1]),output:n.slice(s[0].length)}:{exitCode:void 0,output:n}}function SM(n){if(n==null||typeof n!="object")return"";const s=n;return typeof s.command=="string"?s.command:""}function TM(n){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'(.+?)'\s*$/i.exec(n);if(s)return s[1];const i=/pwsh(?:\.exe)?["']?\s+-Command\s+"(.+?)"\s*$/i.exec(n);return i?i[1]:n}const Cf=3;function kM({tool:n,args:s,result:i,isError:o}){const[c,u]=y.useState(!1),d=SM(s),m=TM(d),h=i===void 0,g=i?xM(i):null,v=(g==null?void 0:g.output.split(`
|
|
481
|
+
`))??[],b=v.length>Cf,_=c?v:v.slice(0,Cf),S=g==null?void 0:g.exitCode,T=o||S!==void 0&&S!==0;return l.jsxs("div",{className:`${ae.card} ${T?ae.cardRed:ae.cardNeutral}`,"data-testid":"tool-card-shell",children:[l.jsxs("div",{className:ae.header,children:[l.jsx("span",{className:ae.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),l.jsx("span",{className:ae.fileName,style:{flex:1,color:"var(--text-primary)"},title:d!==m?d:void 0,"data-testid":"tool-card-command",children:m}),S!==void 0&&l.jsxs("span",{className:S===0?ae.exitOk:ae.exitError,"data-testid":"tool-card-exit-code",children:[S===0?"✓":"✗"," exit ",S]}),!h&&g&&g.output.length>0&&l.jsx(ni,{text:g.output,"data-testid":"tool-card-copy",className:ae.copyButtonInline}),h&&l.jsx("span",{className:ae.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),!h&&g&&g.output.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-output",children:_.join(`
|
|
482
|
+
`)}),b&&l.jsxs("button",{type:"button",className:ae.bodyToggle,onClick:()=>{u(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${ae.chevron} ${c?ae.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Cf} more lines`]})]})]})}function wM(n){if(n==null||typeof n!="object")return{pattern:"",path:""};const s=n,i=typeof s.pattern=="string"?s.pattern:"",o=typeof s.path=="string"?s.path:"";return{pattern:i,path:o}}const Ef=5;function NM({tool:n,args:s,result:i,isError:o}){const[c,u]=y.useState(!1),{pattern:d,path:m}=wM(s),h=i===void 0,g=(i==null?void 0:i.split(`
|
|
483
|
+
`).filter(_=>_.length>0))??[],v=g.length>Ef,b=c?g:g.slice(0,Ef);return l.jsxs("div",{className:`${ae.card} ${o?ae.cardRed:ae.cardPurple} ${h?ae.inProgress:""}`,"data-testid":"tool-card-search",children:[l.jsxs("div",{className:ae.header,children:[l.jsx("span",{className:ae.icon,children:"🔍"}),l.jsx("span",{className:ae.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:n}),d&&l.jsxs("span",{className:ae.fileName,"data-testid":"tool-card-pattern",children:['"',d,'"']}),m&&l.jsxs("span",{className:ae.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",m]}),!h&&!o&&g.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ae.spacer}),l.jsxs("span",{className:ae.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]}),!h&&!o&&i&&l.jsx(ni,{text:i,"data-testid":"tool-card-copy",className:ae.copyButtonInline})]}),o&&i&&l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&b.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-results",children:b.join(`
|
|
484
|
+
`)}),v&&l.jsxs("button",{type:"button",className:ae.bodyToggle,onClick:()=>{u(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${ae.chevron} ${c?ae.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.length-Ef} more matches`]})]})]})}const jM="_progressBar_14f5c_1",CM="_progressFill_14f5c_9",EM="_activeTask_14f5c_16",AM="_activeIcon_14f5c_27",DM="_todoPulse_14f5c_1",RM="_activeText_14f5c_34",MM="_checklist_14f5c_48",OM="_item_14f5c_55",IM="_itemIcon_14f5c_65",BM="_itemText_14f5c_73",LM="_pending_14f5c_78",UM="_in_progress_14f5c_85",zM="_completed_14f5c_97",PM="_emptyMessage_14f5c_108",$n={progressBar:jM,progressFill:CM,activeTask:EM,activeIcon:AM,todoPulse:DM,activeText:RM,checklist:MM,item:OM,itemIcon:IM,itemText:BM,pending:LM,in_progress:UM,completed:zM,emptyMessage:PM},VM=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function qM(n){if(n===void 0||typeof n!="object"||n===null)return[];const s=n;return Array.isArray(s.todos)?s.todos.filter(i=>typeof i=="object"&&i!==null&&typeof i.content=="string"&&typeof i.status=="string").map(i=>({content:i.content,activeForm:typeof i.activeForm=="string"?i.activeForm:void 0,status:Gy(i.status)})):Array.isArray(s.plan)?s.plan.filter(i=>typeof i=="object"&&i!==null&&typeof i.step=="string"&&typeof i.status=="string").map(i=>({content:i.step,status:Gy(i.status)})):typeof s.content=="string"?HM(s.content):[]}function Gy(n){switch(n.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 HM(n){const s=n.split(`
|
|
485
|
+
`),i=[];for(const o of s){const c=VM.exec(o.trim());if(c){const u=c[1],d=c[2].trim();let m="pending";u==="x"||u==="X"?m="completed":(u==="~"||u==="/"||u==="!")&&(m="in_progress"),i.push({content:d,status:m})}}return i}function GM(n){switch(n){case"completed":return"✓";case"in_progress":return"●";default:return"○"}}function $M({args:n}){const s=qM(n),i=s.filter(u=>u.status==="completed").length,o=s.find(u=>u.status==="in_progress"),c=s.length===0;return l.jsxs("div",{className:`${ae.card} ${ae.cardBlue}`,"data-testid":"tool-card-todo",children:[l.jsxs("div",{className:ae.header,children:[l.jsx("span",{className:ae.icon,children:"☑"}),l.jsx("span",{className:ae.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ae.spacer}),l.jsxs("span",{className:ae.badge,"data-testid":"tool-card-todo-progress",children:[i,"/",s.length]})]})]}),!c&&l.jsx("div",{className:$n.progressBar,"data-testid":"tool-card-todo-bar",children:l.jsx("div",{className:$n.progressFill,style:{width:`${i/s.length*100}%`}})}),o&&l.jsxs("div",{className:$n.activeTask,"data-testid":"tool-card-todo-active",children:[l.jsx("span",{className:$n.activeIcon,children:"●"}),l.jsx("span",{className:$n.activeText,children:o.activeForm||o.content})]}),!c&&l.jsx("div",{className:$n.checklist,"data-testid":"tool-card-todo-list",children:s.map((u,d)=>l.jsxs("div",{className:`${$n.item} ${$n[u.status]}`,"data-testid":"tool-card-todo-item",children:[l.jsx("span",{className:$n.itemIcon,children:GM(u.status)}),l.jsx("span",{className:$n.itemText,children:u.content})]},d))}),c&&l.jsx("div",{className:$n.emptyMessage,children:"All items completed and cleared."})]})}function FM(n,s){if(s==null||typeof s!="object")return"";const i=s;if(typeof i.intent=="string")return i.intent;for(const o of Object.values(i))if(typeof o=="string")return o;return n}function ZM({tool:n,args:s}){const i=FM(n,s);return l.jsxs("div",{className:ae.metadata,"data-testid":"tool-card-metadata",children:[l.jsx("span",{className:ae.metadataPrefix,children:"↳"}),i]})}function KM(n){const s=/^mcp__(.+?)__(.+)$/.exec(n);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:n,isMcp:!1}}function YM(n){if(n==null)return"";if(typeof n!="object")return String(n);const s=n;if(typeof s.command=="string")return s.command;if(typeof s.file_path=="string")return s.file_path;if(typeof s.path=="string")return s.path;if(typeof s.query=="string")return s.query;if(typeof s.url=="string")return s.url;try{const i=JSON.stringify(n);return i.length>120?`${i.slice(0,120)}…`:i}catch{return""}}const Af=5;function JM({tool:n,args:s,result:i,isError:o}){const[c,u]=y.useState(!1),{display:d}=KM(n),m=YM(s),h=i===void 0,g=(i==null?void 0:i.split(`
|
|
486
|
+
`))??[],v=g.length>Af,b=c?i:g.slice(0,Af).join(`
|
|
487
|
+
`);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return l.jsxs("div",{className:`${ae.card} ${o?ae.cardRed:ae.cardBlue} ${h?ae.inProgress:""}`,"data-testid":"tool-card-generic",children:[l.jsxs("div",{className:ae.header,children:[l.jsx("span",{className:ae.icon,children:"⚙"}),l.jsx("span",{className:ae.toolName,style:{color:"var(--accent-blue)"},children:d}),m&&l.jsx("span",{className:ae.fileName,children:m}),!h&&!o&&i&&l.jsx(ni,{text:i,"data-testid":"tool-card-copy",className:ae.copyButtonInline})]}),h&&_&&l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-args",children:_}),o&&i&&l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&i&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:ae.pre,"data-testid":"tool-card-result",children:b}),v&&l.jsxs("button",{type:"button",className:ae.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${ae.chevron} ${c?ae.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.length-Af} more lines`]})]})]})}function Df(n){switch(OR(n.tool)){case"file-read":return l.jsx(Hy,{...n});case"file-edit":return l.jsx(bM,{...n});case"file-write":return l.jsx(Hy,{...n,writeVariant:!0});case"shell":return l.jsx(kM,{...n});case"search":return l.jsx(NM,{...n});case"todo":return l.jsx($M,{...n});case"metadata":return l.jsx(ZM,{...n});default:return l.jsx(JM,{...n})}}const WM="_systemContextEvent_8n7q0_1",XM="_systemContextHeader_8n7q0_7",QM="_systemContextBadge_8n7q0_28",e3="_systemContextToggle_8n7q0_37",t3="_systemContextPre_8n7q0_43",n3="_systemContextEllipsis_8n7q0_54",s3="_systemEvent_8n7q0_58",a3="_systemTimestamp_8n7q0_65",i3="_textEvent_8n7q0_69",o3="_messageCopyButton_8n7q0_75",r3="_codeBlockWrapper_8n7q0_159",l3="_codeBlockCopyButton_8n7q0_162",c3="_errorEvent_8n7q0_166",u3="_statusEvent_8n7q0_174",d3="_userInputEvent_8n7q0_183",f3="_userInputContent_8n7q0_189",p3="_signalEvent_8n7q0_206",m3="_signalBadge_8n7q0_217",h3="_signalContent_8n7q0_226",g3="_usageEvent_8n7q0_231",v3="_usageBadge_8n7q0_238",y3="_defaultEvent_8n7q0_247",xt={systemContextEvent:WM,systemContextHeader:XM,systemContextBadge:QM,systemContextToggle:e3,systemContextPre:t3,systemContextEllipsis:n3,systemEvent:s3,systemTimestamp:a3,textEvent:i3,messageCopyButton:o3,codeBlockWrapper:r3,codeBlockCopyButton:l3,errorEvent:c3,statusEvent:u3,userInputEvent:d3,userInputContent:f3,signalEvent:p3,signalBadge:m3,signalContent:h3,usageEvent:g3,usageBadge:v3,defaultEvent:y3},$y=3;function b3({content:n}){const[s,i]=y.useState(!1),o=n.split(`
|
|
488
|
+
`),c=o.length>$y,u=s?n:o.slice(0,$y).join(`
|
|
489
|
+
`);return l.jsxs("div",{className:xt.systemContextEvent,"data-testid":"system-context-event",children:[l.jsxs("button",{type:"button",className:xt.systemContextHeader,onClick:()=>{i(d=>!d)},"aria-expanded":s,children:[l.jsx("span",{className:xt.systemContextBadge,children:"SYSTEM PROMPT"}),c&&l.jsx("span",{className:xt.systemContextToggle,"aria-hidden":"true",children:s?"▾":"▸"})]}),l.jsxs("pre",{className:xt.systemContextPre,children:[u,!s&&c&&l.jsx("span",{className:xt.systemContextEllipsis,children:"…"})]})]})}function _3({time:n,content:s}){return l.jsxs("div",{className:xt.systemEvent,children:[l.jsxs("span",{className:xt.systemTimestamp,children:["[",n,"]"]})," ",s]})}function rp(n){return typeof n=="string"?n:typeof n=="number"?String(n):Array.isArray(n)?n.map(rp).join(""):n!=null&&typeof n=="object"&&"props"in n?rp(n.props.children):""}function x3({children:n,node:s,...i}){const o=rp(n);return l.jsxs("div",{className:xt.codeBlockWrapper,children:[l.jsx("pre",{...i,children:n}),l.jsx(ni,{text:o,"data-testid":"copy-code-block",className:xt.codeBlockCopyButton})]})}const S3={pre:x3};function T3({content:n}){const s=y.useRef(null),i=y.useCallback(()=>{if(!s.current)return;const o=s.current.cloneNode(!0);for(const c of o.querySelectorAll("[data-testid='copy-code-block']"))c.remove();return o.innerHTML},[]);return l.jsxs("div",{className:xt.textEvent,children:[l.jsx(ni,{text:n,getHtml:i,"data-testid":"copy-message",className:xt.messageCopyButton}),l.jsx("div",{ref:s,children:l.jsx(up,{remarkPlugins:[dp],rehypePlugins:[RR],components:S3,children:n})})]})}function k3({content:n}){return l.jsxs("div",{className:xt.errorEvent,children:["Error: ",n]})}function w3({content:n}){return l.jsxs("div",{className:xt.statusEvent,children:["--- ",n," ---"]})}function N3({content:n}){return l.jsx("div",{className:xt.userInputEvent,children:l.jsx("span",{className:xt.userInputContent,children:n})})}function j3({content:n}){return l.jsxs("div",{className:xt.signalEvent,"data-testid":"signal-event",children:[l.jsx("span",{className:xt.signalBadge,children:"SIGNAL"}),l.jsx("span",{className:xt.signalContent,children:n})]})}function C3({content:n}){let s=n;try{const i=JSON.parse(n),o=Number(i.input_tokens)||0,c=Number(i.output_tokens)||0,u=Ex(o+c),d=so(Number(i.cost_usd)||0);s=`${u} tokens · ${d}`}catch{}return l.jsx("div",{className:xt.usageEvent,"data-testid":"usage-event",children:l.jsx("span",{className:xt.usageBadge,children:s})})}function E3({content:n}){return l.jsx("div",{className:xt.defaultEvent,children:n})}function A3({event:n,toolUseCtx:s}){const i=new Date(n.timestamp).toLocaleTimeString();switch(n.eventType){case"system":{if(n.raw)try{if(JSON.parse(n.raw).systemContext===!0)return l.jsx(b3,{content:n.content})}catch{}return l.jsx(_3,{time:i,content:n.content})}case"text":case"output":return l.jsx(T3,{content:n.content});case"tool_use":{let o="",c={};try{const u=JSON.parse(n.content);o=u.tool||"",c=u.args}catch{}return l.jsx(Df,{tool:o,args:c})}case"tool_result":{let o=!1;if(n.raw)try{o=JSON.parse(n.raw).is_error===!0}catch{}let c=n.content;if(n.content.trimStart().startsWith("{"))try{const u=JSON.parse(n.content);typeof u.content=="string"&&(c=u.content)}catch{}return s?l.jsx(Df,{tool:s.tool,args:s.args,result:c,isError:o,detailedResult:s.detailedResult}):l.jsx(Df,{tool:"Tool output",args:void 0,result:c,isError:o})}case"error":return l.jsx(k3,{content:n.content});case"status":return l.jsx(w3,{content:n.content});case"user_input":return l.jsx(N3,{content:n.content});case"signal":return l.jsx(j3,{content:n.content});case"usage":return l.jsx(C3,{content:n.content});default:return l.jsx(E3,{content:n.content})}}const D3="_overlay_cmicx_1",R3="_dialog_cmicx_11",M3="_title_cmicx_30",O3="_description_cmicx_38",I3="_actions_cmicx_45",B3="_cancelButton_cmicx_52",L3="_confirmButton_cmicx_79",Va={overlay:D3,dialog:R3,title:M3,description:O3,actions:I3,cancelButton:B3,confirmButton:L3};function Ja({isOpen:n,title:s,description:i,confirmLabel:o="Delete",onConfirm:c,onCancel:u}){const d=y.useId(),m=y.useId();return l.jsx(rs,{children:n&&l.jsx(Rt.div,{className:Va.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:u,onKeyDown:h=>{h.key==="Escape"&&u()},role:"dialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":i?m:void 0,children:l.jsxs(Rt.div,{className:Va.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:h=>h.stopPropagation(),children:[l.jsx("h3",{id:d,className:Va.title,children:s}),i&&l.jsx("p",{id:m,className:Va.description,children:i}),l.jsxs("div",{className:Va.actions,children:[l.jsx("button",{type:"button",className:Va.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),l.jsx("button",{type:"button",className:Va.confirmButton,onClick:c,children:o})]})]})})})}const U3="_spinner_1uyt1_1",z3="_spin_1uyt1_1",P3="_sm_1uyt1_14",V3="_md_1uyt1_20",q3="_lg_1uyt1_26",H3="_xl_1uyt1_32",Fy={spinner:U3,spin:z3,sm:P3,md:V3,lg:q3,xl:H3};function Ax({size:n="md",className:s,label:i="Loading",liveRegion:o=!1}){return l.jsx("span",{className:`${Fy.spinner} ${Fy[n]} ${s??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const G3="_splash_1bn1g_1",$3="_logo_1bn1g_11",Zy={splash:G3,logo:$3};function Dx(){return l.jsxs("div",{className:Zy.splash,"data-testid":"splash-screen",children:[l.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Zy.logo}),l.jsx(Ax,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}function F3(n,s){const i=y.useRef(null);y.useEffect(()=>{const o=i.current;if(i.current=n,o===null)return;const c=new Map;for(const d of o)c.set(d.id,d);const u=new Set;for(const d of n){u.add(d.id);const m=c.get(d.id);if(m&&m.status!==d.status&&d.status!=="sleeping"){if(d.status==="connecting"){s("Provisioning environment…","info");continue}d.status==="connected"?s("Environment connected","success"):d.status==="error"?s("Environment provision failed","error"):d.status==="disconnected"&&(m.status==="connected"?s("Environment disconnected","warning"):s("Environment stopped","info"))}}for(const d of o)u.has(d.id)||s("Environment removed","info")},[n,s])}const Z3={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 K3(n){return Z3[n]}function Y3(n,s){if(n===void 0)return[];const i=[],o=new Map;for(const u of n)o.set(u.id,u);const c=new Set;for(const u of s){c.add(u.id);const d=o.get(u.id);if(!d||d.status===u.status)continue;const m=K3(u.status);m&&i.push(m)}for(const u of n)c.has(u.id)||i.push({message:"Task deleted",variant:"info"});return i}function J3(n,s){const i=y.useRef(void 0);y.useEffect(()=>{const o=i.current;i.current=n;const c=Y3(o,n);for(const u of c)s(u.message,u.variant)},[n,s])}function W3(n,s,i){const o=n.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=Rx(s),u=s.filter(h=>lp(h,c)).length,d=s.filter(h=>h.status==="paused"||h.status==="failed"||lp(h,c)).length,m=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:o,blockedTasks:u,attentionTasks:d,unhealthyEnvironments:m}}function Rx(n){const s=new Map;for(const i of n)s.set(i.id,i.status);return s}function lp(n,s){return n.dependsOn.some(i=>s.get(i)!=="complete")}function X3(n,s){var d;const i=new Map;for(const m of s)i.set(m.id,m);const o=Rx(n),c=[];for(const m of n){const h=m.workspaceId?((d=i.get(m.workspaceId))==null?void 0:d.name)??"Unknown":"Unknown";m.status==="failed"?c.push({task:m,reason:"failed",workspaceName:h}):lp(m,o)?c.push({task:m,reason:"blocked",workspaceName:h}):m.status==="paused"&&c.push({task:m,reason:"paused",workspaceName:h})}const u={failed:0,blocked:1,paused:2};return c.sort((m,h)=>(u[m.reason]??3)-(u[h.reason]??3)),c}function Q3(n,s){const i=new Map;for(const o of s)i.set(o.id,o);return n.filter(o=>o.status==="running"||o.status==="idle"||o.status==="waiting").map(o=>{var c;return{session:o,environmentName:((c=i.get(o.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function e6(n,s,i){const o=new Map;for(const c of s){if(!c.workspaceId)continue;let u=o.get(c.workspaceId);u||(u={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},o.set(c.workspaceId,u)),u.totalTasks+=1,c.status==="complete"?u.completedTasks+=1:c.status==="working"?u.workingTasks+=1:c.status==="failed"&&(u.failedTasks+=1)}return n.map(c=>{const u=o.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:u.totalTasks,completedTasks:u.completedTasks,workingTasks:u.workingTasks,failedTasks:u.failedTasks}})}const t6="_dashboard_16pzm_1",n6="_kpiStrip_16pzm_11",s6="_kpiCard_16pzm_23",a6="_kpiValue_16pzm_68",i6="_kpiLabel_16pzm_76",o6="_bodyGrid_16pzm_84",r6="_section_16pzm_96",l6="_sectionHeader_16pzm_109",c6="_sectionIcon_16pzm_118",u6="_sectionTitle_16pzm_123",d6="_sectionCount_16pzm_131",f6="_sectionBody_16pzm_138",p6="_emptyHint_16pzm_143",m6="_sessionRow_16pzm_150",h6="_sessionPrompt_16pzm_177",g6="_sessionEnv_16pzm_186",v6="_sessionRuntime_16pzm_192",y6="_sessionStatus_16pzm_198",b6="_statusDot_16pzm_207",_6="_attentionRow_16pzm_233",x6="_attentionTitle_16pzm_259",S6="_attentionMeta_16pzm_267",T6="_reasonBadge_16pzm_274",k6="_bottomGrid_16pzm_301",w6="_envRow_16pzm_312",N6="_envName_16pzm_323",j6="_envStatusBadge_16pzm_333",C6="_workspaceRow_16pzm_369",E6="_workspaceTop_16pzm_395",A6="_workspaceName_16pzm_401",D6="_workspaceCounts_16pzm_407",R6="_progressBar_16pzm_415",M6="_progressFill_16pzm_422",xe={dashboard:t6,kpiStrip:n6,kpiCard:s6,kpiValue:a6,kpiLabel:i6,bodyGrid:o6,section:r6,sectionHeader:l6,sectionIcon:c6,sectionTitle:u6,sectionCount:d6,sectionBody:f6,emptyHint:p6,sessionRow:m6,sessionPrompt:h6,sessionEnv:g6,sessionRuntime:v6,sessionStatus:y6,statusDot:b6,attentionRow:_6,attentionTitle:x6,attentionMeta:S6,reasonBadge:T6,bottomGrid:k6,envRow:w6,envName:N6,envStatusBadge:j6,workspaceRow:C6,workspaceTop:E6,workspaceName:A6,workspaceCounts:D6,progressBar:R6,progressFill:M6},O6={hidden:{opacity:0,y:12},visible:n=>({opacity:1,y:0,transition:{delay:n*.06,duration:.3,ease:"easeOut"}})},rc={hidden:{opacity:0,y:16},visible:n=>({opacity:1,y:0,transition:{delay:.15+n*.08,duration:.35,ease:"easeOut"}})};function I6(n,s,i,o){const c=[`${n} of ${s} tasks completed`];return i>0&&c.push(`${i} in progress`),o>0&&c.push(`${o} failed`),c.join(", ")}function lc({value:n,label:s,accent:i,index:o,testId:c}){return l.jsxs(Rt.div,{className:xe.kpiCard,"data-accent":i,"data-testid":c,variants:O6,initial:"hidden",animate:"visible",custom:o,children:[l.jsx("span",{className:xe.kpiValue,children:n}),l.jsx("span",{className:xe.kpiLabel,children:s})]})}function B6(){const{workspaces:n,tasks:s,sessions:i,environments:o,loadTasks:c}=pt(),u=St(),d=y.useRef(new Set);y.useEffect(()=>{for(const b of n)d.current.has(b.id)||(d.current.add(b.id),c(b.id))},[n,c]);const m=y.useMemo(()=>W3(i,s,o),[i,s,o]),h=y.useMemo(()=>Q3(i,o),[i,o]),g=y.useMemo(()=>X3(s,n),[s,n]),v=y.useMemo(()=>e6(n,s),[n,s,o]);return l.jsxs("div",{className:xe.dashboard,"data-testid":"dashboard",children:[l.jsxs("div",{className:xe.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[l.jsx(lc,{value:m.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),l.jsx(lc,{value:m.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),l.jsx(lc,{value:m.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),l.jsx(lc,{value:m.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),l.jsxs("div",{className:xe.bodyGrid,children:[l.jsxs(Rt.div,{className:xe.section,variants:rc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[l.jsxs("div",{className:xe.sectionHeader,children:[l.jsx("span",{className:xe.sectionIcon,"aria-hidden":"true",children:"●"}),l.jsx("span",{className:xe.sectionTitle,children:"Active Sessions"}),l.jsx("span",{className:xe.sectionCount,children:h.length})]}),l.jsx("div",{className:xe.sectionBody,children:h.length===0?l.jsx("div",{className:xe.emptyHint,children:"No active sessions"}):h.map(({session:b,environmentName:_})=>l.jsxs("button",{type:"button",className:xe.sessionRow,onClick:()=>u(jb(b.id)),"data-testid":"session-row",children:[l.jsx("span",{className:xe.sessionPrompt,title:b.prompt,children:b.prompt||"—"}),l.jsx("span",{className:xe.sessionEnv,children:_}),l.jsx("span",{className:xe.sessionRuntime,children:b.runtime}),l.jsxs("span",{className:xe.sessionStatus,children:[l.jsx("span",{className:xe.statusDot,"data-status":b.status}),b.status]})]},b.id))})]}),l.jsxs(Rt.div,{className:xe.section,variants:rc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[l.jsxs("div",{className:xe.sectionHeader,children:[l.jsx("span",{className:xe.sectionIcon,"aria-hidden":"true",children:"⚑"}),l.jsx("span",{className:xe.sectionTitle,children:"Needs Attention"}),l.jsx("span",{className:xe.sectionCount,children:g.length})]}),l.jsx("div",{className:xe.sectionBody,children:g.length===0?l.jsx("div",{className:xe.emptyHint,children:"All clear"}):g.map(({task:b,reason:_,workspaceName:S})=>l.jsxs("button",{type:"button",className:xe.attentionRow,onClick:()=>u(os(b.id)),"data-testid":"attention-row",children:[l.jsxs("div",{className:xe.attentionTitle,children:[l.jsx("span",{className:xe.reasonBadge,"data-reason":_,children:_}),b.title]}),l.jsx("div",{className:xe.attentionMeta,children:l.jsx("span",{children:S})})]},b.id))})]})]}),l.jsxs("div",{className:xe.bottomGrid,children:[l.jsxs(Rt.div,{className:xe.section,variants:rc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[l.jsxs("div",{className:xe.sectionHeader,children:[l.jsx("span",{className:xe.sectionIcon,"aria-hidden":"true",children:"◈"}),l.jsx("span",{className:xe.sectionTitle,children:"Environment Health"}),l.jsx("span",{className:xe.sectionCount,children:o.length})]}),l.jsx("div",{className:xe.sectionBody,children:o.length===0?l.jsx("div",{className:xe.emptyHint,children:"No environments configured"}):o.map(b=>l.jsxs("div",{className:xe.envRow,"data-testid":"dashboard-env-row",children:[l.jsx("span",{className:xe.envName,children:b.displayName}),l.jsx("span",{className:xe.envStatusBadge,"data-status":b.status,children:b.status})]},b.id))})]}),l.jsxs(Rt.div,{className:xe.section,variants:rc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[l.jsxs("div",{className:xe.sectionHeader,children:[l.jsx("span",{className:xe.sectionIcon,"aria-hidden":"true",children:"▦"}),l.jsx("span",{className:xe.sectionTitle,children:"Workspaces"}),l.jsx("span",{className:xe.sectionCount,children:n.length})]}),l.jsx("div",{className:xe.sectionBody,children:v.length===0?l.jsx("div",{className:xe.emptyHint,children:"No workspaces yet"}):v.map(({workspace:b,totalTasks:_,completedTasks:S,workingTasks:T,failedTasks:N})=>{const j=_>0?Math.round(S/_*100):0;return l.jsxs("button",{type:"button",className:xe.workspaceRow,onClick:()=>u(Wi(b.id,b.environmentId)),"data-testid":"workspace-row",children:[l.jsxs("div",{className:xe.workspaceTop,children:[l.jsx("span",{className:xe.workspaceName,children:b.name}),l.jsxs("span",{className:xe.workspaceCounts,"aria-label":I6(S,_,T,N),children:[S,"/",_,T>0&&l.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",T]}),N>0&&l.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",N]})]})]}),_>0&&l.jsx("div",{className:xe.progressBar,children:l.jsx("div",{className:xe.progressFill,style:{width:`${j}%`}})})]},b.id)})})]})]})]})}const L6="_panelContainer_1h5qd_1",U6="_emptyState_1h5qd_8",z6="_fadeIn_1h5qd_1",P6="_workspaceSummary_1h5qd_17",V6="_workspaceSummaryTitle_1h5qd_28",q6="_workspaceSummarySubtitle_1h5qd_32",H6="_header_1h5qd_36",G6="_headerInfo_1h5qd_71",$6="_killButton_1h5qd_77",F6="_headerTitle_1h5qd_106",Z6="_headerActions_1h5qd_121",K6="_taskStatusBadge_1h5qd_128",Y6="_taskBranch_1h5qd_137",J6="_taskBlockedBadge_1h5qd_143",W6="_btnPrimary_1h5qd_151",X6="_btnDanger_1h5qd_182",Q6="_btnGhost_1h5qd_221",eO="_rejectInput_1h5qd_247",tO="_tabBar_1h5qd_277",nO="_tab_1h5qd_277",sO="_active_1h5qd_303",aO="_eventScroll_1h5qd_308",iO="_tabContent_1h5qd_314",oO="_noContext_1h5qd_319",rO="_overviewContent_1h5qd_325",lO="_overviewDashboard_1h5qd_334",cO="_overviewHero_1h5qd_340",uO="_statusBadge_1h5qd_347",dO="_statusPending_1h5qd_359",fO="_statusAssigned_1h5qd_364",pO="_statusInProgress_1h5qd_369",mO="_statusReview_1h5qd_374",hO="_statusDone_1h5qd_379",gO="_statusFailed_1h5qd_384",vO="_statusWaitingInput_1h5qd_389",yO="_overviewBranchPill_1h5qd_394",bO="_branchLink_1h5qd_409",_O="_overviewSection_1h5qd_420",xO="_overviewLabel_1h5qd_426",SO="_overviewValue_1h5qd_433",TO="_overviewMuted_1h5qd_438",kO="_overviewMarkdown_1h5qd_444",wO="_envRow_1h5qd_513",NO="_envDot_1h5qd_519",jO="_envDotGreen_1h5qd_526",CO="_envDotYellow_1h5qd_530",EO="_envDotRed_1h5qd_534",AO="_envDotGray_1h5qd_538",DO="_depList_1h5qd_542",RO="_depItem_1h5qd_548",MO="_depBlocked_1h5qd_555",OO="_depDone_1h5qd_559",IO="_timeline_1h5qd_563",BO="_timelineRow_1h5qd_569",LO="_timelineKey_1h5qd_576",UO="_timelineValue_1h5qd_582",zO="_timelineDelta_1h5qd_586",PO="_reviewNotes_1h5qd_597",VO="_overviewDescription_1h5qd_608",qO="_waitingMessage_1h5qd_614",HO="_errorMessage_1h5qd_618",GO="_eventOverflowWarning_1h5qd_622",$O="_attemptSelector_1h5qd_636",FO="_attemptLabel_1h5qd_652",ZO="_attemptButton_1h5qd_656",KO="_attemptActive_1h5qd_673",YO="_attemptStatus_1h5qd_679",JO="_emptyCta_1h5qd_685",WO="_ctaTitle_1h5qd_697",XO="_ctaDescription_1h5qd_703",QO="_ctaButton_1h5qd_710",eI="_ctaCreateForm_1h5qd_745",tI="_ctaCreateInput_1h5qd_751",nI="_ctaCreateOk_1h5qd_782",sI="_ctaLink_1h5qd_817",aI="_workspaceHeader_1h5qd_831",iI="_workspaceName_1h5qd_856",oI="_workspaceMeta_1h5qd_869",rI="_metaRow_1h5qd_877",lI="_metaLabel_1h5qd_890",cI="_metaValue_1h5qd_905",uI="_archiveButton_1h5qd_915",dI="_repoLink_1h5qd_945",fI="_metaToggle_1h5qd_955",pI="_metaToggleArrow_1h5qd_976",mI="_metaToggleArrowOpen_1h5qd_981",hI="_progressBarContainer_1h5qd_985",gI="_progressBar_1h5qd_985",vI="_progressFill_1h5qd_1001",yI="_progressLabel_1h5qd_1008",bI="_metaTimestamps_1h5qd_1015",_I="_metaTimestamp_1h5qd_1015",L={panelContainer:L6,emptyState:U6,fadeIn:z6,workspaceSummary:P6,workspaceSummaryTitle:V6,workspaceSummarySubtitle:q6,header:H6,headerInfo:G6,killButton:$6,headerTitle:F6,headerActions:Z6,taskStatusBadge:K6,taskBranch:Y6,taskBlockedBadge:J6,btnPrimary:W6,btnDanger:X6,btnGhost:Q6,rejectInput:eO,tabBar:tO,tab:nO,active:sO,eventScroll:aO,tabContent:iO,noContext:oO,overviewContent:rO,overviewDashboard:lO,overviewHero:cO,statusBadge:uO,statusPending:dO,statusAssigned:fO,statusInProgress:pO,statusReview:mO,statusDone:hO,statusFailed:gO,statusWaitingInput:vO,overviewBranchPill:yO,branchLink:bO,overviewSection:_O,overviewLabel:xO,overviewValue:SO,overviewMuted:TO,overviewMarkdown:kO,envRow:wO,envDot:NO,envDotGreen:jO,envDotYellow:CO,envDotRed:EO,envDotGray:AO,depList:DO,depItem:RO,depBlocked:MO,depDone:OO,timeline:IO,timelineRow:BO,timelineKey:LO,timelineValue:UO,timelineDelta:zO,reviewNotes:PO,overviewDescription:VO,waitingMessage:qO,errorMessage:HO,eventOverflowWarning:GO,attemptSelector:$O,attemptLabel:FO,attemptButton:ZO,attemptActive:KO,attemptStatus:YO,emptyCta:JO,ctaTitle:WO,ctaDescription:XO,ctaButton:QO,ctaCreateForm:eI,ctaCreateInput:tI,ctaCreateOk:nI,ctaLink:sI,workspaceHeader:aI,workspaceName:iI,workspaceMeta:oI,metaRow:rI,metaLabel:lI,metaValue:cI,archiveButton:uI,repoLink:dI,metaToggle:fI,metaToggleArrow:pI,metaToggleArrowOpen:mI,progressBarContainer:hI,progressBar:gI,progressFill:vI,progressLabel:yI,metaTimestamps:bI,metaTimestamp:_I};function xI(){return l.jsx("div",{className:L.emptyState,children:"Select a task or click + to create one"})}function SI(){return l.jsx("div",{className:L.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function TI(){const{workspaces:n,environments:s}=pt(),i=St(),o=s.length>0;return n.length>0?l.jsx(B6,{}):l.jsxs("div",{className:L.emptyCta,"data-testid":"welcome-cta",children:[l.jsx("div",{className:L.ctaTitle,children:"Welcome to Grackle"}),l.jsx("div",{className:L.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),l.jsx("button",{className:L.ctaButton,onClick:()=>i(Ab),disabled:!o,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!o&&l.jsx("div",{className:L.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const Mx=50;function kI(n,s,i,o,c=Mx){return o?n<c:s-n-i<c}function wI(n,s){const i=s-n;return i>0?i:0}function NI({scrollRef:n,contentLength:s,isReversed:i}){const[o,c]=y.useState(!0),u=y.useRef(0),d=y.useRef(!1),m=y.useRef(0);y.useEffect(()=>{const g=n.current;if(!g)return;let v=!0;const b=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const _=kI(g.scrollTop,g.scrollHeight,g.clientHeight,i,Mx);_!==v&&(v=_,c(_))}))};return g.addEventListener("scroll",b,{passive:!0}),()=>{g.removeEventListener("scroll",b),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[n,i]),y.useLayoutEffect(()=>{const g=n.current;!g||d.current||(d.current=!0,i?g.scrollTop=0:g.scrollTop=g.scrollHeight,c(!0))},[n,i]),y.useLayoutEffect(()=>{const g=n.current;if(g){if(i&&!o){const v=wI(u.current,g.scrollHeight);v>0&&(g.scrollTop+=v)}o&&(i?g.scrollTo({top:0,behavior:"smooth"}):g.scrollTo({top:g.scrollHeight,behavior:"smooth"})),u.current=g.scrollHeight}},[s,o,i,n]);const h=y.useCallback(()=>{const g=n.current;if(!g)return;const v=i?0:g.scrollHeight;g.scrollTo({top:v,behavior:"smooth"}),c(!0)},[n,i]);return{isAtAnchor:o,scrollToAnchor:h}}const jI="_wrapper_p24zt_1",CI="_scrollContainer_p24zt_9",EI="_toolbar_p24zt_15",AI="_directionToggle_p24zt_22",DI="_scrollToAnchor_p24zt_60",RI="_scrollToAnchorBottom_p24zt_84",MI="_scrollToAnchorTop_p24zt_88",qa={wrapper:jI,scrollContainer:CI,toolbar:EI,directionToggle:AI,scrollToAnchor:DI,scrollToAnchorBottom:RI,scrollToAnchorTop:MI},Ox="grackle-stream-direction";function OI(){try{return localStorage.getItem(Ox)==="reversed"}catch{return!1}}function II({eventsDropped:n}){return n<=0?l.jsx(l.Fragment,{}):l.jsxs("div",{className:L.eventOverflowWarning,role:"alert",children:["⚠"," ",n.toLocaleString()," older event",n===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function sm({events:n,eventsDropped:s,emptyState:i}){const o=y.useRef(null),[c,u]=y.useState(OI),d=eA(),m=y.useMemo(()=>c?[...n].reverse():n,[n,c]),{isAtAnchor:h,scrollToAnchor:g}=NI({scrollRef:o,contentLength:n.length,isReversed:c}),v=()=>{const S=!c;u(S);try{localStorage.setItem(Ox,S?"reversed":"default")}catch{}},b=d?0:.2,_=c?-8:8;return l.jsxs("div",{className:qa.wrapper,children:[l.jsx("div",{className:qa.toolbar,children:l.jsx("button",{className:qa.directionToggle,onClick:v,title:c?"Showing newest first":"Showing oldest first","aria-label":c?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:c?"↓":"↑"})}),l.jsxs("div",{ref:o,className:qa.scrollContainer,"data-testid":"event-stream-scroll",children:[n.length===0&&i,l.jsx(II,{eventsDropped:s}),l.jsx(rs,{initial:!1,children:m.map((S,T)=>{const N=c?n.length-1-T:T;return l.jsx(Rt.div,{initial:{opacity:0,y:_},animate:{opacity:1,y:0},transition:{duration:b,ease:"easeOut"},children:l.jsx(A3,{event:S,toolUseCtx:S.toolUseCtx})},`${S.sessionId}-${S.timestamp}-${N}`)})})]}),l.jsx(rs,{children:!h&&l.jsxs(Rt.button,{className:`${qa.scrollToAnchor} ${c?qa.scrollToAnchorTop:qa.scrollToAnchorBottom}`,onClick:g,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:[c?"↑":"↓"," New events"]})})]})}const BI="_bar_1xhb4_1",LI="_input_1xhb4_32",UI="_select_1xhb4_67",zI="_btnPrimary_1xhb4_103",PI="_btnGhost_1xhb4_173",VI="_badge_1xhb4_195",qI="_disconnectHint_1xhb4_205",bn={bar:BI,input:LI,select:UI,btnPrimary:zI,btnGhost:PI,badge:VI,disconnectHint:qI};function HI(n,s){if(!n)return!1;const i=s.find(o=>o.id===n);return i!==void 0&&(i.status==="disconnected"||i.status==="error")}function GI({environmentId:n,onReconnect:s}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:bn.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),l.jsx("button",{type:"button",onClick:()=>s(n),className:bn.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function jr({mode:n,sessionId:s,environmentId:i,taskId:o,showPersonaSelect:c,personas:u,environments:d,onSendInput:m,onSpawn:h,onStartTask:g,onProvisionEnvironment:v}){const{showToast:b}=Bs(),[_,S]=y.useState(""),[T,N]=y.useState(""),j=HI(i,d),w=E=>{if(E.preventDefault(),!!_.trim())if(n==="send"){if(!s||j)return;m(s,_),S("")}else if(n==="spawn"){if(!i)return;h(i,_,T),b("Session started","success"),S(""),N("")}else{if(!o)return;g(o,void 0,i,_),S("")}};return n==="spawn"?l.jsxs("form",{onSubmit:w,className:bn.bar,children:[l.jsx("span",{className:bn.badge,children:"new chat"}),l.jsx("input",{type:"text",value:_,onChange:E=>S(E.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:bn.input}),c&&l.jsxs("select",{value:T,onChange:E=>N(E.target.value),className:bn.select,children:[l.jsx("option",{value:"",children:"(Default)"}),u.map(E=>l.jsx("option",{value:E.id,children:E.name},E.id))]}),l.jsx("button",{type:"submit",disabled:!_.trim()||!i,className:bn.btnPrimary,children:"Go"})]}):n==="start"?l.jsxs("form",{onSubmit:w,className:bn.bar,children:[l.jsx("input",{type:"text",value:_,onChange:E=>S(E.target.value),placeholder:"Type a message...",autoFocus:!0,className:bn.input}),l.jsx("button",{type:"submit",disabled:!_.trim(),className:bn.btnPrimary,children:"Send"})]}):l.jsxs("form",{onSubmit:w,className:bn.bar,children:[j&&i&&l.jsx(GI,{environmentId:i,onReconnect:v}),l.jsx("input",{type:"text",value:_,onChange:E=>S(E.target.value),placeholder:"Type a message...",autoFocus:!j,disabled:j,className:bn.input}),l.jsx("span",{title:j?"Environment is unavailable — reconnect first":void 0,children:l.jsx("button",{type:"submit",disabled:!_.trim()||j,className:bn.btnPrimary,children:"Send"})})]})}function am(n){const s=[];for(const i of n){const o=s[s.length-1];i.eventType==="text"&&(o==null?void 0:o.eventType)==="text"?s[s.length-1]={...o,content:o.content+i.content}:s.push(i)}return s}function im(n){const s=new Map;for(const u of n)if(u.raw)try{s.set(u,JSON.parse(u.raw))}catch{}const i=new Map;for(const u of n){if(u.eventType!=="tool_use")continue;const d=s.get(u);if(!(!d||typeof d.id!="string"))try{const m=JSON.parse(u.content);i.set(d.id,{tool:m.tool,args:m.args})}catch{}}const o=new Set;return n.map(u=>{if(u.eventType!=="tool_result")return u;const d=s.get(u);if(!d||typeof d.tool_use_id!="string")return u;const m=i.get(d.tool_use_id);if(!m)return u;o.add(d.tool_use_id);let h;const g=u.content.trim();if(g.startsWith("{"))try{const v=JSON.parse(g);typeof v.detailedContent=="string"&&(h=v.detailedContent)}catch{}return{...u,toolUseCtx:{...m,detailedResult:h}}}).filter(u=>{if(u.eventType!=="tool_use")return!0;const d=s.get(u);return d&&typeof d.id=="string"?!o.has(d.id):!0})}const $I="_panelContainer_19poq_1",FI="_chatHeader_19poq_8",ZI="_chatHeaderInfo_19poq_37",KI="_emptyState_19poq_43",YI="_emptyTitle_19poq_55",JI="_emptyDescription_19poq_61",WI="_emptyHint_19poq_67",Za={panelContainer:$I,chatHeader:FI,chatHeaderInfo:ZI,emptyState:KI,emptyTitle:YI,emptyDescription:JI,emptyHint:WI};function XI({hasLocalEnvironment:n}){return l.jsxs("div",{className:Za.emptyState,"data-testid":"chat-empty-state",children:[l.jsx("div",{className:Za.emptyTitle,children:"Welcome to Grackle"}),l.jsx("div",{className:Za.emptyDescription,children:n?"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."}),!n&&l.jsx("div",{className:Za.emptyHint,children:"Go to Settings → Environments to add one."})]})}function QI(){const{tasks:n,sessions:s,events:i,eventsDropped:o,environments:c,loadTaskSessions:u,loadSessionEvents:d,kill:m,stopGraceful:h,taskSessions:g,sendInput:v,spawn:b,startTask:_,personas:S,provisionEnvironment:T}=pt(),N=y.useRef(void 0),[j,w]=y.useState(),E=n.find(V=>V.id===nr),A=E!=null&&E.latestSessionId?s.find(V=>V.id===E.latestSessionId)??(g[nr]??[]).find(V=>V.id===E.latestSessionId):void 0;y.useEffect(()=>{u(nr)},[u]),y.useEffect(()=>{E!=null&&E.latestSessionId&&u(nr)},[E==null?void 0:E.latestSessionId,u]),y.useEffect(()=>{A&&A.id!==N.current&&(N.current=A.id,d(A.id))},[A==null?void 0:A.id,d]);const O=y.useMemo(()=>{if(!A)return[];const V=i.filter(Z=>Z.sessionId===A.id);return im(am(V))},[i,A==null?void 0:A.id]),C=c.find(V=>V.adapterType==="local"&&V.status==="connected"),M=A!==void 0&&A.status!=="stopped"&&A.status!=="suspended",G=(A==null?void 0:A.status)==="idle";y.useEffect(()=>{j&&A&&G&&(v(A.id,j),w(void 0))},[j,G,A==null?void 0:A.id,v]);const U=y.useCallback((V,Z,ee,ie)=>{ie&&w(ie),_(V,Z,ee)},[_]);return l.jsxs("div",{className:Za.panelContainer,"data-testid":"chat-page",children:[M&&l.jsxs("div",{className:Za.chatHeader,children:[l.jsxs("span",{className:Za.chatHeaderInfo,children:["Session: ",A.id.slice(0,8)," | ",A.runtime," | ",A.status]}),l.jsx(Cx,{label:"Stop",onClick:()=>h(A.id),variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>h(A.id)},{label:"Kill",description:"Force kill",onClick:()=>m(A.id)}]})]}),l.jsx(sm,{events:O,eventsDropped:o,emptyState:l.jsx(XI,{hasLocalEnvironment:!!C})}),C&&M&&l.jsx(jr,{mode:"send",sessionId:A.id,environmentId:A.environmentId,personas:S,environments:c,onSendInput:v,onSpawn:b,onStartTask:_,onProvisionEnvironment:T}),C&&!M&&l.jsx(jr,{mode:"start",taskId:nr,environmentId:C.id,personas:S,environments:c,onSendInput:v,onSpawn:b,onStartTask:U,onProvisionEnvironment:T})]})}function e5(n,s){const i=[];let o=n;const c=new Set;for(;o&&s.has(o)&&!c.has(o);){c.add(o);const u=s.get(o);i.unshift(u),o=u.parentTaskId||void 0}return i}const Wa={label:"Home",url:Ya};function t5(n){return n?[Wa,{label:"Settings",url:Ji},{label:n,url:void 0}]:[Wa,{label:"Settings",url:void 0}]}const Ix={label:"Environments",url:Xi};function n5(){return[Wa,{label:"Environments",url:void 0}]}function s5(){return[Wa,{label:"New Chat",url:void 0}]}function a5(n){return[Wa,{label:`Session ${n.slice(0,8)}`,url:void 0}]}function i5(n,s,i,o){const c=i.find(d=>d.id===n),u=o.find(d=>d.id===s);return[Wa,Ix,{label:(u==null?void 0:u.displayName)??"Environment",url:Qi(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function o5(n,s,i,o,c){const u=e5(n,c),d=c.get(n),m=d==null?void 0:d.workspaceId,h=m?i.find(S=>S.id===m):void 0,g=s??(h==null?void 0:h.environmentId),v=g?o.find(S=>S.id===g):void 0,b=[Wa];v&&g&&(b.push(Ix),b.push({label:v.displayName,url:Qi(g)})),h&&g&&b.push({label:h.name,url:Wi(h.id,g)});for(let S=0;S<u.length-1;S++)b.push({label:u[S].title,url:os(u[S].id,void 0,m,g)});const _=u[u.length-1];return b.push({label:(_==null?void 0:_.title)??n,url:void 0}),b}function r5(){const n=s5(),[s]=bp(),i=s.get("env")??"",{sendInput:o,spawn:c,startTask:u,personas:d,environments:m,provisionEnvironment:h}=pt();return l.jsxs("div",{className:L.panelContainer,children:[l.jsx(ba,{segments:n}),l.jsx("div",{className:L.emptyState,children:"Enter a prompt below to start a new session"}),l.jsx(jr,{mode:"spawn",environmentId:i,showPersonaSelect:!0,personas:d,environments:m,onSendInput:o,onSpawn:c,onStartTask:u,onProvisionEnvironment:h})]})}function l5({sessionId:n,session:s,isActive:i,onStop:o,onKill:c}){return l.jsxs("div",{className:L.header,children:[l.jsxs("span",{children:["Session: ",n.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costUsd?` | ${Ex((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${so(s.costUsd??0)}`:""]}),l.jsxs("span",{className:L.headerInfo,children:[s&&l.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),i&&l.jsx(Cx,{label:"Stop",onClick:o,variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:o},{label:"Kill",description:"Force kill",onClick:c}]})]})]})}function c5({session:n}){const s=n&&(n.status==="stopped"||n.status==="suspended"),i=s?`Session ${n.endReason||n.status} with no events recorded.`:"Waiting for events...";return l.jsx("div",{className:s?L.errorMessage:L.waitingMessage,children:i})}function u5(){const{sessionId:n}=va(),{events:s,eventsDropped:i,sessions:o,kill:c,stopGraceful:u,loadSessionEvents:d,sendInput:m,spawn:h,startTask:g,personas:v,environments:b,provisionEnvironment:_}=pt(),S=y.useRef(void 0),T=a5(n),N=o.find(E=>E.id===n)??void 0,j=y.useMemo(()=>{const E=n?s.filter(A=>A.sessionId===n):[];return im(am(E))},[s,n]);if(y.useEffect(()=>{n&&n!==S.current&&(S.current=n,d(n))},[n,d]),!n)return l.jsx("div",{className:L.emptyState,children:"No session selected"});const w=(N==null?void 0:N.status)==="running"||(N==null?void 0:N.status)==="idle";return l.jsxs("div",{className:L.panelContainer,children:[l.jsx(ba,{segments:T}),l.jsx(l5,{sessionId:n,session:N,isActive:w,onStop:()=>u(n),onKill:()=>c(n)}),l.jsx(sm,{events:j,eventsDropped:i,emptyState:l.jsx(c5,{session:N})}),w&&l.jsx(jr,{mode:"send",sessionId:n,environmentId:N.environmentId,personas:v,environments:b,onSendInput:m,onSpawn:h,onStartTask:g,onProvisionEnvironment:_})]})}function d5(n){if(!n)return!1;const s=n.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||n.isContentEditable)}function Ms(n,s){const i=y.useRef(s);i.current=s;const{key:o,ctrl:c=!1,shift:u=!1,suppressInInputs:d=!0,enabled:m=!0}=n;y.useEffect(()=>{if(!m)return;const h=g=>{if(d&&d5(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(u&&!g.shiftKey||g.key===o&&i.current())};return document.addEventListener("keydown",h),()=>{document.removeEventListener("keydown",h)}},[o,c,u,d,m])}const Ky=220,Yy=70,f5=40,p5=60,m5="hierarchy",h5="dependency";function g5(n){return y.useMemo(()=>{if(n.length===0)return{nodes:[],edges:[]};const s=new Qv.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:f5,ranksep:p5});const i=new Map(n.map(d=>[d.id,d])),o=new Map;for(const d of n)if(d.parentTaskId&&i.has(d.parentTaskId)){const m=o.get(d.parentTaskId)||[];m.push(d),o.set(d.parentTaskId,m)}for(const d of n)s.setNode(d.id,{width:Ky,height:Yy});const c=[];for(const d of n){if(d.parentTaskId&&i.has(d.parentTaskId)){const m=`hierarchy-${d.parentTaskId}-${d.id}`;s.setEdge(d.parentTaskId,d.id,{},m),c.push({id:m,source:d.parentTaskId,target:d.id,type:"smoothstep",data:{edgeType:m5},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const m of d.dependsOn)if(i.has(m)){const h=`dependency-${m}-${d.id}`;s.setEdge(m,d.id,{},h),c.push({id:h,source:m,target:d.id,type:"smoothstep",data:{edgeType:h5},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return Qv.layout(s),{nodes:n.map(d=>{const m=s.node(d.id),h=o.get(d.id)||[];return{id:d.id,type:"task",position:{x:m.x-Ky/2,y:m.y-Yy/2},data:{task:d,childCount:h.length,doneChildCount:h.filter(g=>g.status==="complete").length,hasDependencies:d.dependsOn.length>0}}}),edges:c}},[n])}const v5="_dagContainer_js4w6_1",y5="_taskNode_js4w6_26",b5="_taskNodeBorder_js4w6_54",_5="_taskNodeContent_js4w6_60",x5="_taskNodeHeader_js4w6_70",S5="_taskNodeIcon_js4w6_77",T5="_taskNodeTitle_js4w6_82",k5="_taskNodeBadges_js4w6_90",w5="_childBadge_js4w6_95",N5="_depBadge_js4w6_107",j5="_handle_js4w6_119",C5="_emptyCta_js4w6_126",E5="_ctaDescription_js4w6_137",A5="_ctaButton_js4w6_144",tn={dagContainer:v5,taskNode:y5,taskNodeBorder:b5,taskNodeContent:_5,taskNodeHeader:x5,taskNodeIcon:S5,taskNodeTitle:T5,taskNodeBadges:k5,childBadge:w5,depBadge:N5,handle:j5,emptyCta:C5,ctaDescription:E5,ctaButton:A5};function D5({data:n}){const{task:s,childCount:i,doneChildCount:o,hasDependencies:c}=n,u=ga(s.status);return l.jsxs("div",{className:tn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[l.jsx(e0,{type:"target",position:t0.Top,className:tn.handle}),l.jsx("div",{className:tn.taskNodeBorder,style:{backgroundColor:u.color}}),l.jsxs("div",{className:tn.taskNodeContent,children:[l.jsxs("div",{className:tn.taskNodeHeader,children:[l.jsx("span",{className:tn.taskNodeIcon,style:{color:u.color},children:u.icon}),l.jsx("span",{className:tn.taskNodeTitle,children:s.title})]}),l.jsxs("div",{className:tn.taskNodeBadges,children:[i>0&&l.jsxs("span",{className:tn.childBadge,children:[o,"/",i]}),c&&l.jsx("span",{className:tn.depBadge,children:"dep"})]})]}),l.jsx(e0,{type:"source",position:t0.Bottom,className:tn.handle})]})}const R5=iA,M5={task:D5};function O5({workspaceId:n,environmentId:s,tasks:i}){const o=St(),{resolvedThemeId:c}=qb(),u=y.useMemo(()=>i.filter(b=>b.workspaceId===n),[i,n]),{nodes:d,edges:m}=g5(u),h=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[S,T]of Object.entries(R5))_[S]=b.getPropertyValue(T).trim()||"#6b7a8d";return _},[c]),g=y.useCallback((b,_)=>{o(os(_.id,void 0,n,s))},[o,n,s]),v=y.useCallback(b=>{const _=b.data;return h[_.task.status]||h.pending},[h]);return u.length===0?l.jsxs("div",{className:tn.emptyCta,children:[l.jsx("button",{className:tn.ctaButton,onClick:()=>o(ei(n,void 0,s)),children:"Create Task"}),l.jsx("div",{className:tn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):l.jsx("div",{className:tn.dagContainer,children:l.jsxs(nT,{nodes:d,edges:m,nodeTypes:M5,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[l.jsx(sT,{variant:aT.Dots,gap:24,size:1,color:"var(--text-disabled)"}),l.jsx(iT,{showInteractive:!1}),l.jsx(oT,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}function I5({tasks:n,taskStatusById:s,sessionStatusByTaskId:i}){const o=new Map;for(const u of n)if(u.parentTaskId){const d=o.get(u.parentTaskId);d?d.push(u):o.set(u.parentTaskId,[u])}const c=new Map(Py.map(u=>[u,[]]));for(const u of n){const d=nm(u.status),m=u.dependsOn.length>0&&u.dependsOn.some(T=>s.get(T)!=="complete"),h=o.get(u.id)??[],g=h.length,v=h.filter(T=>T.status==="complete").length;let b;if(d==="paused"&&i){const T=i.get(u.id);T==="idle"?b="Needs input":T==="completed"&&(b="Ready to complete")}const _={task:u,isBlocked:m,childCount:g,doneChildCount:v,pausedSubBadge:b},S=c.get(d);S?S.push(_):c.get("not_started").push(_)}for(const u of c.values())u.sort((d,m)=>d.task.sortOrder-m.task.sortOrder);return Py.map(u=>{const d=ga(u);return{status:u,label:d.label,style:d,tasks:c.get(u)??[]}})}const B5="_boardContainer_1c4y1_1",L5="_column_1c4y1_17",U5="_columnHeader_1c4y1_34",z5="_columnIcon_1c4y1_47",P5="_columnLabel_1c4y1_52",V5="_columnCount_1c4y1_57",q5="_cardList_1c4y1_67",H5="_emptyPlaceholder_1c4y1_76",G5="_card_1c4y1_67",$5="_cardHeader_1c4y1_107",F5="_cardStatusIcon_1c4y1_113",Z5="_cardTitle_1c4y1_119",K5="_cardBadges_1c4y1_127",Y5="_badge_1c4y1_134",J5="_blockedBadge_1c4y1_146",W5="_childBadge_1c4y1_151",X5="_depBadge_1c4y1_155",Q5="_parentBadge_1c4y1_159",e4="_pausedSubBadge_1c4y1_166",t4="_personaBadge_1c4y1_170",n4="_envBadge_1c4y1_174",s4="_emptyCta_1c4y1_178",a4="_ctaButton_1c4y1_188",i4="_ctaDescription_1c4y1_204",Qe={boardContainer:B5,column:L5,columnHeader:U5,columnIcon:z5,columnLabel:P5,columnCount:V5,cardList:q5,emptyPlaceholder:H5,card:G5,cardHeader:$5,cardStatusIcon:F5,cardTitle:Z5,cardBadges:K5,badge:Y5,blockedBadge:J5,childBadge:W5,depBadge:X5,parentBadge:Q5,pausedSubBadge:e4,personaBadge:t4,envBadge:n4,emptyCta:s4,ctaButton:a4,ctaDescription:i4};function o4({workspaceId:n,environmentId:s,tasks:i,sessions:o,personas:c,environments:u}){const d=St(),m=y.useMemo(()=>i.filter(_=>_.workspaceId===n),[i,n]),h=y.useMemo(()=>new Map(i.map(_=>[_.id,_.status])),[i]),g=y.useMemo(()=>new Map(m.map(_=>[_.id,_])),[m]),v=y.useMemo(()=>{const _=new Map(o.map(E=>[E.id,E])),S=new Map(c.map(E=>[E.id,E])),T=new Map(u.map(E=>[E.id,E])),N=new Map,j=new Map,w=new Map;for(const E of m)if(E.latestSessionId){const A=_.get(E.latestSessionId);if(A){if(N.set(E.id,A.endReason||A.status),A.personaId){const O=S.get(A.personaId);O&&j.set(E.id,O.name)}if(A.environmentId){const O=T.get(A.environmentId);O&&w.set(E.id,O.displayName)}}}return{sessionStatusByTaskId:N,personaNameByTaskId:j,environmentNameByTaskId:w}},[m,o,c,u]),b=y.useMemo(()=>I5({tasks:m,taskStatusById:h,sessionStatusByTaskId:v.sessionStatusByTaskId}),[m,h,v]);return m.length===0?l.jsxs("div",{className:Qe.emptyCta,"data-testid":"board-empty-cta",children:[l.jsx("button",{className:Qe.ctaButton,onClick:()=>d(ei(n,void 0,s)),children:"Create Task"}),l.jsx("div",{className:Qe.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):l.jsx("div",{className:Qe.boardContainer,"data-testid":"board-container",children:b.map(_=>l.jsxs("section",{className:Qe.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[l.jsxs("div",{className:Qe.columnHeader,children:[l.jsx("span",{className:Qe.columnIcon,style:{color:_.style.color},children:_.style.icon}),l.jsx("span",{className:Qe.columnLabel,children:_.label}),l.jsx("span",{className:Qe.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),l.jsx("div",{className:Qe.cardList,children:_.tasks.length===0?l.jsx("div",{className:Qe.emptyPlaceholder,children:"No tasks"}):l.jsx(rs,{mode:"popLayout",children:_.tasks.map(S=>l.jsx(Rt.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:l.jsx(r4,{boardTask:S,tasksById:g,personaName:v.personaNameByTaskId.get(S.task.id),envName:v.environmentNameByTaskId.get(S.task.id),onClick:()=>d(os(S.task.id,void 0,n,s))})},S.task.id))})})]},_.status))})}function r4({boardTask:n,tasksById:s,personaName:i,envName:o,onClick:c}){const{task:u,isBlocked:d,childCount:m,doneChildCount:h,pausedSubBadge:g}=n,v=ga(u.status),b=u.parentTaskId?s.get(u.parentTaskId):void 0;return l.jsxs("div",{className:Qe.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[l.jsxs("div",{className:Qe.cardHeader,children:[l.jsx("span",{className:Qe.cardStatusIcon,style:{color:v.color},children:v.icon}),l.jsx("span",{className:Qe.cardTitle,children:u.title})]}),l.jsxs("div",{className:Qe.cardBadges,children:[b&&l.jsx("span",{className:`${Qe.badge} ${Qe.parentBadge}`,title:b.title,children:b.title}),m>0&&l.jsxs("span",{className:`${Qe.badge} ${Qe.childBadge}`,children:[h,"/",m]}),d&&l.jsx("span",{className:`${Qe.badge} ${Qe.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&l.jsx("span",{className:`${Qe.badge} ${Qe.depBadge}`,children:"dep"}),g&&l.jsx("span",{className:`${Qe.badge} ${Qe.pausedSubBadge}`,children:g}),i&&l.jsx("span",{className:`${Qe.badge} ${Qe.personaBadge}`,children:i}),o&&l.jsx("span",{className:`${Qe.badge} ${Qe.envBadge}`,children:o})]})]})}function om(n){const{value:s,onSave:i,validate:o,fieldId:c,activeFieldId:u,onActivate:d,enterToSave:m=!0,trimOnSave:h=!0}=n,[g,v]=y.useState(""),[b,_]=y.useState(""),S=y.useRef(!1),T=u===c,N=y.useCallback(G=>{v(G),_("")},[]),j=y.useCallback(()=>{_("")},[]),w=y.useCallback(()=>{S.current=!1,d==null||d(null),v(""),_("")},[d]),E=y.useCallback(()=>{const G=h?g.trim():g;if(o){const V=o(g);if(V){_(V);return}}const U=h?s.trim():s;if(G===U){w();return}i(G),w()},[g,s,h,o,i,w]),A=y.useCallback(()=>{S.current=!0,d==null||d(c),v(s),_("")},[c,s,d]),O=y.useCallback(G=>{if(S.current){S.current=!1;return}G.relatedTarget instanceof HTMLElement&&G.relatedTarget.dataset.editAction===c||E()},[c,E]),C=y.useCallback(G=>{G.key==="Escape"?w():G.key==="Enter"&&m&&E()},[w,m,E]),M=(()=>{if(!T)return!1;const G=h?s.trim():s;return(h?g.trim():g)!==G})();return y.useEffect(()=>{!T&&(g!==""||b!=="")&&(v(""),_(""))},[T,g,b]),{isEditing:T,draft:g,error:b,isDirty:M,startEdit:A,cancelEdit:w,save:E,setDraft:N,clearError:j,handleBlur:O,handleKeyDown:C,ignoreInitialBlurRef:S}}const l4="_editFieldWrapper_yuzty_1",c4="_editInput_yuzty_10",u4="_editTextarea_yuzty_42",d4="_editSelect_yuzty_78",f4="_editError_yuzty_111",p4="_editInputInvalid_yuzty_118",m4="_editHint_yuzty_123",h4="_unsavedDot_yuzty_132",g4="_metaValueClickable_yuzty_140",v4="_editButton_yuzty_159",y4="_metaPlaceholder_yuzty_175",b4="_worktreeToggle_yuzty_180",We={editFieldWrapper:l4,editInput:c4,editTextarea:u4,editSelect:d4,editError:f4,editInputInvalid:p4,editHint:m4,unsavedDot:h4,metaValueClickable:g4,editButton:v4,metaPlaceholder:y4,worktreeToggle:b4};function Zt(n){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="text",activeFieldId:d,onActivate:m,onChange:h,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:_,"data-testid":S}=n,T=y.useRef(null),N=om({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:m,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(N.isEditing){const w=window.setTimeout(()=>{var E;(E=T.current)==null||E.focus()},0);return()=>window.clearTimeout(w)}},[N.isEditing]),c==="create"){const w=A=>{h==null||h(A.target.value)},E=o==null?void 0:o(s);return l.jsxs("div",{className:We.editFieldWrapper,children:[l.jsx("input",{className:`${We.editInput} ${E?We.editInputInvalid:""}`,value:s,onChange:w,maxLength:b,placeholder:v,"aria-label":_,"data-testid":S?`${S}-input`:void 0}),E&&l.jsx("span",{className:We.editError,"data-testid":"edit-error",children:E})]})}if(N.isEditing)return l.jsxs("div",{className:We.editFieldWrapper,children:[l.jsx("input",{ref:T,className:`${We.editInput} ${N.error?We.editInputInvalid:""}`,value:N.draft,onChange:w=>N.setDraft(w.target.value),onBlur:N.handleBlur,onKeyDown:N.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":S?`${S}-input`:void 0}),N.isDirty&&l.jsx("span",{className:We.unsavedDot,title:"Unsaved changes"}),N.error&&l.jsx("span",{className:We.editError,"data-testid":"edit-error",children:N.error}),l.jsx("span",{className:We.editHint,children:"Enter to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return l.jsxs("span",{role:"button",tabIndex:0,className:We.metaValueClickable,onClick:()=>N.startEdit(),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),N.startEdit())},title:"Click to edit","aria-label":_,"data-testid":S?`${S}-button`:void 0,children:[j!==void 0?j:s?l.jsx("span",{children:s}):l.jsx("span",{className:We.metaPlaceholder,children:v||"None"}),l.jsx("span",{className:We.editButton,"aria-hidden":"true",children:"✏️"})]})}function cp(n){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="textarea",activeFieldId:d,onActivate:m,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=n,S=y.useRef(null),T=om({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:m,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(T.isEditing){const j=window.setTimeout(()=>{var w;(w=S.current)==null||w.focus()},0);return()=>window.clearTimeout(j)}},[T.isEditing]),c==="create"){const j=E=>{h==null||h(E.target.value)},w=o==null?void 0:o(s);return l.jsxs("div",{className:We.editFieldWrapper,children:[l.jsx("textarea",{className:`${We.editTextarea} ${w?We.editInputInvalid:""}`,value:s,onChange:j,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),w&&l.jsx("span",{className:We.editError,"data-testid":"edit-error",children:w})]})}if(T.isEditing)return l.jsxs("div",{className:We.editFieldWrapper,children:[l.jsx("textarea",{ref:S,className:`${We.editTextarea} ${T.error?We.editInputInvalid:""}`,value:T.draft,onChange:j=>T.setDraft(j.target.value),onBlur:T.handleBlur,onKeyDown:T.handleKeyDown,title:b,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),T.isDirty&&l.jsx("span",{className:We.unsavedDot,title:"Unsaved changes"}),T.error&&l.jsx("span",{className:We.editError,"data-testid":"edit-error",children:T.error}),l.jsx("span",{className:We.editHint,children:"Tab to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return l.jsxs("span",{role:"button",tabIndex:0,className:We.metaValueClickable,onClick:()=>T.startEdit(),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),T.startEdit())},title:"Click to edit","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[N!==void 0?N:s?l.jsx("span",{children:s}):l.jsx("span",{className:We.metaPlaceholder,children:v||"None"}),l.jsx("span",{className:We.editButton,"aria-hidden":"true",children:"✏️"})]})}function Cc(n){var A;const{value:s,onSave:i,mode:o="edit",options:c,fieldId:u="select",activeFieldId:d,onActivate:m,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=n,S=y.useRef(null),T=om({value:s,onSave:i,fieldId:u,activeFieldId:d,onActivate:m,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(T.isEditing){const O=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(O)}},[T.isEditing]);const N=y.useCallback(O=>{const C=O.target.value;T.ignoreInitialBlurRef.current=!1,C!==s&&i(C),T.cancelEdit()},[s,i,T]),j=y.useCallback(O=>{if(T.ignoreInitialBlurRef.current){T.ignoreInitialBlurRef.current=!1;return}O.relatedTarget instanceof HTMLElement&&O.relatedTarget.dataset.editAction===u||T.cancelEdit()},[u,T]);if(o==="create")return l.jsx("select",{className:We.editSelect,value:s,onChange:O=>h==null?void 0:h(O.target.value),"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(O=>l.jsx("option",{value:O.value,children:O.label},O.value))});if(T.isEditing)return l.jsx("select",{ref:S,className:We.editSelect,value:T.draft,onChange:N,onBlur:j,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(O=>l.jsx("option",{value:O.value,children:O.label},O.value))});const w=g==null?void 0:g(s),E=(A=c.find(O=>O.value===s))==null?void 0:A.label;return l.jsxs("button",{type:"button",className:We.metaValueClickable,onClick:()=>T.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[w!==void 0?w:E?l.jsx("span",{children:E}):l.jsx("span",{className:We.metaPlaceholder,children:v||"None"}),l.jsx("span",{className:We.editButton,"aria-hidden":"true",children:"✏️"})]})}function _4(n){const{checked:s,onChange:i,label:o,ariaLabel:c,"data-testid":u}=n;return l.jsxs("label",{className:We.worktreeToggle,"data-testid":u,children:[l.jsx("input",{type:"checkbox",checked:s,onChange:d=>i(d.target.checked),"aria-label":c}),l.jsx("span",{children:o})]})}const x4="_envRow_1e1r5_1",S4="_envDot_1e1r5_7",T4="_envDotGreen_1e1r5_14",k4="_envDotYellow_1e1r5_18",w4="_envDotRed_1e1r5_22",N4="_envDotGray_1e1r5_26",Yi={envRow:x4,envDot:S4,envDotGreen:T4,envDotYellow:k4,envDotRed:w4,envDotGray:N4};function j4(n){const s=n.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?Yi.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?Yi.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?Yi.envDotRed:Yi.envDotGray}function C4(n){const{value:s,onSave:i,environments:o,allowNone:c=!1,fieldId:u="environment",activeFieldId:d,onActivate:m,placeholder:h="No environment",ariaLabel:g="Environment","data-testid":v}=n,b=o.find(T=>T.id===s),_=[...c?[{value:"",label:"None"}]:[],...o.map(T=>({value:T.id,label:T.displayName}))],S=()=>{if(b)return l.jsxs("span",{className:Yi.envRow,children:[l.jsx("span",{className:`${Yi.envDot} ${j4(b.status)}`}),b.displayName]})};return l.jsx(Cc,{value:s,onSave:i,options:_,fieldId:u,activeFieldId:d,onActivate:m,renderDisplay:S,placeholder:h,ariaLabel:g,"data-testid":v})}function Jy(n){if(!n)return"";const s=new Date(n);if(isNaN(s.getTime()))return"";const o=Date.now()-s.getTime();if(o<0)return"just now";const c=Math.floor(o/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const u=Math.floor(c/60);if(u<24)return`${u}h ago`;const d=Math.floor(u/24);return d<30?`${d}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const Rf=100;function E4(n){try{const s=new URL(n);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function A4(){const{workspaceId:n,environmentId:s}=va(),i=St(),{tasks:o,environments:c,workspaces:u,personas:d,sessions:m,archiveWorkspace:h,updateWorkspace:g,usageCache:v,loadUsage:b}=pt(),[_,S]=y.useState("tasks"),[T,N]=y.useState(!1),[j,w]=y.useState(null),[E,A]=y.useState(!1),O=y.useRef(void 0),C=u.find(K=>K.id===n),M=s??(C==null?void 0:C.environmentId)??"",G=i5(n,M,u,c);Ms({key:"1"},()=>S("graph")),Ms({key:"2"},()=>S("board")),Ms({key:"3"},()=>S("tasks")),y.useEffect(()=>{const K=O.current;O.current=n,!(K===void 0||K===n)&&j!==null&&w(null)},[n,j]);const U=m.reduce((K,re)=>K+(re.costUsd??0),0);y.useEffect(()=>{n&&b("workspace",n)},[n,b,U]);const V=n?v[`workspace:${n}`]:void 0,Z=o.filter(K=>K.workspaceId===n),ee=Z.filter(K=>K.status==="complete").length,ie=Z.length,be=ie>0?Math.round(ee/ie*100):0;return l.jsxs("div",{className:L.panelContainer,children:[l.jsx(ba,{segments:G}),l.jsxs("div",{className:L.workspaceHeader,children:[l.jsx("span",{className:L.workspaceName,"data-testid":"workspace-name",children:l.jsx(Zt,{value:(C==null?void 0:C.name)||"",onSave:K=>{C&&g(C.id,{name:K})},validate:K=>{const re=K.trim();if(!re)return"Name is required";if(re.length>Rf)return`Max ${Rf} characters`},maxLength:Rf,fieldId:"name",activeFieldId:j,onActivate:w,ariaLabel:"Workspace name",renderDisplay:K=>K||n||void 0,"data-testid":"edit-name"})}),l.jsx("button",{className:L.archiveButton,onClick:()=>N(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),l.jsxs("button",{className:L.metaToggle,onClick:()=>A(!E),"aria-expanded":!E,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[l.jsx("span",{className:`${L.metaToggleArrow} ${E?"":L.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!E&&l.jsxs("div",{className:L.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[l.jsxs("div",{className:L.metaRow,children:[l.jsx("span",{className:L.metaLabel,children:"Description"}),l.jsx("div",{className:L.metaValue,children:l.jsx(cp,{value:(C==null?void 0:C.description)||"",onSave:K=>{C&&g(C.id,{description:K})},fieldId:"description",activeFieldId:j,onActivate:w,renderDisplay:K=>K?l.jsx("span",{className:L.overviewMarkdown,children:l.jsx(up,{remarkPlugins:[dp],children:K})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),l.jsxs("div",{className:L.metaRow,children:[l.jsx("span",{className:L.metaLabel,children:"Repository"}),l.jsx("div",{className:L.metaValue,children:l.jsx(Zt,{value:(C==null?void 0:C.repoUrl)||"",onSave:K=>{C&&g(C.id,{repoUrl:K})},validate:K=>{const re=K.trim();if(re&&!/^https?:\/\/.+/.test(re))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:j,onActivate:w,renderDisplay:K=>{const re=E4(K);return re?l.jsx("a",{className:L.repoLink,href:re,target:"_blank",rel:"noopener noreferrer",onClick:I=>I.stopPropagation(),children:K}):K?l.jsx("span",{children:K}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),l.jsxs("div",{className:L.metaRow,children:[l.jsx("span",{className:L.metaLabel,children:"Environment"}),l.jsx("div",{className:L.metaValue,children:l.jsx(C4,{value:(C==null?void 0:C.environmentId)||"",onSave:K=>{C&&K&&g(C.id,{environmentId:K})},environments:c,fieldId:"environmentId",activeFieldId:j,onActivate:w,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),l.jsxs("div",{className:L.metaRow,children:[l.jsx("span",{className:L.metaLabel,children:"Persona"}),l.jsx("div",{className:L.metaValue,children:l.jsx(Cc,{value:(C==null?void 0:C.defaultPersonaId)||"",onSave:K=>{C&&g(C.id,{defaultPersonaId:K})},options:[{value:"",label:"(Inherit)"},...d.map(K=>({value:K.id,label:K.name}))],fieldId:"defaultPersonaId",activeFieldId:j,onActivate:w,renderDisplay:K=>{const re=d.find(I=>I.id===K);if(re)return l.jsx("span",{children:re.name})},placeholder:(C==null?void 0:C.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),l.jsxs("div",{className:L.metaRow,children:[l.jsx("span",{className:L.metaLabel,children:"Worktrees"}),l.jsx("div",{className:L.metaValue,children:l.jsx(_4,{checked:(C==null?void 0:C.useWorktrees)??!0,onChange:K=>{C&&g(C.id,{useWorktrees:K})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),l.jsxs("div",{className:L.metaRow,children:[l.jsx("span",{className:L.metaLabel,children:"Working Dir"}),l.jsx("div",{className:L.metaValue,children:l.jsx(Zt,{value:(C==null?void 0:C.workingDirectory)||"",onSave:K=>{C&&g(C.id,{workingDirectory:K})},fieldId:"workingDirectory",activeFieldId:j,onActivate:w,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),C&&l.jsxs("div",{className:L.metaTimestamps,children:[l.jsxs("span",{className:L.metaTimestamp,children:["Created ",Jy(C.createdAt)]}),C.updatedAt&&C.updatedAt!==C.createdAt&&l.jsxs("span",{className:L.metaTimestamp,children:["· Updated ",Jy(C.updatedAt)]})]})]}),ie>0&&l.jsxs("div",{className:L.progressBarContainer,"data-testid":"progress-bar",children:[l.jsx("div",{className:L.progressBar,children:l.jsx("div",{className:L.progressFill,style:{width:`${be}%`}})}),l.jsxs("span",{className:L.progressLabel,children:[ee,"/",ie]})]}),V&&V.costUsd>0&&l.jsx("div",{className:L.progressBarContainer,children:l.jsxs("span",{className:L.progressLabel,children:["Usage: ",so(V.costUsd)," (",V.sessionCount," session",V.sessionCount!==1?"s":"",")"]})}),l.jsxs("div",{className:L.tabBar,role:"tablist","aria-label":"Workspace view",children:[l.jsx("button",{role:"tab","aria-selected":_==="graph",className:`${L.tab} ${_==="graph"?L.active:""}`,onClick:()=>S("graph"),children:"Graph"}),l.jsx("button",{role:"tab","aria-selected":_==="board",className:`${L.tab} ${_==="board"?L.active:""}`,onClick:()=>S("board"),"data-testid":"board-tab",children:"Board"}),l.jsx("button",{role:"tab","aria-selected":_==="tasks",className:`${L.tab} ${_==="tasks"?L.active:""}`,onClick:()=>S("tasks"),children:"Tasks"})]}),_==="tasks"&&ie>0&&l.jsxs("div",{className:L.workspaceSummary,children:[l.jsx("span",{className:L.workspaceSummaryTitle,children:`${ee}/${ie} tasks complete`}),l.jsx("span",{className:L.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),_==="tasks"&&ie===0&&l.jsxs("div",{className:L.emptyCta,children:[l.jsx("button",{className:L.ctaButton,onClick:()=>i(ei(n,void 0,M)),children:"Create Task"}),l.jsx("div",{className:L.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),_==="board"&&l.jsx(o4,{workspaceId:n,environmentId:M,tasks:o,sessions:m,personas:d,environments:c}),_==="graph"&&l.jsx(O5,{workspaceId:n,environmentId:M,tasks:o}),l.jsx(Ja,{isOpen:T,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{C&&(h(C.id),i("/",{replace:!0})),N(!1)},onCancel:()=>N(!1)})]})}const D4="_formContent_ymnez_1",R4="_section_ymnez_13",M4="_label_ymnez_19",O4="_titleInput_ymnez_26",I4="_descriptionTextarea_ymnez_58",B4="_selectField_ymnez_94",L4="_checkboxRow_ymnez_128",U4="_checkboxLabel_ymnez_141",z4="_fieldError_ymnez_146",ut={formContent:D4,section:R4,label:M4,titleInput:O4,descriptionTextarea:I4,selectField:B4,checkboxRow:L4,checkboxLabel:U4,fieldError:z4};function P4(n,s){return{name:(n==null?void 0:n.name)??"",description:(n==null?void 0:n.description)??"",repoUrl:(n==null?void 0:n.repoUrl)??"",environmentId:(n==null?void 0:n.environmentId)??s??"",defaultPersonaId:(n==null?void 0:n.defaultPersonaId)??"",useWorktrees:(n==null?void 0:n.useWorktrees)??!0,workingDirectory:(n==null?void 0:n.workingDirectory)??""}}const V4=100;function q4({values:n,onChange:s,environments:i,personas:o,errors:c,disabled:u,autoFocusName:d}){const m=(h,g)=>{s({...n,[h]:g})};return l.jsxs("div",{className:ut.formContent,children:[l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-name",children:"Name"}),l.jsx("input",{id:"ws-name",className:ut.titleInput,type:"text",value:n.name,onChange:h=>m("name",h.target.value),placeholder:"Workspace name",maxLength:V4,autoFocus:d,disabled:u,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&l.jsx("span",{className:ut.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-description",children:"Description"}),l.jsx("textarea",{id:"ws-description",className:ut.descriptionTextarea,value:n.description,onChange:h=>m("description",h.target.value),placeholder:"Optional description (Markdown supported)",disabled:u,"data-testid":"workspace-form-description"})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-repo",children:"Repository URL"}),l.jsx("input",{id:"ws-repo",className:ut.titleInput,type:"text",value:n.repoUrl,onChange:h=>m("repoUrl",h.target.value),placeholder:"https://github.com/org/repo",disabled:u,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&l.jsx("span",{className:ut.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-environment",children:"Environment"}),l.jsxs("select",{id:"ws-environment",className:ut.selectField,value:n.environmentId,onChange:h=>m("environmentId",h.target.value),disabled:u,"data-testid":"workspace-form-environment",children:[l.jsx("option",{value:"",children:"Select environment…"}),i.map(h=>l.jsx("option",{value:h.id,children:h.displayName||h.id},h.id))]}),(c==null?void 0:c.environmentId)&&l.jsx("span",{className:ut.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-persona",children:"Default Persona"}),l.jsxs("select",{id:"ws-persona",className:ut.selectField,value:n.defaultPersonaId,onChange:h=>m("defaultPersonaId",h.target.value),disabled:u,"data-testid":"workspace-form-persona",children:[l.jsx("option",{value:"",children:"(Inherit)"}),o.map(h=>l.jsx("option",{value:h.id,children:h.name},h.id))]})]}),l.jsx("div",{className:ut.section,children:l.jsxs("label",{className:ut.checkboxRow,children:[l.jsx("input",{type:"checkbox",checked:n.useWorktrees,onChange:h=>m("useWorktrees",h.target.checked),disabled:u,"data-testid":"workspace-form-worktrees"}),l.jsx("span",{className:ut.checkboxLabel,children:"Enable worktree isolation"})]})}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-workdir",children:"Working Directory"}),l.jsx("input",{id:"ws-workdir",className:ut.titleInput,type:"text",value:n.workingDirectory,onChange:h=>m("workingDirectory",h.target.value),placeholder:"Default (server default)",disabled:u,"data-testid":"workspace-form-workdir"})]})]})}const H4="_container_cddyd_1",G4="_header_cddyd_8",$4="_headerTitle_cddyd_35",F4="_badge_cddyd_44",Z4="_headerActions_cddyd_54",K4="_body_cddyd_61",Y4="_formContent_cddyd_73",J4="_section_cddyd_85",W4="_label_cddyd_91",X4="_titleInput_cddyd_98",Q4="_descriptionTextarea_cddyd_131",eB="_parentContext_cddyd_167",tB="_parentLabel_cddyd_175",nB="_parentName_cddyd_182",sB="_personaSelect_cddyd_186",aB="_depList_cddyd_220",iB="_depItem_cddyd_226",oB="_depItemSelected_cddyd_248",rB="_noDeps_cddyd_252",lB="_btnPrimary_cddyd_258",cB="_btnGhost_cddyd_289",Be={container:H4,header:G4,headerTitle:$4,badge:F4,headerActions:Z4,body:K4,formContent:Y4,section:J4,label:W4,titleInput:X4,descriptionTextarea:Q4,parentContext:eB,parentLabel:tB,parentName:nB,personaSelect:sB,depList:aB,depItem:iB,depItemSelected:oB,noDeps:rB,btnPrimary:lB,btnGhost:cB};function uB(n){const s={};return n.name.trim()||(s.name="Name is required"),n.repoUrl.trim()&&!/^https?:\/\/.+/i.test(n.repoUrl.trim())&&(s.repoUrl="Must be a valid http(s) URL"),n.environmentId||(s.environmentId="Environment is required"),Object.keys(s).length>0?s:void 0}const dB=[{label:"Home",url:Ya},{label:"New Workspace",url:void 0}];function fB(){const[n]=bp(),s=n.get("environment")??void 0,{environments:i,personas:o,createWorkspace:c,workspaceCreating:u}=pt(),{showToast:d}=Bs(),m=St(),[h,g]=y.useState(()=>{var j;return P4(void 0,s||((j=i[0])==null?void 0:j.id))}),[v,b]=y.useState(),[_,S]=y.useState();y.useEffect(()=>{s||h.environmentId||i.length===0||g(j=>{var w;return j.environmentId?j:{...j,environmentId:((w=i[0])==null?void 0:w.id)??""}})},[i,s,h.environmentId]);const T=()=>{const j=uB(h);if(j){b(j),S(void 0);return}b(void 0),S(void 0),c(h.name.trim(),h.description,h.repoUrl.trim(),h.environmentId,h.defaultPersonaId,h.useWorktrees,h.workingDirectory,()=>{d("Workspace created","success"),m(Ya,{replace:!0})},w=>{S(w)})},N=()=>{m(s?Qi(s):Ya,{replace:!0})};return l.jsxs("div",{className:Be.container,children:[l.jsxs("div",{className:Be.header,children:[l.jsx("div",{className:Be.headerTitle,children:l.jsx(ba,{segments:dB})}),l.jsxs("div",{className:Be.headerActions,children:[l.jsx("button",{className:Be.btnGhost,onClick:N,disabled:u,"data-testid":"workspace-create-cancel",children:"Cancel"}),l.jsx("button",{className:Be.btnPrimary,onClick:T,disabled:u||!h.name.trim()||!h.environmentId,"data-testid":"workspace-create-save",children:u?l.jsx(Ax,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),l.jsxs("div",{className:Be.body,children:[l.jsx(q4,{values:h,onChange:j=>{g(j),b(void 0),S(void 0)},environments:i,personas:o,errors:v,disabled:u,autoFocusName:!0}),_&&l.jsx("div",{className:Be.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function Bx({mode:n,taskId:s,workspaceId:i,parentTaskId:o,environmentId:c,tasks:u,workspaces:d,personas:m,onCreateTask:h,onUpdateTask:g,onEditDone:v}){const{showToast:b}=Bs(),_=St(),S=n==="edit",T=S&&s?u.find(pe=>pe.id===s):void 0,N=S?(T==null?void 0:T.workspaceId)??"":i??"",[j,w]=y.useState(N),E=N||j,A=d.find(pe=>pe.id===E),O=c??(A==null?void 0:A.environmentId),C=!S&&!i,M=S?(T==null?void 0:T.parentTaskId)??"":o??"",G=M?u.find(pe=>pe.id===M):void 0,[U,V]=y.useState((T==null?void 0:T.title)??""),[Z,ee]=y.useState((T==null?void 0:T.description)??""),[ie,be]=y.useState((T==null?void 0:T.dependsOn)??[]),[K,re]=y.useState((T==null?void 0:T.defaultPersonaId)??""),[I,$]=y.useState((T==null?void 0:T.canDecompose)??!1),[Q,de]=y.useState(!1),me=y.useRef(!1);y.useEffect(()=>{S&&T&&!me.current&&(me.current=!0,V(T.title),ee(T.description),be(T.dependsOn),re(T.defaultPersonaId),$(T.canDecompose))},[S,T]);const ze=u.filter(pe=>pe.workspaceId===E&&(!S||pe.id!==s)&&pe.id!==M),je=U.trim().length>0&&(!S||T!==void 0)&&E.length>0,Ne=pe=>{be(Re=>Re.includes(pe)?Re.filter(Bt=>Bt!==pe):[...Re,pe])},Ae=()=>{!je||Q||S&&T===void 0||(S&&s?(g(s,U.trim(),Z,ie,K),b("Task updated","success"),v?v():_(os(s,void 0,E,O),{replace:!0})):(de(!0),h(E,U.trim(),Z,ie.length>0?ie:void 0,M||void 0,K,I,()=>{b("Task created","success"),_(i?Wi(i,O):"/tasks",{replace:!0})},pe=>{b(pe,"error"),de(!1)})))},ce=()=>{if(v){v();return}_(S&&s?os(s,void 0,E,O):i?Wi(i,O):"/tasks")},fe=S?"edit task":M?"child task":"new task";return l.jsxs("div",{className:Be.container,children:[l.jsxs("div",{className:Be.header,children:[l.jsxs("div",{className:Be.headerTitle,children:[l.jsx("span",{className:Be.badge,children:fe}),G&&l.jsxs("span",{className:Be.parentContext,children:[l.jsx("span",{className:Be.parentLabel,children:"Child of"}),l.jsx("span",{className:Be.parentName,children:G.title})]})]}),l.jsxs("div",{className:Be.headerActions,children:[l.jsx("button",{onClick:Ae,disabled:!je||Q,className:Be.btnPrimary,"data-testid":"task-edit-save",children:Q?"Creating…":S?"Save Changes":"Create"}),l.jsx("button",{onClick:ce,className:Be.btnGhost,children:"Cancel"})]})]}),l.jsx("div",{className:Be.body,children:l.jsxs("div",{className:Be.formContent,children:[C&&l.jsxs("div",{className:Be.section,children:[l.jsx("label",{className:Be.label,htmlFor:"task-edit-workspace",children:"Workspace"}),l.jsxs("select",{id:"task-edit-workspace",value:j,onChange:pe=>w(pe.target.value),className:Be.personaSelect,"data-testid":"task-edit-workspace",children:[l.jsx("option",{value:"",children:"Select a workspace..."}),d.map(pe=>l.jsx("option",{value:pe.id,children:pe.name},pe.id))]})]}),l.jsxs("div",{className:Be.section,children:[l.jsx("label",{className:Be.label,htmlFor:"task-edit-title",children:"Title"}),l.jsx("input",{id:"task-edit-title",type:"text",value:U,onChange:pe=>V(pe.target.value),placeholder:"Task title...",autoFocus:!0,className:Be.titleInput,"data-testid":"task-edit-title",onKeyDown:pe=>{pe.key==="Enter"&&je&&Ae()}})]}),l.jsxs("div",{className:Be.section,children:[l.jsx("label",{className:Be.label,htmlFor:"task-edit-description",children:"Description"}),l.jsx("textarea",{id:"task-edit-description",value:Z,onChange:pe=>ee(pe.target.value),placeholder:"Describe the task... (markdown supported)",className:Be.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),l.jsxs("div",{className:Be.section,children:[l.jsx("label",{className:Be.label,htmlFor:"task-edit-persona",children:"Default Persona"}),l.jsxs("select",{id:"task-edit-persona",value:K,onChange:pe=>re(pe.target.value),className:Be.personaSelect,"data-testid":"task-edit-persona",children:[l.jsx("option",{value:"",children:"(Inherit)"}),m.map(pe=>l.jsx("option",{value:pe.id,children:pe.name},pe.id))]})]}),!S&&l.jsx("div",{className:Be.section,children:l.jsxs("label",{className:Be.depItem,"data-testid":"task-edit-can-decompose",children:[l.jsx("input",{type:"checkbox",checked:I,onChange:pe=>$(pe.target.checked)}),"Can spawn subtasks"]})}),l.jsxs("div",{className:Be.section,children:[l.jsx("div",{className:Be.label,children:"Dependencies"}),ze.length===0?l.jsx("div",{className:Be.noDeps,children:"No other tasks in this workspace"}):l.jsx("div",{className:Be.depList,children:ze.map(pe=>{const Re=ie.includes(pe.id);return l.jsxs("label",{className:`${Be.depItem} ${Re?Be.depItemSelected:""}`,"data-testid":`dep-option-${pe.id}`,children:[l.jsx("input",{type:"checkbox",checked:Re,onChange:()=>Ne(pe.id)}),pe.title,l.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",pe.status,")"]})]},pe.id)})})]})]})})]})}function Wy(){const{workspaceId:n,environmentId:s}=va(),[i]=bp(),o=n??i.get("workspace")??"",c=i.get("parent")??void 0,{tasks:u,workspaces:d,personas:m,createTask:h,updateTask:g}=pt();return l.jsx(Bx,{mode:"new",workspaceId:o,parentTaskId:c,environmentId:s,tasks:u,workspaces:d,personas:m,onCreateTask:h,onUpdateTask:g})}const pB="_container_1pqxm_1",mB="_emptyState_1pqxm_8",hB="_card_1pqxm_14",gB="_cardHeader_1pqxm_34",vB="_categoryBadge_1pqxm_46",yB="_findingTitle_1pqxm_54",bB="_findingDate_1pqxm_60",_B="_findingContent_1pqxm_72",xB="_tags_1pqxm_78",SB="_tag_1pqxm_78",ts={container:pB,emptyState:mB,card:hB,cardHeader:gB,categoryBadge:vB,findingTitle:yB,findingDate:bB,findingContent:_B,tags:xB,tag:SB};function TB(n){const s=new Date(n),i=new Date,o=i.getTime()-s.getTime(),c=Math.floor(o/1e3),u=Math.floor(c/60),d=Math.floor(u/60),m=Math.floor(d/24);if(c<60)return"just now";if(u<60)return`${u}m ago`;if(d<24)return`${d}h ago`;if(m===1)return"yesterday";if(m<7)return`${m} days ago`;const h=s.getFullYear()===i.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return h?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Xy={architecture:{text:"var(--accent-blue)",bg:"var(--accent-blue-dim)"},api:{text:"var(--accent-green)",bg:"var(--accent-green-dim)"},bug:{text:"var(--accent-red)",bg:"var(--accent-red-dim)"},decision:{text:"var(--accent-yellow)",bg:"var(--accent-yellow-dim)"},dependency:{text:"var(--accent-purple)",bg:"var(--accent-purple-dim)"},pattern:{text:"var(--accent-cyan)",bg:"var(--accent-cyan-dim)"},general:{text:"var(--text-secondary)",bg:"var(--bg-elevated)"}};function kB({findings:n}){return n.length===0?l.jsx("div",{className:ts.emptyState,children:"No findings yet. Agents will post discoveries here."}):l.jsx("div",{className:ts.container,children:n.map((s,i)=>{const o=Xy[s.category]||Xy.general;return l.jsxs(Rt.div,{className:ts.card,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:i*.05,duration:.2},children:[l.jsxs("div",{className:ts.cardHeader,children:[l.jsx("span",{className:ts.categoryBadge,style:{background:o.bg,color:o.text},children:s.category}),l.jsx("span",{className:ts.findingTitle,children:s.title}),l.jsx("span",{className:ts.findingDate,title:s.createdAt,children:TB(s.createdAt)})]}),l.jsx("div",{className:ts.findingContent,children:s.content.length>300?s.content.slice(0,300)+"...":s.content}),s.tags.length>0&&l.jsx("div",{className:ts.tags,children:s.tags.map(c=>l.jsx("span",{className:ts.tag,style:{color:o.text,textShadow:`0 0 8px ${o.text}`},children:c},c))})]},s.id)})})}const wB="_workpadSection_y8nj9_1",NB="_workpadLabel_y8nj9_9",jB="_workpadStatus_y8nj9_17",CB="_workpadSummary_y8nj9_23",EB="_workpadExtra_y8nj9_29",da={workpadSection:wB,workpadLabel:NB,workpadStatus:jB,workpadSummary:CB,workpadExtra:EB};function AB({workpad:n}){if(!n)return;let s;try{const i=JSON.parse(n);if(i==null||typeof i!="object"||Array.isArray(i))return;s=i}catch{return l.jsxs("div",{className:da.workpadSection,"data-testid":"workpad-panel",children:[l.jsx("div",{className:da.workpadLabel,children:"Workpad"}),l.jsx("div",{className:da.workpadExtra,children:n})]})}if(!(!s.status&&!s.summary&&!s.extra))return l.jsxs("div",{className:da.workpadSection,"data-testid":"workpad-panel",children:[l.jsx("div",{className:da.workpadLabel,children:"Workpad"}),s.status&&l.jsx("div",{className:da.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&l.jsx("div",{className:da.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&l.jsx("div",{className:da.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}function cc(n){if(!n)return"—";const s=new Date(n);return isNaN(s.getTime())?"—":s.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Mf(n,s){if(!n||!s)return;const i=new Date(s).getTime()-new Date(n).getTime();if(isNaN(i)||i<0)return;const o=Math.floor(i/6e4),c=Math.floor(i%6e4/1e3);if(o===0)return`${c}s`;const u=Math.floor(o/60),d=o%60;return u===0?`${o}m ${c}s`:`${u}h ${d}m`}function Qy(n){const s=n.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?L.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?L.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?L.envDotRed:L.envDotGray}function DB({status:n}){const s=ga(n),i=nA(n);return l.jsx("span",{className:`${L.statusBadge} ${L[i]??L.statusPending}`,children:s.label})}function RB({task:n,tasksById:s,environments:i,workspaces:o,taskSessions:c,selectedEnvId:u}){const{loadUsage:d,usageCache:m}=pt(),h=c.reduce((A,O)=>A+(O.costUsd??0),0);y.useEffect(()=>{d("task",n.id),n.childTaskIds.length>0&&d("task_tree",n.id)},[n.id,n.childTaskIds.length,d,h]);const g=`task:${n.id}`,v=g in m?m[g]:void 0,b=`task_tree:${n.id}`,_=n.childTaskIds.length>0&&b in m?m[b]:void 0,S=c.length>0?c[c.length-1]:void 0,T=(S==null?void 0:S.environmentId)??"",N=T?i.find(A=>A.id===T):void 0,j=o.find(A=>A.id===n.workspaceId),w=i.find(A=>A.id===u),E=n.branch&&(j!=null&&j.repoUrl)?`${j.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(n.branch)}`:void 0;return l.jsxs("div",{className:L.overviewDashboard,children:[l.jsxs("div",{className:L.overviewHero,children:[l.jsx(DB,{status:n.status}),n.branch&&l.jsx("span",{className:L.overviewBranchPill,children:E?l.jsxs("a",{href:E,target:"_blank",rel:"noreferrer noopener",className:L.branchLink,children:["🔗"," ",n.branch]}):l.jsxs("span",{children:["🔗"," ",n.branch]})})]}),typeof n.description=="string"&&n.description&&l.jsxs("div",{className:L.overviewSection,children:[l.jsx("div",{className:L.overviewLabel,children:"Description"}),l.jsx("div",{className:L.overviewMarkdown,children:l.jsx(up,{remarkPlugins:[dp],children:n.description})})]}),n.workpad&&l.jsx(AB,{workpad:n.workpad}),l.jsxs("div",{className:L.overviewSection,children:[l.jsx("div",{className:L.overviewLabel,children:"Environment"}),T&&N?l.jsxs("div",{className:L.envRow,"data-testid":"task-overview-environment",children:[l.jsx("span",{className:`${L.envDot} ${Qy(N.status)}`,title:N.status,"aria-label":`Status: ${N.status}`,role:"img"}),l.jsx("span",{className:L.overviewValue,children:N.displayName})]}):w?l.jsxs("div",{className:L.envRow,"data-testid":"task-overview-environment",children:[l.jsx("span",{className:`${L.envDot} ${Qy(w.status)}`,title:w.status,"aria-label":`Status: ${w.status}`,role:"img"}),l.jsx("span",{className:L.overviewValue,children:w.displayName}),l.jsx("span",{className:L.overviewMuted,children:"(workspace default)"})]}):l.jsx("div",{className:L.overviewMuted,children:"Set in workspace settings"})]}),l.jsxs("div",{className:L.overviewSection,"data-testid":"task-overview-dependencies",children:[l.jsx("div",{className:L.overviewLabel,children:"Dependencies"}),n.dependsOn.length===0?l.jsx("div",{className:L.overviewMuted,children:"None"}):l.jsx("div",{className:L.depList,children:n.dependsOn.map(A=>{const O=s.get(A),C=(O==null?void 0:O.status)==="complete";return l.jsxs("div",{className:`${L.depItem} ${C?L.depDone:L.depBlocked}`,children:[l.jsx("span",{children:C?"✓":"○"}),l.jsx("span",{children:(O==null?void 0:O.title)??A})]},A)})})]}),l.jsxs("div",{className:L.overviewSection,children:[l.jsx("div",{className:L.overviewLabel,children:"Timeline"}),l.jsxs("div",{className:L.timeline,children:[n.createdAt&&l.jsxs("div",{className:L.timelineRow,children:[l.jsx("span",{className:L.timelineKey,children:"Created"}),l.jsx("span",{className:L.timelineValue,children:cc(n.createdAt)})]}),n.assignedAt&&(()=>{const A=Mf(n.createdAt,n.assignedAt);return l.jsxs("div",{className:L.timelineRow,children:[l.jsx("span",{className:L.timelineKey,children:"Assigned"}),l.jsx("span",{className:L.timelineValue,children:cc(n.assignedAt)}),A!==void 0&&l.jsx("span",{className:L.timelineDelta,children:A})]})})(),n.startedAt&&(()=>{const A=Mf(n.assignedAt??n.createdAt,n.startedAt);return l.jsxs("div",{className:L.timelineRow,children:[l.jsx("span",{className:L.timelineKey,children:"Started"}),l.jsx("span",{className:L.timelineValue,children:cc(n.startedAt)}),A!==void 0&&l.jsx("span",{className:L.timelineDelta,children:A})]})})(),n.completedAt&&(()=>{const A=Mf(n.startedAt,n.completedAt);return l.jsxs("div",{className:L.timelineRow,children:[l.jsx("span",{className:L.timelineKey,children:"Completed"}),l.jsx("span",{className:L.timelineValue,children:cc(n.completedAt)}),A!==void 0&&l.jsx("span",{className:L.timelineDelta,children:A})]})})(),!n.createdAt&&!n.assignedAt&&!n.startedAt&&!n.completedAt&&l.jsx("div",{className:L.overviewMuted,children:"No timing data"})]})]}),v&&v.costUsd>0&&l.jsxs("div",{className:L.overviewSection,children:[l.jsx("div",{className:L.overviewLabel,children:"Usage"}),l.jsxs("div",{className:L.timeline,children:[l.jsxs("div",{className:L.timelineRow,children:[l.jsx("span",{className:L.timelineKey,children:"Cost"}),l.jsx("span",{className:L.timelineValue,children:so(v.costUsd)}),l.jsxs("span",{className:L.timelineDelta,children:[v.sessionCount," session",v.sessionCount!==1?"s":""]})]}),_&&_.costUsd>v.costUsd&&l.jsxs("div",{className:L.timelineRow,children:[l.jsx("span",{className:L.timelineKey,children:"Total (incl. subtasks)"}),l.jsx("span",{className:L.timelineValue,children:so(_.costUsd)}),l.jsxs("span",{className:L.timelineDelta,children:[_.sessionCount," session",_.sessionCount!==1?"s":""]})]})]})]}),n.reviewNotes&&l.jsxs("div",{className:L.overviewSection,children:[l.jsx("div",{className:L.overviewLabel,children:"Review Notes"}),l.jsx("div",{className:L.reviewNotes,children:n.reviewNotes})]})]})}function MB({task:n,sessionId:s,isBlocked:i,onStart:o,onResume:c,onStop:u,onPause:d,onDelete:m,onEdit:h}){if(n.status==="not_started")return i?l.jsxs("div",{className:L.headerActions,children:[l.jsx("button",{onClick:h,className:L.btnGhost,children:"Edit"}),l.jsx("button",{onClick:m,className:L.btnDanger,children:"Delete"})]}):l.jsxs("div",{className:L.headerActions,children:[l.jsx("button",{"data-testid":"task-header-start",onClick:o,className:L.btnPrimary,children:"Start"}),l.jsx("button",{onClick:h,className:L.btnGhost,children:"Edit"}),l.jsx("button",{onClick:m,className:L.btnDanger,children:"Delete"})]});if(n.status==="working")return l.jsxs("div",{className:L.headerActions,children:[l.jsx("button",{onClick:u,className:L.btnDanger,children:"Stop"}),l.jsx("button",{onClick:d,disabled:!s,className:L.btnGhost,children:"Pause"})]});if(n.status==="paused")return l.jsxs("div",{className:L.headerActions,children:[l.jsx("button",{onClick:u,className:L.btnPrimary,children:"Stop"}),l.jsx("button",{onClick:c,className:L.btnGhost,children:"Resume"}),l.jsx("button",{onClick:m,className:L.btnDanger,children:"Delete"})]});if(n.status==="complete")return l.jsx("div",{className:L.headerActions,children:l.jsx("button",{onClick:m,className:L.btnDanger,children:"Delete"})});if(n.status==="failed")return l.jsxs("div",{className:L.headerActions,children:[l.jsx("button",{onClick:o,className:L.btnPrimary,children:"Retry"}),l.jsx("button",{onClick:m,className:L.btnDanger,children:"Delete"})]})}function OB({taskSessions:n,selectedSessionId:s,onSelect:i}){if(!(n.length<2))return l.jsxs("div",{className:L.attemptSelector,"data-testid":"attempt-selector",children:[l.jsx("span",{className:L.attemptLabel,children:"Attempts:"}),n.map((o,c)=>{const u=o.id===s,d=o.status==="stopped"&&o.endReason==="completed"?"✓":o.status==="stopped"?"✗":o.status==="running"||o.status==="idle"?"●":"";return l.jsxs("button",{className:`${L.attemptButton} ${u?L.attemptActive:""}`,onClick:()=>i(o.id),title:`Attempt #${c+1} — ${o.status}`,"aria-label":`Attempt #${c+1}, ${o.status}`,"aria-pressed":u,"data-testid":`attempt-${c+1}`,children:["#",c+1,d&&l.jsx("span",{className:L.attemptStatus,children:d})]},o.id)})]})}function fa(){const{taskId:n,workspaceId:s,environmentId:i}=va(),o=It(),c=St(),{events:u,eventsDropped:d,tasks:m,sessions:h,environments:g,findings:v,loadSessionEvents:b,loadFindings:_,kill:S,startTask:T,stopTask:N,resumeTask:j,deleteTask:w,createTask:E,updateTask:A,workspaces:O,taskSessions:C,loadTaskSessions:M,sendInput:G,spawn:U,personas:V,provisionEnvironment:Z}=pt(),ee=y.useRef(void 0),ie=y.useRef(void 0),be=y.useRef(void 0),K=y.useRef(void 0),re=y.useRef(void 0),I=o.pathname.endsWith("/stream")?"stream":o.pathname.endsWith("/findings")?"findings":"overview",$=o.pathname.endsWith("/edit"),[Q,de]=y.useState(I),[me,ze]=y.useState(!1),[je,Ne]=y.useState(void 0),[Ae,ce]=y.useState(""),[fe,pe]=y.useState($),Re=y.useRef(I),Bt=y.useRef($),te=m.find(Me=>Me.id===n),X=(te==null?void 0:te.workspaceId)||void 0,Te=O.find(Me=>Me.id===X);y.useEffect(()=>{I!==Re.current&&(Re.current=I,I!==Q&&de(I))},[I,Q]),y.useEffect(()=>{$!==Bt.current&&(Bt.current=$,$!==fe&&pe($))},[$,fe]),y.useEffect(()=>{if(Ae===""){if(Te!=null&&Te.environmentId)ce(Te.environmentId);else if(g.length>0){const Me=g.find(Mt=>Mt.status==="connected");ce((Me==null?void 0:Me.id)??g[0].id)}}},[Ae,Te==null?void 0:Te.environmentId,g]);const un=te?C[te.id]??[]:[];let Ze;je&&un.some(Me=>Me.id===je)?Ze=je:Ze=(te==null?void 0:te.latestSessionId)||void 0;const Kn=()=>{ze(!0)},Yn=()=>{if(!te)return;w(te.id),ze(!1);const Me=i??(Te==null?void 0:Te.environmentId);c(te.workspaceId&&Me?Wi(te.workspaceId,Me):"/",{replace:!0})};y.useEffect(()=>{(te==null?void 0:te.id)!==ie.current&&(ie.current=te==null?void 0:te.id,Ne(void 0),ce(""),pe($))},[te==null?void 0:te.id,$]),y.useEffect(()=>{if(!(te!=null&&te.id))return;const Me=te.id!==K.current,Mt=te.latestSessionId!==re.current;(Me||Mt)&&(K.current=te.id,re.current=te.latestSessionId,M(te.id))},[te==null?void 0:te.id,te==null?void 0:te.latestSessionId,M]),y.useEffect(()=>{if((te==null?void 0:te.status)!==be.current){const Me=be.current===void 0;be.current=te==null?void 0:te.status;const Mt=(te==null?void 0:te.status)==="not_started"?"overview":(te==null?void 0:te.status)==="working"||(te==null?void 0:te.status)==="paused"?"stream":(te==null?void 0:te.status)==="complete"?"findings":void 0;Mt&&Mt!==Q&&!(Me&&I!=="overview")&&de(Mt)}},[te==null?void 0:te.status,Q,I]);const zn=y.useMemo(()=>new Map(m.map(Me=>[Me.id,Me])),[m]),Jn=y.useMemo(()=>{const Me=Ze?u.filter(Mt=>Mt.sessionId===Ze):[];return im(am(Me))},[u,Ze]),Tn=te?te.dependsOn.some(Me=>{const Mt=zn.get(Me);return Mt!==void 0&&Mt.status!=="complete"}):!1,Ls=y.useMemo(()=>o5(n,i,O,g,zn),[n,i,O,g,zn]);y.useEffect(()=>{Ze&&Ze!==ee.current&&(ee.current=Ze,b(Ze))},[Ze,b]),y.useEffect(()=>{Q==="findings"&&X&&_(X)},[Q,X,_]);const dn=Me=>{de(Me),c(os(n,Me==="overview"?void 0:Me,s,i))};return Ms({key:"1"},()=>dn("overview")),Ms({key:"2"},()=>dn("stream")),Ms({key:"3"},()=>dn("findings")),l.jsxs("div",{className:L.panelContainer,children:[l.jsx(ba,{segments:Ls}),l.jsxs("div",{className:L.header,children:[l.jsxs("span",{className:L.headerTitle,children:[l.jsx("span",{"data-testid":"task-title",children:(te==null?void 0:te.title)||n}),te&&l.jsx("span",{className:L.taskStatusBadge,"data-testid":"task-status",children:te.status}),(te==null?void 0:te.branch)&&l.jsx("span",{className:L.taskBranch,children:te.branch}),Tn&&l.jsx("span",{className:L.taskBlockedBadge,children:"blocked"})]}),te&&l.jsx(MB,{task:te,sessionId:Ze,isBlocked:Tn,onStart:()=>T(te.id,void 0,Ae),onResume:()=>j(te.id),onStop:()=>N(te.id),onPause:()=>Ze&&S(Ze),onDelete:Kn,onEdit:()=>pe(!0)})]}),l.jsxs("div",{className:L.tabBar,role:"tablist","aria-label":"Task view",children:[l.jsx("button",{role:"tab","aria-selected":Q==="overview",className:`${L.tab} ${Q==="overview"?L.active:""}`,onClick:()=>dn("overview"),children:"Overview"}),l.jsx("button",{role:"tab","aria-selected":Q==="stream",className:`${L.tab} ${Q==="stream"?L.active:""}`,onClick:()=>dn("stream"),children:"Stream"}),l.jsx("button",{role:"tab","aria-selected":Q==="findings",className:`${L.tab} ${Q==="findings"?L.active:""}`,onClick:()=>dn("findings"),children:"Findings"})]}),l.jsxs(rs,{mode:"wait",children:[Q==="overview"&&l.jsx(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:L.overviewContent,"data-testid":"task-overview",children:fe&&te?l.jsx(Bx,{mode:"edit",taskId:te.id,workspaceId:X,environmentId:i,tasks:m,workspaces:O,personas:V,onCreateTask:E,onUpdateTask:A,onEditDone:()=>{$?c(os(te.id,void 0,s,i),{replace:!0}):pe(!1)}}):te?l.jsx(RB,{task:te,tasksById:zn,environments:g,workspaces:O,taskSessions:un,selectedEnvId:Ae}):l.jsx("div",{className:L.waitingMessage,children:"No additional details"})},"overview"),Q==="stream"&&l.jsxs(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[l.jsx(OB,{taskSessions:un,selectedSessionId:Ze,onSelect:Me=>Ne(Me)}),l.jsx(sm,{events:Jn,eventsDropped:d,emptyState:!Ze&&te?Tn?l.jsx("div",{className:L.emptyCta,"data-testid":"stream-blocked-message",children:l.jsx("div",{className:L.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):l.jsxs("div",{className:L.emptyCta,children:[l.jsx("button",{"data-testid":"stream-start-cta",className:L.ctaButton,onClick:()=>T(te.id,void 0,Ae),children:"Start Task"}),l.jsx("div",{className:L.ctaDescription,children:"Click to begin agent execution"})]}):Ze&&Jn.length===0?l.jsx("div",{className:L.waitingMessage,children:"Waiting for events..."}):void 0})]},"stream"),Q==="findings"&&l.jsx(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:L.tabContent,children:X?l.jsx(kB,{findings:v.filter(Me=>Me.workspaceId===X)}):l.jsx("div",{className:L.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!te||te.status!=="working"&&te.status!=="paused")return;const Me=Ze?h.find(Mt=>Mt.id===Ze):void 0;if(!(!Me||Me.status==="stopped"))return l.jsx(jr,{mode:"send",sessionId:Me.id,environmentId:Me.environmentId,personas:V,environments:g,onSendInput:G,onSpawn:U,onStartTask:T,onProvisionEnvironment:Z})})(),te&&l.jsx(Ja,{isOpen:me,title:"Delete Task?",description:`"${te.title}" will be permanently removed.`,onConfirm:Yn,onCancel:()=>ze(!1)})]})}const IB="_container_legrg_1",BB="_header_legrg_8",LB="_headerTitle_legrg_35",UB="_badge_legrg_44",zB="_headerActions_legrg_54",PB="_body_legrg_61",VB="_formContent_legrg_73",qB="_section_legrg_85",HB="_label_legrg_91",GB="_nameInput_legrg_98",$B="_fieldInput_legrg_131",FB="_adapterSelect_legrg_164",ZB="_readOnlyValue_legrg_198",KB="_codespaceSection_legrg_204",YB="_codespaceActions_legrg_210",JB="_creatingHint_legrg_216",WB="_errorHint_legrg_222",XB="_btnPrimary_legrg_235",QB="_btnGhost_legrg_266",se={container:IB,header:BB,headerTitle:LB,badge:UB,headerActions:zB,body:PB,formContent:VB,section:qB,label:HB,nameInput:GB,fieldInput:$B,adapterSelect:FB,readOnlyValue:ZB,codespaceSection:KB,codespaceActions:YB,creatingHint:JB,errorHint:WB,btnPrimary:XB,btnGhost:QB},gc=1,vc=65535;function Of(n){if(!n.trim())return!0;const s=Number(n);return Number.isInteger(s)&&s>=gc&&s<=vc}function If(n){try{const s=JSON.parse(n);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function eL({codespaceName:n,onCodespaceNameChange:s,envName:i,onEnvNameChange:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:m,onCreateCodespace:h}){const[g,v]=y.useState("pick"),[b,_]=y.useState(""),[S,T]=y.useState("");return g==="create"?l.jsxs("div",{className:se.codespaceSection,children:[l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Repository"}),l.jsx("input",{type:"text",value:b,onChange:N=>_(N.target.value),placeholder:"owner/repo",className:se.fieldInput,"data-testid":"env-codespace-repo"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Machine Type"}),l.jsx("input",{type:"text",value:S,onChange:N=>T(N.target.value),placeholder:"Machine type (optional)...",className:se.fieldInput,"data-testid":"env-codespace-machine"})]}),l.jsxs("div",{className:se.codespaceActions,children:[l.jsx("button",{onClick:()=>{b.trim()&&(h(b.trim(),S.trim()||void 0),v("pick"),_(""),T(""))},disabled:!b.trim(),className:se.btnPrimary,children:"Create"}),l.jsx("button",{onClick:()=>{v("pick"),_(""),T("")},className:se.btnGhost,children:"Cancel"})]})]}):l.jsx("div",{className:se.codespaceSection,children:l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Codespace"}),!d&&l.jsxs("select",{value:n,onChange:N=>{N.target.value==="__create__"?(v("create"),s("")):(s(N.target.value),N.target.value&&!i.trim()&&o(N.target.value))},disabled:m,className:se.adapterSelect,"data-testid":"env-codespace-select",children:[l.jsx("option",{value:"",children:"Select a codespace..."}),c.map(N=>l.jsxs("option",{value:N.name,children:[N.name," (",N.repository,") — ",N.state]},N.name)),l.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),m&&l.jsx("span",{className:se.creatingHint,children:"Creating codespace..."}),d&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:se.errorHint,children:d}),l.jsx("input",{type:"text",value:n,onChange:N=>s(N.target.value),placeholder:"Or enter codespace name manually...",className:se.fieldInput,"data-testid":"env-codespace-manual"})]}),u&&!d&&l.jsx("span",{className:se.errorHint,children:u})]})})}function Lx({mode:n,environmentId:s,environments:i,onAddEnvironment:o,onUpdateEnvironment:c,onListCodespaces:u,codespaces:d,codespaceError:m,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v}){const{showToast:b}=Bs(),_=St(),S=n==="edit",T=S&&s?i.find(ce=>ce.id===s):void 0,[N,j]=y.useState(""),[w,E]=y.useState("local"),[A,O]=y.useState(""),[C,M]=y.useState(""),[G,U]=y.useState(""),[V,Z]=y.useState(""),[ee,ie]=y.useState(""),[be,K]=y.useState(""),[re,I]=y.useState(""),[$,Q]=y.useState(null),de=y.useCallback(()=>{const ce={};if(w==="local"){if(A.trim()&&(ce.host=A.trim()),C.trim()){const fe=Number(C);Number.isInteger(fe)&&(ce.port=fe)}}else if(w==="ssh"){if(ce.host=A.trim(),G.trim()&&(ce.user=G.trim()),C.trim()){const fe=Number(C);Number.isInteger(fe)&&(ce.sshPort=fe)}V.trim()&&(ce.identityFile=V.trim())}else w==="docker"?(ee.trim()&&(ce.image=ee.trim()),be.trim()&&(ce.repo=be.trim())):w==="codespace"&&(ce.codespaceName=re.trim());return ce},[w,A,C,G,V,ee,be,re]),me=()=>!(!N.trim()||w==="ssh"&&!A.trim()||w==="codespace"&&!re.trim()||(w==="local"||w==="ssh")&&!Of(C)),ze=()=>{me()&&(o(N.trim(),w,de()),b("Environment added successfully","success"),_(Xi,{replace:!0}))},je=()=>{_(s?Qi(s):Xi)},Ne=y.useCallback((ce,fe)=>{if(!T||!s)return;const pe=If(T.adapterConfig),Re=fe.trim();Re?pe[ce]=Re:delete pe[ce],c(s,{adapterConfig:pe})},[T,s,c]),Ae=y.useCallback((ce,fe)=>{if(!T||!s)return;const pe=If(T.adapterConfig);if(fe.trim()){const Re=Number(fe);Number.isInteger(Re)&&Re>=gc&&Re<=vc&&(pe[ce]=Re)}else delete pe[ce];c(s,{adapterConfig:pe})},[T,s,c]);if(S){if(!T)return l.jsxs("div",{className:se.container,children:[l.jsxs("div",{className:se.header,children:[l.jsx("div",{className:se.headerTitle,children:l.jsx("span",{className:se.badge,children:"edit environment"})}),l.jsx("div",{className:se.headerActions,children:l.jsx("button",{onClick:je,className:se.btnGhost,children:"Back"})})]}),l.jsx("div",{className:se.body,children:l.jsx("div",{className:se.formContent,children:l.jsx("span",{className:se.readOnlyValue,children:"Environment not found"})})})]});const ce=If(T.adapterConfig);return l.jsxs("div",{className:se.container,"data-testid":"env-edit-panel",children:[l.jsxs("div",{className:se.header,children:[l.jsx("div",{className:se.headerTitle,children:l.jsx("span",{className:se.badge,children:"edit environment"})}),l.jsx("div",{className:se.headerActions,children:l.jsx("button",{onClick:je,className:se.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),l.jsx("div",{className:se.body,children:l.jsxs("div",{className:se.formContent,children:[l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Name"}),l.jsx(Zt,{value:T.displayName,onSave:fe=>{s&&c(s,{displayName:fe})},validate:fe=>fe.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:$,onActivate:Q,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Adapter Type"}),l.jsx("span",{className:se.readOnlyValue,"data-testid":"env-edit-adapter-type",children:T.adapterType})]}),T.adapterType==="local"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Host"}),l.jsx(Zt,{value:String(ce.host??""),onSave:fe=>Ne("host",fe),mode:"edit",fieldId:"host",activeFieldId:$,onActivate:Q,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Port"}),l.jsx(Zt,{value:String(ce.port??""),onSave:fe=>Ae("port",fe),validate:fe=>Of(fe)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:$,onActivate:Q,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),T.adapterType==="ssh"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Host"}),l.jsx(Zt,{value:String(ce.host??""),onSave:fe=>Ne("host",fe),validate:fe=>fe.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:$,onActivate:Q,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"User"}),l.jsx(Zt,{value:String(ce.user??""),onSave:fe=>Ne("user",fe),mode:"edit",fieldId:"user",activeFieldId:$,onActivate:Q,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"SSH Port"}),l.jsx(Zt,{value:String(ce.sshPort??""),onSave:fe=>Ae("sshPort",fe),validate:fe=>Of(fe)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:$,onActivate:Q,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Identity File"}),l.jsx(Zt,{value:String(ce.identityFile??""),onSave:fe=>Ne("identityFile",fe),mode:"edit",fieldId:"identityFile",activeFieldId:$,onActivate:Q,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),T.adapterType==="docker"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Image"}),l.jsx(Zt,{value:String(ce.image??""),onSave:fe=>Ne("image",fe),mode:"edit",fieldId:"image",activeFieldId:$,onActivate:Q,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Repo"}),l.jsx(Zt,{value:String(ce.repo??""),onSave:fe=>Ne("repo",fe),mode:"edit",fieldId:"repo",activeFieldId:$,onActivate:Q,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),T.adapterType==="codespace"&&l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,children:"Codespace Name"}),l.jsx(Zt,{value:String(ce.codespaceName??""),onSave:fe=>Ne("codespaceName",fe),validate:fe=>fe.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:$,onActivate:Q,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return l.jsxs("div",{className:se.container,"data-testid":"env-create-panel",children:[l.jsxs("div",{className:se.header,children:[l.jsx("div",{className:se.headerTitle,children:l.jsx("span",{className:se.badge,children:"new environment"})}),l.jsxs("div",{className:se.headerActions,children:[l.jsx("button",{onClick:ze,disabled:!me(),className:se.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),l.jsx("button",{onClick:je,className:se.btnGhost,children:"Cancel"})]})]}),l.jsx("div",{className:se.body,children:l.jsxs("div",{className:se.formContent,children:[l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,htmlFor:"env-create-name",children:"Name"}),l.jsx("input",{id:"env-create-name",type:"text",value:N,onChange:ce=>j(ce.target.value),placeholder:"Environment name...",autoFocus:!0,className:se.nameInput,"data-testid":"env-create-name",onKeyDown:ce=>{ce.key==="Enter"&&me()&&ze()}})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),l.jsxs("select",{id:"env-create-adapter",value:w,onChange:ce=>{E(ce.target.value),ce.target.value==="codespace"&&u()},className:se.adapterSelect,"data-testid":"env-create-adapter",children:[l.jsx("option",{value:"local",children:"local"}),l.jsx("option",{value:"ssh",children:"ssh"}),l.jsx("option",{value:"docker",children:"docker"}),l.jsx("option",{value:"codespace",children:"codespace"})]})]}),w==="local"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,htmlFor:"env-create-host",children:"Host"}),l.jsx("input",{id:"env-create-host",type:"text",value:A,onChange:ce=>O(ce.target.value),placeholder:"Host (optional)...",className:se.fieldInput,"data-testid":"env-create-host"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,htmlFor:"env-create-port",children:"Port"}),l.jsx("input",{id:"env-create-port",type:"number",min:gc,max:vc,value:C,onChange:ce=>M(ce.target.value),placeholder:"Port (optional)...",className:se.fieldInput,"data-testid":"env-create-port"})]})]}),w==="ssh"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,htmlFor:"env-create-host",children:"Host"}),l.jsx("input",{id:"env-create-host",type:"text",value:A,onChange:ce=>O(ce.target.value),placeholder:"Host (required)...",className:se.fieldInput,"data-testid":"env-create-host"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,htmlFor:"env-create-user",children:"User"}),l.jsx("input",{id:"env-create-user",type:"text",value:G,onChange:ce=>U(ce.target.value),placeholder:"User (optional)...",className:se.fieldInput,"data-testid":"env-create-user"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,htmlFor:"env-create-port",children:"SSH Port"}),l.jsx("input",{id:"env-create-port",type:"number",min:gc,max:vc,value:C,onChange:ce=>M(ce.target.value),placeholder:"SSH port (optional)...",className:se.fieldInput,"data-testid":"env-create-port"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,htmlFor:"env-create-identity",children:"Identity File"}),l.jsx("input",{id:"env-create-identity",type:"text",value:V,onChange:ce=>Z(ce.target.value),placeholder:"Identity file (optional)...",className:se.fieldInput,"data-testid":"env-create-identity"})]})]}),w==="docker"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,htmlFor:"env-create-image",children:"Image"}),l.jsx("input",{id:"env-create-image",type:"text",value:ee,onChange:ce=>ie(ce.target.value),placeholder:"Image (optional)...",className:se.fieldInput,"data-testid":"env-create-image"})]}),l.jsxs("div",{className:se.section,children:[l.jsx("label",{className:se.label,htmlFor:"env-create-repo",children:"Repo"}),l.jsx("input",{id:"env-create-repo",type:"text",value:be,onChange:ce=>K(ce.target.value),placeholder:"Repo (optional)...",className:se.fieldInput,"data-testid":"env-create-repo"})]})]}),w==="codespace"&&l.jsx(eL,{codespaceName:re,onCodespaceNameChange:I,envName:N,onEnvNameChange:j,codespaces:d,codespaceError:m,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}function tL(){const{environments:n,addEnvironment:s,updateEnvironment:i,listCodespaces:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:m,createCodespace:h}=pt();return l.jsx(Lx,{mode:"new",environments:n,onAddEnvironment:s,onUpdateEnvironment:i,onListCodespaces:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:m,onCreateCodespace:h})}function nL(){const{environmentId:n}=va(),{environments:s,addEnvironment:i,updateEnvironment:o,listCodespaces:c,codespaces:u,codespaceError:d,codespaceListError:m,codespaceCreating:h,createCodespace:g}=pt();return l.jsx(Lx,{mode:"edit",environmentId:n,environments:s,onAddEnvironment:i,onUpdateEnvironment:o,onListCodespaces:c,codespaces:u,codespaceError:d,codespaceListError:m,codespaceCreating:h,onCreateCodespace:g})}const sL="_layout_11u79_1",aL="_content_11u79_8",iL="_tabPanel_11u79_14",br={layout:sL,content:aL,tabPanel:iL};function oL(){const n=n5();return l.jsxs("div",{className:br.layout,children:[l.jsx(ba,{segments:n}),l.jsx("div",{className:br.content,children:l.jsx(Qa,{})})]})}const rL="_container_13sb6_1",lL="_envHeader_13sb6_6",cL="_envTitleRow_13sb6_10",uL="_statusDot_13sb6_16",dL="_envName_13sb6_21",fL="_statusBadge_13sb6_27",pL="_envMeta_13sb6_33",mL="_metaTag_13sb6_39",hL="_actions_13sb6_51",gL="_provisionMessage_13sb6_59",vL="_errorMessage_13sb6_64",yL="_section_13sb6_69",bL="_sectionHeader_13sb6_73",_L="_cardList_13sb6_121",xL="_card_13sb6_121",SL="_cardHeader_13sb6_138",TL="_cardName_13sb6_144",kL="_cardActions_13sb6_149",wL="_cardDescription_13sb6_154",NL="_cardMeta_13sb6_160",jL="_repoLink_13sb6_166",CL="_empty_13sb6_174",EL="_btnPrimary_13sb6_180",AL="_btnOutline_13sb6_214",DL="_btnSmall_13sb6_241",RL="_btnDanger_13sb6_267",$e={container:rL,envHeader:lL,envTitleRow:cL,statusDot:uL,envName:dL,statusBadge:fL,envMeta:pL,metaTag:mL,actions:hL,provisionMessage:gL,errorMessage:vL,section:yL,sectionHeader:bL,cardList:_L,card:xL,cardHeader:SL,cardName:TL,cardActions:kL,cardDescription:wL,cardMeta:NL,repoLink:jL,empty:CL,btnPrimary:EL,btnOutline:AL,btnSmall:DL,btnDanger:RL},ML={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function OL(){const{environmentId:n}=va(),s=St(),{environments:i,workspaces:o,sessions:c,provisionStatus:u,provisionEnvironment:d,stopEnvironment:m,removeEnvironment:h,archiveWorkspace:g}=pt(),[v,b]=y.useState(!1),[_,S]=y.useState(!1),[T,N]=y.useState(void 0),j=i.find(ie=>ie.id===n);if(!n||!j)return l.jsx(Zn,{to:Xi,replace:!0});const w=o.filter(ie=>ie.environmentId===j.id),E=c.filter(ie=>ie.environmentId===j.id),A=E.reduce((ie,be)=>ie+(be.costUsd??0),0),O=ML[j.status]||"var(--text-tertiary)",C=j.status==="connected",M=j.status==="connecting",G=j.status==="disconnected"||j.status==="error",U=j.id in u?u[j.id]:void 0,V=()=>{h(j.id),b(!1),s(Xi,{replace:!0})},Z=()=>{S(!1),d(j.id,!0)},ee=ie=>{g(ie),N(void 0)};return l.jsxs("div",{className:$e.container,children:[l.jsx(Ja,{isOpen:v,title:"Delete Environment?",description:`"${j.displayName||j.id}" will be permanently removed along with all its data.`,onConfirm:V,onCancel:()=>b(!1)}),l.jsx(Ja,{isOpen:_,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:Z,onCancel:()=>S(!1)}),l.jsxs("div",{className:$e.envHeader,children:[l.jsxs("div",{className:$e.envTitleRow,children:[l.jsx("span",{className:$e.statusDot,style:{color:O},children:"●"}),l.jsx("h2",{className:$e.envName,children:j.displayName||j.id}),l.jsx("span",{className:$e.statusBadge,style:{color:O},children:j.status})]}),l.jsxs("div",{className:$e.envMeta,children:[l.jsxs("span",{className:$e.metaTag,children:["Adapter: ",j.adapterType]}),E.length>0&&l.jsxs("span",{className:$e.metaTag,children:[E.length," session",E.length!==1?"s":""]}),A>0&&l.jsxs("span",{className:$e.metaTag,children:["Cost: ",so(A)]})]})]}),l.jsxs("div",{className:$e.actions,children:[C&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:$e.btnPrimary,onClick:()=>s(Cb(j.id)),children:"New Chat"}),l.jsx("button",{className:$e.btnOutline,onClick:()=>m(j.id),children:"Stop"}),l.jsx("button",{className:$e.btnOutline,onClick:()=>S(!0),disabled:U!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),G&&l.jsx("button",{className:$e.btnPrimary,onClick:()=>d(j.id),children:j.status==="error"?"Retry":"Connect"}),M&&U!==void 0&&l.jsx("span",{className:$e.provisionMessage,children:U.message}),j.status==="error"&&(U==null?void 0:U.stage)==="error"&&l.jsx("span",{className:$e.errorMessage,children:U.message}),l.jsx("button",{className:$e.btnOutline,onClick:()=>s(lw(j.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),l.jsx("button",{className:$e.btnDanger,onClick:()=>b(!0),children:"Delete"})]}),l.jsxs("div",{className:$e.section,children:[l.jsxs("div",{className:$e.sectionHeader,children:[l.jsx("h3",{children:"Workspaces"}),l.jsx("button",{className:$e.btnPrimary,onClick:()=>s(`${Ab}?environment=${encodeURIComponent(j.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"})]}),w.length===0&&l.jsx("p",{className:$e.empty,children:"No workspaces yet. Create one to get started."}),l.jsx("div",{className:$e.cardList,children:w.map(ie=>l.jsx(IL,{workspace:ie,confirmArchiveId:T,onOpen:()=>s(Wi(ie.id,j.id)),onArchive:()=>N(ie.id),onConfirmArchive:()=>ee(ie.id),onCancelArchive:()=>N(void 0)},ie.id))})]})]})}function IL({workspace:n,confirmArchiveId:s,onOpen:i,onArchive:o,onConfirmArchive:c,onCancelArchive:u}){const d=s===n.id,m=n.repoUrl&&/^https?:\/\//.test(n.repoUrl);return l.jsxs("div",{className:$e.card,"data-testid":"workspace-card",children:[l.jsxs("div",{className:$e.cardHeader,children:[l.jsx("strong",{className:$e.cardName,children:n.name}),l.jsxs("div",{className:$e.cardActions,children:[l.jsx("button",{className:$e.btnSmall,onClick:i,children:"Open"}),d?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:$e.btnDanger,onClick:c,children:"Confirm"}),l.jsx("button",{className:$e.btnSmall,onClick:u,children:"Cancel"})]}):l.jsx("button",{className:$e.btnSmall,onClick:o,children:"Archive"})]})]}),n.description&&l.jsx("p",{className:$e.cardDescription,children:n.description}),n.repoUrl&&l.jsx("div",{className:$e.cardMeta,children:m?l.jsx("a",{href:n.repoUrl,target:"_blank",rel:"noopener noreferrer",className:$e.repoLink,children:n.repoUrl}):l.jsx("span",{children:n.repoUrl})})]})}const BL={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function LL(){const s=It().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=BL[s],o=t5(i);return l.jsxs("div",{className:br.layout,children:[l.jsx(ba,{segments:o}),l.jsx("div",{className:br.content,children:l.jsx("div",{className:br.tabPanel,children:l.jsx(Qa,{})},s)})]})}const UL="_section_1ingb_14",zL="_sectionTitle_1ingb_26",PL="_sectionDescription_1ingb_35",VL="_tokenList_1ingb_48",qL="_tokenRow_1ingb_55",HL="_tokenBadge_1ingb_68",GL="_tokenName_1ingb_83",$L="_tokenTarget_1ingb_90",FL="_deleteButton_1ingb_99",ZL="_addForm_1ingb_113",KL="_formRow_1ingb_119",YL="_input_1ingb_125",JL="_select_1ingb_155",WL="_addButton_1ingb_187",XL="_emptyStateInfo_1ingb_221",QL="_themeOptions_1ingb_229",e8="_themeOption_1ingb_229",t8="_themeOptionSelected_1ingb_254",n8="_themeOptionHeader_1ingb_259",s8="_themeOptionLabel_1ingb_266",a8="_themeOptionDesc_1ingb_273",i8="_variantToggle_1ingb_279",o8="_variantButton_1ingb_286",r8="_variantActive_1ingb_305",l8="_themeSwatches_1ingb_311",c8="_themeSwatch_1ingb_311",u8="_systemToggle_1ingb_325",d8="_systemToggleHint_1ingb_341",f8="_themeActive_1ingb_348",p8="_aboutGrid_1ingb_354",m8="_aboutItem_1ingb_360",h8="_aboutLabel_1ingb_373",g8="_aboutValue_1ingb_379",v8="_aboutDot_1ingb_387",y8="_aboutDotConnected_1ingb_394",b8="_aboutDotDisconnected_1ingb_398",he={section:UL,sectionTitle:zL,sectionDescription:PL,tokenList:VL,tokenRow:qL,tokenBadge:HL,tokenName:GL,tokenTarget:$L,deleteButton:FL,addForm:ZL,formRow:KL,input:YL,select:JL,addButton:WL,emptyStateInfo:XL,themeOptions:QL,themeOption:e8,themeOptionSelected:t8,themeOptionHeader:n8,themeOptionLabel:s8,themeOptionDesc:a8,variantToggle:i8,variantButton:o8,variantActive:r8,themeSwatches:l8,themeSwatch:c8,systemToggle:u8,systemToggleHint:d8,themeActive:f8,aboutGrid:p8,aboutItem:m8,aboutLabel:h8,aboutValue:g8,aboutDot:v8,aboutDotConnected:y8,aboutDotDisconnected:b8},_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:n,onUpdateCredentialProviders:s}){const i=(o,c)=>{const u={...n};o==="claude"?u.claude=c:u[o]=c,s(u)};return l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Credential Providers"}),l.jsx("p",{className:he.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),l.jsx("div",{className:he.tokenList,children:_8.map(o=>l.jsxs("div",{className:he.tokenRow,children:[l.jsx("span",{className:he.tokenName,children:o.label}),l.jsx("span",{className:he.tokenTarget,children:o.description}),l.jsx("select",{className:he.select,value:n[o.key],onChange:c=>i(o.key,c.target.value),children:o.options.map(c=>l.jsx("option",{value:c.value,children:c.label},c.value))})]},o.key))})]})}const S8=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function T8({tokens:n,onSetToken:s,onDeleteToken:i}){const{showToast:o}=Bs(),[c,u]=y.useState(""),[d,m]=y.useState(""),[h,g]=y.useState("env_var"),[v,b]=y.useState(""),[_,S]=y.useState(null),T=w=>{if(w.preventDefault(),!c||!d)return;const E=h==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,d,h,E,h==="file"?v:""),o("Token saved successfully","success"),u(""),m(""),b("")},N=w=>{S(w)},j=()=>{_&&(i(_),o("Token deleted","info")),S(null)};return l.jsxs(l.Fragment,{children:[l.jsx(Ja,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:j,onCancel:()=>S(null)}),l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Tokens"}),l.jsx("p",{className:he.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),n.length===0?l.jsx("div",{className:he.emptyStateInfo,children:"Add your first API token to enable service integrations."}):l.jsx("div",{className:he.tokenList,children:n.map(w=>l.jsxs("div",{className:he.tokenRow,children:[l.jsx("span",{className:he.tokenBadge,children:w.tokenType}),l.jsx("span",{className:he.tokenName,children:w.name}),l.jsx("span",{className:he.tokenTarget,children:w.tokenType==="env_var"?w.envVar:w.filePath}),l.jsx("button",{className:he.deleteButton,onClick:()=>N(w.name),title:`Delete ${w.name}`,children:"×"})]},w.name))}),l.jsxs("form",{className:he.addForm,onSubmit:T,children:[l.jsxs("div",{className:he.formRow,children:[l.jsx("input",{className:he.input,type:"text",placeholder:"Token name",value:c,onChange:w=>u(w.target.value)}),l.jsx("input",{className:he.input,type:"password",placeholder:"Value",value:d,onChange:w=>m(w.target.value)})]}),l.jsxs("div",{className:he.formRow,children:[l.jsx("select",{className:he.select,value:h,onChange:w=>g(w.target.value),children:S8.map(w=>l.jsx("option",{value:w.value,children:w.label},w.value))}),l.jsx("input",{className:he.input,type:"text",placeholder:h==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:w=>b(w.target.value)}),l.jsx("button",{className:he.addButton,type:"submit",children:"Add Token"})]})]})]})]})}function k8(){const{tokens:n,setToken:s,deleteToken:i,credentialProviders:o,updateCredentialProviders:c}=pt();return l.jsxs(l.Fragment,{children:[l.jsx(x8,{credentialProviders:o,onUpdateCredentialProviders:c}),l.jsx(T8,{tokens:n,onSetToken:s,onDeleteToken:i})]})}const w8="_container_10efq_1",N8="_header_10efq_7",j8="_form_10efq_19",C8="_formActions_10efq_87",E8="_editableSection_10efq_94",A8="_list_10efq_105",D8="_card_10efq_111",R8="_cardHeader_10efq_125",M8="_cardTitle_10efq_135",O8="_defaultBadge_10efq_141",I8="_cardActions_10efq_155",B8="_description_10efq_160",L8="_meta_10efq_166",U8="_empty_10efq_212",z8="_typeToggle_10efq_348",P8="_typeBadge_10efq_362",V8="_scriptEditor_10efq_376",q8="_optional_10efq_383",gt={container:w8,header:N8,form:j8,formActions:C8,editableSection:E8,list:A8,card:D8,cardHeader:R8,cardTitle:M8,defaultBadge:O8,cardActions:I8,description:B8,meta:L8,empty:U8,typeToggle:z8,typeBadge:P8,scriptEditor:V8,optional:q8};function H8({personas:n,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:o,onNavigateToNew:c,onNavigateToPersona:u}){const[d,m]=y.useState(null),h=d?n.find(v=>v.id===d):void 0,g=async v=>{await i(v),m(null)};return l.jsxs("div",{className:gt.container,children:[l.jsxs("div",{className:gt.header,children:[l.jsx("h2",{children:"Personas"}),l.jsx(As,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),n.length===0?l.jsx("p",{className:gt.empty,children:"No personas yet. Create one to get started."}):l.jsx("div",{className:gt.list,children:n.map(v=>{const b=s===v.id,_=v.type==="script";return l.jsxs("div",{className:gt.card,"data-testid":`persona-card-${v.id}`,onClick:()=>u(v.id),role:"button",tabIndex:0,onKeyDown:S=>{S.currentTarget===S.target&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),u(v.id))},children:[l.jsxs("div",{className:gt.cardHeader,children:[l.jsxs("span",{className:gt.cardTitle,children:[l.jsx("strong",{children:v.name}),l.jsx("span",{className:gt.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&l.jsx("span",{className:gt.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),l.jsxs("div",{className:gt.cardActions,onClick:S=>S.stopPropagation(),children:[!b&&l.jsx(As,{variant:"ghost",size:"sm",onClick:()=>{o(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),l.jsx(As,{variant:"ghost",size:"sm",onClick:()=>u(v.id),children:"Edit"}),l.jsx(As,{variant:"ghost",size:"sm",onClick:()=>m(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&l.jsx("p",{className:gt.description,children:v.description}),l.jsxs("div",{className:gt.meta,children:[v.runtime&&l.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&l.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&l.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),l.jsx(Ja,{isOpen:d!==null,title:"Delete Persona?",description:`"${(h==null?void 0:h.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{d&&g(d).catch(()=>{})},onCancel:()=>m(null)})]})}function G8(){const{personas:n,deletePersona:s,appDefaultPersonaId:i,setAppDefaultPersonaId:o}=pt(),{showToast:c}=Bs(),u=St();return l.jsx(H8,{personas:n,appDefaultPersonaId:i,onDeletePersona:async d=>{try{await s(d)}catch(m){throw console.error("Failed to delete persona",{personaId:d,error:m}),c("Failed to delete persona","error"),m}},onSetAppDefaultPersonaId:async d=>{try{await o(d)}catch(m){console.error("Failed to set app default persona ID",{personaId:d,error:m}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>u(uw),onNavigateToPersona:d=>u(Eb(d))})}const $8="_container_uy08i_1",F8="_header_uy08i_7",Z8="_count_uy08i_13",K8="_presets_uy08i_18",Y8="_presetButton_uy08i_24",J8="_filterInput_uy08i_41",W8="_groups_uy08i_53",X8="_group_uy08i_53",Q8="_groupHeader_uy08i_68",eU="_groupName_uy08i_77",tU="_groupCount_uy08i_81",nU="_toolList_uy08i_87",sU="_toolItem_uy08i_95",aU="_toolName_uy08i_103",en={container:$8,header:F8,count:Z8,presets:K8,presetButton:Y8,filterInput:J8,groups:W8,group:X8,groupHeader:Q8,groupName:eU,groupCount:tU,toolList:nU,toolItem:sU,toolName:aU},iU=(()=>{const n=new Map;for(const s of rb){const i=s==="get_version_status"?"version":s.split("_")[0];n.has(i)||n.set(i,[]),n.get(i).push(s)}return[...n.entries()].sort(([s],[i])=>s.localeCompare(i)).map(([s,i])=>({group:s,tools:i.sort()}))})(),oU=[{name:"default",label:"Default",tools:lb},{name:"worker",label:"Worker",tools:gT},{name:"orchestrator",label:"Orchestrator",tools:vT},{name:"admin",label:"Admin",tools:yT}];function eb({selectedTools:n,onChange:s,disabled:i}){const[o,c]=y.useState(""),u=y.useMemo(()=>new Set(n),[n]),d=y.useCallback(v=>{if(i)return;const b=new Set(u);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[u,s,i]),m=y.useCallback((v,b)=>{if(i)return;const _=new Set(u);for(const S of v)b?_.delete(S):_.add(S);s([..._].sort())},[u,s,i]),h=y.useCallback(v=>{i||s([...v].sort())},[s,i]),g=o.toLowerCase();return l.jsxs("div",{className:en.container,"data-testid":"mcp-tool-selector",children:[l.jsx("div",{className:en.header,children:l.jsx("span",{className:en.count,children:n.length===0?`Using default (${lb.length} tools)`:`${n.length} of ${rb.size} tools selected`})}),l.jsxs("div",{className:en.presets,"data-testid":"mcp-tool-presets",children:[oU.map(v=>l.jsx("button",{type:"button",className:en.presetButton,disabled:i,onClick:()=>h(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),l.jsx("button",{type:"button",className:en.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),l.jsx("input",{type:"text",className:en.filterInput,placeholder:"Filter tools...",value:o,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),l.jsx("div",{className:en.groups,children:iU.map(({group:v,tools:b})=>{const _=g?b.filter(T=>T.toLowerCase().includes(g)):b;if(_.length===0)return null;const S=_.every(T=>u.has(T));return l.jsxs("div",{className:en.group,"data-testid":`tool-group-${v}`,children:[l.jsxs("label",{className:en.groupHeader,children:[l.jsx("input",{type:"checkbox",checked:S,onChange:()=>m(_,S),disabled:i,"data-testid":`group-toggle-${v}`}),l.jsx("span",{className:en.groupName,children:v}),l.jsxs("span",{className:en.groupCount,children:["(",_.filter(T=>u.has(T)).length,"/",_.length,")"]})]}),l.jsx("div",{className:en.toolList,children:_.map(T=>l.jsxs("label",{className:en.toolItem,children:[l.jsx("input",{type:"checkbox",checked:u.has(T),onChange:()=>d(T),disabled:i,"data-testid":`tool-${T}`}),l.jsx("span",{className:en.toolName,children:T})]},T))})]},v)})})]})}const tb=[{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)"}],nb=[{value:"genaiscript",label:"genaiscript"}],rU="0";function sb(){const{personaId:n}=va(),s=St(),{showToast:i}=Bs(),{personas:o,createPersona:c,updatePersona:u,deletePersona:d,appDefaultPersonaId:m,setAppDefaultPersonaId:h}=pt(),g=n===void 0,v=g?void 0:o.find(_=>_.id===n);if(!g&&o.length>0&&!v)return l.jsx(Zn,{to:af,replace:!0});const b=[{label:"Settings",url:Ji},{label:"Personas",url:af},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return l.jsxs("div",{className:gt.container,children:[l.jsx(ba,{segments:b}),l.jsx(lU,{existing:v,isNew:g,appDefaultPersonaId:m,onCreatePersona:c,onUpdatePersona:u,onDeletePersona:d,onSetAppDefaultPersonaId:h,onDone:()=>{s(af)},showToast:i})]})}function lU({existing:n,isNew:s,appDefaultPersonaId:i,onCreatePersona:o,onUpdatePersona:c,onDeletePersona:u,onSetAppDefaultPersonaId:d,onDone:m,showToast:h}){const g=St(),[v,b]=y.useState((n==null?void 0:n.name)??""),[_,S]=y.useState((n==null?void 0:n.description)??""),[T,N]=y.useState((n==null?void 0:n.systemPrompt)??""),[j,w]=y.useState((n==null?void 0:n.runtime)??"claude-code"),[E,A]=y.useState((n==null?void 0:n.model)??"sonnet"),[O,C]=y.useState((n==null?void 0:n.maxTurns)??0),[M,G]=y.useState((n==null?void 0:n.type)==="script"?"script":"agent"),[U,V]=y.useState((n==null?void 0:n.script)??""),[Z,ee]=y.useState((n==null?void 0:n.allowedMcpTools)??[]),[ie,be]=y.useState(!1),[K,re]=y.useState(null),[I,$]=y.useState(!!s);y.useEffect(()=>{if(!s&&n&&!I){$(!0),b(n.name),S(n.description),N(n.systemPrompt);const X=n.type==="script"?"script":"agent";w(X==="script"?n.runtime||"genaiscript":n.runtime),A(n.model),C(n.maxTurns),G(X),V(n.script||""),ee(n.allowedMcpTools)}},[s,n,I]);const Q=X=>{G(X),X==="script"?w("genaiscript"):j==="genaiscript"&&w("claude-code")},de=!s&&n===void 0,me=v.trim().length>0&&!de&&T.trim().length>0&&(M==="script"?U.trim().length>0:!!j&&!!E),ze=s&&me,je=!s&&i===(n==null?void 0:n.id),Ne=!s&&n&&!je&&M==="agent"&&!!j&&!!E,Ae=(X,Te)=>{if(!X.trim())return`${Te} is required`},ce=X=>{if(X.preventDefault(),!(de||!me)){if(n){c(n.id,v,_,T,j,E,O,M,U).then(()=>{h("Persona updated","success"),m()},()=>{h("Failed to save persona","error")});return}o(v,_,T,j,E,O,M,U,Z).then(Te=>{h("Persona created","success"),g(Eb(Te.id),{replace:!0})},()=>{h("Failed to save persona","error")})}},fe=()=>{n&&u(n.id).then(()=>{h("Persona deleted","success"),m()},()=>{h("Failed to delete persona","error")})},pe=async(X,Te,un,Ze)=>X().then(()=>{Te(),h(un,"success")},()=>{h(Ze,"error")}),Re=(X,Te)=>{if(!n)return;const un=X==="type"?String(Te):M,Ze=X==="runtime"?String(Te):X==="type"?String(Te)==="script"?"genaiscript":j==="genaiscript"?"claude-code":j:j,Kn=X==="model"?String(Te):E,Yn=X==="maxTurns"?Number(Te):O,zn=X==="systemPrompt"?String(Te):T,Jn=X==="script"?String(Te):U;pe(()=>c(n.id,X==="name"?String(Te):v,X==="description"?String(Te):_,zn,Ze,Kn,Yn,un,Jn),()=>{if(X==="type"){const Tn=String(Te)==="script"?"script":"agent";G(Tn),w(Ze)}X==="runtime"&&w(String(Te)),X==="name"&&b(String(Te)),X==="description"&&S(String(Te)),X==="systemPrompt"&&N(String(Te)),X==="model"&&A(String(Te)),X==="maxTurns"&&C(Number(Te)),X==="script"&&V(String(Te))},"Persona updated","Failed to update persona").catch(()=>{})},Bt=X=>{ce(X)},te=()=>{n&&d(n.id).then(()=>{h("Set as app default","success")},()=>{h("Failed to set app default","error")})};return l.jsxs(l.Fragment,{children:[de?l.jsxs("div",{className:gt.form,children:[l.jsx("h3",{children:"Edit Persona"}),l.jsx("p",{children:"Loading persona..."})]}):s?l.jsxs("form",{onSubmit:Bt,className:gt.form,children:[l.jsx("h3",{children:"Create Persona"}),l.jsxs("div",{className:gt.typeToggle,"data-testid":"persona-type-toggle",children:[l.jsxs("label",{children:[l.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:M==="agent",onChange:()=>Q("agent")}),"Agent"]}),l.jsxs("label",{children:[l.jsx("input",{type:"radio",name:"personaType",value:"script",checked:M==="script",onChange:()=>Q("script")}),"Script"]})]}),l.jsxs("label",{children:["Name",l.jsx("input",{type:"text",value:v,onChange:X=>b(X.target.value),placeholder:M==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),l.jsxs("label",{children:["Description",l.jsx("input",{type:"text",value:_,onChange:X=>S(X.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),l.jsxs("label",{children:["Runtime",l.jsx("select",{value:j,onChange:X=>w(X.target.value),"data-testid":"persona-runtime-select",children:(M==="script"?nb:tb).map(X=>l.jsx("option",{value:X.value,children:X.label},X.value))})]}),M==="agent"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{children:["Model",l.jsx("input",{type:"text",value:E,onChange:X=>A(X.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),l.jsxs("label",{children:["Max Turns",l.jsx("input",{type:"number",value:O,onChange:X=>C(parseInt(X.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),l.jsxs("label",{children:["System Prompt",l.jsx("textarea",{value:T,onChange:X=>N(X.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),M==="script"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{children:["Model ",l.jsx("span",{className:gt.optional,children:"(optional)"}),l.jsx("input",{type:"text",value:E,onChange:X=>A(X.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),l.jsxs("label",{children:["System Prompt",l.jsx("textarea",{value:T,onChange:X=>N(X.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),l.jsxs("label",{children:["Script",l.jsx("textarea",{value:U,onChange:X=>V(X.target.value),placeholder:`script({ model: "openai:gpt-4o" });
|
|
490
|
+
|
|
491
|
+
const grackle = await host.mcpServer({
|
|
492
|
+
id: "grackle",
|
|
493
|
+
url: env.vars.GRACKLE_MCP_URL,
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
$\`Summarize the current tasks.\`;`,rows:20,className:gt.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),M==="agent"&&l.jsxs("div",{children:[l.jsx("label",{children:"Allowed MCP Tools"}),l.jsx(eb,{selectedTools:Z,onChange:ee})]}),l.jsxs("div",{className:gt.formActions,children:[l.jsx(As,{type:"submit",variant:"primary",size:"md",disabled:!ze,"data-testid":"persona-detail-save",children:"Create"}),l.jsx(As,{type:"button",variant:"outline",size:"md",onClick:m,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):n?l.jsxs("div",{className:gt.form,children:[l.jsx("h3",{children:"Edit Persona"}),l.jsxs("div",{className:gt.formActions,children:[l.jsx(As,{type:"button",variant:"outline",size:"md",onClick:m,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),Ne&&l.jsx(As,{type:"button",variant:"ghost",size:"md",onClick:te,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),je&&l.jsx("span",{className:gt.defaultBadge,children:"App Default"}),l.jsx(As,{type:"button",variant:"danger",size:"md",onClick:()=>be(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),l.jsxs("div",{className:gt.editableSection,children:[l.jsxs("label",{children:["Name",l.jsx(Zt,{value:v,onSave:X=>{Re("name",X)},validate:X=>Ae(X,"Name"),fieldId:"persona-name",activeFieldId:K,onActivate:re,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),l.jsxs("label",{children:["Description",l.jsx(Zt,{value:_,onSave:X=>{Re("description",X)},fieldId:"persona-description",activeFieldId:K,onActivate:re,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),l.jsxs("label",{children:["Type",l.jsx(Cc,{value:M,onSave:X=>{Re("type",X)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:K,onActivate:re,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),l.jsxs("label",{children:["Runtime",l.jsx(Cc,{value:j,onSave:X=>{Re("runtime",X)},options:M==="script"?nb:tb,fieldId:"persona-runtime",activeFieldId:K,onActivate:re,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),l.jsxs("label",{children:["Model",M==="script"?" (optional)":"",l.jsx(Zt,{value:E,onSave:X=>{Re("model",X)},validate:M==="agent"?X=>Ae(X,"Model"):void 0,fieldId:"persona-model",activeFieldId:K,onActivate:re,placeholder:M==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),l.jsxs("label",{children:["Max Turns",l.jsx(Zt,{value:String(O),onSave:X=>{Re("maxTurns",parseInt(X,10)||0)},validate:X=>/^\d+$/.test(X.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:K,onActivate:re,placeholder:rU,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),l.jsxs("label",{children:["System Prompt",l.jsx(cp,{value:T,onSave:X=>{Re("systemPrompt",X)},validate:X=>Ae(X,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:K,onActivate:re,placeholder:M==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),M==="script"&&l.jsxs("label",{children:["Script",l.jsx(cp,{value:U,onSave:X=>{Re("script",X)},validate:X=>Ae(X,"Script"),fieldId:"persona-script",activeFieldId:K,onActivate:re,placeholder:`script({ model: "openai:gpt-4o" });
|
|
497
|
+
|
|
498
|
+
const grackle = await host.mcpServer({
|
|
499
|
+
id: "grackle",
|
|
500
|
+
url: env.vars.GRACKLE_MCP_URL,
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
$\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),M==="agent"&&l.jsxs("div",{children:[l.jsx("label",{children:"Allowed MCP Tools"}),l.jsx(eb,{selectedTools:Z,onChange:X=>{ee(X);const Te=X.length===0?["__clear__"]:X;pe(()=>c(n.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Te),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Ne&&!je&&l.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,l.jsx(Ja,{isOpen:ie,title:"Delete Persona?",description:`"${n==null?void 0:n.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:fe,onCancel:()=>be(!1)})]})}function cU(){const{themeId:n,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=qb();return l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Appearance"}),l.jsx("p",{className:he.sectionDescription,children:"Choose how Grackle looks across the app."}),l.jsx("div",{className:he.themeOptions,children:Oc.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),m=d?n===u.id||n===u.variantLightId||n===u.variantDarkId:n===u.id,h=d&&s===u.variantLightId;return l.jsxs("button",{type:"button",className:`${he.themeOption} ${m?he.themeOptionSelected:""}`,"aria-pressed":m,onClick:()=>i(u.id),children:[l.jsxs("span",{className:he.themeOptionHeader,children:[l.jsxs("span",{children:[l.jsx("span",{className:he.themeOptionLabel,children:u.label}),l.jsx("span",{className:he.themeOptionDesc,children:u.description})]}),d&&l.jsxs("span",{className:he.variantToggle,children:[l.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&h?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantLightId))},"aria-label":"Light variant","aria-pressed":m&&h,children:"☼"}),l.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&!h?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":m&&!h,children:"☾"})]})]}),u.swatches&&l.jsx("span",{className:he.themeSwatches,children:u.swatches.map((g,v)=>l.jsx("span",{className:he.themeSwatch,style:{background:g}},v))})]},u.id)})}),l.jsxs("label",{className:he.systemToggle,children:[l.jsx("input",{type:"checkbox",checked:o,onChange:u=>c(u.target.checked)}),l.jsx("span",{children:"Match system light/dark preference"})]}),l.jsx("p",{className:he.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),l.jsxs("p",{className:he.themeActive,children:["Active theme: ",l.jsx("strong",{children:s})]})]})}function uU(){return l.jsx(cU,{})}function dU({connected:n,environments:s,sessions:i}){const o=s.filter(d=>d.status==="connected").length,c=s.length,u=i.filter(d=>["running","idle"].includes(d.status)).length;return l.jsxs("section",{className:he.section,"data-testid":"about-panel",children:[l.jsx("h3",{className:he.sectionTitle,children:"About"}),l.jsx("p",{className:he.sectionDescription,children:"Connection status and application information."}),l.jsxs("div",{className:he.aboutGrid,children:[l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Connection"}),l.jsxs("span",{className:he.aboutValue,children:[l.jsx("span",{className:`${he.aboutDot} ${n?he.aboutDotConnected:he.aboutDotDisconnected}`}),n?"Connected":"Disconnected"]})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Environments"}),l.jsxs("span",{className:he.aboutValue,children:[o,"/",c," connected"]})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Active Sessions"}),l.jsx("span",{className:he.aboutValue,children:u})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Version"}),l.jsx("span",{className:he.aboutValue,children:"0.83.2"})]})]})]})}function fU({currentVersion:n,latestVersion:s,updateAvailable:i,isDocker:o}){if(!i)return l.jsx(l.Fragment,{});const c=o?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return l.jsx("div",{"data-testid":"update-banner",children:l.jsxs(ZD,{variant:"info",dismissible:!0,children:[l.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",n,")."," ","Run: ",l.jsx("code",{children:c})]})})}function pU(){const[n,s]=y.useState(void 0);return y.useEffect(()=>{let i=!1;return we.getVersionStatus({}).then(o=>{i||s({currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker})},()=>{}),()=>{i=!0}},[]),n}function mU(){const{connected:n,environments:s,sessions:i}=pt(),o=pU();return l.jsxs(l.Fragment,{children:[o&&l.jsx(fU,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),l.jsx(dU,{connected:n,environments:s,sessions:i})]})}const hU="_group_1iprv_1",gU="_groupTitle_1iprv_8",vU="_shortcutList_1iprv_17",yU="_shortcutRow_1iprv_23",bU="_keys_1iprv_36",_U="_kbd_1iprv_43",xU="_description_1iprv_60",Ha={group:hU,groupTitle:gU,shortcutList:vU,shortcutRow:yU,keys:bU,kbd:_U,description:xU},SU=[{title:"Global",shortcuts:[{keys:["?"],description:"Open keyboard shortcuts reference"},{keys:["N"],description:"Create a new task"},{keys:["Escape"],description:"Close dialog or cancel editing"}]},{title:"Task Page",shortcuts:[{keys:["1"],description:"Switch to Overview tab"},{keys:["2"],description:"Switch to Stream tab"},{keys:["3"],description:"Switch to Findings tab"}]},{title:"Workspace Page",shortcuts:[{keys:["1"],description:"Switch to Graph view"},{keys:["2"],description:"Switch to Board view"},{keys:["3"],description:"Switch to Tasks view"}]},{title:"Navigation Lists",shortcuts:[{keys:["←"],description:"Previous tab (horizontal nav)"},{keys:["→"],description:"Next tab (horizontal nav)"},{keys:["↑"],description:"Previous item (vertical nav)"},{keys:["↓"],description:"Next item (vertical nav)"},{keys:["J"],description:"Next item (alias for arrow down/right)"},{keys:["K"],description:"Previous item (alias for arrow up/left)"},{keys:["Home"],description:"Jump to first item"},{keys:["End"],description:"Jump to last item"}]},{title:"Editing",shortcuts:[{keys:["Enter"],description:"Activate / save inline edit"},{keys:["Space"],description:"Activate button or start editing"},{keys:["Escape"],description:"Cancel edit and discard changes"}]},{title:"Chat",shortcuts:[{keys:["Enter"],description:"Send message (when input is focused)"}]}];function TU(){return l.jsxs("section",{className:he.section,"data-testid":"keyboard-shortcuts-panel",children:[l.jsx("h3",{className:he.sectionTitle,children:"Keyboard Shortcuts"}),l.jsx("p",{className:he.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),SU.map(n=>l.jsxs("div",{className:Ha.group,children:[l.jsx("h4",{className:Ha.groupTitle,children:n.title}),l.jsx("div",{className:Ha.shortcutList,children:n.shortcuts.map(s=>l.jsxs("div",{className:Ha.shortcutRow,children:[l.jsx("span",{className:Ha.keys,children:s.keys.map(i=>l.jsx("kbd",{className:Ha.kbd,children:i},i))}),l.jsx("span",{className:Ha.description,children:s.description})]},s.description))})]},n.title))]})}function kU(){return l.jsx(TU,{})}const ab=ei();function wU(){const n=St();return Ms({key:"?"},()=>{n(dw)}),Ms({key:"n"},()=>{n(ab)}),Ms({key:"N"},()=>{n(ab)}),l.jsx(l.Fragment,{})}const NU="_wizard_1260s_1",jU="_container_1260s_10",CU="_stepContent_1260s_19",EU="_logoArea_1260s_28",AU="_logoImage_1260s_32",DU="_heading_1260s_41",RU="_tagline_1260s_49",MU="_subtitle_1260s_56",OU="_featureList_1260s_64",IU="_runtimeGrid_1260s_89",BU="_runtimeCard_1260s_101",LU="_runtimeName_1260s_133",UU="_runtimeDescription_1260s_139",zU="_buttonRow_1260s_144",PU="_primaryButton_1260s_151",VU="_ghostButton_1260s_185",qU="_dots_1260s_213",HU="_dot_1260s_213",rt={wizard:NU,container:jU,stepContent:CU,logoArea:EU,logoImage:AU,heading:DU,tagline:RU,subtitle:MU,featureList:OU,runtimeGrid:IU,runtimeCard:BU,runtimeName:LU,runtimeDescription:UU,buttonRow:zU,primaryButton:PU,ghostButton:VU,dots:qU,dot:HU};function GU({onNext:n}){return l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-welcome",children:[l.jsx("div",{className:rt.logoArea,children:l.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:rt.logoImage})}),l.jsx("h1",{className:rt.heading,children:"Welcome to Grackle"}),l.jsx("p",{className:rt.tagline,children:"Multi-agent orchestration for software teams"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:n,"data-testid":"setup-get-started",children:"Get Started"})]})}function $U({onNext:n,onBack:s}){return l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-about",children:[l.jsx("h2",{className:rt.heading,children:"What is Grackle?"}),l.jsxs("ul",{className:rt.featureList,children:[l.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),l.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),l.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),l.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),l.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),l.jsxs("div",{className:rt.buttonRow,children:[l.jsx("button",{type:"button",className:rt.ghostButton,onClick:s,children:"Back"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:n,"data-testid":"setup-about-next",children:"Next"})]})]})}const FU=[{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 ZU({currentRuntime:n,onFinish:s,onBack:i,finishDisabled:o}){const[c,u]=y.useState(n||"claude-code");return y.useEffect(()=>{n&&u(n)},[n]),l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-runtime",children:[l.jsx("h2",{className:rt.heading,children:"Choose Your Runtime"}),l.jsx("p",{className:rt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),l.jsx("div",{className:rt.runtimeGrid,children:FU.map(d=>l.jsxs("button",{type:"button",className:rt.runtimeCard,"data-selected":c===d.id,"aria-pressed":c===d.id,"data-testid":`runtime-card-${d.id}`,onClick:()=>u(d.id),children:[l.jsx("span",{className:rt.runtimeName,children:d.name}),l.jsx("span",{className:rt.runtimeDescription,children:d.description})]},d.id))}),l.jsxs("div",{className:rt.buttonRow,children:[l.jsx("button",{type:"button",className:rt.ghostButton,onClick:i,children:"Back"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:()=>s(c),disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const KU=3,ib={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function YU(){const{personas:n,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=pt(),c=St(),[u,d]=y.useState(0),m=n.find(g=>g.id==="claude-code"),h=y.useCallback(g=>{if(m&&g!==m.runtime){const b=ib[g]??"sonnet";s(m.id,void 0,void 0,void 0,g,b).catch(()=>{})}const v=n.find(b=>b.id===n0);if(v&&g!==v.runtime){const b=ib[g]??"sonnet";s(n0,void 0,void 0,void 0,g,b).catch(()=>{})}i(),c("/",{replace:!0})},[m,n,s,i,c]);return o===!0?l.jsx(Zn,{to:"/",replace:!0}):l.jsx("div",{className:rt.wizard,"data-testid":"setup-wizard",children:l.jsxs("div",{className:rt.container,children:[l.jsx(rs,{mode:"wait",children:l.jsxs(Rt.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&l.jsx(GU,{onNext:()=>d(1)}),u===1&&l.jsx($U,{onNext:()=>d(2),onBack:()=>d(0)}),u===2&&l.jsx(ZU,{currentRuntime:(m==null?void 0:m.runtime)??"claude-code",onFinish:h,onBack:()=>d(1),finishDisabled:!m})]},u)}),l.jsx("div",{className:rt.dots,children:Array.from({length:KU},(g,v)=>l.jsx("span",{className:rt.dot,"data-active":v===u},v))})]})})}const JU="_root_zndgp_1",WU="_body_zndgp_7",XU="_main_zndgp_19",QU="_sidebarWrapper_zndgp_26",ez="_overlay_zndgp_51",pr={root:JU,body:WU,main:XU,sidebarWrapper:QU,overlay:ez},tz=y.lazy(()=>NT(()=>import("./KnowledgePage-vV_eStmC.js"),__vite__mapDeps([0,1,2,3,4])).then(n=>({default:n.KnowledgePage}))),Ux=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function nz(){const{connected:n,environments:s,sessions:i,tasks:o}=pt(),c=It(),d=$b()!==void 0,[m,h]=y.useState(!1),g=y.useCallback(()=>h(v=>!v),[]);return y.useEffect(()=>{h(!1)},[c.pathname]),y.useEffect(()=>{if(!m)return;const v=b=>{b.key==="Escape"&&h(!1)};return document.addEventListener("keydown",v),()=>{document.removeEventListener("keydown",v)}},[m]),l.jsxs(l.Fragment,{children:[l.jsx(p2,{connected:n,environments:s,sessions:i,onToggleSidebar:d?g:void 0,sidebarOpen:m}),l.jsx(_2,{}),l.jsxs("div",{className:pr.body,children:[d&&l.jsx("div",{className:pr.sidebarWrapper,"data-sidebar-open":m,children:l.jsx(C2,{})}),d&&m&&l.jsx("div",{className:pr.overlay,"data-testid":"drawer-overlay",onClick:()=>h(!1)}),l.jsxs("div",{className:pr.main,children:[l.jsx(Qa,{}),l.jsx(kD,{sessions:i,tasks:o,environments:s})]})]}),l.jsx(LD,{}),l.jsx(wU,{})]})}function sz(){const{lastSpawnedId:n,environments:s,tasks:i,connected:o,onboardingCompleted:c}=pt(),{showToast:u}=Bs();F3(s,u),J3(i,u);const d=St(),m=It();return y.useEffect(()=>{n&&!m.pathname.includes("/tasks/")&&d(jb(n),{replace:!0})},[n,d,m.pathname]),o&&c===!1?l.jsx(Zn,{to:"/setup",replace:!0}):l.jsx(x2,{children:l.jsxs("div",{className:pr.root,children:[Ux&&l.jsx(vR,{}),l.jsx(nz,{})]})})}function Bf(){const{workspaceId:n}=va(),{workspaces:s}=pt(),i=It(),o=s.find(h=>h.id===n);if(!(o!=null&&o.environmentId))return s.length===0?void 0:l.jsx(Zn,{to:"/environments",replace:!0});const c=encodeURIComponent(n),u=`/workspaces/${c}`,d=i.pathname.startsWith(u)?i.pathname.slice(u.length):"",m=`/environments/${encodeURIComponent(o.environmentId)}/workspaces/${c}${d}${i.search}${i.hash}`;return l.jsx(Zn,{to:m,replace:!0})}function az(){return l.jsxs(Nk,{children:[l.jsx(Ce,{path:"setup",element:l.jsx(YU,{})}),l.jsxs(Ce,{element:l.jsx(sz,{}),children:[l.jsx(Ce,{index:!0,element:l.jsx(TI,{})}),l.jsx(Ce,{path:"chat",element:l.jsx(QI,{})}),l.jsx(Ce,{path:"sessions/new",element:l.jsx(r5,{})}),l.jsx(Ce,{path:"sessions/:sessionId",element:l.jsx(u5,{})}),l.jsx(Ce,{element:l.jsx(gD,{}),children:l.jsx(Ce,{path:"knowledge",element:l.jsx(y.Suspense,{fallback:l.jsx(Dx,{}),children:l.jsx(tz,{})})})}),l.jsxs(Ce,{element:l.jsx(pD,{}),children:[l.jsx(Ce,{path:"tasks",element:l.jsx(xI,{})}),l.jsx(Ce,{path:"tasks/new",element:l.jsx(Wy,{})}),l.jsx(Ce,{path:"tasks/:taskId",element:l.jsx(fa,{})}),l.jsx(Ce,{path:"tasks/:taskId/edit",element:l.jsx(fa,{})}),l.jsx(Ce,{path:"tasks/:taskId/stream",element:l.jsx(fa,{})}),l.jsx(Ce,{path:"tasks/:taskId/findings",element:l.jsx(fa,{})})]}),l.jsxs(Ce,{element:l.jsx(mD,{}),children:[l.jsx(Ce,{path:"workspaces",element:l.jsx(Zn,{to:"/environments",replace:!0})}),l.jsx(Ce,{path:"workspaces/new",element:l.jsx(fB,{})}),l.jsx(Ce,{path:"workspaces/:workspaceId",element:l.jsx(Bf,{})}),l.jsx(Ce,{path:"workspaces/:workspaceId/tasks/:taskId",element:l.jsx(Bf,{})}),l.jsx(Ce,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:l.jsx(Bf,{})}),l.jsx(Ce,{path:"environments/:environmentId/workspaces/:workspaceId",element:l.jsx(A4,{})}),l.jsx(Ce,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:l.jsx(Wy,{})}),l.jsx(Ce,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:l.jsx(fa,{})}),l.jsx(Ce,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:l.jsx(fa,{})}),l.jsx(Ce,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:l.jsx(fa,{})}),l.jsx(Ce,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:l.jsx(fa,{})}),l.jsxs(Ce,{path:"environments",element:l.jsx(oL,{}),children:[l.jsx(Ce,{index:!0,element:l.jsx(SI,{})}),l.jsx(Ce,{path:"new",element:l.jsx(tL,{})}),l.jsx(Ce,{path:":environmentId",element:l.jsx(OL,{})}),l.jsx(Ce,{path:":environmentId/edit",element:l.jsx(nL,{})})]})]}),l.jsx(Ce,{element:l.jsx(hD,{}),children:l.jsxs(Ce,{path:"settings",element:l.jsx(LL,{}),children:[l.jsx(Ce,{index:!0,element:l.jsx(Zn,{to:"credentials",replace:!0})}),l.jsx(Ce,{path:"environments",element:l.jsx(Zn,{to:"/environments",replace:!0})}),l.jsx(Ce,{path:"credentials",element:l.jsx(k8,{})}),l.jsx(Ce,{path:"tokens",element:l.jsx(Zn,{to:"../credentials",replace:!0})}),l.jsx(Ce,{path:"personas",element:l.jsx(G8,{})}),l.jsx(Ce,{path:"personas/new",element:l.jsx(sb,{})}),l.jsx(Ce,{path:"personas/:personaId",element:l.jsx(sb,{})}),l.jsx(Ce,{path:"appearance",element:l.jsx(uU,{})}),l.jsx(Ce,{path:"shortcuts",element:l.jsx(kU,{})}),l.jsx(Ce,{path:"about",element:l.jsx(mU,{})})]})}),l.jsx(Ce,{path:"*",element:l.jsx(Zn,{to:"/",replace:!0})})]})]})}const iz=1e4;function oz(){const{onboardingCompleted:n}=pt(),[s,i]=y.useState(!1);y.useEffect(()=>{if(n!==void 0)return;const c=setTimeout(()=>i(!0),iz);return()=>clearTimeout(c)},[n]);const o=n===void 0&&!s;return l.jsx(rs,{mode:"wait",children:o?l.jsx(Rt.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:l.jsx(Dx,{})},"splash"):l.jsx(Rt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:l.jsx(Wk,{basename:"/".replace(/\/$/,""),children:l.jsx(az,{})})},"app")})}function rz(){const n=Ux?Ww:Vw;return l.jsx(s2,{children:l.jsx(Qw,{children:l.jsx(n,{children:l.jsx(oz,{})})})})}TT.createRoot(document.getElementById("root")).render(l.jsx(y.StrictMode,{children:l.jsx(rz,{})}));export{ba as B,Db as K,pt as a,jb as s,os as t,St as u};
|